diff --git a/src/main/java/com/simibubi/create/AllBlockTags.java b/src/main/java/com/simibubi/create/AllBlockTags.java index 71864a2a0..15690638b 100644 --- a/src/main/java/com/simibubi/create/AllBlockTags.java +++ b/src/main/java/com/simibubi/create/AllBlockTags.java @@ -8,7 +8,10 @@ import net.minecraft.util.ResourceLocation; public enum AllBlockTags { - WINDMILL_SAILS; + WINDMILL_SAILS, + FAN_HEATERS, + + ; public Tag tag; diff --git a/src/main/java/com/simibubi/create/AllBlocks.java b/src/main/java/com/simibubi/create/AllBlocks.java index 06362e269..f04093824 100644 --- a/src/main/java/com/simibubi/create/AllBlocks.java +++ b/src/main/java/com/simibubi/create/AllBlocks.java @@ -53,6 +53,7 @@ import net.minecraft.block.Block; import net.minecraft.block.Block.Properties; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; +import net.minecraft.block.FallingBlock; import net.minecraft.block.FenceBlock; import net.minecraft.block.FenceGateBlock; import net.minecraft.block.RotatedPillarBlock; @@ -141,6 +142,7 @@ public enum AllBlocks { INDENTED_GABBRO(new Block(Properties.from(GABBRO.block)), ComesWith.SLAB), SLIGHTLY_MOSSY_GABBRO_BRICKS(new Block(Properties.from(GABBRO.block))), MOSSY_GABBRO_BRICKS(new Block(Properties.from(GABBRO.block))), + LIMESAND(new FallingBlock(Properties.from(Blocks.SAND))), LIMESTONE(new Block(Properties.from(Blocks.SANDSTONE)), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL), LIMESTONE_BRICKS(new Block(Properties.from(LIMESTONE.block)), ComesWith.STAIRS, ComesWith.SLAB, ComesWith.WALL), POLISHED_LIMESTONE(new Block(Properties.from(LIMESTONE.block)), ComesWith.SLAB), diff --git a/src/main/java/com/simibubi/create/AllRecipes.java b/src/main/java/com/simibubi/create/AllRecipes.java index f77466f78..6757954aa 100644 --- a/src/main/java/com/simibubi/create/AllRecipes.java +++ b/src/main/java/com/simibubi/create/AllRecipes.java @@ -18,7 +18,7 @@ import net.minecraftforge.event.RegistryEvent; public enum AllRecipes { - PLACEMENT_HANDGUN_UPGRADE(BuilderGunUpgradeRecipe.Serializer::new, Types.BLOCKZAPPER_UPGRADE), + BLOCKZAPPER_UPGRADE(BuilderGunUpgradeRecipe.Serializer::new, IRecipeType.CRAFTING), CRUSHING(() -> new ProcessingRecipeSerializer<>(CrushingRecipe::new), Types.CRUSHING), SPLASHING(() -> new ProcessingRecipeSerializer<>(SplashingRecipe::new), Types.SPLASHING), PRESSING(() -> new ProcessingRecipeSerializer<>(PressingRecipe::new), Types.PRESSING), @@ -29,7 +29,6 @@ public enum AllRecipes { public static IRecipeType CRUSHING = register("crushing"); public static IRecipeType SPLASHING = register("splashing"); public static IRecipeType PRESSING = register("pressing"); - public static IRecipeType BLOCKZAPPER_UPGRADE = register("blockzapper_upgrade"); static > IRecipeType register(final String key) { return Registry.register(Registry.RECIPE_TYPE, new ResourceLocation(key), new IRecipeType() { diff --git a/src/main/java/com/simibubi/create/ClientEvents.java b/src/main/java/com/simibubi/create/ClientEvents.java index 6a1514c99..a77b9bdd2 100644 --- a/src/main/java/com/simibubi/create/ClientEvents.java +++ b/src/main/java/com/simibubi/create/ClientEvents.java @@ -3,7 +3,7 @@ package com.simibubi.create; import java.util.ArrayList; import java.util.List; -import com.simibubi.create.compat.jei.AnimatedKinetics; +import com.simibubi.create.compat.jei.AnimationTickHolder; import com.simibubi.create.foundation.block.IBlockWithScrollableValue; import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.utility.TooltipHelper; @@ -38,7 +38,7 @@ public class ClientEvents { if (event.phase == Phase.START) return; - AnimatedKinetics.tick(); + AnimationTickHolder.tick(); if (!isGameActive()) return; diff --git a/src/main/java/com/simibubi/create/CreateClient.java b/src/main/java/com/simibubi/create/CreateClient.java index 5397e445b..8ed54062d 100644 --- a/src/main/java/com/simibubi/create/CreateClient.java +++ b/src/main/java/com/simibubi/create/CreateClient.java @@ -1,11 +1,15 @@ package com.simibubi.create; +import com.simibubi.create.modules.contraptions.CachedBufferReloader; import com.simibubi.create.modules.contraptions.receivers.EncasedFanParticleHandler; import com.simibubi.create.modules.schematics.ClientSchematicLoader; import com.simibubi.create.modules.schematics.client.SchematicAndQuillHandler; import com.simibubi.create.modules.schematics.client.SchematicHandler; import com.simibubi.create.modules.schematics.client.SchematicHologram; +import net.minecraft.client.Minecraft; +import net.minecraft.resources.IReloadableResourceManager; +import net.minecraft.resources.IResourceManager; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; @@ -22,7 +26,7 @@ public class CreateClient { public static EncasedFanParticleHandler fanParticles; public static ModConfig config; - + @SubscribeEvent public static void clientInit(FMLClientSetupEvent event) { schematicSender = new ClientSchematicLoader(); @@ -30,19 +34,23 @@ public class CreateClient { schematicHologram = new SchematicHologram(); schematicAndQuillHandler = new SchematicAndQuillHandler(); fanParticles = new EncasedFanParticleHandler(); - + AllKeys.register(); AllContainers.registerScreenFactories(); AllTileEntities.registerRenderers(); AllItems.registerColorHandlers(); AllBlocks.registerColorHandlers(); + + IResourceManager resourceManager = Minecraft.getInstance().getResourceManager(); + if (resourceManager instanceof IReloadableResourceManager) + ((IReloadableResourceManager) resourceManager).addReloadListener(new CachedBufferReloader()); } - + @SubscribeEvent public static void createConfigs(ModConfig.ModConfigEvent event) { if (event.getConfig().getSpec() == CreateConfig.specification) return; - + config = event.getConfig(); } diff --git a/src/main/java/com/simibubi/create/compat/jei/AnimatedKinetics.java b/src/main/java/com/simibubi/create/compat/jei/AnimatedKinetics.java index 59571a2a9..b4b443060 100644 --- a/src/main/java/com/simibubi/create/compat/jei/AnimatedKinetics.java +++ b/src/main/java/com/simibubi/create/compat/jei/AnimatedKinetics.java @@ -5,14 +5,8 @@ import net.minecraft.client.Minecraft; public abstract class AnimatedKinetics implements IDrawable { - protected static int ticks; - - public static void tick() { - ticks++; - } - public static float getCurrentAngle() { - return ((ticks + Minecraft.getInstance().getRenderPartialTicks()) * 4f) % 360; + return ((AnimationTickHolder.ticks + Minecraft.getInstance().getRenderPartialTicks()) * 4f) % 360; } } diff --git a/src/main/java/com/simibubi/create/compat/jei/AnimatedPress.java b/src/main/java/com/simibubi/create/compat/jei/AnimatedPress.java index 55fee1255..4980040e3 100644 --- a/src/main/java/com/simibubi/create/compat/jei/AnimatedPress.java +++ b/src/main/java/com/simibubi/create/compat/jei/AnimatedPress.java @@ -1,5 +1,7 @@ package com.simibubi.create.compat.jei; +import static com.simibubi.create.compat.jei.AnimationTickHolder.ticks; + import com.mojang.blaze3d.platform.GlStateManager; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.gui.ScreenElementRenderer; diff --git a/src/main/java/com/simibubi/create/compat/jei/AnimationTickHolder.java b/src/main/java/com/simibubi/create/compat/jei/AnimationTickHolder.java new file mode 100644 index 000000000..08c03df78 --- /dev/null +++ b/src/main/java/com/simibubi/create/compat/jei/AnimationTickHolder.java @@ -0,0 +1,11 @@ +package com.simibubi.create.compat.jei; + +public class AnimationTickHolder { + + protected static int ticks; + + public static void tick() { + ticks++; + } + +} diff --git a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java index 084157341..d4fbef785 100644 --- a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java +++ b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java @@ -64,7 +64,8 @@ public class CreateJEI implements IModPlugin { registration.addRecipes(findRecipes(AllRecipes.CRUSHING), crushingCategory.getUid()); registration.addRecipes(findRecipes(AllRecipes.SPLASHING), splashingCategory.getUid()); registration.addRecipes(findRecipes(AllRecipes.PRESSING), pressingCategory.getUid()); - registration.addRecipes(findRecipes(AllRecipes.PLACEMENT_HANDGUN_UPGRADE), blockzapperCategory.getUid()); + registration.addRecipes(findRecipesById(AllRecipes.BLOCKZAPPER_UPGRADE.serializer.getRegistryName()), + blockzapperCategory.getUid()); registration.addRecipes(findRecipesByType(IRecipeType.SMOKING), smokingCategory.getUid()); registration.addRecipes(findRecipesByTypeExcluding(IRecipeType.SMELTING, IRecipeType.SMOKING), blastingCategory.getUid()); @@ -98,6 +99,11 @@ public class CreateJEI implements IModPlugin { .collect(Collectors.toList()); } + private static List> findRecipesById(ResourceLocation id) { + return Minecraft.getInstance().world.getRecipeManager().getRecipes().stream() + .filter(r -> r.getSerializer().getRegistryName().equals(id)).collect(Collectors.toList()); + } + private static List> findRecipesByTypeExcluding(IRecipeType type, IRecipeType excludingType) { List> byType = findRecipesByType(type); List> byExcludingType = findRecipesByType(excludingType); diff --git a/src/main/java/com/simibubi/create/modules/contraptions/CachedBufferReloader.java b/src/main/java/com/simibubi/create/modules/contraptions/CachedBufferReloader.java new file mode 100644 index 000000000..713c83f90 --- /dev/null +++ b/src/main/java/com/simibubi/create/modules/contraptions/CachedBufferReloader.java @@ -0,0 +1,28 @@ +package com.simibubi.create.modules.contraptions; + +import com.simibubi.create.modules.contraptions.base.KineticTileEntityRenderer; +import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalBearingTileEntityRenderer; +import com.simibubi.create.modules.contraptions.receivers.constructs.MechanicalPistonTileEntityRenderer; +import com.simibubi.create.modules.logistics.block.diodes.FlexpeaterTileEntityRenderer; + +import net.minecraft.client.resources.ReloadListener; +import net.minecraft.profiler.IProfiler; +import net.minecraft.resources.IResourceManager; + +public class CachedBufferReloader extends ReloadListener { + + @Override + protected String prepare(IResourceManager resourceManagerIn, IProfiler profilerIn) { + return ""; + } + + @Override + protected void apply(String splashList, IResourceManager resourceManagerIn, IProfiler profilerIn) { + KineticTileEntityRenderer.invalidateCache(); + MechanicalPistonTileEntityRenderer.invalidateCache(); + MechanicalBearingTileEntityRenderer.invalidateCache(); + FlexpeaterTileEntityRenderer.invalidateCache(); + } + + +} diff --git a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntityRenderer.java index 85d6a4cc9..6d7b876ae 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/base/KineticTileEntityRenderer.java @@ -119,4 +119,9 @@ public class KineticTileEntityRenderer extends TileEntityRendererFast getType() { - return AllRecipes.Types.BLOCKZAPPER_UPGRADE; - } +// @Override +// public IRecipeType getType() { +// return AllRecipes.Types.BLOCKZAPPER_UPGRADE; +// } @Override public IRecipeSerializer getSerializer() { - return AllRecipes.PLACEMENT_HANDGUN_UPGRADE.serializer; + return AllRecipes.BLOCKZAPPER_UPGRADE.serializer; } public static class Serializer extends ForgeRegistryEntry> implements IRecipeSerializer { diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/ConfigureFlexpeaterPacket.java b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/ConfigureFlexpeaterPacket.java index 6112a7af8..75431b3b6 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/ConfigureFlexpeaterPacket.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/ConfigureFlexpeaterPacket.java @@ -4,6 +4,7 @@ import com.simibubi.create.foundation.packet.TileEntityConfigurationPacket; import net.minecraft.network.PacketBuffer; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; public class ConfigureFlexpeaterPacket extends TileEntityConfigurationPacket { @@ -31,6 +32,7 @@ public class ConfigureFlexpeaterPacket extends TileEntityConfigurationPacket= maxState; + boolean atMin = state <= 0; if (!charging && powered) charging = true; diff --git a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntityRenderer.java b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntityRenderer.java index 0436fc336..619ed0638 100644 --- a/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/modules/logistics/block/diodes/FlexpeaterTileEntityRenderer.java @@ -33,12 +33,12 @@ public class FlexpeaterTileEntityRenderer extends TileEntityRendererFast> 16); byte g = (byte) ((color >> 8) & 0xFF); byte b = (byte) (color & 0xFF); byte a = (byte) 255; - + for (int vertex = 0; vertex < vertexCount(original); vertex++) { putColor(mutable, vertex, r, g, b, a); putPos(mutable, vertex, getX(original, vertex) + xIn, getY(original, vertex) + yIn, @@ -50,7 +50,7 @@ public class FlexpeaterTileEntityRenderer extends TileEntityRendererFast