Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/zeta120' into zeta120
Browse files Browse the repository at this point in the history
  • Loading branch information
IThundxr committed Dec 28, 2023
2 parents c9d753c + 6c58141 commit e3dd28f
Show file tree
Hide file tree
Showing 170 changed files with 1,970 additions and 2,211 deletions.
4 changes: 2 additions & 2 deletions build.properties
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#Sat Oct 14 17:25:20 UTC 2023
mapping_version=1.20.1
version=4.0-alpha
version=4.0-beta
mod_name=Quark
mc_version=1.20.1
mapping_channel=official
mod_id=quark
build_number=421
build_number=423
dir_output=../Build Output/Quark/
41 changes: 41 additions & 0 deletions src/main/java/org/violetmoon/quark/QuarkRemapHandler.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
package org.violetmoon.quark;

import net.minecraft.core.DefaultedRegistry;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.resources.ResourceLocation;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.MissingMappingsEvent;
import org.violetmoon.quark.base.Quark;

import java.util.HashMap;
import java.util.Map;

@Mod.EventBusSubscriber
public class QuarkRemapHandler {
//datafixers could have also been used here but good luck figuring them out

private static final Map<String, String> REMAP = new HashMap<>();

static {
REMAP.put("quark:crafter", "minecraft:crafter");
REMAP.put("quark:polished_tuff", "minecraft:polished_tuff");
}

@SubscribeEvent
public static void onRemapBlocks(MissingMappingsEvent event) {
remapAll(event, BuiltInRegistries.BLOCK);
remapAll(event, BuiltInRegistries.ITEM);
}


private static <T> void remapAll(MissingMappingsEvent event, DefaultedRegistry<T> block) {
for (var v : event.getMappings(block.key(), Quark.MOD_ID)) {
String rem = REMAP.get(v.getKey().toString());
if (rem != null) {
var b = block.getOptional(new ResourceLocation(rem));
b.ifPresent(v::remap);
} else v.ignore();
}
}
}
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
package org.violetmoon.quark.addons.oddities.client.render.be;

import com.google.common.collect.ImmutableList;
import com.mojang.blaze3d.vertex.PoseStack;
import com.mojang.blaze3d.vertex.VertexConsumer;

import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Font;
import net.minecraft.client.renderer.MultiBufferSource;
Expand All @@ -25,19 +23,15 @@
import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import net.minecraft.world.phys.BlockHitResult;
import net.minecraft.world.phys.HitResult;

import org.jetbrains.annotations.NotNull;

import org.violetmoon.quark.addons.oddities.block.be.TinyPotatoBlockEntity;
import org.violetmoon.quark.addons.oddities.module.TinyPotatoModule;
import org.violetmoon.quark.addons.oddities.util.TinyPotatoInfo;
import org.violetmoon.quark.content.tools.item.RuneItem;
import org.violetmoon.quark.content.tools.base.RuneColor;
import org.violetmoon.quark.content.tools.module.ColorRunesModule;
import org.violetmoon.quark.mixin.mixins.client.accessor.AccessorModelManager;

import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
import java.util.Map;
import java.util.regex.Pattern;

Expand All @@ -48,8 +42,6 @@ public class TinyPotatoRenderer implements BlockEntityRenderer<TinyPotatoBlockEn
private static final Pattern ESCAPED = Pattern.compile("[^a-z0-9/._-]");
private final BlockRenderDispatcher blockRenderDispatcher;

private static List<ItemStack> runeStacks;

public static boolean isTheSpookDay() {
Calendar calendar = Calendar.getInstance();

Expand Down Expand Up @@ -93,15 +85,6 @@ private static String normalizeName(String name) {

@Override
public void render(@NotNull TinyPotatoBlockEntity potato, float partialTicks, @NotNull PoseStack ms, @NotNull MultiBufferSource buffers, int light, int overlay) {
if(runeStacks == null) {
List<ItemStack> stacks = new ArrayList<>();
for(RuneItem item : ColorRunesModule.runes) {
stacks.add(new ItemStack(item));
}
stacks.add(new ItemStack(ColorRunesModule.rainbow_rune));
runeStacks = ImmutableList.copyOf(stacks);
}

ms.pushPose();

TinyPotatoInfo info = TinyPotatoInfo.fromComponent(potato.name);
Expand Down Expand Up @@ -143,10 +126,9 @@ public void render(@NotNull TinyPotatoBlockEntity potato, float partialTicks, @N
if(render) {
ms.pushPose();
ms.translate(-0.5F, 0, -0.5F);
if(0 <= info.runeColor() && info.runeColor() < ColorRunesModule.RUNE_TYPES)
ColorRunesModule.setTargetStack(runeStacks.get(info.runeColor()));
else
ColorRunesModule.setTargetStack(ItemStack.EMPTY);
RuneColor runeColor = info.runeColor();
if(runeColor != null)
ColorRunesModule.setTargetColor(runeColor);

VertexConsumer buffer = ItemRenderer.getFoilBuffer(buffers, layer, true, info.enchanted());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import org.violetmoon.quark.addons.oddities.util.TinyPotatoInfo;
import org.violetmoon.quark.api.IRuneColorProvider;
import org.violetmoon.quark.base.handler.ContributorRewardHandler;
import org.violetmoon.quark.content.tools.base.RuneColor;
import org.violetmoon.zeta.item.ZetaBlockItem;
import org.violetmoon.zeta.registry.CreativeTabManager;
import org.violetmoon.zeta.util.ItemNBTHelper;
Expand Down Expand Up @@ -102,9 +103,9 @@ public boolean isFoil(@NotNull ItemStack stack) {
}

@Override
public int getRuneColor(ItemStack stack) {
public RuneColor getRuneColor(ItemStack stack) {
if(stack.hasCustomHoverName())
return TinyPotatoInfo.fromComponent(stack.getHoverName()).runeColor();
return -1;
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

import net.minecraft.ChatFormatting;
import net.minecraft.network.chat.Component;
import net.minecraft.world.item.DyeColor;
import org.jetbrains.annotations.Nullable;
import org.violetmoon.quark.content.tools.base.RuneColor;

import java.util.List;
import java.util.Locale;

public record TinyPotatoInfo(int runeColor, boolean enchanted, String name) {
public record TinyPotatoInfo(@Nullable RuneColor runeColor, boolean enchanted, String name) {

private static final List<String> RAINBOW_NAMES = List.of("gay homosexual", "rainbow", "lgbt", "lgbtq", "lgbtq+", "gay");
private static final List<String> ENCHANTMENT_NAMES = List.of("enchanted", "glowy", "shiny", "gay");
Expand All @@ -28,7 +29,7 @@ public static TinyPotatoInfo fromString(String string) {
string = ChatFormatting.stripFormatting(string);

if(string == null)
return new TinyPotatoInfo(-1, false, "");
return new TinyPotatoInfo(null, false, "");

string = string.trim().toLowerCase(Locale.ROOT);

Expand All @@ -41,28 +42,29 @@ public static TinyPotatoInfo fromString(String string) {
}
}

int color = -1;
RuneColor color = null;

if(enchanted) {
for(DyeColor dyeColor : DyeColor.values()) {
String key = dyeColor.getSerializedName().replace("_", " ");
for(RuneColor runeColor : RuneColor.values()) {
String key = runeColor.getName().replace("_", " ");
if(matches(string, key)) {
color = dyeColor.getId();
color = runeColor;
string = removeFromFront(string, key);
break;
} else if(key.contains("gray")) {
} else if (key.contains("gray")) {
key = key.replace("gray", "grey");
if(matches(string, key)) {
color = dyeColor.getId();
color = runeColor;
string = removeFromFront(string, key);
break;
}
}
}
if(color == -1) {

if(color == null) {
for(String rainbow : RAINBOW_NAMES) {
if(matches(string, rainbow)) {
color = 16;
color = RuneColor.RAINBOW;
string = removeFromFront(string, rainbow);
break;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package org.violetmoon.quark.api;

import net.minecraft.world.item.ItemStack;
import org.violetmoon.quark.content.tools.base.RuneColor;

/**
* @author WireSegal
* Created at 2:22 PM on 8/17/19.
*/
public interface IRuneColorProvider {

int getRuneColor(ItemStack stack);
RuneColor getRuneColor(ItemStack stack);
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,12 @@ public class QuarkSounds {
private static final List<SoundEvent> REGISTRY_DEFERENCE = Lists.newArrayList();

public static final SoundEvent ENTITY_SHIBA_EAT_ARROW = register("entity.shiba.eat_arrow");
public static final SoundEvent ENTITY_SHIBA_WHINE = register("entity.shiba.whine");
public static final SoundEvent ENTITY_SHIBA_STEP = register("entity.shiba.step");
public static final SoundEvent ENTITY_SHIBA_AMBIENT = register("entity.shiba.ambient");
public static final SoundEvent ENTITY_SHIBA_PANT = register("entity.shiba.pant");
public static final SoundEvent ENTITY_SHIBA_HURT = register("entity.shiba.hurt");
public static final SoundEvent ENTITY_SHIBA_DEATH = register("entity.shiba.death");

public static final SoundEvent ENTITY_STONELING_MEEP = register("entity.stoneling.meep");
public static final SoundEvent ENTITY_STONELING_PURR = register("entity.stoneling.purr");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ public static WoodSet addWoodSet(ZRegister event, ZetaModule module, String name
set.wallHangingSign = new ZetaWallHangingSignBlock(name + "_wall_hanging_sign", module, type, OldMaterials.wood().forceSolidOn().mapColor(color).noCollission().strength(1.0F).sound(SoundType.WOOD).lootFrom(() -> set.sign));

set.bookshelf = new VariantBookshelfBlock(name, module, true, sound).setCondition(() -> Quark.ZETA.modules.isEnabledOrOverlapping(VariantBookshelvesModule.class));
set.ladder = new VariantLadderBlock(name, module, true).setCondition(() -> Quark.ZETA.modules.isEnabledOrOverlapping(VariantLaddersModule.class));
set.ladder = new VariantLadderBlock(name, module, Block.Properties.copy(Blocks.LADDER).sound(sound), true).setCondition(() -> Quark.ZETA.modules.isEnabledOrOverlapping(VariantLaddersModule.class));

set.post = new WoodPostBlock(module, set.fence, "", sound).setCondition(() -> Quark.ZETA.modules.isEnabledOrOverlapping(WoodenPostsModule.class));
set.strippedPost = new WoodPostBlock(module, set.fence, "stripped_", sound).setCondition(() -> Quark.ZETA.modules.isEnabledOrOverlapping(WoodenPostsModule.class));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.client.ConfigScreenHandler.ConfigScreenFactory;
import net.minecraftforge.fml.ModLoadingContext;

import org.violetmoon.quark.base.Quark;
import org.violetmoon.quark.base.QuarkClient;
import org.violetmoon.quark.base.client.config.QButtonHandler;
Expand Down Expand Up @@ -102,6 +101,11 @@ public boolean isClientPlayerHoldingShift() {
return Screen.hasShiftDown();
}

@Override
public float getVisualTime() {
return QuarkClient.ticker.total;
}

private static void copyProgrammerArtIfMissing() {
File dir = new File(".", "resourcepacks");
File target = new File(dir, "Quark Programmer Art.zip");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,4 +149,8 @@ public InteractionResult clientUseItem(Player player, Level level, InteractionHa
public boolean isClientPlayerHoldingShift() {
return false;
}

public float getVisualTime() {
return 0f;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

public class VanillaWoods {

public static record Wood(String name, Block log, Block wood, Block planks, Block leaf, Block fence, boolean nether, SoundType soundWood, SoundType soundPlanks) {
}
public static record Wood(String name, Block log, Block wood, Block planks, Block leaf, Block fence, boolean nether, SoundType soundWood, SoundType soundPlanks) {}

public static Wood OAK = new Wood("oak", Blocks.OAK_LOG, Blocks.OAK_WOOD, Blocks.OAK_PLANKS, Blocks.OAK_LEAVES, Blocks.OAK_FENCE, false, SoundType.WOOD, SoundType.WOOD);
public static Wood SPRUCE = new Wood("spruce", Blocks.SPRUCE_LOG, Blocks.SPRUCE_WOOD, Blocks.SPRUCE_PLANKS, Blocks.SPRUCE_LEAVES, Blocks.SPRUCE_FENCE, false, SoundType.WOOD, SoundType.WOOD);
Expand All @@ -17,7 +16,7 @@ public static record Wood(String name, Block log, Block wood, Block planks, Bloc
public static Wood DARK_OAK = new Wood("dark_oak", Blocks.DARK_OAK_LOG, Blocks.DARK_OAK_WOOD, Blocks.DARK_OAK_PLANKS, Blocks.DARK_OAK_LEAVES, Blocks.DARK_OAK_FENCE, false, SoundType.WOOD, SoundType.WOOD);
public static Wood MANGROVE = new Wood("mangrove", Blocks.MANGROVE_LOG, Blocks.MANGROVE_WOOD, Blocks.MANGROVE_PLANKS, Blocks.MANGROVE_LEAVES, Blocks.MANGROVE_FENCE, false, SoundType.WOOD, SoundType.WOOD);
public static Wood BAMBOO = new Wood("bamboo", Blocks.BAMBOO_BLOCK, null, Blocks.BAMBOO_PLANKS, null, Blocks.BAMBOO_FENCE, false, SoundType.BAMBOO_WOOD, SoundType.BAMBOO_WOOD);
public static Wood CHERRY = new Wood("cherry", Blocks.CHERRY_LOG, Blocks.CHERRY_WOOD, Blocks.CHERRY_PLANKS, Blocks.CHERRY_LEAVES, Blocks.CHERRY_FENCE, false, SoundType.WOOD, SoundType.WOOD);
public static Wood CHERRY = new Wood("cherry", Blocks.CHERRY_LOG, Blocks.CHERRY_WOOD, Blocks.CHERRY_PLANKS, Blocks.CHERRY_LEAVES, Blocks.CHERRY_FENCE, false, SoundType.CHERRY_WOOD, SoundType.CHERRY_WOOD);

public static Wood CRIMSON = new Wood("crimson", Blocks.CRIMSON_STEM, Blocks.CRIMSON_HYPHAE, Blocks.CRIMSON_PLANKS, null, Blocks.CRIMSON_FENCE, true, SoundType.STEM, SoundType.NETHER_WOOD);
public static Wood WARPED = new Wood("warped", Blocks.WARPED_STEM, Blocks.WARPED_HYPHAE, Blocks.WARPED_PLANKS, null, Blocks.WARPED_FENCE, true, SoundType.STEM, SoundType.NETHER_WOOD);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,15 @@ public void tick(BlockState state, ServerLevel world, BlockPos pos, RandomSource

@Override
public void neighborChanged(BlockState state, Level world, BlockPos pos, Block sourceBlock, BlockPos sourcePos, boolean notify) {
PowerState powerState = state.getValue(POWER);
boolean bl = world.hasNeighborSignal(pos) || world.hasNeighborSignal(pos.above());
boolean bl2 = state.getValue(POWER).powered();
boolean bl2 = powerState.powered();

if (bl && !bl2) {
world.scheduleTick(pos, this, 6);
((CrafterBlockEntity) world.getBlockEntity(pos)).craft();
world.setBlock(pos, state.setValue(POWER, PowerState.TRIGGERED), 2);
} else if (!bl && state.getValue(POWER) == PowerState.ON) {
} else if (!bl && state.getValue(POWER) != PowerState.OFF) {
world.setBlock(pos, state.setValue(POWER, PowerState.OFF), 2);
}
}
Expand All @@ -134,7 +136,7 @@ public int getAnalogOutputSignal(BlockState state, Level world, BlockPos pos) {

@Override
public BlockState getStateForPlacement(BlockPlaceContext ctx) {
return this.defaultBlockState().setValue(FACING, ctx.getNearestLookingDirection().getOpposite());
return this.defaultBlockState().setValue(FACING, ctx.getHorizontalDirection().getOpposite());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public class FeedingTroughBlock extends ZetaBlock implements EntityBlock {

private static final SoundType WOOD_WITH_PLANT_STEP = new ForgeSoundType(1.0F, 1.0F, () -> SoundEvents.WOOD_BREAK, () -> SoundEvents.GRASS_STEP, () -> SoundEvents.WOOD_PLACE, () -> SoundEvents.WOOD_HIT, () -> SoundEvents.WOOD_FALL);

public static BooleanProperty FULL = BooleanProperty.create("full");
public static final BooleanProperty FULL = BooleanProperty.create("full");

public static final VoxelShape CUBOID_SHAPE = box(0, 0, 0, 16, 8, 16);
public static final VoxelShape EMPTY_SHAPE = Shapes.join(CUBOID_SHAPE, box(2, 2, 2, 14, 8, 14), BooleanOp.ONLY_FIRST);
Expand Down Expand Up @@ -106,8 +106,8 @@ public void fallOn(Level level, @NotNull BlockState state, @NotNull BlockPos pos
public void onRemove(BlockState state, @NotNull Level world, @NotNull BlockPos pos, @NotNull BlockState newState, boolean isMoving) {
if(state.getBlock() != newState.getBlock()) {
BlockEntity tile = world.getBlockEntity(pos);
if(tile instanceof FeedingTroughBlockEntity) {
Containers.dropContents(world, pos, (FeedingTroughBlockEntity) tile);
if(tile instanceof FeedingTroughBlockEntity f) {
Containers.dropContents(world, pos, f);
world.updateNeighbourForOutputSignal(pos, this);
}

Expand Down Expand Up @@ -150,17 +150,12 @@ public boolean triggerEvent(@NotNull BlockState state, @NotNull Level world, @No
@Nullable
public MenuProvider getMenuProvider(@NotNull BlockState state, Level world, @NotNull BlockPos pos) {
BlockEntity tile = world.getBlockEntity(pos);
return tile instanceof MenuProvider ? (MenuProvider) tile : null;
return tile instanceof MenuProvider m ? m : null;
}

@Override
public BlockEntity newBlockEntity(@NotNull BlockPos pos, @NotNull BlockState state) {
return new FeedingTroughBlockEntity(pos, state);
}

@Override
public <T extends BlockEntity> BlockEntityTicker<T> getTicker(@NotNull Level world, @NotNull BlockState state, @NotNull BlockEntityType<T> type) {
return createTickerHelper(type, FeedingTroughModule.blockEntityType, FeedingTroughBlockEntity::tick);
}

}
Loading

0 comments on commit e3dd28f

Please sign in to comment.