diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 000000000..363785069 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,21 @@ +# http://editorconfig.org +root = true + +[*] +indent_style = space +indent_size = 4 +continuation_indent_size = 8 +end_of_line = lf +charset = utf-8 +trim_trailing_whitespace = true +insert_final_newline = true + +[*.json] +indent_style = space +indent_size = 2 + +[*.java] +indent_style = tab +ij_java_class_count_to_use_import_on_demand = 99 +ij_java_names_count_to_use_import_on_demand = 99 +ij_java_imports_layout = $*,|,java.**,|,javax.**,|,org.**,|,com.**,|,* \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/AllBlockPartials.java b/src/main/java/com/simibubi/create/AllBlockPartials.java index a3e747f41..d6a27e9d0 100644 --- a/src/main/java/com/simibubi/create/AllBlockPartials.java +++ b/src/main/java/com/simibubi/create/AllBlockPartials.java @@ -10,15 +10,10 @@ import java.util.Map; import java.util.function.Supplier; import com.mojang.blaze3d.matrix.MatrixStack; -import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; -import com.simibubi.create.content.contraptions.base.RotatingData; import com.simibubi.create.content.contraptions.fluids.FluidTransportBehaviour.AttachmentTypes; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel; -import com.simibubi.create.content.contraptions.relays.belt.BeltData; import com.simibubi.create.foundation.render.SuperByteBuffer; -import com.simibubi.create.foundation.render.backend.MaterialType; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; -import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.Iterate; @@ -66,10 +61,10 @@ public class AllBlockPartials { HARVESTER_BLADE = get("mechanical_harvester/blade"), DEPLOYER_POLE = get("deployer/pole"), DEPLOYER_HAND_POINTING = get("deployer/hand_pointing"), DEPLOYER_HAND_PUNCHING = get("deployer/hand_punching"), DEPLOYER_HAND_HOLDING = get("deployer/hand_holding"), ANALOG_LEVER_HANDLE = get("analog_lever/handle"), - ANALOG_LEVER_INDICATOR = get("analog_lever/indicator"), FUNNEL_FLAP = get("funnel/flap"), - BELT_FUNNEL_FLAP = get("belt_funnel/flap"), - BELT_TUNNEL_FLAP = get("belt_tunnel/flap"), FLEXPEATER_INDICATOR = get("diodes/indicator"), - FLYWHEEL = get("flywheel/wheel"), FLYWHEEL_UPPER_ROTATING = get("flywheel/upper_rotating_connector"), + ANALOG_LEVER_INDICATOR = get("analog_lever/indicator"), FUNNEL_FLAP = get("funnel/flap"), + BELT_FUNNEL_FLAP = get("belt_funnel/flap"), BELT_TUNNEL_FLAP = get("belt_tunnel/flap"), + FLEXPEATER_INDICATOR = get("diodes/indicator"), FLYWHEEL = get("flywheel/wheel"), + FLYWHEEL_UPPER_ROTATING = get("flywheel/upper_rotating_connector"), FLYWHEEL_LOWER_ROTATING = get("flywheel/lower_rotating_connector"), FLYWHEEL_UPPER_SLIDING = get("flywheel/upper_sliding_connector"), @@ -77,31 +72,28 @@ public class AllBlockPartials { FURNACE_GENERATOR_FRAME = get("furnace_engine/frame"), CUCKOO_MINUTE_HAND = get("cuckoo_clock/minute_hand"), CUCKOO_HOUR_HAND = get("cuckoo_clock/hour_hand"), CUCKOO_LEFT_DOOR = get("cuckoo_clock/left_door"), CUCKOO_RIGHT_DOOR = get("cuckoo_clock/right_door"), CUCKOO_PIG = get("cuckoo_clock/pig"), - CUCKOO_CREEPER = get("cuckoo_clock/creeper"), - + CUCKOO_CREEPER = get("cuckoo_clock/creeper"), + GANTRY_COGS = get("gantry_carriage/wheels"), - - ROPE_COIL = get("rope_pulley/rope_coil"), - ROPE_HALF = get("rope_pulley/rope_half"), + + ROPE_COIL = get("rope_pulley/rope_coil"), ROPE_HALF = get("rope_pulley/rope_half"), ROPE_HALF_MAGNET = get("rope_pulley/rope_half_magnet"), - - HOSE_COIL = get("hose_pulley/rope_coil"), - HOSE = get("hose_pulley/rope"), - HOSE_MAGNET = get("hose_pulley/pulley_magnet"), - HOSE_HALF = get("hose_pulley/rope_half"), + + HOSE_COIL = get("hose_pulley/rope_coil"), HOSE = get("hose_pulley/rope"), + HOSE_MAGNET = get("hose_pulley/pulley_magnet"), HOSE_HALF = get("hose_pulley/rope_half"), HOSE_HALF_MAGNET = get("hose_pulley/rope_half_magnet"), - + MILLSTONE_COG = get("millstone/inner"), SYMMETRY_PLANE = get("symmetry_effect/plane"), SYMMETRY_CROSSPLANE = get("symmetry_effect/crossplane"), SYMMETRY_TRIPLEPLANE = get("symmetry_effect/tripleplane"), - + STICKER_HEAD = get("sticker/head"), PORTABLE_STORAGE_INTERFACE_MIDDLE = get("portable_storage_interface/block_middle"), PORTABLE_STORAGE_INTERFACE_MIDDLE_POWERED = get("portable_storage_interface/block_middle_powered"), PORTABLE_STORAGE_INTERFACE_TOP = get("portable_storage_interface/block_top"), - + PORTABLE_FLUID_INTERFACE_MIDDLE = get("portable_fluid_interface/block_middle"), PORTABLE_FLUID_INTERFACE_MIDDLE_POWERED = get("portable_fluid_interface/block_middle_powered"), PORTABLE_FLUID_INTERFACE_TOP = get("portable_fluid_interface/block_top"), @@ -120,11 +112,11 @@ public class AllBlockPartials { SPOUT_TOP = get("spout/top"), SPOUT_MIDDLE = get("spout/middle"), SPOUT_BOTTOM = get("spout/bottom"), SPEED_CONTROLLER_BRACKET = get("rotation_speed_controller/bracket"), - + GOGGLES = get("goggles"), - + EJECTOR_TOP = get("weighted_ejector/top"), - + COUPLING_ATTACHMENT = getEntity("minecart_coupling/attachment"), COUPLING_RING = getEntity("minecart_coupling/ring"), COUPLING_CONNECTOR = getEntity("minecart_coupling/connector") @@ -237,14 +229,15 @@ public class AllBlockPartials { return CreateClient.bufferCache.renderDirectionalPartial(this, referenceState, facing, ms); } - public > M getModel(RenderMaterial mat, BlockState referenceState, Direction facing) { + public > M getModel(RenderMaterial mat, BlockState referenceState, + Direction facing) { Supplier ms = () -> { MatrixStack stack = new MatrixStack(); MatrixStacker.of(stack) - .centre() - .rotateY(AngleHelper.horizontalAngle(facing)) - .rotateX(AngleHelper.verticalAngle(facing)) - .unCentre(); + .centre() + .rotateY(AngleHelper.horizontalAngle(facing)) + .rotateX(AngleHelper.verticalAngle(facing)) + .unCentre(); return stack; }; return mat.getModel(this, referenceState, facing, ms); diff --git a/src/main/java/com/simibubi/create/AllColorHandlers.java b/src/main/java/com/simibubi/create/AllColorHandlers.java index a99eb9b31..f8d86596d 100644 --- a/src/main/java/com/simibubi/create/AllColorHandlers.java +++ b/src/main/java/com/simibubi/create/AllColorHandlers.java @@ -41,9 +41,8 @@ public class AllColorHandlers { } public static IBlockColor getRedstonePower() { - return new BlockColor( - (state, world, pos, layer) -> RedstoneWireBlock.getWireColor(pos != null && world != null ? state.get(BlockStateProperties.POWER_0_15) : 0) - ); + return new BlockColor((state, world, pos, layer) -> RedstoneWireBlock + .getWireColor(pos != null && world != null ? state.get(BlockStateProperties.POWER_0_15) : 0)); } // diff --git a/src/main/java/com/simibubi/create/AllContainerTypes.java b/src/main/java/com/simibubi/create/AllContainerTypes.java index 81c1b2e27..f7ea37a0c 100644 --- a/src/main/java/com/simibubi/create/AllContainerTypes.java +++ b/src/main/java/com/simibubi/create/AllContainerTypes.java @@ -45,8 +45,9 @@ public enum AllContainerTypes { public static void register(RegistryEvent.Register> event) { for (AllContainerTypes container : values()) { container.type = new ContainerType<>(container.factory) - .setRegistryName(new ResourceLocation(Create.ID, Lang.asId(container.name()))); - event.getRegistry().register(container.type); + .setRegistryName(new ResourceLocation(Create.ID, Lang.asId(container.name()))); + event.getRegistry() + .register(container.type); } } @@ -62,7 +63,7 @@ public enum AllContainerTypes { @OnlyIn(Dist.CLIENT) @SuppressWarnings("unchecked") private static > void bind(AllContainerTypes c, - IScreenFactory factory) { + IScreenFactory factory) { ScreenManager.registerFactory((ContainerType) c.type, factory); } diff --git a/src/main/java/com/simibubi/create/AllEntityTypes.java b/src/main/java/com/simibubi/create/AllEntityTypes.java index c92797f23..32afec7fa 100644 --- a/src/main/java/com/simibubi/create/AllEntityTypes.java +++ b/src/main/java/com/simibubi/create/AllEntityTypes.java @@ -32,8 +32,8 @@ public class AllEntityTypes { public static final RegistryEntry> SUPER_GLUE = register("super_glue", SuperGlueEntity::new, EntityClassification.MISC, 10, Integer.MAX_VALUE, false, true, SuperGlueEntity::build); - public static final RegistryEntry> SEAT = - register("seat", SeatEntity::new, EntityClassification.MISC, 0, Integer.MAX_VALUE, false, true, SeatEntity::build); + public static final RegistryEntry> SEAT = register("seat", SeatEntity::new, + EntityClassification.MISC, 0, Integer.MAX_VALUE, false, true, SeatEntity::build); // @@ -64,12 +64,10 @@ public class AllEntityTypes { @OnlyIn(value = Dist.CLIENT) public static void registerRenderers() { - RenderingRegistry.registerEntityRenderingHandler(CONTROLLED_CONTRAPTION.get(), - ContraptionEntityRenderer::new); + RenderingRegistry.registerEntityRenderingHandler(CONTROLLED_CONTRAPTION.get(), ContraptionEntityRenderer::new); RenderingRegistry.registerEntityRenderingHandler(ORIENTED_CONTRAPTION.get(), OrientedContraptionEntityRenderer::new); - RenderingRegistry.registerEntityRenderingHandler(GANTRY_CONTRAPTION.get(), - ContraptionEntityRenderer::new); + RenderingRegistry.registerEntityRenderingHandler(GANTRY_CONTRAPTION.get(), ContraptionEntityRenderer::new); RenderingRegistry.registerEntityRenderingHandler(SUPER_GLUE.get(), SuperGlueRenderer::new); RenderingRegistry.registerEntityRenderingHandler(SEAT.get(), SeatEntity.Render::new); } diff --git a/src/main/java/com/simibubi/create/AllKeys.java b/src/main/java/com/simibubi/create/AllKeys.java index e3fedc25f..d997811b2 100644 --- a/src/main/java/com/simibubi/create/AllKeys.java +++ b/src/main/java/com/simibubi/create/AllKeys.java @@ -9,8 +9,7 @@ import net.minecraftforge.fml.client.registry.ClientRegistry; public enum AllKeys { - TOOL_MENU("toolmenu", GLFW.GLFW_KEY_LEFT_ALT), - ACTIVATE_TOOL("", GLFW.GLFW_KEY_LEFT_CONTROL), + TOOL_MENU("toolmenu", GLFW.GLFW_KEY_LEFT_ALT), ACTIVATE_TOOL("", GLFW.GLFW_KEY_LEFT_CONTROL), ; @@ -46,15 +45,20 @@ public enum AllKeys { } public String getBoundKey() { - return keybind.getBoundKeyLocalizedText().getString().toUpperCase(); + return keybind.getBoundKeyLocalizedText() + .getString() + .toUpperCase(); } public int getBoundCode() { - return keybind.getKey().getKeyCode(); + return keybind.getKey() + .getKeyCode(); } public static boolean isKeyDown(int key) { - return GLFW.glfwGetKey(Minecraft.getInstance().getWindow().getHandle(), key) != 0; + return GLFW.glfwGetKey(Minecraft.getInstance() + .getWindow() + .getHandle(), key) != 0; } public static boolean ctrlDown() { diff --git a/src/main/java/com/simibubi/create/AllMovementBehaviours.java b/src/main/java/com/simibubi/create/AllMovementBehaviours.java index 44d298625..0d306ddaf 100644 --- a/src/main/java/com/simibubi/create/AllMovementBehaviours.java +++ b/src/main/java/com/simibubi/create/AllMovementBehaviours.java @@ -38,7 +38,7 @@ public class AllMovementBehaviours { public static MovementBehaviour of(Block block) { return of(block.getRegistryName()); } - + @Nullable public static MovementBehaviour of(BlockState state) { return of(state.getBlock()); diff --git a/src/main/java/com/simibubi/create/AllSpecialTextures.java b/src/main/java/com/simibubi/create/AllSpecialTextures.java index 27f11391a..d3b95fe85 100644 --- a/src/main/java/com/simibubi/create/AllSpecialTextures.java +++ b/src/main/java/com/simibubi/create/AllSpecialTextures.java @@ -14,7 +14,7 @@ public enum AllSpecialTextures { CUTOUT_CHECKERED("cutout_checkerboard.png"), HIGHLIGHT_CHECKERED("highlighted_checkerboard.png"), SELECTION("selection.png"), - + ; public static final String ASSET_PATH = "textures/special/"; @@ -25,9 +25,11 @@ public enum AllSpecialTextures { } public void bind() { - Minecraft.getInstance().getTextureManager().bindTexture(location); + Minecraft.getInstance() + .getTextureManager() + .bindTexture(location); } - + public ResourceLocation getLocation() { return location; } diff --git a/src/main/java/com/simibubi/create/AllSpriteShifts.java b/src/main/java/com/simibubi/create/AllSpriteShifts.java index 825023bfd..224d852a7 100644 --- a/src/main/java/com/simibubi/create/AllSpriteShifts.java +++ b/src/main/java/com/simibubi/create/AllSpriteShifts.java @@ -44,8 +44,7 @@ public class AllSpriteShifts { SHADOW_STEEL_CASING = omni("shadow_steel_casing"), REFINED_RADIANCE_CASING = omni("refined_radiance_casing"), CREATIVE_CASING = getCT(CTType.CROSS, "creative_casing"); - public static final CTSpriteShiftEntry - CHASSIS_SIDE = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_side"), + public static final CTSpriteShiftEntry CHASSIS_SIDE = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_side"), SECONDARY_CHASSIS_SIDE = getCT(CTType.OMNIDIRECTIONAL, "secondary_linear_chassis_side"), CHASSIS = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_end"), CHASSIS_STICKY = getCT(CTType.OMNIDIRECTIONAL, "linear_chassis_end_sticky"); @@ -97,7 +96,8 @@ public class AllSpriteShifts { String id = color.getString(); DYED_BELTS.put(color, SpriteShifter.get("block/belt", "block/belt/" + id + "_scroll")); DYED_OFFSET_BELTS.put(color, SpriteShifter.get("block/belt_offset", "block/belt/" + id + "_scroll")); - DYED_DIAGONAL_BELTS.put(color, SpriteShifter.get("block/belt_diagonal", "block/belt/" + id + "_diagonal_scroll")); + DYED_DIAGONAL_BELTS.put(color, + SpriteShifter.get("block/belt_diagonal", "block/belt/" + id + "_diagonal_scroll")); } } diff --git a/src/main/java/com/simibubi/create/AllTags.java b/src/main/java/com/simibubi/create/AllTags.java index 1a7768a7c..b42cdf120 100644 --- a/src/main/java/com/simibubi/create/AllTags.java +++ b/src/main/java/com/simibubi/create/AllTags.java @@ -47,7 +47,7 @@ public class AllTags { public static ITag.INamedTag forgeItemTag(String name) { return forgeTag(ItemTags::makeWrapperTag, name); } - + public static ITag.INamedTag forgeFluidTag(String name) { return forgeTag(FluidTags::makeWrapperTag, name); } @@ -56,7 +56,8 @@ public class AllTags { return tag(wrapperFactory, "forge", name); } - public static ITag.INamedTag tag(Function> wrapperFactory, String domain, String name) { + public static ITag.INamedTag tag(Function> wrapperFactory, String domain, + String name) { return wrapperFactory.apply(new ResourceLocation(domain, name).toString()); } @@ -65,6 +66,7 @@ public class AllTags { MOD(Create.ID), FORGE("forge"), MC("minecraft"), TIC("tconstruct") ; + String id; private NameSpace(String id) { @@ -112,13 +114,14 @@ public class AllTags { .addTag(tag)); } } - + public static enum AllFluidTags { NO_INFINITE_DRAINING - + ; + public ITag.INamedTag tag; - + private AllFluidTags() { this(MOD, ""); } @@ -131,17 +134,26 @@ public class AllTags { tag = FluidTags.createOptional( new ResourceLocation(namespace.id, (path.isEmpty() ? "" : path + "/") + Lang.asId(name()))); } - + public boolean matches(Fluid fluid) { return fluid != null && fluid.isIn(tag); } - - static void loadClass() { - } + + static void loadClass() {} } public static enum AllBlockTags { - WINDMILL_SAILS, FAN_HEATERS, WINDOWABLE, NON_MOVABLE, BRITTLE, SEATS, SAILS, VALVE_HANDLES, FAN_TRANSPARENT, SAFE_NBT, SLIMY_LOGS(TIC) + WINDMILL_SAILS, + FAN_HEATERS, + WINDOWABLE, + NON_MOVABLE, + BRITTLE, + SEATS, + SAILS, + VALVE_HANDLES, + FAN_TRANSPARENT, + SAFE_NBT, + SLIMY_LOGS(TIC) ; @@ -156,8 +168,10 @@ public class AllTags { } private AllBlockTags(NameSpace namespace, String path) { - ResourceLocation id = new ResourceLocation(namespace.id, (path.isEmpty() ? "" : path + "/") + Lang.asId(name())); - if (ModList.get().isLoaded(namespace.id)) { + ResourceLocation id = + new ResourceLocation(namespace.id, (path.isEmpty() ? "" : path + "/") + Lang.asId(name())); + if (ModList.get() + .isLoaded(namespace.id)) { tag = BlockTags.makeWrapperTag(id.toString()); REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getOrCreateTagBuilder(tag)); } else { @@ -178,9 +192,10 @@ public class AllTags { REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getOrCreateTagBuilder(tag) .addTag(child)); } - - public void add(Block ...values) { - REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getOrCreateTagBuilder(tag).add(values)); + + public void add(Block... values) { + REGISTRATE.addDataGenerator(ProviderType.BLOCK_TAGS, prov -> prov.getOrCreateTagBuilder(tag) + .add(values)); } } @@ -192,7 +207,7 @@ public class AllTags { Items.HONEY_BOTTLE); AllBlockTags.WINDMILL_SAILS.includeAll(BlockTags.WOOL); - + AllBlockTags.BRITTLE.includeAll(BlockTags.DOORS); AllBlockTags.BRITTLE.add(Blocks.FLOWER_POT, Blocks.BELL, Blocks.COCOA); diff --git a/src/main/java/com/simibubi/create/AllTileEntities.java b/src/main/java/com/simibubi/create/AllTileEntities.java index e090e03a3..be2086c82 100644 --- a/src/main/java/com/simibubi/create/AllTileEntities.java +++ b/src/main/java/com/simibubi/create/AllTileEntities.java @@ -49,7 +49,11 @@ import com.simibubi.create.content.contraptions.components.press.PressInstance; import com.simibubi.create.content.contraptions.components.saw.SawInstance; import com.simibubi.create.content.contraptions.components.saw.SawRenderer; import com.simibubi.create.content.contraptions.components.saw.SawTileEntity; -import com.simibubi.create.content.contraptions.components.structureMovement.bearing.*; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.BearingInstance; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.BearingRenderer; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.ClockworkBearingTileEntity; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.MechanicalBearingTileEntity; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.WindmillBearingTileEntity; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.ChassisTileEntity; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.StickerInstance; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.StickerRenderer; @@ -60,7 +64,10 @@ import com.simibubi.create.content.contraptions.components.structureMovement.gan import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerTileEntity; import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonRenderer; import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonTileEntity; -import com.simibubi.create.content.contraptions.components.structureMovement.pulley.*; +import com.simibubi.create.content.contraptions.components.structureMovement.pulley.HosePulleyInstance; +import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyRenderer; +import com.simibubi.create.content.contraptions.components.structureMovement.pulley.PulleyTileEntity; +import com.simibubi.create.content.contraptions.components.structureMovement.pulley.RopePulleyInstance; import com.simibubi.create.content.contraptions.components.turntable.TurntableTileEntity; import com.simibubi.create.content.contraptions.components.waterwheel.WaterWheelTileEntity; import com.simibubi.create.content.contraptions.fluids.PumpCogInstance; @@ -117,7 +124,11 @@ import com.simibubi.create.content.logistics.block.chute.ChuteRenderer; import com.simibubi.create.content.logistics.block.chute.ChuteTileEntity; import com.simibubi.create.content.logistics.block.chute.SmartChuteRenderer; import com.simibubi.create.content.logistics.block.chute.SmartChuteTileEntity; -import com.simibubi.create.content.logistics.block.depot.*; +import com.simibubi.create.content.logistics.block.depot.DepotRenderer; +import com.simibubi.create.content.logistics.block.depot.DepotTileEntity; +import com.simibubi.create.content.logistics.block.depot.EjectorInstance; +import com.simibubi.create.content.logistics.block.depot.EjectorRenderer; +import com.simibubi.create.content.logistics.block.depot.EjectorTileEntity; import com.simibubi.create.content.logistics.block.diodes.AdjustablePulseRepeaterTileEntity; import com.simibubi.create.content.logistics.block.diodes.AdjustableRepeaterInstance; import com.simibubi.create.content.logistics.block.diodes.AdjustableRepeaterRenderer; @@ -244,14 +255,14 @@ public class AllTileEntities { .validBlocks(AllBlocks.CUCKOO_CLOCK, AllBlocks.MYSTERIOUS_CUCKOO_CLOCK) .renderer(() -> CuckooClockRenderer::new) .register(); - + public static final TileEntityEntry GANTRY_SHAFT = Create.registrate() .tileEntity("gantry_shaft", GantryShaftTileEntity::new) .instance(() -> SingleRotatingInstance::new) .validBlocks(AllBlocks.GANTRY_SHAFT) .renderer(() -> KineticTileEntityRenderer::new) .register(); - + public static final TileEntityEntry GANTRY_PINION = Create.registrate() .tileEntity("gantry_pinion", GantryCarriageTileEntity::new) .instance(() -> GantryCarriageInstance::new) @@ -406,7 +417,7 @@ public class AllTileEntities { .validBlocks(AllBlocks.RADIAL_CHASSIS, AllBlocks.LINEAR_CHASSIS, AllBlocks.SECONDARY_LINEAR_CHASSIS) // .renderer(() -> renderer) .register(); - + public static final TileEntityEntry STICKER = Create.registrate() .tileEntity("sticker", StickerTileEntity::new) .instance(() -> StickerInstance::new) diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index 56fe62c32..213768e90 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -2,8 +2,6 @@ package com.simibubi.create; import java.util.Random; -import net.minecraft.world.gen.feature.Feature; -import net.minecraft.world.gen.placement.Placement; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -39,6 +37,8 @@ import net.minecraft.item.crafting.IRecipeSerializer; import net.minecraft.particles.ParticleType; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundEvent; +import net.minecraft.world.gen.feature.Feature; +import net.minecraft.world.gen.placement.Placement; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.world.BiomeLoadingEvent; @@ -120,13 +120,13 @@ public class Create { AllPackets.registerPackets(); AllTriggers.register(); - + event.enqueueWork(() -> { SchematicProcessor.register(); AllWorldFeatures.registerFeatures(); }); } - + public static void onBiomeLoad(BiomeLoadingEvent event) { AllWorldFeatures.reload(event); } diff --git a/src/main/java/com/simibubi/create/CreateClient.java b/src/main/java/com/simibubi/create/CreateClient.java index 9a7038edb..103166ff1 100644 --- a/src/main/java/com/simibubi/create/CreateClient.java +++ b/src/main/java/com/simibubi/create/CreateClient.java @@ -1,5 +1,12 @@ package com.simibubi.create; +import java.util.ArrayList; +import java.util.List; +import java.util.Map; +import java.util.function.Function; + +import javax.annotation.Nullable; + import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher; import com.simibubi.create.content.contraptions.relays.encased.CasingConnectivity; @@ -24,6 +31,7 @@ import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRen import com.simibubi.create.foundation.utility.WorldAttached; import com.simibubi.create.foundation.utility.ghost.GhostBlocks; import com.simibubi.create.foundation.utility.outliner.Outliner; + import net.minecraft.block.Block; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockModelShapes; @@ -50,12 +58,6 @@ import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; -import java.util.Map; -import java.util.function.Function; - public class CreateClient { public static ClientSchematicLoader schematicSender; @@ -100,7 +102,7 @@ public class CreateClient { AllKeys.register(); AllContainerTypes.registerScreenFactories(); - //AllTileEntities.registerRenderers(); + // AllTileEntities.registerRenderers(); AllEntityTypes.registerRenderers(); getColorHandler().init(); AllFluids.assignRenderLayers(); @@ -170,7 +172,7 @@ public class CreateClient { swapModels(modelRegistry, location, factory); }); } - + protected static void swapModels(Map modelRegistry, ModelResourceLocation location, Function factory) { modelRegistry.put(location, factory.apply(modelRegistry.get(location))); @@ -199,7 +201,7 @@ public class CreateClient { colorHandlers = new AllColorHandlers(); return colorHandlers; } - + public static CasingConnectivity getCasingConnectivity() { if (casingConnectivity == null) casingConnectivity = new CasingConnectivity(); @@ -214,7 +216,8 @@ public class CreateClient { bufferCache.invalidate(); if (world != null) { - kineticRenderer.get(world).invalidate(); + kineticRenderer.get(world) + .invalidate(); } else { kineticRenderer.forEach(InstancedTileRenderer::invalidate); } @@ -233,11 +236,14 @@ public class CreateClient { if (AllConfigs.CLIENT.ignoreFabulousWarning.get()) return; - IFormattableTextComponent text = TextComponentUtils.bracketed(new StringTextComponent("WARN")).formatted(TextFormatting.GOLD) - .append(new StringTextComponent(" Some of Create's visual features will not be available while Fabulous graphics are enabled!")) - .styled(style -> style - .withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/create dismissFabulousWarning")) - .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, new StringTextComponent("Click here to disable this warning")))); + IFormattableTextComponent text = TextComponentUtils.bracketed(new StringTextComponent("WARN")) + .formatted(TextFormatting.GOLD) + .append(new StringTextComponent( + " Some of Create's visual features will not be available while Fabulous graphics are enabled!")) + .styled(style -> style + .withClickEvent(new ClickEvent(ClickEvent.Action.RUN_COMMAND, "/create dismissFabulousWarning")) + .withHoverEvent(new HoverEvent(HoverEvent.Action.SHOW_TEXT, + new StringTextComponent("Click here to disable this warning")))); mc.ingameGUI.addChatMessage(ChatType.CHAT, text, mc.player.getUniqueID()); } 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 fd502605e..adbcf7883 100644 --- a/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java +++ b/src/main/java/com/simibubi/create/compat/jei/CreateJEI.java @@ -1,12 +1,39 @@ package com.simibubi.create.compat.jei; +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.function.Supplier; +import java.util.stream.Collectors; + +import javax.annotation.Nonnull; + import com.google.common.base.Predicates; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.AllRecipeTypes; import com.simibubi.create.Create; -import com.simibubi.create.compat.jei.category.*; +import com.simibubi.create.compat.jei.category.BlockCuttingCategory; import com.simibubi.create.compat.jei.category.BlockCuttingCategory.CondensedBlockCuttingRecipe; +import com.simibubi.create.compat.jei.category.BlockzapperUpgradeCategory; +import com.simibubi.create.compat.jei.category.CreateRecipeCategory; +import com.simibubi.create.compat.jei.category.CrushingCategory; +import com.simibubi.create.compat.jei.category.FanBlastingCategory; +import com.simibubi.create.compat.jei.category.FanSmokingCategory; +import com.simibubi.create.compat.jei.category.FanWashingCategory; +import com.simibubi.create.compat.jei.category.ItemDrainCategory; +import com.simibubi.create.compat.jei.category.MechanicalCraftingCategory; +import com.simibubi.create.compat.jei.category.MillingCategory; +import com.simibubi.create.compat.jei.category.MixingCategory; +import com.simibubi.create.compat.jei.category.MysteriousItemConversionCategory; +import com.simibubi.create.compat.jei.category.PackingCategory; +import com.simibubi.create.compat.jei.category.PolishingCategory; +import com.simibubi.create.compat.jei.category.PressingCategory; +import com.simibubi.create.compat.jei.category.ProcessingViaFanCategory; +import com.simibubi.create.compat.jei.category.SawingCategory; +import com.simibubi.create.compat.jei.category.SpoutCategory; import com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity; import com.simibubi.create.content.contraptions.components.saw.SawTileEntity; import com.simibubi.create.content.contraptions.fluids.recipe.PotionMixingRecipeManager; @@ -20,27 +47,27 @@ import com.simibubi.create.content.schematics.block.SchematicannonScreen; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.config.CRecipes; import com.simibubi.create.foundation.config.ConfigBase.ConfigBool; + import mezz.jei.api.IModPlugin; import mezz.jei.api.JeiPlugin; -import mezz.jei.api.registration.*; +import mezz.jei.api.registration.IGuiHandlerRegistration; +import mezz.jei.api.registration.IRecipeCatalystRegistration; +import mezz.jei.api.registration.IRecipeCategoryRegistration; +import mezz.jei.api.registration.IRecipeRegistration; +import mezz.jei.api.registration.ISubtypeRegistration; import mezz.jei.api.runtime.IIngredientManager; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; -import net.minecraft.item.crafting.*; +import net.minecraft.item.crafting.ICraftingRecipe; +import net.minecraft.item.crafting.IRecipe; +import net.minecraft.item.crafting.IRecipeSerializer; +import net.minecraft.item.crafting.IRecipeType; +import net.minecraft.item.crafting.ShapedRecipe; import net.minecraft.util.IItemProvider; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.ModList; -import javax.annotation.Nonnull; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.function.Function; -import java.util.function.Predicate; -import java.util.function.Supplier; -import java.util.stream.Collectors; - @JeiPlugin @SuppressWarnings("unused") public class CreateJEI implements IModPlugin { @@ -119,9 +146,11 @@ public class CreateJEI implements IModPlugin { .build(), woodCutting = register("wood_cutting", () -> new BlockCuttingCategory(Items.OAK_STAIRS)) - .recipeList(() -> CondensedBlockCuttingRecipe.condenseRecipes(findRecipesByType(SawTileEntity.woodcuttingRecipeType.getValue()))) + .recipeList(() -> CondensedBlockCuttingRecipe + .condenseRecipes(findRecipesByType(SawTileEntity.woodcuttingRecipeType.getValue()))) .catalyst(AllBlocks.MECHANICAL_SAW::get) - .enableWhenBool(c -> c.allowWoodcuttingOnSaw.get() && ModList.get().isLoaded("druidcraft")) + .enableWhenBool(c -> c.allowWoodcuttingOnSaw.get() && ModList.get() + .isLoaded("druidcraft")) .build(), packing = register("packing", PackingCategory::standard).recipes(AllRecipeTypes.COMPACTING) diff --git a/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java b/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java index 2771ecc7f..9abd1c945 100644 --- a/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java +++ b/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java @@ -38,7 +38,7 @@ public class DoubleItemIcon implements IDrawable { primaryStack = primarySupplier.get(); secondaryStack = secondarySupplier.get(); } - + RenderHelper.enable(); RenderSystem.color4f(1, 1, 1, 1); RenderSystem.enableDepthTest(); @@ -47,13 +47,15 @@ public class DoubleItemIcon implements IDrawable { matrixStack.push(); matrixStack.translate(1, 1, 0); - GuiGameElement.of(primaryStack).render(matrixStack); + GuiGameElement.of(primaryStack) + .render(matrixStack); matrixStack.pop(); matrixStack.push(); matrixStack.translate(10, 10, 100); matrixStack.scale(.5f, .5f, .5f); - GuiGameElement.of(secondaryStack).render(matrixStack); + GuiGameElement.of(secondaryStack) + .render(matrixStack); matrixStack.pop(); matrixStack.pop(); diff --git a/src/main/java/com/simibubi/create/compat/jei/EmptyBackground.java b/src/main/java/com/simibubi/create/compat/jei/EmptyBackground.java index eeed3d260..f574b23cc 100644 --- a/src/main/java/com/simibubi/create/compat/jei/EmptyBackground.java +++ b/src/main/java/com/simibubi/create/compat/jei/EmptyBackground.java @@ -13,7 +13,7 @@ public class EmptyBackground implements IDrawable { this.width = width; this.height = height; } - + @Override public int getWidth() { return width; @@ -25,7 +25,6 @@ public class EmptyBackground implements IDrawable { } @Override - public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { - } + public void draw(MatrixStack matrixStack, int xOffset, int yOffset) {} } diff --git a/src/main/java/com/simibubi/create/compat/jei/FilterGhostIngredientHandler.java b/src/main/java/com/simibubi/create/compat/jei/FilterGhostIngredientHandler.java index 7b6d085b0..c5ee188cd 100644 --- a/src/main/java/com/simibubi/create/compat/jei/FilterGhostIngredientHandler.java +++ b/src/main/java/com/simibubi/create/compat/jei/FilterGhostIngredientHandler.java @@ -22,7 +22,8 @@ import net.minecraft.nbt.CompoundNBT; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault -public class FilterGhostIngredientHandler implements IGhostIngredientHandler> { +public class FilterGhostIngredientHandler + implements IGhostIngredientHandler> { @Override public List> getTargets(AbstractFilterScreen gui, I ingredient, boolean doStart) { @@ -33,8 +34,9 @@ public class FilterGhostIngredientHandler imp for (int i = 36; i < gui.getContainer().inventorySlots.size(); i++) { targets.add(new FilterGhostTarget<>(gui, i - 36, isAttributeFilter)); - //Only accept items in 1st slot. 2nd is used for functionality, don't wanna override that one - if (isAttributeFilter) break; + // Only accept items in 1st slot. 2nd is used for functionality, don't wanna override that one + if (isAttributeFilter) + break; } } @@ -46,7 +48,7 @@ public class FilterGhostIngredientHandler imp @Override public boolean shouldHighlightTargets() { - //TODO change to false and highlight the slots ourself in some better way + // TODO change to false and highlight the slots ourself in some better way return true; } @@ -57,17 +59,12 @@ public class FilterGhostIngredientHandler imp private final int slotIndex; private final boolean isAttributeFilter; - public FilterGhostTarget(AbstractFilterScreen gui, int slotIndex, boolean isAttributeFilter) { this.gui = gui; this.slotIndex = slotIndex; this.isAttributeFilter = isAttributeFilter; Slot slot = gui.getContainer().inventorySlots.get(slotIndex + 36); - this.area = new Rectangle2d( - gui.getGuiLeft() + slot.xPos, - gui.getGuiTop() + slot.yPos, - 16, - 16); + this.area = new Rectangle2d(gui.getGuiLeft() + slot.xPos, gui.getGuiTop() + slot.yPos, 16, 16); } @Override @@ -78,13 +75,15 @@ public class FilterGhostIngredientHandler imp @Override public void accept(I ingredient) { ItemStack stack = ((ItemStack) ingredient).copy(); - LogManager.getLogger().info(stack); + LogManager.getLogger() + .info(stack); stack.setCount(1); gui.getContainer().filterInventory.setStackInSlot(slotIndex, stack); - if (isAttributeFilter) return; + if (isAttributeFilter) + return; - //sync new filter contents with server + // sync new filter contents with server CompoundNBT data = new CompoundNBT(); data.putInt("Slot", slotIndex); data.put("Item", stack.serializeNBT()); diff --git a/src/main/java/com/simibubi/create/compat/jei/ScreenResourceWrapper.java b/src/main/java/com/simibubi/create/compat/jei/ScreenResourceWrapper.java index 720d2944e..67e7ce970 100644 --- a/src/main/java/com/simibubi/create/compat/jei/ScreenResourceWrapper.java +++ b/src/main/java/com/simibubi/create/compat/jei/ScreenResourceWrapper.java @@ -27,8 +27,8 @@ public class ScreenResourceWrapper implements IDrawable { @Override public void draw(MatrixStack matrixStack, int xOffset, int yOffset) { resource.bind(); - AbstractGui.drawTexture(matrixStack, xOffset, yOffset, 0, resource.startX, resource.startY, resource.width, resource.height, 256, - 256); + AbstractGui.drawTexture(matrixStack, xOffset, yOffset, 0, resource.startX, resource.startY, resource.width, + resource.height, 256, 256); } } diff --git a/src/main/java/com/simibubi/create/compat/jei/SlotMover.java b/src/main/java/com/simibubi/create/compat/jei/SlotMover.java index e6ec1ef42..622114746 100644 --- a/src/main/java/com/simibubi/create/compat/jei/SlotMover.java +++ b/src/main/java/com/simibubi/create/compat/jei/SlotMover.java @@ -1,11 +1,12 @@ package com.simibubi.create.compat.jei; +import java.util.List; + import com.simibubi.create.foundation.gui.AbstractSimiContainerScreen; + import mezz.jei.api.gui.handlers.IGuiContainerHandler; import net.minecraft.client.renderer.Rectangle2d; -import java.util.List; - /** * Allows a {@link AbstractSimiContainerScreen} to specify an area in getExtraArea() that will be avoided by JEI * @@ -13,8 +14,8 @@ import java.util.List; */ public class SlotMover implements IGuiContainerHandler> { - @Override - public List getGuiExtraAreas(AbstractSimiContainerScreen containerScreen) { - return containerScreen.getExtraAreas(); - } + @Override + public List getGuiExtraAreas(AbstractSimiContainerScreen containerScreen) { + return containerScreen.getExtraAreas(); + } } diff --git a/src/main/java/com/simibubi/create/compat/jei/category/BlockCuttingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/BlockCuttingCategory.java index 3f701ef8f..f1e1817f9 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/BlockCuttingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/BlockCuttingCategory.java @@ -1,11 +1,16 @@ package com.simibubi.create.compat.jei.category; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlocks; import com.simibubi.create.compat.jei.category.BlockCuttingCategory.CondensedBlockCuttingRecipe; import com.simibubi.create.compat.jei.category.animations.AnimatedSaw; import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.item.ItemHelper; + import mezz.jei.api.constants.VanillaTypes; import mezz.jei.api.gui.IRecipeLayout; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; @@ -17,10 +22,6 @@ import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.StonecuttingRecipe; import net.minecraft.util.ResourceLocation; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - public class BlockCuttingCategory extends CreateRecipeCategory { private AnimatedSaw saw = new AnimatedSaw(); diff --git a/src/main/java/com/simibubi/create/compat/jei/category/CreateRecipeCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/CreateRecipeCategory.java index 689eaf6b9..84543da40 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/CreateRecipeCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/CreateRecipeCategory.java @@ -1,5 +1,10 @@ package com.simibubi.create.compat.jei.category; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Supplier; +import java.util.stream.Collectors; + import com.simibubi.create.AllFluids; import com.simibubi.create.Create; import com.simibubi.create.compat.jei.DoubleItemIcon; @@ -10,6 +15,7 @@ import com.simibubi.create.content.contraptions.processing.ProcessingRecipe; import com.simibubi.create.foundation.fluid.FluidIngredient; import com.simibubi.create.foundation.gui.AllGuiTextures; import com.simibubi.create.foundation.utility.Lang; + import mezz.jei.api.gui.drawable.IDrawable; import mezz.jei.api.gui.ingredient.IGuiFluidStackGroup; import mezz.jei.api.gui.ingredient.IGuiItemStackGroup; @@ -23,11 +29,6 @@ import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.FluidStack; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Supplier; -import java.util.stream.Collectors; - public abstract class CreateRecipeCategory> implements IRecipeCategory { public List> recipeCatalysts = new ArrayList<>(); diff --git a/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java b/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java index bc5df13fb..86febc77d 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/MechanicalCraftingCategory.java @@ -26,7 +26,6 @@ import net.minecraft.item.crafting.ICraftingRecipe; import net.minecraft.item.crafting.Ingredient; import net.minecraft.item.crafting.ShapedRecipe; import net.minecraft.util.NonNullList; -import net.minecraft.util.math.vector.Quaternion; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; import net.minecraft.util.text.TranslationTextComponent; diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedItemDrain.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedItemDrain.java index 301874aed..41bed07e1 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedItemDrain.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedItemDrain.java @@ -1,7 +1,6 @@ package com.simibubi.create.compat.jei.category.animations; import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.fluid.FluidRenderer; import com.simibubi.create.foundation.gui.GuiGameElement; diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedKinetics.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedKinetics.java index 77b8aa0c7..ef9e662ce 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedKinetics.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedKinetics.java @@ -3,6 +3,7 @@ package com.simibubi.create.compat.jei.category.animations; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import mezz.jei.api.gui.drawable.IDrawable; import net.minecraft.block.BlockState; import net.minecraft.state.properties.BlockStateProperties; diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMixer.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMixer.java index 32522a5ae..5359d7b76 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMixer.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedMixer.java @@ -5,6 +5,7 @@ import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3f; diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedPress.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedPress.java index 345c1d249..a7e1d262a 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedPress.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedPress.java @@ -5,6 +5,7 @@ import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.vector.Vector3f; diff --git a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedSpout.java b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedSpout.java index 744ba4cdb..40f23c032 100644 --- a/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedSpout.java +++ b/src/main/java/com/simibubi/create/compat/jei/category/animations/AnimatedSpout.java @@ -1,11 +1,14 @@ package com.simibubi.create.compat.jei.category.animations; +import java.util.List; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.fluid.FluidRenderer; import com.simibubi.create.foundation.gui.GuiGameElement; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.IRenderTypeBuffer.Impl; import net.minecraft.client.renderer.Tessellator; @@ -13,8 +16,6 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3f; import net.minecraftforge.fluids.FluidStack; -import java.util.List; - public class AnimatedSpout extends AnimatedKinetics { private List fluids; diff --git a/src/main/java/com/simibubi/create/content/AllSections.java b/src/main/java/com/simibubi/create/content/AllSections.java index 1dc2dfde0..81569f408 100644 --- a/src/main/java/com/simibubi/create/content/AllSections.java +++ b/src/main/java/com/simibubi/create/content/AllSections.java @@ -24,7 +24,7 @@ public enum AllSections { /** Base materials, ingredients and tools */ MATERIALS(Palette.Green), - + /** Helpful gadgets and other shenanigans */ CURIOSITIES(Palette.Purple), diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/BackHalfShaftInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/BackHalfShaftInstance.java index 185815e03..738155141 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/BackHalfShaftInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/BackHalfShaftInstance.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.contraptions.base; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; + import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/HalfShaftInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/HalfShaftInstance.java index 2876a466b..4b834f520 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/HalfShaftInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/HalfShaftInstance.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.base; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; + import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/HorizontalHalfShaftInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/HorizontalHalfShaftInstance.java index 3e80e8afb..d5a21d468 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/HorizontalHalfShaftInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/HorizontalHalfShaftInstance.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.contraptions.base; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; + import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticData.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticData.java index 69792da01..b259c89aa 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticData.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticData.java @@ -1,13 +1,14 @@ package com.simibubi.create.content.contraptions.base; -import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; +import java.nio.ByteBuffer; + import com.simibubi.create.foundation.render.backend.core.BasicData; +import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.utility.ColorHelper; + import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3f; -import java.nio.ByteBuffer; - public class KineticData extends BasicData { private float x; private float y; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticRenderMaterials.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticRenderMaterials.java index 4efbb13c5..29ee62162 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticRenderMaterials.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticRenderMaterials.java @@ -3,8 +3,8 @@ package com.simibubi.create.content.contraptions.base; import com.simibubi.create.content.contraptions.components.actors.ActorData; import com.simibubi.create.content.contraptions.relays.belt.BeltData; import com.simibubi.create.content.logistics.block.FlapData; -import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.MaterialType; +import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; public class KineticRenderMaterials { public static final MaterialType> ROTATING = new MaterialType<>(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java index fc2568ffb..d91befd6a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntity.java @@ -1,5 +1,12 @@ package com.simibubi.create.content.contraptions.base; +import static net.minecraft.util.text.TextFormatting.GOLD; +import static net.minecraft.util.text.TextFormatting.GRAY; + +import java.util.List; + +import javax.annotation.Nullable; + import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.KineticNetwork; import com.simibubi.create.content.contraptions.RotationPropagator; @@ -15,6 +22,7 @@ import com.simibubi.create.foundation.render.backend.instancing.IInstanceRendere import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.utility.Lang; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.client.resources.I18n; @@ -35,12 +43,6 @@ import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import javax.annotation.Nullable; -import java.util.List; - -import static net.minecraft.util.text.TextFormatting.GOLD; -import static net.minecraft.util.text.TextFormatting.GRAY; - public abstract class KineticTileEntity extends SmartTileEntity implements ITickableTileEntity, IHaveGoggleInformation, IHaveHoveringInformation, IInstanceRendered { diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java index eb4280ed7..dcefcadfe 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileEntityRenderer.java @@ -5,7 +5,6 @@ import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlocks; import com.simibubi.create.CreateClient; import com.simibubi.create.content.contraptions.KineticDebugger; -import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.foundation.render.Compartment; import com.simibubi.create.foundation.render.SuperByteBuffer; @@ -13,6 +12,7 @@ import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ColorHelper; + import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java index 5a8d1e3a2..f5d6d902e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/KineticTileInstance.java @@ -1,10 +1,13 @@ package com.simibubi.create.content.contraptions.base; import com.simibubi.create.AllBlocks; -import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock; -import com.simibubi.create.foundation.render.backend.instancing.*; +import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; +import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; +import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial; +import com.simibubi.create.foundation.render.backend.instancing.TileEntityInstance; + import net.minecraft.block.BlockState; import net.minecraft.util.Direction; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/RotatingModel.java b/src/main/java/com/simibubi/create/content/contraptions/base/RotatingModel.java index ec3becb67..81582c35b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/RotatingModel.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/RotatingModel.java @@ -1,9 +1,9 @@ package com.simibubi.create.content.contraptions.base; +import com.simibubi.create.foundation.render.backend.core.BasicAttributes; import com.simibubi.create.foundation.render.backend.gl.attrib.VertexFormat; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; -import com.simibubi.create.foundation.render.backend.core.BasicAttributes; import net.minecraft.client.renderer.BufferBuilder; diff --git a/src/main/java/com/simibubi/create/content/contraptions/base/SingleRotatingInstance.java b/src/main/java/com/simibubi/create/content/contraptions/base/SingleRotatingInstance.java index f802d006a..1749e308f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/base/SingleRotatingInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/base/SingleRotatingInstance.java @@ -2,9 +2,8 @@ package com.simibubi.create.content.contraptions.base; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; -import net.minecraft.block.BlockState; -import static com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer.KINETIC_TILE; +import net.minecraft.block.BlockState; public class SingleRotatingInstance extends KineticTileInstance { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/ActorData.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/ActorData.java index 1b401901c..191e3ebc0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/ActorData.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/ActorData.java @@ -1,13 +1,14 @@ package com.simibubi.create.content.contraptions.components.actors; +import java.nio.ByteBuffer; + import com.simibubi.create.foundation.render.backend.instancing.InstanceData; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; + import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Quaternion; import net.minecraft.util.math.vector.Vector3f; -import java.nio.ByteBuffer; - public class ActorData extends InstanceData { private float x; private float y; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillActorInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillActorInstance.java index 79c19821c..40df1e591 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillActorInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillActorInstance.java @@ -8,6 +8,7 @@ import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.util.Direction; import net.minecraft.util.math.vector.Quaternion; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillInstance.java index 5250673d9..ad6b2ce47 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillInstance.java @@ -1,16 +1,15 @@ package com.simibubi.create.content.contraptions.components.actors; -import net.minecraft.block.BlockState; +import static net.minecraft.state.properties.BlockStateProperties.FACING; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.RotatingData; import com.simibubi.create.content.contraptions.base.SingleRotatingInstance; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; -import static net.minecraft.state.properties.BlockStateProperties.FACING; +import net.minecraft.block.BlockState; public class DrillInstance extends SingleRotatingInstance { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java index ef83ad596..8232772f3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillMovementBehaviour.java @@ -8,6 +8,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.ren import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.util.DamageSource; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillRenderer.java index 1cf206097..38f940dab 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/DrillRenderer.java @@ -10,6 +10,7 @@ import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterActorInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterActorInstance.java index 769e57285..83f516058 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterActorInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterActorInstance.java @@ -1,23 +1,24 @@ package com.simibubi.create.content.contraptions.components.actors; +import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer; +import com.simibubi.create.foundation.render.backend.core.ModelData; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial; -import com.simibubi.create.foundation.render.backend.core.ModelData; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.util.Direction; import net.minecraft.util.math.vector.Vector3d; -import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING; - public class HarvesterActorInstance extends ActorInstance { static double oneOverRadius = 16.0 / 6.5; static float originOffset = 1 / 16f; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java index 5b6dc8e51..6472d23d4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterMovementBehaviour.java @@ -1,5 +1,11 @@ package com.simibubi.create.content.contraptions.components.actors; +import static net.minecraft.block.HorizontalBlock.HORIZONTAL_FACING; + +import javax.annotation.Nullable; + +import org.apache.commons.lang3.mutable.MutableBoolean; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; @@ -8,7 +14,14 @@ import com.simibubi.create.content.contraptions.components.structureMovement.ren import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.VecHelper; -import net.minecraft.block.*; + +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.CocoaBlock; +import net.minecraft.block.CropsBlock; +import net.minecraft.block.KelpBlock; +import net.minecraft.block.KelpTopBlock; +import net.minecraft.block.SugarCaneBlock; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.item.ItemStack; import net.minecraft.state.IntegerProperty; @@ -18,11 +31,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.common.IPlantable; -import org.apache.commons.lang3.mutable.MutableBoolean; - -import javax.annotation.Nullable; - -import static net.minecraft.block.HorizontalBlock.HORIZONTAL_FACING; public class HarvesterMovementBehaviour extends MovementBehaviour { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterRenderer.java index 08b963561..5b50202e3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterRenderer.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.contraptions.components.actors; +import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; @@ -9,6 +11,7 @@ import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; @@ -18,8 +21,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; -import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING; - public class HarvesterRenderer extends SafeTileEntityRenderer { public HarvesterRenderer(TileEntityRendererDispatcher dispatcher) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterTileEntity.java index 629a3294a..0bda273c1 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/HarvesterTileEntity.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.contraptions.components.actors; import com.simibubi.create.foundation.tileEntity.SyncedTileEntity; + import net.minecraft.tileentity.TileEntityType; public class HarvesterTileEntity extends SyncedTileEntity { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PloughMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PloughMovementBehaviour.java index 7b4ee3227..98e628ab0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PloughMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PloughMovementBehaviour.java @@ -1,8 +1,11 @@ package com.simibubi.create.content.contraptions.components.actors; +import static net.minecraft.block.HorizontalBlock.HORIZONTAL_FACING; + import com.simibubi.create.content.contraptions.components.actors.PloughBlock.PloughFakePlayer; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.FarmlandBlock; @@ -23,8 +26,6 @@ import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; -import static net.minecraft.block.HorizontalBlock.HORIZONTAL_FACING; - public class PloughMovementBehaviour extends BlockBreakingMovementBehaviour { @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceTileEntity.java index c5d14099f..30bb7d191 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/PortableStorageInterfaceTileEntity.java @@ -1,10 +1,13 @@ package com.simibubi.create.content.contraptions.components.actors; +import java.util.List; + import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.utility.animation.LerpedFloat; + import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; import net.minecraft.nbt.CompoundNBT; @@ -14,8 +17,6 @@ import net.minecraft.util.math.MathHelper; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import java.util.List; - public abstract class PortableStorageInterfaceTileEntity extends SmartTileEntity { protected int transferTimer; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java index 8da527cd2..b5dea8fcd 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/SeatEntity.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.contraptions.components.actors; import com.simibubi.create.AllEntityTypes; + import net.minecraft.client.renderer.culling.ClippingHelper; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/ContraptionBlockSource.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/ContraptionBlockSource.java index 6414e8f0c..57bfc9449 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/ContraptionBlockSource.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/ContraptionBlockSource.java @@ -3,7 +3,6 @@ package com.simibubi.create.content.contraptions.components.actors.dispenser; import javax.annotation.Nullable; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; -import com.simibubi.create.foundation.utility.BlockHelper; import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.BlockState; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/ConnectedInputHandler.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/ConnectedInputHandler.java index 2fb5edc3d..db6b86bfd 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/ConnectedInputHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/ConnectedInputHandler.java @@ -14,7 +14,6 @@ import java.util.function.Consumer; import java.util.stream.Collectors; import com.simibubi.create.AllBlocks; -import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Iterate; import net.minecraft.block.BlockState; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java index 6bb2d2d90..05c41789d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterBlock.java @@ -15,6 +15,7 @@ import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Pointing; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; @@ -33,7 +34,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorldReader; import net.minecraft.world.World; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.CapabilityItemHandler; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterInstance.java index 285930550..2d88b431c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCrafterInstance.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.contraptions.components.crafter; +import java.util.function.Supplier; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -8,9 +10,8 @@ import com.simibubi.create.content.contraptions.base.SingleRotatingInstance; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; import com.simibubi.create.foundation.utility.MatrixStacker; -import net.minecraft.util.Direction; -import java.util.function.Supplier; +import net.minecraft.util.Direction; public class MechanicalCrafterInstance extends SingleRotatingInstance { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCraftingRecipe.java b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCraftingRecipe.java index e7848ca4b..a44acfa42 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCraftingRecipe.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crafter/MechanicalCraftingRecipe.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.components.crafter; import com.google.gson.JsonObject; import com.simibubi.create.AllRecipeTypes; + import net.minecraft.inventory.CraftingInventory; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipeSerializer; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankBlock.java index 9cd4a201c..511be5565 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankBlock.java @@ -6,6 +6,7 @@ import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.config.AllConfigs; + import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankRenderer.java index 7ae91fe8f..11442df9e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crank/HandCrankRenderer.java @@ -1,11 +1,14 @@ package com.simibubi.create.content.contraptions.components.crank; +import static net.minecraft.state.properties.BlockStateProperties.FACING; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -13,8 +16,6 @@ import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.Direction; -import static net.minecraft.state.properties.BlockStateProperties.FACING; - public class HandCrankRenderer extends KineticTileEntityRenderer { public HandCrankRenderer(TileEntityRendererDispatcher dispatcher) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelBlock.java index 49d81264c..127ed6923 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelBlock.java @@ -1,7 +1,7 @@ package com.simibubi.create.content.contraptions.components.crusher; import static com.simibubi.create.content.contraptions.components.crusher.CrushingWheelControllerBlock.VALID; -import static com.simibubi.create.content.contraptions.components.crusher.CrushingWheelControllerBlock.FACING; +import static net.minecraft.block.DirectionalBlock.FACING; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java index 459c1e91f..e8562843c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelControllerTileEntity.java @@ -1,5 +1,13 @@ package com.simibubi.create.content.contraptions.components.crusher; +import static net.minecraft.block.DirectionalBlock.FACING; + +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.Random; +import java.util.UUID; + import com.simibubi.create.AllRecipeTypes; import com.simibubi.create.content.contraptions.processing.ProcessingInventory; import com.simibubi.create.content.contraptions.processing.ProcessingRecipe; @@ -10,6 +18,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour; import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; @@ -35,10 +44,6 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.wrapper.RecipeWrapper; -import java.util.*; - -import static com.simibubi.create.content.contraptions.components.crusher.CrushingWheelControllerBlock.FACING; - public class CrushingWheelControllerTileEntity extends SmartTileEntity { public Entity processingEntity; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelTileEntity.java index 6049c8299..ea210238d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/crusher/CrushingWheelTileEntity.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.components.crusher; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.entity.item.ItemEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.DamageSource; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerActorInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerActorInstance.java index 8c4f82948..a62bf37d8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerActorInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerActorInstance.java @@ -1,25 +1,33 @@ package com.simibubi.create.content.contraptions.components.deployer; +import static com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE; +import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.content.contraptions.base.*; +import com.simibubi.create.content.contraptions.base.IRotate; +import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; +import com.simibubi.create.content.contraptions.base.KineticTileInstance; +import com.simibubi.create.content.contraptions.base.RotatingData; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionProgram; +import com.simibubi.create.foundation.render.backend.core.ModelData; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial; -import com.simibubi.create.foundation.render.backend.core.ModelData; -import com.simibubi.create.foundation.utility.*; +import com.simibubi.create.foundation.utility.AngleHelper; +import com.simibubi.create.foundation.utility.AnimationTickHolder; +import com.simibubi.create.foundation.utility.MatrixStacker; +import com.simibubi.create.foundation.utility.NBTHelper; +import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3d; -import static com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE; -import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING; - public class DeployerActorInstance extends ActorInstance { Direction facing; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerInstance.java index 18342b131..3ffd3339b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerInstance.java @@ -1,12 +1,15 @@ package com.simibubi.create.content.contraptions.components.deployer; +import static com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE; +import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING; + import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; +import com.simibubi.create.foundation.render.backend.core.OrientedData; +import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; import com.simibubi.create.foundation.render.backend.instancing.ITickableInstance; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; -import com.simibubi.create.foundation.render.backend.instancing.*; -import com.simibubi.create.foundation.render.backend.core.OrientedData; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; @@ -16,9 +19,6 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Quaternion; import net.minecraft.util.math.vector.Vector3i; -import static com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE; -import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING; - public class DeployerInstance extends ShaftInstance implements IDynamicInstance, ITickableInstance { final DeployerTileEntity tile; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java index ead744dab..209144e81 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerMovementBehaviour.java @@ -22,10 +22,10 @@ import com.simibubi.create.content.schematics.ItemRequirement; import com.simibubi.create.content.schematics.SchematicWorld; import com.simibubi.create.content.schematics.filtering.SchematicInstances; import com.simibubi.create.foundation.item.ItemHelper; -import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; -import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.item.ItemHelper.ExtractionCountMode; +import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.utility.BlockHelper; +import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.NBTProcessors; import net.minecraft.block.BlockState; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerRenderer.java index b2c540244..d9dd683c6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerRenderer.java @@ -1,5 +1,8 @@ package com.simibubi.create.content.contraptions.components.deployer; +import static com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE; +import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING; + import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -16,6 +19,7 @@ import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -34,9 +38,6 @@ import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3f; import net.minecraft.world.World; -import static com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock.AXIS_ALONG_FIRST_COORDINATE; -import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING; - public class DeployerRenderer extends SafeTileEntityRenderer { public DeployerRenderer(TileEntityRendererDispatcher dispatcher) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java index bfa759a3a..8705330ba 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/deployer/DeployerTileEntity.java @@ -1,5 +1,10 @@ package com.simibubi.create.content.contraptions.components.deployer; +import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING; + +import java.util.ArrayList; +import java.util.List; + import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -11,6 +16,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBe import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.animation.LerpedFloat; + import net.minecraft.block.BlockState; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.item.ItemStack; @@ -20,7 +26,11 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.Hand; -import net.minecraft.util.math.*; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceContext; import net.minecraft.util.math.RayTraceContext.BlockMode; import net.minecraft.util.math.RayTraceContext.FluidMode; import net.minecraft.util.math.vector.Vector3d; @@ -31,11 +41,6 @@ import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.IItemHandlerModifiable; -import java.util.ArrayList; -import java.util.List; - -import static com.simibubi.create.content.contraptions.base.DirectionalKineticBlock.FACING; - public class DeployerTileEntity extends KineticTileEntity { protected State state; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanRenderer.java index dcb5652e5..cb469d615 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanRenderer.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.contraptions.components.fan; +import static net.minecraft.state.properties.BlockStateProperties.FACING; + import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -8,6 +10,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.WorldRenderer; @@ -15,8 +18,6 @@ import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.Direction; import net.minecraft.util.math.MathHelper; -import static net.minecraft.state.properties.BlockStateProperties.FACING; - public class EncasedFanRenderer extends KineticTileEntityRenderer { public EncasedFanRenderer(TileEntityRendererDispatcher dispatcher) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java index f2c1c6e36..a5968c862 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/EncasedFanTileEntity.java @@ -1,11 +1,14 @@ package com.simibubi.create.content.contraptions.components.fan; +import javax.annotation.Nullable; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllTags.AllBlockTags; import com.simibubi.create.content.contraptions.base.GeneratingKineticTileEntity; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock; import com.simibubi.create.content.logistics.block.chute.ChuteTileEntity; import com.simibubi.create.foundation.config.AllConfigs; + import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; @@ -16,8 +19,6 @@ import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import javax.annotation.Nullable; - @MethodsReturnNonnullByDefault public class EncasedFanTileEntity extends GeneratingKineticTileEntity implements IAirCurrentSource { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/fan/FanInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/fan/FanInstance.java index 57048adfa..05e921f0a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/fan/FanInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/fan/FanInstance.java @@ -1,16 +1,16 @@ package com.simibubi.create.content.contraptions.components.fan; +import static net.minecraft.state.properties.BlockStateProperties.FACING; + import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; import com.simibubi.create.content.contraptions.base.KineticTileInstance; import com.simibubi.create.content.contraptions.base.RotatingData; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; + import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import static net.minecraft.state.properties.BlockStateProperties.FACING; - public class FanInstance extends KineticTileInstance { protected final RotatingData shaft; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlyWheelInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlyWheelInstance.java index d6cce85bc..d01c2633f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlyWheelInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlyWheelInstance.java @@ -1,29 +1,30 @@ package com.simibubi.create.content.contraptions.components.flywheel; +import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING; + import java.util.Collections; import java.util.List; import com.google.common.collect.Lists; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; import com.simibubi.create.content.contraptions.base.KineticTileInstance; import com.simibubi.create.content.contraptions.base.RotatingData; -import com.simibubi.create.foundation.render.backend.MaterialTypes; -import com.simibubi.create.foundation.render.backend.instancing.*; import com.simibubi.create.foundation.render.backend.core.ModelData; +import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; +import com.simibubi.create.foundation.render.backend.instancing.InstanceData; +import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; +import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; +import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.MatrixStacker; import net.minecraft.block.BlockState; -import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.Rotation; import net.minecraft.util.math.MathHelper; -import static net.minecraft.state.properties.BlockStateProperties.HORIZONTAL_FACING; - public class FlyWheelInstance extends KineticTileInstance implements IDynamicInstance { protected final Direction facing; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelBlock.java index 8a4f9255d..607dcdd19 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelBlock.java @@ -1,5 +1,12 @@ package com.simibubi.create.content.contraptions.components.flywheel; +import com.simibubi.create.AllTileEntities; +import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock; +import com.simibubi.create.content.contraptions.components.flywheel.engine.EngineTileEntity; +import com.simibubi.create.content.contraptions.components.flywheel.engine.FurnaceEngineBlock; +import com.simibubi.create.foundation.advancement.AllTriggers; +import com.simibubi.create.foundation.utility.Lang; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.item.BlockItemUseContext; @@ -16,13 +23,6 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -import com.simibubi.create.AllTileEntities; -import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock; -import com.simibubi.create.content.contraptions.components.flywheel.engine.EngineTileEntity; -import com.simibubi.create.content.contraptions.components.flywheel.engine.FurnaceEngineBlock; -import com.simibubi.create.foundation.advancement.AllTriggers; -import com.simibubi.create.foundation.utility.Lang; - public class FlywheelBlock extends HorizontalKineticBlock { public static EnumProperty CONNECTION = EnumProperty.create("connection", ConnectionState.class); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelRenderer.java index ad0c22af8..03434b9e9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelRenderer.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.contraptions.components.flywheel; +import static com.simibubi.create.content.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING; + import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -9,6 +11,7 @@ import com.simibubi.create.content.contraptions.components.flywheel.FlywheelBloc import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.utility.AngleHelper; + import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; @@ -20,8 +23,6 @@ import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.Rotation; import net.minecraft.util.math.MathHelper; -import static com.simibubi.create.content.contraptions.base.HorizontalKineticBlock.HORIZONTAL_FACING; - public class FlywheelRenderer extends KineticTileEntityRenderer { public FlywheelRenderer(TileEntityRendererDispatcher dispatcher) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelTileEntity.java index 54720d28e..48c14a9e7 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/FlywheelTileEntity.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.components.flywheel; import com.simibubi.create.content.contraptions.base.GeneratingKineticTileEntity; import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue; + import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntityType; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineInstance.java index 43f63e5e1..a88cbbd1a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineInstance.java @@ -2,11 +2,12 @@ package com.simibubi.create.content.contraptions.components.flywheel.engine; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; +import com.simibubi.create.foundation.render.backend.core.ModelData; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; import com.simibubi.create.foundation.render.backend.instancing.TileEntityInstance; -import com.simibubi.create.foundation.render.backend.core.ModelData; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.MatrixStacker; + import net.minecraft.block.Block; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineRenderer.java index 42cc92dfd..597895c48 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineRenderer.java @@ -5,6 +5,7 @@ import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.AngleHelper; + import net.minecraft.block.Block; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java index da6848b74..6887efaf4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/EngineTileEntity.java @@ -1,11 +1,14 @@ package com.simibubi.create.content.contraptions.components.flywheel.engine; +import java.util.List; + import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.components.flywheel.FlywheelBlock; import com.simibubi.create.content.contraptions.components.flywheel.FlywheelTileEntity; import com.simibubi.create.foundation.render.backend.instancing.IInstanceRendered; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; + import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; @@ -15,8 +18,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import java.util.List; - public class EngineTileEntity extends SmartTileEntity implements IInstanceRendered { public float appliedCapacity; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java index c7afb4c97..947e03081 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/flywheel/engine/FurnaceEngineTileEntity.java @@ -2,7 +2,6 @@ package com.simibubi.create.content.contraptions.components.flywheel.engine; import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.config.AllConfigs; -import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.block.AbstractFurnaceBlock; import net.minecraft.block.BlockState; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillStoneCogInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillStoneCogInstance.java index 9e5f5c390..e2f931eba 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillStoneCogInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/millstone/MillStoneCogInstance.java @@ -1,7 +1,6 @@ package com.simibubi.create.content.contraptions.components.millstone; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.RotatingData; import com.simibubi.create.content.contraptions.base.SingleRotatingInstance; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerRenderer.java index 8b2f873f1..41635cb02 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MechanicalMixerRenderer.java @@ -8,6 +8,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java index 5929e3d7c..2df6346ab 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/mixer/MixerInstance.java @@ -3,8 +3,9 @@ package com.simibubi.create.content.contraptions.components.mixer; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.RotatingData; import com.simibubi.create.content.contraptions.base.ShaftlessCogInstance; -import com.simibubi.create.foundation.render.backend.instancing.*; import com.simibubi.create.foundation.render.backend.core.OrientedData; +import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; +import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.util.Direction; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/press/BeltPressingCallbacks.java b/src/main/java/com/simibubi/create/content/contraptions/components/press/BeltPressingCallbacks.java index 1a0ac5a85..56ef63878 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/press/BeltPressingCallbacks.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/press/BeltPressingCallbacks.java @@ -1,17 +1,18 @@ package com.simibubi.create.content.contraptions.components.press; +import static com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult.HOLD; +import static com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult.PASS; + import java.util.List; import java.util.Optional; import java.util.stream.Collectors; + import com.simibubi.create.content.contraptions.components.press.MechanicalPressTileEntity.Mode; import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack; import com.simibubi.create.content.logistics.InWorldProcessing; import com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult; import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour; -import static com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult.HOLD; -import static com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult.PASS; - public class BeltPressingCallbacks { static ProcessingResult onItemReceived(TransportedItemStack transported, diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressRenderer.java index 7c9d45699..e2aa898ad 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/press/MechanicalPressRenderer.java @@ -6,6 +6,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; + import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java index 4b1d88c19..8dc92b64f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/press/PressInstance.java @@ -2,11 +2,12 @@ package com.simibubi.create.content.contraptions.components.press; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; +import com.simibubi.create.foundation.render.backend.core.OrientedData; import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; -import com.simibubi.create.foundation.render.backend.core.OrientedData; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.util.math.vector.Quaternion; import net.minecraft.util.math.vector.Vector3f; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java index 8f82fb1d9..f7eca3cc1 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/saw/SawTileEntity.java @@ -1,6 +1,9 @@ package com.simibubi.create.content.contraptions.components.saw; -import java.util.*; +import java.util.ArrayList; +import java.util.LinkedList; +import java.util.List; +import java.util.Random; import java.util.function.Predicate; import java.util.stream.Collectors; @@ -19,8 +22,17 @@ import com.simibubi.create.foundation.utility.TreeCutter; import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.recipe.RecipeConditions; import com.simibubi.create.foundation.utility.recipe.RecipeFinder; + import mcp.MethodsReturnNonnullByDefault; -import net.minecraft.block.*; +import net.minecraft.block.BambooBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.CactusBlock; +import net.minecraft.block.ChorusPlantBlock; +import net.minecraft.block.KelpBlock; +import net.minecraft.block.KelpTopBlock; +import net.minecraft.block.StemGrownBlock; +import net.minecraft.block.SugarCaneBlock; import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java index e61fb0046..b04160388 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AbstractContraptionEntity.java @@ -1,5 +1,15 @@ package com.simibubi.create.content.contraptions.components.structureMovement; +import java.util.IdentityHashMap; +import java.util.Iterator; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.UUID; + +import org.apache.commons.lang3.mutable.MutableInt; +import org.apache.commons.lang3.tuple.MutablePair; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllMovementBehaviours; import com.simibubi.create.content.contraptions.components.actors.SeatEntity; @@ -10,6 +20,7 @@ import com.simibubi.create.foundation.collision.Matrix3d; import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.material.PushReaction; import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; @@ -37,11 +48,6 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; import net.minecraftforge.fml.network.NetworkHooks; import net.minecraftforge.fml.network.PacketDistributor; -import org.apache.commons.lang3.mutable.MutableInt; -import org.apache.commons.lang3.tuple.MutablePair; - -import java.util.*; -import java.util.Map.Entry; public abstract class AbstractContraptionEntity extends Entity implements IEntityAdditionalSpawnData { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AssemblyException.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AssemblyException.java index 5fee880eb..51eb14340 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AssemblyException.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/AssemblyException.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement; import com.simibubi.create.foundation.config.AllConfigs; + import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java index 7af8f2468..3b1af157c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/BlockMovementTraits.java @@ -8,7 +8,11 @@ import com.simibubi.create.content.contraptions.components.actors.PortableStorag import com.simibubi.create.content.contraptions.components.crank.HandCrankBlock; import com.simibubi.create.content.contraptions.components.fan.NozzleBlock; import com.simibubi.create.content.contraptions.components.flywheel.engine.EngineBlock; -import com.simibubi.create.content.contraptions.components.structureMovement.bearing.*; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.ClockworkBearingBlock; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.ClockworkBearingTileEntity; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.MechanicalBearingBlock; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.MechanicalBearingTileEntity; +import com.simibubi.create.content.contraptions.components.structureMovement.bearing.SailBlock; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.AbstractChassisBlock; import com.simibubi.create.content.contraptions.components.structureMovement.chassis.StickerBlock; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerBlock; @@ -19,8 +23,25 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pul import com.simibubi.create.content.contraptions.fluids.tank.FluidTankBlock; import com.simibubi.create.content.contraptions.fluids.tank.FluidTankConnectivityHandler; import com.simibubi.create.content.logistics.block.redstone.RedstoneLinkBlock; -import com.simibubi.create.foundation.utility.BlockHelper; -import net.minecraft.block.*; + +import net.minecraft.block.AbstractPressurePlateBlock; +import net.minecraft.block.AbstractRailBlock; +import net.minecraft.block.BellBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.CarpetBlock; +import net.minecraft.block.DoorBlock; +import net.minecraft.block.FenceGateBlock; +import net.minecraft.block.FlowerPotBlock; +import net.minecraft.block.GrindstoneBlock; +import net.minecraft.block.HorizontalBlock; +import net.minecraft.block.HorizontalFaceBlock; +import net.minecraft.block.LadderBlock; +import net.minecraft.block.RedstoneDiodeBlock; +import net.minecraft.block.RedstoneWallTorchBlock; +import net.minecraft.block.RedstoneWireBlock; +import net.minecraft.block.TorchBlock; +import net.minecraft.block.WallTorchBlock; import net.minecraft.block.material.PushReaction; import net.minecraft.state.properties.AttachFace; import net.minecraft.state.properties.BellAttachment; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionEntityRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionEntityRenderer.java index d0dffbe9b..271319b91 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionEntityRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionEntityRenderer.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.culling.ClippingHelper; import net.minecraft.client.renderer.entity.EntityRenderer; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionLighter.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionLighter.java index 402381d3c..641c3a90c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionLighter.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionLighter.java @@ -1,14 +1,14 @@ package com.simibubi.create.content.contraptions.components.structureMovement; -import net.minecraft.world.IBlockDisplayReader; -import net.minecraft.world.LightType; - import com.simibubi.create.content.contraptions.components.structureMovement.render.RenderedContraption; import com.simibubi.create.foundation.render.backend.light.GridAlignedBB; import com.simibubi.create.foundation.render.backend.light.LightUpdateListener; import com.simibubi.create.foundation.render.backend.light.LightUpdater; import com.simibubi.create.foundation.render.backend.light.LightVolume; +import net.minecraft.world.IBlockDisplayReader; +import net.minecraft.world.LightType; + public abstract class ContraptionLighter implements LightUpdateListener { protected final C contraption; public final LightVolume lightVolume; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionWorld.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionWorld.java index 4a83b2b96..bff9499dd 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionWorld.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ContraptionWorld.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement; import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; + import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.entity.player.PlayerEntity; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/IDisplayAssemblyExceptions.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/IDisplayAssemblyExceptions.java index dc0f9c5bd..2bbd13f3a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/IDisplayAssemblyExceptions.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/IDisplayAssemblyExceptions.java @@ -1,17 +1,18 @@ package com.simibubi.create.content.contraptions.components.structureMovement; -import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation; -import com.simibubi.create.foundation.item.TooltipHelper; -import com.simibubi.create.foundation.utility.Lang; -import net.minecraft.util.text.ITextComponent; -import net.minecraft.util.text.StringTextComponent; -import net.minecraft.util.text.TextFormatting; +import static net.minecraft.util.text.TextFormatting.GRAY; +import static net.minecraft.util.text.TextFormatting.WHITE; import java.util.Arrays; import java.util.List; -import static net.minecraft.util.text.TextFormatting.GRAY; -import static net.minecraft.util.text.TextFormatting.WHITE; +import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation; +import com.simibubi.create.foundation.item.TooltipHelper; +import com.simibubi.create.foundation.utility.Lang; + +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.StringTextComponent; +import net.minecraft.util.text.TextFormatting; public interface IDisplayAssemblyExceptions { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementBehaviour.java index 2003b9127..9b17ea7f5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MovementBehaviour.java @@ -1,8 +1,11 @@ package com.simibubi.create.content.contraptions.components.structureMovement; +import javax.annotation.Nullable; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionKineticRenderer; + import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; @@ -12,8 +15,6 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.items.ItemHandlerHelper; -import javax.annotation.Nullable; - public abstract class MovementBehaviour { public boolean isActive(MovementContext context) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java index f1d0c139a..49b4d3594 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/OrientedContraptionEntity.java @@ -1,5 +1,12 @@ package com.simibubi.create.content.contraptions.components.structureMovement; +import static com.simibubi.create.foundation.utility.AngleHelper.angleLerp; + +import java.util.Optional; +import java.util.UUID; + +import javax.annotation.Nullable; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllEntityTypes; import com.simibubi.create.content.contraptions.components.structureMovement.bearing.StabilizedContraption; @@ -8,7 +15,12 @@ import com.simibubi.create.content.contraptions.components.structureMovement.mou import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.CapabilityMinecartController; import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.MinecartController; import com.simibubi.create.foundation.item.ItemHelper; -import com.simibubi.create.foundation.utility.*; +import com.simibubi.create.foundation.utility.AngleHelper; +import com.simibubi.create.foundation.utility.Couple; +import com.simibubi.create.foundation.utility.MatrixStacker; +import com.simibubi.create.foundation.utility.NBTHelper; +import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -33,12 +45,6 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.util.LazyOptional; -import javax.annotation.Nullable; -import java.util.Optional; -import java.util.UUID; - -import static com.simibubi.create.foundation.utility.AngleHelper.angleLerp; - /** * Ex: Minecarts, Couplings
* Oriented Contraption Entities can rotate freely around two axes diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/StructureTransform.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/StructureTransform.java index ac984bd5f..1d47d2554 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/StructureTransform.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/StructureTransform.java @@ -10,7 +10,6 @@ import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock import com.simibubi.create.content.contraptions.components.structureMovement.chassis.AbstractChassisBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltSlope; -import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.DirectionHelper; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.VecHelper; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingBlock.java index 6b1a723cb..66e55acbe 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingBlock.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.bearing; import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; + import net.minecraft.block.BlockState; import net.minecraft.item.ItemUseContext; import net.minecraft.tileentity.TileEntity; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingContraption.java index 6ba390e0b..8e1e60aa6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingContraption.java @@ -1,11 +1,14 @@ package com.simibubi.create.content.contraptions.components.structureMovement.bearing; +import org.apache.commons.lang3.tuple.Pair; + import com.simibubi.create.AllTags.AllBlockTags; import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException; import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter; import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType; import com.simibubi.create.foundation.config.AllConfigs; + import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; @@ -14,7 +17,6 @@ import net.minecraft.world.World; import net.minecraft.world.gen.feature.template.Template.BlockInfo; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.apache.commons.lang3.tuple.Pair; public class BearingContraption extends Contraption { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingInstance.java index 43e8a4561..a4ce86d26 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/BearingInstance.java @@ -1,10 +1,5 @@ package com.simibubi.create.content.contraptions.components.structureMovement.bearing; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.math.vector.Quaternion; -import net.minecraft.util.math.vector.Vector3f; - import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.BackHalfShaftInstance; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -14,6 +9,11 @@ import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRen import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.util.Direction; +import net.minecraft.util.math.vector.Quaternion; +import net.minecraft.util.math.vector.Vector3f; + public class BearingInstance extends BackHalfShaftInstance implements IDynamicInstance { final B bearing; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkBearingBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkBearingBlock.java index faf4fde2b..125950656 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkBearingBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkBearingBlock.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.be import com.simibubi.create.AllTileEntities; import com.simibubi.create.foundation.block.ITE; + import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemUseContext; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkBearingTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkBearingTileEntity.java index 7b8912aac..1816c047c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkBearingTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkBearingTileEntity.java @@ -1,5 +1,9 @@ package com.simibubi.create.content.contraptions.components.structureMovement.bearing; +import java.util.List; + +import org.apache.commons.lang3.tuple.Pair; + import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity; import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException; @@ -14,6 +18,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOpt import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.ServerSpeedProvider; + import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.state.properties.BlockStateProperties; @@ -22,9 +27,6 @@ import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.List; public class ClockworkBearingTileEntity extends KineticTileEntity implements IBearingTileEntity, IDisplayAssemblyExceptions { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkContraption.java index 572e63850..949228ba9 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/ClockworkContraption.java @@ -1,19 +1,21 @@ package com.simibubi.create.content.contraptions.components.structureMovement.bearing; +import java.util.HashSet; +import java.util.Queue; +import java.util.Set; + +import org.apache.commons.lang3.tuple.Pair; + import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException; import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter; import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType; import com.simibubi.create.foundation.utility.NBTHelper; + import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import org.apache.commons.lang3.tuple.Pair; - -import java.util.HashSet; -import java.util.Queue; -import java.util.Set; public class ClockworkContraption extends Contraption { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/IBearingTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/IBearingTileEntity.java index 67ebba73e..e729feae4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/IBearingTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/IBearingTileEntity.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.be import com.simibubi.create.content.contraptions.components.structureMovement.DirectionalExtenderScrollOptionSlot; import com.simibubi.create.content.contraptions.components.structureMovement.IControlContraption; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; + import net.minecraft.util.Direction.Axis; public interface IBearingTileEntity extends IControlContraption { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/MechanicalBearingTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/MechanicalBearingTileEntity.java index a986fd42e..9e9d0ff1b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/MechanicalBearingTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/MechanicalBearingTileEntity.java @@ -1,5 +1,9 @@ package com.simibubi.create.content.contraptions.components.structureMovement.bearing; +import static net.minecraft.state.properties.BlockStateProperties.FACING; + +import java.util.List; + import com.simibubi.create.content.contraptions.base.GeneratingKineticTileEntity; import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity; import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException; @@ -10,9 +14,9 @@ import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour; import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.ServerSpeedProvider; + import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.state.properties.BlockStateProperties; @@ -22,10 +26,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.ITextComponent; -import java.util.List; - -import static net.minecraft.state.properties.BlockStateProperties.FACING; - public class MechanicalBearingTileEntity extends GeneratingKineticTileEntity implements IBearingTileEntity, IDisplayAssemblyExceptions { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/SailBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/SailBlock.java index 1a49ab773..ddc70ae1c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/SailBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/SailBlock.java @@ -1,5 +1,13 @@ package com.simibubi.create.content.contraptions.components.structureMovement.bearing; +import java.util.ArrayList; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.function.Predicate; + +import javax.annotation.Nullable; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; import com.simibubi.create.foundation.block.ProperDirectionalBlock; @@ -8,13 +16,18 @@ import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.placement.IPlacementHelper; import com.simibubi.create.foundation.utility.placement.PlacementHelpers; import com.simibubi.create.foundation.utility.placement.PlacementOffset; + import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; -import net.minecraft.item.*; +import net.minecraft.item.BlockItem; +import net.minecraft.item.BlockItemUseContext; +import net.minecraft.item.DyeColor; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ShearsItem; import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.Hand; @@ -27,13 +40,6 @@ import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.HashSet; -import java.util.List; -import java.util.Set; -import java.util.function.Predicate; - public class SailBlock extends ProperDirectionalBlock { public static SailBlock frame(Properties properties) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingInstance.java index 1376415b9..49c7007b0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingInstance.java @@ -1,11 +1,5 @@ package com.simibubi.create.content.contraptions.components.structureMovement.bearing; -import net.minecraft.block.BlockState; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.util.Direction; -import net.minecraft.util.math.vector.Quaternion; -import net.minecraft.util.math.vector.Vector3f; - import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.contraptions.components.structureMovement.render.ActorInstance; @@ -13,6 +7,12 @@ import com.simibubi.create.content.contraptions.components.structureMovement.ren import com.simibubi.create.foundation.render.backend.core.OrientedData; import com.simibubi.create.foundation.utility.AnimationTickHolder; +import net.minecraft.block.BlockState; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.util.Direction; +import net.minecraft.util.math.vector.Quaternion; +import net.minecraft.util.math.vector.Vector3f; + public class StabilizedBearingInstance extends ActorInstance { final OrientedData topInstance; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java index d87c126d2..4db44925a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/bearing/StabilizedBearingMovementBehaviour.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.bearing; +import javax.annotation.Nullable; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity; @@ -12,7 +14,6 @@ import com.simibubi.create.content.contraptions.components.structureMovement.ren import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; -import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -24,8 +25,6 @@ import net.minecraft.util.math.vector.Quaternion; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import javax.annotation.Nullable; - public class StabilizedBearingMovementBehaviour extends MovementBehaviour { @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/AbstractChassisBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/AbstractChassisBlock.java index e24272a76..ad32300e6 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/AbstractChassisBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/AbstractChassisBlock.java @@ -5,6 +5,7 @@ import com.simibubi.create.AllSoundEvents; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.block.BlockState; import net.minecraft.block.RotatedPillarBlock; import net.minecraft.entity.player.PlayerEntity; @@ -12,7 +13,12 @@ import net.minecraft.item.ItemStack; import net.minecraft.particles.ParticleTypes; import net.minecraft.state.BooleanProperty; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; +import net.minecraft.util.Mirror; +import net.minecraft.util.Rotation; +import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.vector.Vector3d; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/ChassisTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/ChassisTileEntity.java index 042c261e6..0c21d2b83 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/ChassisTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/ChassisTileEntity.java @@ -1,5 +1,15 @@ package com.simibubi.create.content.contraptions.components.structureMovement.chassis; +import static net.minecraft.state.properties.BlockStateProperties.AXIS; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Queue; +import java.util.Set; + import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.components.structureMovement.BlockMovementTraits; import com.simibubi.create.foundation.config.AllConfigs; @@ -10,6 +20,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.BulkScrol import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Lang; + import net.minecraft.block.BlockState; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.tileentity.TileEntity; @@ -21,10 +32,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; -import java.util.*; - -import static net.minecraft.state.properties.BlockStateProperties.AXIS; - public class ChassisTileEntity extends SmartTileEntity { ScrollValueBehaviour range; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/LinearChassisBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/LinearChassisBlock.java index b4e1e4d2e..c10ea95da 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/LinearChassisBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/LinearChassisBlock.java @@ -4,6 +4,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllSpriteShifts; import com.simibubi.create.foundation.block.connected.CTSpriteShiftEntry; import com.simibubi.create.foundation.block.connected.ConnectedTextureBehaviour; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.item.BlockItemUseContext; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerBlock.java index 16d33de57..277223c95 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerBlock.java @@ -4,6 +4,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllTileEntities; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.block.ProperDirectionalBlock; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerInstance.java index ec99e4fd4..9e83b008c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerInstance.java @@ -2,11 +2,14 @@ package com.simibubi.create.content.contraptions.components.structureMovement.ch import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.foundation.render.backend.instancing.*; import com.simibubi.create.foundation.render.backend.core.ModelData; +import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; +import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; +import com.simibubi.create.foundation.render.backend.instancing.TileEntityInstance; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.MatrixStacker; + import net.minecraft.client.Minecraft; import net.minecraft.util.Direction; import net.minecraft.util.math.MathHelper; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerRenderer.java index 5b1077bfd..83679ee68 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerRenderer.java @@ -7,6 +7,7 @@ import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerTileEntity.java index 7add70e0e..d6402c34c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/chassis/StickerTileEntity.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.chassis; +import java.util.List; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllSoundEvents; import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity; @@ -10,6 +12,7 @@ import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.utility.animation.LerpedFloat; import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser; + import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.nbt.CompoundNBT; @@ -20,8 +23,6 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fml.DistExecutor; -import java.util.List; - public class StickerTileEntity extends SmartTileEntity implements IInstanceRendered { LerpedFloat piston; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageBlock.java index 60e0fe8f5..849bfb36b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageBlock.java @@ -7,6 +7,7 @@ import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageInstance.java index c7ab236f9..fba18244f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageInstance.java @@ -5,16 +5,17 @@ import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; +import com.simibubi.create.foundation.render.backend.core.ModelData; import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; -import com.simibubi.create.foundation.render.backend.core.ModelData; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.MatrixStacker; + import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3f; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.vector.Vector3f; public class GantryCarriageInstance extends ShaftInstance implements IDynamicInstance { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageRenderer.java index 35b495535..8faa4f599 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageRenderer.java @@ -9,6 +9,7 @@ import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageTileEntity.java index 0cb588fdd..055db9ed8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryCarriageTileEntity.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.gantry; +import static net.minecraft.state.properties.BlockStateProperties.FACING; + import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException; @@ -7,6 +9,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Con import com.simibubi.create.content.contraptions.components.structureMovement.IDisplayAssemblyExceptions; import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftBlock; import com.simibubi.create.content.contraptions.relays.advanced.GantryShaftTileEntity; + import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; @@ -15,8 +18,6 @@ import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; -import static net.minecraft.state.properties.BlockStateProperties.FACING; - public class GantryCarriageTileEntity extends KineticTileEntity implements IDisplayAssemblyExceptions { boolean assembleNextTick; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraption.java index 2c48a1128..df6366c73 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/gantry/GantryContraption.java @@ -1,7 +1,12 @@ package com.simibubi.create.content.contraptions.components.structureMovement.gantry; import com.simibubi.create.AllBlocks; -import com.simibubi.create.content.contraptions.components.structureMovement.*; +import com.simibubi.create.content.contraptions.components.structureMovement.AssemblyException; +import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionLighter; +import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType; +import com.simibubi.create.content.contraptions.components.structureMovement.NonStationaryLighter; +import com.simibubi.create.content.contraptions.components.structureMovement.TranslatingContraption; + import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java index 5cde6b092..dc89ef02e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/glue/SuperGlueEntity.java @@ -1,5 +1,9 @@ package com.simibubi.create.content.contraptions.components.structureMovement.glue; +import javax.annotation.Nullable; + +import org.apache.commons.lang3.Validate; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllEntityTypes; import com.simibubi.create.AllItems; @@ -15,13 +19,18 @@ import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.BlockFace; import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; + import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.DirectionalBlock; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.world.ClientWorld; -import net.minecraft.entity.*; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntitySize; +import net.minecraft.entity.EntityType; +import net.minecraft.entity.MoverType; +import net.minecraft.entity.Pose; import net.minecraft.entity.effect.LightningBoltEntity; import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.player.PlayerEntity; @@ -30,9 +39,19 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.IPacket; import net.minecraft.network.PacketBuffer; import net.minecraft.state.BooleanProperty; -import net.minecraft.util.*; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.DamageSource; +import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; -import net.minecraft.util.math.*; +import net.minecraft.util.Hand; +import net.minecraft.util.Mirror; +import net.minecraft.util.Rotation; +import net.minecraft.util.SoundEvents; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.BlockRayTraceResult; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult.Type; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; @@ -43,9 +62,6 @@ import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.common.registry.IEntityAdditionalSpawnData; import net.minecraftforge.fml.network.NetworkHooks; import net.minecraftforge.fml.network.PacketDistributor; -import org.apache.commons.lang3.Validate; - -import javax.annotation.Nullable; public class SuperGlueEntity extends Entity implements IEntityAdditionalSpawnData, ISpecialEntityItemRequirement { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java index ebdfe71aa..2c0cdaf93 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerBlock.java @@ -1,5 +1,13 @@ package com.simibubi.create.content.contraptions.components.structureMovement.mounted; +import java.util.ArrayList; +import java.util.List; +import java.util.Optional; +import java.util.UUID; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; @@ -18,6 +26,7 @@ import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.utility.Couple; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.AbstractRailBlock; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -40,8 +49,13 @@ import net.minecraft.state.StateContainer.Builder; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.RailShape; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; +import net.minecraft.util.Hand; +import net.minecraft.util.Rotation; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.MathHelper; @@ -56,13 +70,6 @@ import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.common.util.LazyOptional; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; -import java.util.Optional; -import java.util.UUID; - public class CartAssemblerBlock extends AbstractRailBlock implements ITE, IWrenchable, ISpecialBlockItemRequirement { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerTileEntity.java index 0a54aec1e..63a942b25 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/CartAssemblerTileEntity.java @@ -11,7 +11,6 @@ import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxT import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.INamedIconOptions; import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollOptionBehaviour; -import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.VecHelper; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MinecartContraptionItem.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MinecartContraptionItem.java index 81334cda8..75058a61a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MinecartContraptionItem.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MinecartContraptionItem.java @@ -1,10 +1,16 @@ package com.simibubi.create.content.contraptions.components.structureMovement.mounted; +import java.util.List; +import java.util.Optional; + +import javax.annotation.Nullable; + import com.simibubi.create.AllItems; import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity; import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; import com.simibubi.create.content.contraptions.components.structureMovement.OrientedContraptionEntity; import com.simibubi.create.foundation.utility.NBTHelper; + import net.minecraft.block.AbstractRailBlock; import net.minecraft.block.BlockState; import net.minecraft.block.DispenserBlock; @@ -31,10 +37,6 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; -import javax.annotation.Nullable; -import java.util.List; -import java.util.Optional; - @EventBusSubscriber public class MinecartContraptionItem extends Item { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java index a4f4d4202..97b75e778 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/mounted/MountedContraption.java @@ -13,7 +13,6 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Con import com.simibubi.create.content.contraptions.components.structureMovement.ContraptionType; import com.simibubi.create.content.contraptions.components.structureMovement.NonStationaryLighter; import com.simibubi.create.content.contraptions.components.structureMovement.mounted.CartAssemblerTileEntity.CartMovementMode; -import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.VecHelper; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonTileEntity.java index 8ef835f5b..bad6186c7 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/MechanicalPistonTileEntity.java @@ -9,6 +9,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Dir import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.PistonState; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.utility.ServerSpeedProvider; + import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.state.properties.BlockStateProperties; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java index 171e0421b..06e2f6137 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/piston/PistonExtensionPoleBlock.java @@ -1,13 +1,20 @@ package com.simibubi.create.content.contraptions.components.structureMovement.piston; +import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isExtensionPole; +import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isPiston; +import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.isPistonHead; + +import java.util.function.Predicate; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; -import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.*; +import com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.PistonState; import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.foundation.block.ProperDirectionalBlock; import com.simibubi.create.foundation.utility.placement.IPlacementHelper; import com.simibubi.create.foundation.utility.placement.PlacementHelpers; import com.simibubi.create.foundation.utility.placement.util.PoleHelper; + import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -34,10 +41,6 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.World; -import java.util.function.Predicate; - -import static com.simibubi.create.content.contraptions.components.structureMovement.piston.MechanicalPistonBlock.*; - public class PistonExtensionPoleBlock extends ProperDirectionalBlock implements IWrenchable, IWaterLoggable { private static final int placementHelperId = PlacementHelpers.register(PlacementHelper.get()); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyInstance.java index cea43d167..d17c12582 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/AbstractPulleyInstance.java @@ -1,5 +1,20 @@ package com.simibubi.create.content.contraptions.components.structureMovement.pulley; +import java.util.Arrays; + +import com.simibubi.create.content.contraptions.base.KineticTileEntity; +import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; +import com.simibubi.create.foundation.render.backend.core.OrientedData; +import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; +import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; +import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; +import com.simibubi.create.foundation.render.backend.instancing.util.ConditionalInstance; +import com.simibubi.create.foundation.render.backend.instancing.util.InstanceGroup; +import com.simibubi.create.foundation.render.backend.instancing.util.SelectInstance; +import com.simibubi.create.foundation.render.backend.light.GridAlignedBB; +import com.simibubi.create.foundation.render.backend.light.LightUpdateListener; +import com.simibubi.create.foundation.render.backend.light.LightUpdater; + import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -7,18 +22,6 @@ import net.minecraft.util.math.vector.Vector3f; import net.minecraft.world.IBlockDisplayReader; import net.minecraft.world.LightType; -import java.util.Arrays; -import com.simibubi.create.content.contraptions.base.KineticTileEntity; -import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; -import com.simibubi.create.foundation.render.backend.core.OrientedData; -import com.simibubi.create.foundation.render.backend.instancing.*; -import com.simibubi.create.foundation.render.backend.instancing.util.ConditionalInstance; -import com.simibubi.create.foundation.render.backend.instancing.util.InstanceGroup; -import com.simibubi.create.foundation.render.backend.instancing.util.SelectInstance; -import com.simibubi.create.foundation.render.backend.light.GridAlignedBB; -import com.simibubi.create.foundation.render.backend.light.LightUpdateListener; -import com.simibubi.create.foundation.render.backend.light.LightUpdater; - public abstract class AbstractPulleyInstance extends ShaftInstance implements IDynamicInstance, LightUpdateListener { final OrientedData coil; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyBlock.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyBlock.java index 435b96614..0152848b4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyBlock.java @@ -5,7 +5,6 @@ import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock; import com.simibubi.create.foundation.block.ITE; -import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.block.Block; import net.minecraft.block.BlockState; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyRenderer.java index a2c0fbbb8..740302722 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyRenderer.java @@ -6,6 +6,7 @@ import com.simibubi.create.CreateClient; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity; import com.simibubi.create.foundation.render.SuperByteBuffer; + import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.MathHelper; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java index d24b53744..075d08335 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/pulley/PulleyTileEntity.java @@ -9,6 +9,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.pis import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.tileEntity.behaviour.CenteredSideValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; + import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.IWaterLoggable; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ActorInstance.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ActorInstance.java index 9507a05ef..561d6661b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ActorInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ActorInstance.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.render; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; + import net.minecraft.world.LightType; public abstract class ActorInstance { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionKineticRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionKineticRenderer.java index 9478495f7..51f02c77b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionKineticRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionKineticRenderer.java @@ -1,5 +1,12 @@ package com.simibubi.create.content.contraptions.components.structureMovement.render; +import java.lang.ref.WeakReference; +import java.util.ArrayList; + +import javax.annotation.Nullable; + +import org.apache.commons.lang3.tuple.Pair; + import com.simibubi.create.AllMovementBehaviours; import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; import com.simibubi.create.content.contraptions.base.RotatingModel; @@ -11,19 +18,15 @@ import com.simibubi.create.content.contraptions.relays.belt.BeltInstancedModel; import com.simibubi.create.content.logistics.block.FlapModel; import com.simibubi.create.foundation.render.AllProgramSpecs; import com.simibubi.create.foundation.render.backend.MaterialTypes; -import com.simibubi.create.foundation.render.backend.instancing.*; - import com.simibubi.create.foundation.render.backend.core.OrientedModel; import com.simibubi.create.foundation.render.backend.core.TransformedModel; +import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; +import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; +import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial; import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.util.math.BlockPos; import net.minecraft.world.gen.feature.template.Template; -import org.apache.commons.lang3.tuple.Pair; - -import javax.annotation.Nullable; -import java.lang.ref.WeakReference; -import java.util.ArrayList; public class ContraptionKineticRenderer extends InstancedTileRenderer { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionModel.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionModel.java index 2157f607f..270d8d08d 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionModel.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionModel.java @@ -1,15 +1,17 @@ package com.simibubi.create.content.contraptions.components.structureMovement.render; +import java.nio.ByteBuffer; + +import org.lwjgl.opengl.GL15; +import org.lwjgl.opengl.GL20; + import com.simibubi.create.foundation.render.backend.BufferedModel; import com.simibubi.create.foundation.render.backend.gl.GlBuffer; import com.simibubi.create.foundation.render.backend.gl.GlPrimitiveType; import com.simibubi.create.foundation.render.backend.gl.attrib.VertexFormat; + import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.LightTexture; -import org.lwjgl.opengl.GL15; -import org.lwjgl.opengl.GL20; - -import java.nio.ByteBuffer; public class ContraptionModel extends BufferedModel { public static final VertexFormat FORMAT = VertexFormat.builder() diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionProgram.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionProgram.java index 2ec5bce4c..977593f34 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionProgram.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionProgram.java @@ -1,11 +1,13 @@ package com.simibubi.create.content.contraptions.components.structureMovement.render; +import org.lwjgl.opengl.GL20; + import com.simibubi.create.foundation.render.backend.gl.BasicProgram; import com.simibubi.create.foundation.render.backend.gl.shader.ProgramFogMode; + import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.vector.Matrix4f; -import org.lwjgl.opengl.GL20; public class ContraptionProgram extends BasicProgram { protected final int uLightBoxSize; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java index 8d59124fa..2674f778a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/ContraptionRenderDispatcher.java @@ -3,10 +3,10 @@ package com.simibubi.create.content.contraptions.components.structureMovement.re import java.util.List; import java.util.Random; -import net.minecraft.util.math.vector.Matrix4f; -import net.minecraft.world.IBlockDisplayReader; import org.apache.commons.lang3.tuple.Pair; -import org.lwjgl.opengl.*; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL13; +import org.lwjgl.opengl.GL40; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllMovementBehaviours; @@ -30,6 +30,7 @@ import it.unimi.dsi.fastutil.ints.Int2ObjectOpenHashMap; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.BlockModelRenderer; import net.minecraft.client.renderer.BlockRendererDispatcher; import net.minecraft.client.renderer.BufferBuilder; @@ -38,11 +39,12 @@ import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraft.client.renderer.WorldRenderer; -import net.minecraft.client.renderer.*; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.world.IBlockDisplayReader; import net.minecraft.world.LightType; import net.minecraft.world.World; import net.minecraft.world.gen.feature.template.Template; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/RenderedContraption.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/RenderedContraption.java index 67365a0e3..23f188946 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/RenderedContraption.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/render/RenderedContraption.java @@ -17,10 +17,16 @@ import com.simibubi.create.foundation.render.backend.light.GridAlignedBB; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld; import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorldStarlight; + import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.*; +import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.client.renderer.BlockModelRenderer; +import net.minecraft.client.renderer.BlockRendererDispatcher; +import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.renderer.RenderType; +import net.minecraft.client.renderer.RenderTypeLookup; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ContraptionInteractionPacket.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ContraptionInteractionPacket.java index b9e7e43a2..aa286757c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ContraptionInteractionPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ContraptionInteractionPacket.java @@ -6,7 +6,6 @@ import com.simibubi.create.content.contraptions.components.structureMovement.Abs import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.network.PacketBuffer; import net.minecraft.util.Direction; diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java index a8f42e6fd..74becf2da 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingPhysics.java @@ -13,8 +13,8 @@ import net.minecraft.entity.item.minecart.AbstractMinecartEntity; import net.minecraft.state.properties.RailShape; import net.minecraft.tags.BlockTags; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; public class CouplingPhysics { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/OpenEndedPipe.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/OpenEndedPipe.java index 261b342a6..7cc6874b3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/OpenEndedPipe.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/OpenEndedPipe.java @@ -12,7 +12,6 @@ import com.simibubi.create.content.contraptions.fluids.potion.PotionFluidHandler import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.fluid.FluidHelper; import com.simibubi.create.foundation.utility.BlockFace; -import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.block.BlockState; import net.minecraft.block.FlowingFluidBlock; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/PipeConnection.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/PipeConnection.java index a77de5441..5f3fc685b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/PipeConnection.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/PipeConnection.java @@ -1,5 +1,9 @@ package com.simibubi.create.content.contraptions.fluids; +import java.util.Optional; +import java.util.Random; +import java.util.function.Predicate; + import com.simibubi.create.AllBlocks; import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; @@ -8,6 +12,7 @@ import com.simibubi.create.foundation.utility.Couple; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.animation.LerpedFloat; + import net.minecraft.client.Minecraft; import net.minecraft.entity.Entity; import net.minecraft.nbt.CompoundNBT; @@ -25,10 +30,6 @@ import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fml.DistExecutor; -import java.util.Optional; -import java.util.Random; -import java.util.function.Predicate; - public class PipeConnection { Direction side; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpBlock.java index cbbe18376..e01220fb0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpBlock.java @@ -2,12 +2,12 @@ package com.simibubi.create.content.contraptions.fluids; import java.util.Random; -import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import org.apache.commons.lang3.mutable.MutableBoolean; import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -27,7 +27,6 @@ import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; -import net.minecraft.world.IWorldReader; import net.minecraft.world.TickPriority; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpCogInstance.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpCogInstance.java index 27ffe2b5c..202a93992 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpCogInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpCogInstance.java @@ -1,16 +1,15 @@ package com.simibubi.create.content.contraptions.fluids; -import net.minecraft.block.BlockState; +import static net.minecraft.state.properties.BlockStateProperties.FACING; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.RotatingData; import com.simibubi.create.content.contraptions.base.SingleRotatingInstance; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; -import static net.minecraft.state.properties.BlockStateProperties.FACING; +import net.minecraft.block.BlockState; public class PumpCogInstance extends SingleRotatingInstance { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java index ff12d494f..62630d7ec 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/PumpTileEntity.java @@ -1,5 +1,18 @@ package com.simibubi.create.content.contraptions.fluids; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.HashSet; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; + +import javax.annotation.Nullable; + +import org.apache.commons.lang3.mutable.MutableBoolean; + import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; @@ -9,6 +22,7 @@ import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Pair; import com.simibubi.create.foundation.utility.animation.LerpedFloat; import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser; + import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; @@ -20,11 +34,6 @@ import net.minecraft.world.IWorld; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; -import org.apache.commons.lang3.mutable.MutableBoolean; - -import javax.annotation.Nullable; -import java.util.*; -import java.util.Map.Entry; public class PumpTileEntity extends KineticTileEntity { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidManipulationBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidManipulationBehaviour.java index 259222e89..16e61b211 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidManipulationBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/FluidManipulationBehaviour.java @@ -6,7 +6,6 @@ import java.util.List; import java.util.Set; import java.util.function.BiConsumer; -import com.simibubi.create.AllTags.AllFluidTags; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.fluid.FluidHelper; import com.simibubi.create.foundation.networking.AllPackets; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java index d5d8034a2..7871b9e10 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/HosePulleyTileEntity.java @@ -1,11 +1,14 @@ package com.simibubi.create.content.contraptions.fluids.actors; +import java.util.List; + import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.foundation.fluid.SmartFluidTank; import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.utility.ServerSpeedProvider; import com.simibubi.create.foundation.utility.animation.LerpedFloat; + import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntityType; @@ -19,8 +22,6 @@ import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.IFluidHandler; -import java.util.List; - public class HosePulleyTileEntity extends KineticTileEntity { LerpedFloat offset; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainBlock.java index 782040a0a..389d49fca 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainBlock.java @@ -7,6 +7,7 @@ import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.fluid.FluidHelper; import com.simibubi.create.foundation.tileEntity.ComparatorUtil; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainTileEntity.java index eca2edebd..ab80e1ff0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/ItemDrainTileEntity.java @@ -1,5 +1,9 @@ package com.simibubi.create.content.contraptions.fluids.actors; +import java.util.IdentityHashMap; +import java.util.List; +import java.util.Map; + import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation; import com.simibubi.create.content.contraptions.processing.EmptyingByBasin; import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack; @@ -12,6 +16,7 @@ import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Pair; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; @@ -28,10 +33,6 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import net.minecraftforge.items.ItemHandlerHelper; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; - public class ItemDrainTileEntity extends SmartTileEntity implements IHaveGoggleInformation { public static final int FILLING_TIME = 20; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutBlock.java index a2fb4acf4..f53e8331b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutBlock.java @@ -4,6 +4,7 @@ import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.foundation.tileEntity.ComparatorUtil; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java index be66a8911..02c0e05a2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/actors/SpoutTileEntity.java @@ -1,5 +1,13 @@ package com.simibubi.create.content.contraptions.fluids.actors; +import static com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult.HOLD; +import static com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult.PASS; + +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Nullable; + import com.simibubi.create.content.contraptions.fluids.FluidFX; import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation; import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack; @@ -12,6 +20,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemS import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult; import com.simibubi.create.foundation.tileEntity.behaviour.fluid.SmartFluidTankBehaviour; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.item.PotionItem; @@ -34,13 +43,6 @@ import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fml.ModList; -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; - -import static com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult.HOLD; -import static com.simibubi.create.foundation.tileEntity.behaviour.belt.BeltProcessingBehaviour.ProcessingResult.PASS; - public class SpoutTileEntity extends SmartTileEntity implements IHaveGoggleInformation { private static final boolean IS_TIC_LOADED = ModList.get().isLoaded("tconstruct"); private static final Class CASTING_FLUID_HANDLER_CLASS; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveBlock.java index 3756d8b12..4091f564f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveBlock.java @@ -1,10 +1,15 @@ package com.simibubi.create.content.contraptions.fluids.pipes; +import java.util.Random; + +import javax.annotation.Nonnull; + import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock; import com.simibubi.create.content.contraptions.fluids.FluidPropagator; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.network.DebugPacketSender; @@ -22,9 +27,6 @@ import net.minecraft.world.TickPriority; import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; -import javax.annotation.Nonnull; -import java.util.Random; - public class FluidValveBlock extends DirectionalAxisKineticBlock implements IAxisPipe { public static final BooleanProperty ENABLED = BooleanProperty.create("enabled"); diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveInstance.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveInstance.java index e5f8c76ff..2e041cc60 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveInstance.java @@ -5,12 +5,13 @@ import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; +import com.simibubi.create.foundation.render.backend.core.ModelData; import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; -import com.simibubi.create.foundation.render.backend.core.ModelData; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.MatrixStacker; + import net.minecraft.util.Direction; import net.minecraft.util.math.MathHelper; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveRenderer.java index c90fd0dd6..14439f84a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveRenderer.java @@ -8,6 +8,7 @@ import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.MatrixStacker; + import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveTileEntity.java index 92bcee149..c57007b7f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/FluidValveTileEntity.java @@ -1,11 +1,14 @@ package com.simibubi.create.content.contraptions.fluids.pipes; +import java.util.List; + import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.fluids.pipes.StraightPipeTileEntity.StraightPipeFluidTransportBehaviour; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.utility.animation.LerpedFloat; import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser; + import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntityType; @@ -13,8 +16,6 @@ import net.minecraft.util.Direction; import net.minecraft.util.math.MathHelper; import net.minecraftforge.fluids.FluidStack; -import java.util.List; - public class FluidValveTileEntity extends KineticTileEntity { LerpedFloat pointer; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/TransparentStraightPipeRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/TransparentStraightPipeRenderer.java index 864cab4cf..5fc575317 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/TransparentStraightPipeRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/pipes/TransparentStraightPipeRenderer.java @@ -8,6 +8,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.animation.LerpedFloat; + import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.Direction; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/potion/PotionFluid.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/potion/PotionFluid.java index 9ca9fb039..bac7497c1 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/potion/PotionFluid.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/potion/PotionFluid.java @@ -1,8 +1,12 @@ package com.simibubi.create.content.contraptions.fluids.potion; +import java.util.Collection; +import java.util.List; + import com.simibubi.create.AllFluids; import com.simibubi.create.content.contraptions.fluids.VirtualFluid; import com.simibubi.create.foundation.utility.NBTHelper; + import net.minecraft.fluid.Fluid; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; @@ -16,9 +20,6 @@ import net.minecraftforge.fluids.FluidAttributes; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.registries.ForgeRegistries; -import java.util.Collection; -import java.util.List; - public class PotionFluid extends VirtualFluid { public enum BottleType { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/potion/PotionFluidHandler.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/potion/PotionFluidHandler.java index 4e1c3b38b..f577c249c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/potion/PotionFluidHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/potion/PotionFluidHandler.java @@ -1,11 +1,16 @@ package com.simibubi.create.content.contraptions.fluids.potion; +import java.util.List; +import java.util.Map; +import java.util.Map.Entry; + import com.google.common.collect.Lists; import com.simibubi.create.content.contraptions.fluids.potion.PotionFluid.BottleType; import com.simibubi.create.foundation.fluid.FluidHelper; import com.simibubi.create.foundation.fluid.FluidIngredient; import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.Pair; + import net.minecraft.entity.ai.attributes.Attribute; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.fluid.Fluids; @@ -13,7 +18,12 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.nbt.CompoundNBT; -import net.minecraft.potion.*; +import net.minecraft.potion.Effect; +import net.minecraft.potion.EffectInstance; +import net.minecraft.potion.EffectUtils; +import net.minecraft.potion.Potion; +import net.minecraft.potion.PotionUtils; +import net.minecraft.potion.Potions; import net.minecraft.util.IItemProvider; import net.minecraft.util.Tuple; import net.minecraft.util.text.ITextComponent; @@ -24,10 +34,6 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.fluids.FluidStack; -import java.util.List; -import java.util.Map; -import java.util.Map.Entry; - public class PotionFluidHandler { public static Pair emptyPotion(ItemStack stack, boolean simulate) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankBlock.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankBlock.java index e4bbfbea5..2b7426d6a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankBlock.java @@ -10,6 +10,7 @@ import com.simibubi.create.foundation.fluid.FluidHelper; import com.simibubi.create.foundation.fluid.FluidHelper.FluidExchange; import com.simibubi.create.foundation.tileEntity.ComparatorUtil; import com.simibubi.create.foundation.utility.Lang; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.SoundType; @@ -25,7 +26,14 @@ import net.minecraft.state.EnumProperty; import net.minecraft.state.StateContainer.Builder; import net.minecraft.tags.FluidTags; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.*; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Hand; +import net.minecraft.util.IStringSerializable; +import net.minecraft.util.Mirror; +import net.minecraft.util.Rotation; +import net.minecraft.util.SoundCategory; +import net.minecraft.util.SoundEvent; +import net.minecraft.util.SoundEvents; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.MathHelper; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java index 673034926..3501c84f3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/tank/FluidTankTileEntity.java @@ -1,5 +1,12 @@ package com.simibubi.create.content.contraptions.fluids.tank; +import static java.lang.Math.abs; + +import java.util.List; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import com.simibubi.create.content.contraptions.fluids.tank.FluidTankBlock.Shape; import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation; import com.simibubi.create.foundation.config.AllConfigs; @@ -7,6 +14,7 @@ import com.simibubi.create.foundation.fluid.SmartFluidTank; import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; + import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTUtil; @@ -28,12 +36,6 @@ import net.minecraftforge.fluids.capability.IFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler.FluidAction; import net.minecraftforge.fluids.capability.templates.FluidTank; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.List; - -import static java.lang.Math.abs; - public class FluidTankTileEntity extends SmartTileEntity implements IHaveGoggleInformation { private static final int MAX_SIZE = 3; diff --git a/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleConfigScreen.java b/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleConfigScreen.java index 51113c7db..d3956d25b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleConfigScreen.java +++ b/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleConfigScreen.java @@ -8,7 +8,6 @@ import com.simibubi.create.AllItems; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.gui.AbstractSimiScreen; import com.simibubi.create.foundation.gui.GuiGameElement; -import com.simibubi.create.foundation.gui.UIRenderHelper; import com.simibubi.create.foundation.utility.Lang; import net.minecraft.client.Minecraft; diff --git a/src/main/java/com/simibubi/create/content/contraptions/goggles/GogglesModel.java b/src/main/java/com/simibubi/create/content/contraptions/goggles/GogglesModel.java index 7533007ba..333f65bbd 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/goggles/GogglesModel.java +++ b/src/main/java/com/simibubi/create/content/contraptions/goggles/GogglesModel.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.goggles; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.foundation.block.render.WrappedBakedModel; + import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; diff --git a/src/main/java/com/simibubi/create/content/contraptions/particle/RotationIndicatorParticle.java b/src/main/java/com/simibubi/create/content/contraptions/particle/RotationIndicatorParticle.java index 4cd05968f..ffb2f1996 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/particle/RotationIndicatorParticle.java +++ b/src/main/java/com/simibubi/create/content/contraptions/particle/RotationIndicatorParticle.java @@ -5,6 +5,7 @@ import com.simibubi.create.content.contraptions.goggles.GogglesItem; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.particle.IAnimatedSprite; diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinBlock.java b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinBlock.java index 32cd04ed5..efe51f549 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinBlock.java @@ -14,6 +14,7 @@ import com.simibubi.create.foundation.item.ItemHelper; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; @@ -36,7 +37,6 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.fluids.capability.CapabilityFluidHandler; import net.minecraftforge.fluids.capability.IFluidHandler; diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinRenderer.java index 85cf71437..fbc1b9a00 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinRenderer.java @@ -1,11 +1,18 @@ package com.simibubi.create.content.contraptions.processing; +import java.util.Random; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.fluid.FluidRenderer; import com.simibubi.create.foundation.tileEntity.behaviour.fluid.SmartFluidTankBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.fluid.SmartFluidTankBehaviour.TankSegment; import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer; -import com.simibubi.create.foundation.utility.*; +import com.simibubi.create.foundation.utility.AngleHelper; +import com.simibubi.create.foundation.utility.AnimationTickHolder; +import com.simibubi.create.foundation.utility.IntAttached; +import com.simibubi.create.foundation.utility.MatrixStacker; +import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -21,8 +28,6 @@ import net.minecraftforge.fluids.FluidStack; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; -import java.util.Random; - public class BasinRenderer extends SmartTileEntityRenderer { public BasinRenderer(TileEntityRendererDispatcher dispatcher) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java index 0d0081e52..6f61259dd 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/BasinTileEntity.java @@ -1,5 +1,14 @@ package com.simibubi.create.content.contraptions.processing; +import java.util.ArrayList; +import java.util.Collections; +import java.util.Iterator; +import java.util.List; +import java.util.Optional; +import java.util.Random; + +import javax.annotation.Nonnull; + import com.simibubi.create.AllParticleTypes; import com.simibubi.create.AllTags; import com.simibubi.create.content.contraptions.components.mixer.MechanicalMixerTileEntity; @@ -17,9 +26,15 @@ import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputB import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.fluid.SmartFluidTankBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.fluid.SmartFluidTankBehaviour.TankSegment; -import com.simibubi.create.foundation.utility.*; +import com.simibubi.create.foundation.utility.AnimationTickHolder; +import com.simibubi.create.foundation.utility.Couple; +import com.simibubi.create.foundation.utility.IntAttached; +import com.simibubi.create.foundation.utility.Iterate; +import com.simibubi.create.foundation.utility.NBTHelper; +import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.animation.LerpedFloat; import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; @@ -50,9 +65,6 @@ import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.wrapper.CombinedInvWrapper; -import javax.annotation.Nonnull; -import java.util.*; - public class BasinTileEntity extends SmartTileEntity implements IHaveGoggleInformation { private boolean areFluidsMoving; diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingInventory.java b/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingInventory.java index b45c57411..45cb0927b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingInventory.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingInventory.java @@ -1,11 +1,11 @@ package com.simibubi.create.content.contraptions.processing; +import java.util.function.Consumer; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.items.ItemStackHandler; -import java.util.function.Consumer; - public class ProcessingInventory extends ItemStackHandler { public float remainingTime; public float recipeDuration; diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipe.java b/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipe.java index 791f80266..9fc92040c 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipe.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/ProcessingRecipe.java @@ -1,11 +1,20 @@ package com.simibubi.create.content.contraptions.processing; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import javax.annotation.ParametersAreNonnullByDefault; + +import org.apache.logging.log4j.Logger; + import com.google.gson.JsonObject; import com.simibubi.create.AllRecipeTypes; import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.processing.ProcessingRecipeBuilder.ProcessingRecipeParams; import com.simibubi.create.foundation.fluid.FluidIngredient; import com.simibubi.create.foundation.utility.Lang; + import mcp.MethodsReturnNonnullByDefault; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; @@ -17,12 +26,6 @@ import net.minecraft.network.PacketBuffer; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.FluidStack; -import org.apache.logging.log4j.Logger; - -import javax.annotation.ParametersAreNonnullByDefault; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerRenderer.java index bbf74d0f9..df11ef484 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerRenderer.java @@ -7,6 +7,7 @@ import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; diff --git a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java index 346cd8832..7e104acca 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/processing/burner/BlazeBurnerTileEntity.java @@ -1,5 +1,8 @@ package com.simibubi.create.content.contraptions.processing.burner; +import java.util.List; +import java.util.Random; + import com.simibubi.create.AllItems; import com.simibubi.create.content.contraptions.particle.CubeParticleData; import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.HeatLevel; @@ -9,6 +12,7 @@ import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.animation.LerpedFloat; import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser; + import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; @@ -19,9 +23,6 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.common.ForgeHooks; -import java.util.List; -import java.util.Random; - public class BlazeBurnerTileEntity extends SmartTileEntity { private final static int[][] heatParticleColors = diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftBlock.java index 8d5625b8d..41a62efb3 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftBlock.java @@ -1,5 +1,9 @@ package com.simibubi.create.content.contraptions.relays.advanced; +import java.util.ArrayList; +import java.util.List; +import java.util.function.Predicate; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; @@ -11,6 +15,7 @@ import com.simibubi.create.foundation.utility.placement.IPlacementHelper; import com.simibubi.create.foundation.utility.placement.PlacementHelpers; import com.simibubi.create.foundation.utility.placement.PlacementOffset; import com.simibubi.create.foundation.utility.placement.util.PoleHelper; + import net.minecraft.block.Block; import net.minecraft.block.BlockRenderType; import net.minecraft.block.BlockState; @@ -39,10 +44,6 @@ import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -import java.util.ArrayList; -import java.util.List; -import java.util.function.Predicate; - public class GantryShaftBlock extends DirectionalKineticBlock { public static final Property PART = EnumProperty.create("part", Part.class); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftTileEntity.java index b54685651..dbdeeb073 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/GantryShaftTileEntity.java @@ -5,6 +5,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryCarriageBlock; import com.simibubi.create.content.contraptions.components.structureMovement.gantry.GantryCarriageTileEntity; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerBlock.java index 5a7edbd98..46a4f25d4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerBlock.java @@ -1,16 +1,20 @@ package com.simibubi.create.content.contraptions.relays.advanced; +import java.util.function.Predicate; + +import javax.annotation.ParametersAreNonnullByDefault; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.HorizontalAxisKineticBlock; import com.simibubi.create.content.contraptions.relays.elementary.CogWheelBlock; -import com.simibubi.create.content.contraptions.relays.elementary.CogwheelBlockItem; import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.utility.placement.IPlacementHelper; import com.simibubi.create.foundation.utility.placement.PlacementHelpers; import com.simibubi.create.foundation.utility.placement.PlacementOffset; + import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -29,9 +33,6 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; -import javax.annotation.ParametersAreNonnullByDefault; -import java.util.function.Predicate; - @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class SpeedControllerBlock extends HorizontalAxisKineticBlock implements ITE { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerRenderer.java index 8dc0407a4..786a4b8b4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerRenderer.java @@ -8,6 +8,7 @@ import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRenderer; + import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java index 0f35e2dd1..d173a0008 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/SpeedControllerTileEntity.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.contraptions.relays.advanced; -import com.simibubi.create.AllBlocks; +import java.util.List; + import com.simibubi.create.content.contraptions.RotationPropagator; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.components.motor.CreativeMotorTileEntity; @@ -12,13 +13,12 @@ import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraft.util.math.vector.Vector3d; -import java.util.List; - public class SpeedControllerTileEntity extends KineticTileEntity { public static final int DEFAULT_SPEED = 16; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftTileEntity.java index 5ded363d3..42b961a98 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/advanced/sequencer/SequencedGearshiftTileEntity.java @@ -1,14 +1,15 @@ package com.simibubi.create.content.contraptions.relays.advanced.sequencer; +import java.util.Vector; + import com.simibubi.create.content.contraptions.relays.encased.SplitShaftTileEntity; + import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraftforge.common.util.Constants.NBT; -import java.util.Vector; - public class SequencedGearshiftTileEntity extends SplitShaftTileEntity { Vector instructions; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltData.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltData.java index 3363b4c00..ec0b082c5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltData.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltData.java @@ -1,13 +1,14 @@ package com.simibubi.create.content.contraptions.relays.belt; +import java.nio.ByteBuffer; + import com.simibubi.create.content.contraptions.base.KineticData; import com.simibubi.create.foundation.block.render.SpriteShiftEntry; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; + import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.math.vector.Quaternion; -import java.nio.ByteBuffer; - public class BeltData extends KineticData { private float qX; private float qY; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstance.java index 6b27b77e0..c02c3fb54 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstance.java @@ -1,5 +1,8 @@ package com.simibubi.create.content.contraptions.relays.belt; +import java.util.ArrayList; +import java.util.function.Supplier; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.AllBlocks; @@ -12,14 +15,12 @@ import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.MatrixStacker; + import net.minecraft.item.DyeColor; import net.minecraft.util.Direction; import net.minecraft.util.math.vector.Quaternion; import net.minecraft.world.LightType; -import java.util.ArrayList; -import java.util.function.Supplier; - public class BeltInstance extends KineticTileInstance { boolean upward; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstancedModel.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstancedModel.java index fd8cd918b..7b75ce395 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstancedModel.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltInstancedModel.java @@ -1,10 +1,10 @@ package com.simibubi.create.content.contraptions.relays.belt; import com.simibubi.create.content.contraptions.base.KineticAttributes; +import com.simibubi.create.foundation.render.backend.core.BasicAttributes; import com.simibubi.create.foundation.render.backend.gl.attrib.VertexFormat; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; -import com.simibubi.create.foundation.render.backend.core.BasicAttributes; import net.minecraft.client.renderer.BufferBuilder; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java index 41eb7511e..6b8ace415 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltRenderer.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.contraptions.relays.belt; +import java.util.Random; + import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -18,6 +20,7 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; + import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -36,8 +39,6 @@ import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3f; import net.minecraft.util.math.vector.Vector3i; -import java.util.Random; - public class BeltRenderer extends SafeTileEntityRenderer { public BeltRenderer(TileEntityRendererDispatcher dispatcher) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java index 493bb143c..253f54500 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltTileEntity.java @@ -1,10 +1,26 @@ package com.simibubi.create.content.contraptions.relays.belt; +import static com.simibubi.create.content.contraptions.relays.belt.BeltPart.MIDDLE; +import static com.simibubi.create.content.contraptions.relays.belt.BeltSlope.HORIZONTAL; +import static net.minecraft.util.Direction.AxisDirection.NEGATIVE; +import static net.minecraft.util.Direction.AxisDirection.POSITIVE; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Optional; +import java.util.function.Function; + import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.content.contraptions.base.KineticTileEntity; -import com.simibubi.create.content.contraptions.relays.belt.transport.*; +import com.simibubi.create.content.contraptions.relays.belt.transport.BeltInventory; +import com.simibubi.create.content.contraptions.relays.belt.transport.BeltMovementHandler; import com.simibubi.create.content.contraptions.relays.belt.transport.BeltMovementHandler.TransportedEntityInfo; +import com.simibubi.create.content.contraptions.relays.belt.transport.BeltTunnelInteractionHandler; +import com.simibubi.create.content.contraptions.relays.belt.transport.ItemHandlerBeltSegment; +import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack; import com.simibubi.create.content.logistics.block.belts.tunnel.BrassTunnelTileEntity; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.render.backend.light.GridAlignedBB; @@ -15,6 +31,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputB import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult; import com.simibubi.create.foundation.utility.NBTHelper; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; @@ -43,14 +60,6 @@ import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; -import java.util.*; -import java.util.function.Function; - -import static com.simibubi.create.content.contraptions.relays.belt.BeltPart.MIDDLE; -import static com.simibubi.create.content.contraptions.relays.belt.BeltSlope.HORIZONTAL; -import static net.minecraft.util.Direction.AxisDirection.NEGATIVE; -import static net.minecraft.util.Direction.AxisDirection.POSITIVE; - public class BeltTileEntity extends KineticTileEntity implements LightUpdateListener { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/item/BeltConnectorHandler.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/item/BeltConnectorHandler.java index 093bbc437..420cf78e5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/item/BeltConnectorHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/item/BeltConnectorHandler.java @@ -7,7 +7,6 @@ import java.util.Random; import com.simibubi.create.AllItems; import com.simibubi.create.content.contraptions.relays.elementary.ShaftBlock; import com.simibubi.create.foundation.config.AllConfigs; -import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.PlayerEntity; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltCrusherInteractionHandler.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltCrusherInteractionHandler.java index 5568591f1..39400e412 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltCrusherInteractionHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltCrusherInteractionHandler.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.relays.belt.transport; import com.simibubi.create.content.contraptions.components.crusher.CrushingWheelControllerBlock; import com.simibubi.create.content.contraptions.components.crusher.CrushingWheelControllerTileEntity; import com.simibubi.create.content.contraptions.relays.belt.BeltHelper; + import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltFunnelInteractionHandler.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltFunnelInteractionHandler.java index a29a48828..8ea4af97f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltFunnelInteractionHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltFunnelInteractionHandler.java @@ -6,6 +6,7 @@ import com.simibubi.create.content.logistics.block.funnel.BeltFunnelBlock.Shape; import com.simibubi.create.content.logistics.block.funnel.FunnelTileEntity; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour; + import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltInventory.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltInventory.java index 267070dc2..d445f9567 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltInventory.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltInventory.java @@ -1,5 +1,13 @@ package com.simibubi.create.content.contraptions.relays.belt.transport; +import static com.simibubi.create.content.contraptions.relays.belt.transport.BeltTunnelInteractionHandler.flapTunnel; + +import java.util.Collections; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import java.util.function.Function; + import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltHelper; import com.simibubi.create.content.contraptions.relays.belt.BeltSlope; @@ -12,6 +20,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemS import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult; import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.ServerSpeedProvider; + import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; @@ -22,14 +31,6 @@ import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.common.util.Constants.NBT; -import java.util.Collections; -import java.util.Iterator; -import java.util.LinkedList; -import java.util.List; -import java.util.function.Function; - -import static com.simibubi.create.content.contraptions.relays.belt.transport.BeltTunnelInteractionHandler.flapTunnel; - public class BeltInventory { final BeltTileEntity belt; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltMovementHandler.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltMovementHandler.java index a576ecb45..9786a30c4 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltMovementHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltMovementHandler.java @@ -1,11 +1,18 @@ package com.simibubi.create.content.contraptions.relays.belt.transport; +import static net.minecraft.entity.MoverType.SELF; +import static net.minecraft.util.Direction.AxisDirection.NEGATIVE; +import static net.minecraft.util.Direction.AxisDirection.POSITIVE; + +import java.util.List; + import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.components.structureMovement.AbstractContraptionEntity; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltPart; import com.simibubi.create.content.contraptions.relays.belt.BeltSlope; import com.simibubi.create.content.contraptions.relays.belt.BeltTileEntity; + import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; @@ -23,12 +30,6 @@ import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3i; import net.minecraft.world.World; -import java.util.List; - -import static net.minecraft.entity.MoverType.SELF; -import static net.minecraft.util.Direction.AxisDirection.NEGATIVE; -import static net.minecraft.util.Direction.AxisDirection.POSITIVE; - public class BeltMovementHandler { public static class TransportedEntityInfo { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltTunnelInteractionHandler.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltTunnelInteractionHandler.java index b239b65b9..91b31e8f5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltTunnelInteractionHandler.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/transport/BeltTunnelInteractionHandler.java @@ -17,7 +17,6 @@ import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; -import net.minecraft.util.Direction.Axis; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.items.ItemHandlerHelper; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/BracketedTileEntityBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/BracketedTileEntityBehaviour.java index 8bc847faf..f2dbec548 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/BracketedTileEntityBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/BracketedTileEntityBehaviour.java @@ -1,11 +1,16 @@ package com.simibubi.create.content.contraptions.relays.elementary; +import java.util.Optional; +import java.util.function.Function; +import java.util.function.Predicate; + import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.advancement.ITriggerable; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType; import com.simibubi.create.foundation.utility.NBTHelper; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -14,10 +19,6 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.NBTUtil; import net.minecraft.world.World; -import java.util.Optional; -import java.util.function.Function; -import java.util.function.Predicate; - public class BracketedTileEntityBehaviour extends TileEntityBehaviour { public static BehaviourType TYPE = new BehaviourType<>(); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java index 4b4ea6f1c..7662c10f5 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogWheelBlock.java @@ -1,10 +1,13 @@ package com.simibubi.create.content.contraptions.relays.elementary; +import javax.annotation.ParametersAreNonnullByDefault; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; import com.simibubi.create.content.contraptions.base.IRotate; import com.simibubi.create.content.contraptions.relays.advanced.SpeedControllerBlock; import com.simibubi.create.foundation.utility.Iterate; + import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -19,7 +22,6 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -import javax.annotation.ParametersAreNonnullByDefault; @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java index db7b6f488..e7ecf1fbb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/CogwheelBlockItem.java @@ -1,5 +1,19 @@ package com.simibubi.create.content.contraptions.relays.elementary; +import static com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock.AXIS; + +import java.util.List; +import java.util.function.Predicate; + +import com.simibubi.create.AllShapes; +import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; +import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock; +import com.simibubi.create.foundation.advancement.AllTriggers; +import com.simibubi.create.foundation.utility.Iterate; +import com.simibubi.create.foundation.utility.placement.IPlacementHelper; +import com.simibubi.create.foundation.utility.placement.PlacementHelpers; +import com.simibubi.create.foundation.utility.placement.PlacementOffset; + import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; @@ -15,19 +29,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.world.World; -import java.util.List; -import java.util.function.Predicate; -import com.simibubi.create.AllShapes; -import com.simibubi.create.content.contraptions.base.DirectionalKineticBlock; -import com.simibubi.create.content.contraptions.base.HorizontalKineticBlock; -import com.simibubi.create.foundation.advancement.AllTriggers; -import com.simibubi.create.foundation.utility.Iterate; -import com.simibubi.create.foundation.utility.placement.IPlacementHelper; -import com.simibubi.create.foundation.utility.placement.PlacementHelpers; -import com.simibubi.create.foundation.utility.placement.PlacementOffset; - -import static com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock.AXIS; - public class CogwheelBlockItem extends BlockItem { boolean large; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java index 7f2ad6f2c..079987ad8 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ICogWheel.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.contraptions.relays.elementary; import com.simibubi.create.content.contraptions.base.IRotate; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.item.BlockItem; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ShaftBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ShaftBlock.java index 56cb322ad..51c02d3af 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ShaftBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/elementary/ShaftBlock.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.contraptions.relays.elementary; +import java.util.function.Predicate; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; import com.simibubi.create.content.contraptions.base.KineticTileEntity; @@ -8,6 +10,7 @@ import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.utility.placement.IPlacementHelper; import com.simibubi.create.foundation.utility.placement.PlacementHelpers; import com.simibubi.create.foundation.utility.placement.util.PoleHelper; + import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; @@ -23,8 +26,6 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; -import java.util.function.Predicate; - public class ShaftBlock extends AbstractShaftBlock { private static final int placementHelperId = PlacementHelpers.register(new PlacementHelper()); diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AdjustablePulleyTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AdjustablePulleyTileEntity.java index aa3350ca9..46c9d41de 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AdjustablePulleyTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/AdjustablePulleyTileEntity.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.contraptions.relays.encased; import com.simibubi.create.content.contraptions.base.KineticTileEntity; + import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntityType; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/ShaftInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/ShaftInstance.java index 1349518f5..b2929b67f 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/ShaftInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/ShaftInstance.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.relays.encased; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.base.SingleRotatingInstance; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; + import net.minecraft.block.BlockState; public class ShaftInstance extends SingleRotatingInstance { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftInstance.java index 14f666e32..92eab7077 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftInstance.java @@ -1,8 +1,9 @@ package com.simibubi.create.content.contraptions.relays.encased; +import java.util.ArrayList; + import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.IRotate; -import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; import com.simibubi.create.content.contraptions.base.KineticTileInstance; import com.simibubi.create.content.contraptions.base.RotatingData; import com.simibubi.create.foundation.render.backend.instancing.InstanceData; @@ -10,11 +11,10 @@ import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.block.Block; import net.minecraft.util.Direction; -import java.util.ArrayList; - public class SplitShaftInstance extends KineticTileInstance { protected final ArrayList keys; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftRenderer.java index 3b3980a5d..a1cf575af 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/encased/SplitShaftRenderer.java @@ -9,6 +9,7 @@ import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.block.Block; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeInstance.java index d54633a8e..dd0a740dd 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeInstance.java @@ -1,17 +1,23 @@ package com.simibubi.create.content.contraptions.relays.gauge; +import java.util.ArrayList; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; -import com.simibubi.create.foundation.render.backend.instancing.*; import com.simibubi.create.foundation.render.backend.core.ModelData; -import com.simibubi.create.foundation.utility.*; +import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; +import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; +import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; +import com.simibubi.create.foundation.utility.AnimationTickHolder; +import com.simibubi.create.foundation.utility.Couple; +import com.simibubi.create.foundation.utility.Iterate; +import com.simibubi.create.foundation.utility.MatrixStacker; + import net.minecraft.util.Direction; import net.minecraft.util.math.MathHelper; -import java.util.ArrayList; - public abstract class GaugeInstance extends ShaftInstance implements IDynamicInstance { protected final ArrayList faces; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeRenderer.java index 232b18d1c..bc89519bb 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeRenderer.java @@ -9,6 +9,7 @@ import com.simibubi.create.content.contraptions.relays.gauge.GaugeBlock.Type; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/SpeedGaugeTileEntity.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/SpeedGaugeTileEntity.java index 9d5d33db3..1bdb7b191 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/SpeedGaugeTileEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/SpeedGaugeTileEntity.java @@ -1,18 +1,19 @@ package com.simibubi.create.content.contraptions.relays.gauge; +import java.util.List; + import com.simibubi.create.content.contraptions.base.IRotate.SpeedLevel; import com.simibubi.create.content.contraptions.goggles.GogglesItem; import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.Lang; + import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextFormatting; -import java.util.List; - public class SpeedGaugeTileEntity extends GaugeTileEntity { public SpeedGaugeTileEntity(TileEntityType type) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxInstance.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxInstance.java index 2e6b51631..62a2cd6b2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxInstance.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxInstance.java @@ -1,7 +1,9 @@ package com.simibubi.create.content.contraptions.relays.gearbox; +import java.util.EnumMap; +import java.util.Map; + import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; import com.simibubi.create.content.contraptions.base.KineticTileInstance; import com.simibubi.create.content.contraptions.base.RotatingData; import com.simibubi.create.foundation.render.backend.instancing.InstanceData; @@ -9,14 +11,12 @@ import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.LightType; -import java.util.EnumMap; -import java.util.Map; - public class GearboxInstance extends KineticTileInstance { protected final EnumMap keys; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxRenderer.java index 38cc2965b..45463f007 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxRenderer.java @@ -8,6 +8,7 @@ import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; diff --git a/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchItemRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchItemRenderer.java index 1ce92b68f..8a9e75a53 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/wrench/WrenchItemRenderer.java @@ -5,6 +5,7 @@ import com.simibubi.create.foundation.block.render.CustomRenderedItemModelRender import com.simibubi.create.foundation.item.PartialItemModelRenderer; import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueHandler; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.item.ItemStack; import net.minecraft.util.math.vector.Vector3f; diff --git a/src/main/java/com/simibubi/create/content/curiosities/ChromaticCompoundColor.java b/src/main/java/com/simibubi/create/content/curiosities/ChromaticCompoundColor.java index d318f0652..60c3e3754 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/ChromaticCompoundColor.java +++ b/src/main/java/com/simibubi/create/content/curiosities/ChromaticCompoundColor.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.curiosities; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ColorHelper; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.item.ItemStack; diff --git a/src/main/java/com/simibubi/create/content/curiosities/NoGravMagicalDohickyItem.java b/src/main/java/com/simibubi/create/content/curiosities/NoGravMagicalDohickyItem.java index 76887104e..2921241d3 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/NoGravMagicalDohickyItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/NoGravMagicalDohickyItem.java @@ -8,7 +8,6 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; import net.minecraft.particles.ParticleTypes; import net.minecraft.util.math.MathHelper; - import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryHandler.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryHandler.java index ce4f34b85..d21926abf 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryHandler.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryHandler.java @@ -1,11 +1,14 @@ package com.simibubi.create.content.curiosities.symmetry; +import java.util.Random; + import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllItems; import com.simibubi.create.content.curiosities.symmetry.mirror.EmptyMirror; import com.simibubi.create.content.curiosities.symmetry.mirror.SymmetryMirror; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.block.Blocks; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; @@ -35,8 +38,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; -import java.util.Random; - @EventBusSubscriber(bus = Bus.FORGE) public class SymmetryHandler { diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java index 71a300bf6..acd103510 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/SymmetryWandItem.java @@ -1,5 +1,12 @@ package com.simibubi.create.content.curiosities.symmetry; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Nonnull; + import com.simibubi.create.content.curiosities.symmetry.mirror.CrossPlaneMirror; import com.simibubi.create.content.curiosities.symmetry.mirror.EmptyMirror; import com.simibubi.create.content.curiosities.symmetry.mirror.PlaneMirror; @@ -9,12 +16,17 @@ import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.FluidState; -import net.minecraft.item.*; +import net.minecraft.item.BlockItem; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.item.ItemUseContext; +import net.minecraft.item.Rarity; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ActionResult; @@ -33,12 +45,6 @@ import net.minecraftforge.event.ForgeEventFactory; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.network.PacketDistributor; -import javax.annotation.Nonnull; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - public class SymmetryWandItem extends Item { public static final String SYMMETRY = "symmetry"; diff --git a/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandItemRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandItemRenderer.java index e6e372367..69e68f142 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/symmetry/client/SymmetryWandItemRenderer.java @@ -4,6 +4,7 @@ import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.block.render.CustomRenderedItemModelRenderer; import com.simibubi.create.foundation.item.PartialItemModelRenderer; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/DeforesterItem.java b/src/main/java/com/simibubi/create/content/curiosities/tools/DeforesterItem.java index 24dbc12bb..862b11161 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/DeforesterItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/DeforesterItem.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.curiosities.tools; +import javax.annotation.ParametersAreNonnullByDefault; + import com.simibubi.create.AllItems; import com.simibubi.create.AllTags; import com.simibubi.create.foundation.utility.TreeCutter; @@ -22,8 +24,6 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber.Bus; -import javax.annotation.ParametersAreNonnullByDefault; - @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/DeforesterItemRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/tools/DeforesterItemRenderer.java index 6ccd6ab33..46712178b 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/DeforesterItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/DeforesterItemRenderer.java @@ -4,6 +4,7 @@ import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.block.render.CustomRenderedItemModelRenderer; import com.simibubi.create.foundation.item.PartialItemModelRenderer; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.item.ItemStack; import net.minecraft.util.math.vector.Vector3f; diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripInteractionPacket.java b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripInteractionPacket.java index cace5783e..a5f854031 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripInteractionPacket.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripInteractionPacket.java @@ -5,7 +5,6 @@ import java.util.function.Supplier; import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.network.PacketBuffer; import net.minecraft.util.Hand; diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java index 1ed1e78c2..ecba3ded1 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItem.java @@ -1,11 +1,14 @@ package com.simibubi.create.content.curiosities.tools; +import java.util.UUID; + import com.google.common.collect.ImmutableMultimap; import com.google.common.collect.Multimap; import com.simibubi.create.AllItems; import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.entity.Entity; @@ -38,8 +41,6 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod.EventBusSubscriber; -import java.util.UUID; - @EventBusSubscriber public class ExtendoGripItem extends Item { private static DamageSource lastActiveDamageSource; diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItemRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItemRenderer.java index 50cd6a226..2f09786c6 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/ExtendoGripItemRenderer.java @@ -6,6 +6,7 @@ import com.simibubi.create.foundation.block.render.CustomRenderedItemModelRender import com.simibubi.create.foundation.item.PartialItemModelRenderer; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.MatrixStacker; + import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.model.ItemCameraTransforms.TransformType; import net.minecraft.item.ItemStack; diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperItem.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperItem.java index d9d66089f..1a8cdb843 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperItem.java @@ -13,7 +13,6 @@ import com.simibubi.create.content.curiosities.zapper.ZapperItem; import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.gui.ScreenOpener; import com.simibubi.create.foundation.item.ItemDescription; -import com.simibubi.create.foundation.item.ItemDescription.Palette; import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Lang; diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperItemRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperItemRenderer.java index a80e8602e..e59924335 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/blockzapper/BlockzapperItemRenderer.java @@ -1,11 +1,20 @@ package com.simibubi.create.content.curiosities.zapper.blockzapper; +import static com.simibubi.create.content.curiosities.zapper.blockzapper.BlockzapperItem.Components.Accelerator; +import static com.simibubi.create.content.curiosities.zapper.blockzapper.BlockzapperItem.Components.Amplifier; +import static com.simibubi.create.content.curiosities.zapper.blockzapper.BlockzapperItem.Components.Body; +import static com.simibubi.create.content.curiosities.zapper.blockzapper.BlockzapperItem.Components.Retriever; +import static com.simibubi.create.content.curiosities.zapper.blockzapper.BlockzapperItem.Components.Scope; +import static java.lang.Math.max; +import static net.minecraft.util.math.MathHelper.clamp; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.curiosities.zapper.ZapperItemRenderer; import com.simibubi.create.content.curiosities.zapper.blockzapper.BlockzapperItem.ComponentTier; import com.simibubi.create.content.curiosities.zapper.blockzapper.BlockzapperItem.Components; import com.simibubi.create.foundation.item.PartialItemModelRenderer; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -16,10 +25,6 @@ import net.minecraft.util.HandSide; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3f; -import static com.simibubi.create.content.curiosities.zapper.blockzapper.BlockzapperItem.Components.*; -import static java.lang.Math.max; -import static net.minecraft.util.math.MathHelper.clamp; - public class BlockzapperItemRenderer extends ZapperItemRenderer { @Override diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperItemRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperItemRenderer.java index 93f94f5cd..88b5e5c86 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperItemRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/terrainzapper/WorldshaperItemRenderer.java @@ -1,9 +1,13 @@ package com.simibubi.create.content.curiosities.zapper.terrainzapper; +import static java.lang.Math.max; +import static net.minecraft.util.math.MathHelper.clamp; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.curiosities.zapper.ZapperItemRenderer; import com.simibubi.create.foundation.item.PartialItemModelRenderer; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -13,9 +17,6 @@ import net.minecraft.util.HandSide; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3f; -import static java.lang.Math.max; -import static net.minecraft.util.math.MathHelper.clamp; - public class WorldshaperItemRenderer extends ZapperItemRenderer { @Override diff --git a/src/main/java/com/simibubi/create/content/logistics/InWorldProcessing.java b/src/main/java/com/simibubi/create/content/logistics/InWorldProcessing.java index d716baba9..670f02cfc 100644 --- a/src/main/java/com/simibubi/create/content/logistics/InWorldProcessing.java +++ b/src/main/java/com/simibubi/create/content/logistics/InWorldProcessing.java @@ -1,5 +1,25 @@ package com.simibubi.create.content.logistics; +import static com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.getHeatLevelOf; + +import java.util.ArrayList; +import java.util.Collections; +import java.util.List; +import java.util.Optional; + +import javax.annotation.Nullable; + +import com.simibubi.create.AllBlocks; +import com.simibubi.create.AllRecipeTypes; +import com.simibubi.create.content.contraptions.components.fan.SplashingRecipe; +import com.simibubi.create.content.contraptions.processing.ProcessingRecipe; +import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock; +import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack; +import com.simibubi.create.foundation.config.AllConfigs; +import com.simibubi.create.foundation.item.ItemHelper; +import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult; +import com.simibubi.create.foundation.utility.ColorHelper; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -28,24 +48,6 @@ import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.wrapper.RecipeWrapper; -import java.util.ArrayList; -import java.util.Collections; -import java.util.List; -import java.util.Optional; -import javax.annotation.Nullable; -import com.simibubi.create.AllBlocks; -import com.simibubi.create.AllRecipeTypes; -import com.simibubi.create.content.contraptions.components.fan.SplashingRecipe; -import com.simibubi.create.content.contraptions.processing.ProcessingRecipe; -import com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock; -import com.simibubi.create.content.contraptions.relays.belt.transport.TransportedItemStack; -import com.simibubi.create.foundation.config.AllConfigs; -import com.simibubi.create.foundation.item.ItemHelper; -import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult; -import com.simibubi.create.foundation.utility.ColorHelper; - -import static com.simibubi.create.content.contraptions.processing.burner.BlazeBurnerBlock.getHeatLevelOf; - public class InWorldProcessing { public static class SplashingInv extends RecipeWrapper { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/FlapData.java b/src/main/java/com/simibubi/create/content/logistics/block/FlapData.java index bdc5eef42..2a91a9e94 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/FlapData.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/FlapData.java @@ -1,13 +1,14 @@ package com.simibubi.create.content.logistics.block; +import java.nio.ByteBuffer; + +import com.simibubi.create.foundation.render.backend.core.IFlatLight; import com.simibubi.create.foundation.render.backend.instancing.InstanceData; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; -import com.simibubi.create.foundation.render.backend.core.IFlatLight; + import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Vector3f; -import java.nio.ByteBuffer; - public class FlapData extends InstanceData implements IFlatLight { private float x; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/FlapModel.java b/src/main/java/com/simibubi/create/content/logistics/block/FlapModel.java index fb4731bc7..7a6a00f14 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/FlapModel.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/FlapModel.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.block; import com.simibubi.create.foundation.render.backend.gl.attrib.VertexFormat; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; + import net.minecraft.client.renderer.BufferBuilder; public class FlapModel extends InstancedModel { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelBlock.java index f039bf840..b16763bf2 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelBlock.java @@ -11,6 +11,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.item.BlockItemUseContext; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelInstance.java index b9f8c8aca..36cf2bbd7 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelInstance.java @@ -9,7 +9,11 @@ import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; import com.simibubi.create.content.logistics.block.FlapData; import com.simibubi.create.foundation.gui.widgets.InterpolatedValue; -import com.simibubi.create.foundation.render.backend.instancing.*; +import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; +import com.simibubi.create.foundation.render.backend.instancing.InstanceData; +import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; +import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; +import com.simibubi.create.foundation.render.backend.instancing.TileEntityInstance; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.util.Direction; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelRenderer.java index 61b5a4090..f82be3bb1 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelRenderer.java @@ -10,6 +10,7 @@ import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelTileEntity.java index 6f6d30e83..6527280b9 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/belts/tunnel/BeltTunnelTileEntity.java @@ -20,6 +20,7 @@ import com.simibubi.create.foundation.render.backend.instancing.IInstanceRendere import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.INBT; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/chute/AbstractChuteBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/chute/AbstractChuteBlock.java index 4ad4242fa..33c5c818b 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/chute/AbstractChuteBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/chute/AbstractChuteBlock.java @@ -1,11 +1,14 @@ package com.simibubi.create.content.logistics.block.chute; +import javax.annotation.Nullable; + import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputBehaviour; import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.client.particle.ParticleManager; @@ -28,8 +31,6 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.util.LazyOptional; -import javax.annotation.Nullable; - public abstract class AbstractChuteBlock extends Block implements IWrenchable, ITE { public AbstractChuteBlock(Properties p_i48440_1_) { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java index 6c173cc0a..701ca4566 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/chute/ChuteTileEntity.java @@ -29,6 +29,7 @@ import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.VecHelper; + import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.Block; import net.minecraft.block.BlockState; @@ -54,11 +55,6 @@ import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; -import java.util.LinkedList; -import java.util.List; - @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault /* diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotTileEntity.java index 92c1eb482..ec4233523 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/DepotTileEntity.java @@ -1,15 +1,16 @@ package com.simibubi.create.content.logistics.block.depot; +import java.util.List; + import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; + import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Direction; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.items.CapabilityItemHandler; -import java.util.List; - public class DepotTileEntity extends SmartTileEntity { DepotBehaviour depotBehaviour; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorBlock.java index ad735a27d..8447b25a8 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorBlock.java @@ -24,9 +24,9 @@ import net.minecraft.util.Direction.Axis; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; -import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorInstance.java index fb36deb8b..ad44cb651 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorInstance.java @@ -1,16 +1,16 @@ package com.simibubi.create.content.logistics.block.depot; -import net.minecraft.util.math.MathHelper; - import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.relays.encased.ShaftInstance; +import com.simibubi.create.foundation.render.backend.core.ModelData; import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; -import com.simibubi.create.foundation.render.backend.core.ModelData; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.MatrixStacker; +import net.minecraft.util.math.MathHelper; + public class EjectorInstance extends ShaftInstance implements IDynamicInstance { protected final EjectorTileEntity tile; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTargetHandler.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTargetHandler.java index 0285f44c7..db730fdc6 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTargetHandler.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTargetHandler.java @@ -27,8 +27,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult; import net.minecraft.util.math.RayTraceResult.Type; -import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java index 2a124a32d..5188e1ab0 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/depot/EjectorTileEntity.java @@ -47,11 +47,11 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.RayTraceContext; import net.minecraft.util.math.RayTraceContext.BlockMode; import net.minecraft.util.math.RayTraceContext.FluidMode; import net.minecraft.util.math.RayTraceResult.Type; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterInstance.java index c7979e95e..4bef959ea 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/diodes/AdjustableRepeaterInstance.java @@ -2,8 +2,10 @@ package com.simibubi.create.content.logistics.block.diodes; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.foundation.render.backend.instancing.*; import com.simibubi.create.foundation.render.backend.core.ModelData; +import com.simibubi.create.foundation.render.backend.instancing.ITickableInstance; +import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; +import com.simibubi.create.foundation.render.backend.instancing.TileEntityInstance; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.MatrixStacker; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/AbstractFunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/AbstractFunnelBlock.java index 18c402dda..68c43bc22 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/AbstractFunnelBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/AbstractFunnelBlock.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.logistics.block.funnel; +import javax.annotation.Nullable; + import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.wrench.IWrenchable; import com.simibubi.create.foundation.block.ITE; @@ -7,6 +9,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour; import com.simibubi.create.foundation.utility.BlockHelper; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.client.particle.ParticleManager; @@ -24,8 +27,6 @@ import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import javax.annotation.Nullable; - public abstract class AbstractFunnelBlock extends Block implements ITE, IWrenchable { public static final BooleanProperty POWERED = BlockStateProperties.POWERED; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/AndesiteFunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/AndesiteFunnelBlock.java index 3b5961870..2dc92c421 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/AndesiteFunnelBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/AndesiteFunnelBlock.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.logistics.block.funnel; import com.simibubi.create.AllBlocks; + import net.minecraft.block.BlockState; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/BeltFunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/BeltFunnelBlock.java index f66d2209e..839053db0 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/BeltFunnelBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/BeltFunnelBlock.java @@ -12,6 +12,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.belt.DirectBeltInputB import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.VoxelShaper; import com.tterrag.registrate.util.entry.BlockEntry; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.item.ItemEntity; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/BrassFunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/BrassFunnelBlock.java index 7a1fe0670..e44c2aa4d 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/BrassFunnelBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/BrassFunnelBlock.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.logistics.block.funnel; import com.simibubi.create.AllBlocks; + import net.minecraft.block.BlockState; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelBlock.java index 60f4f8971..747414130 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelBlock.java @@ -4,6 +4,7 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.AllShapes; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelFilterSlotPositioning.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelFilterSlotPositioning.java index 8fab3a0a2..927296f0a 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelFilterSlotPositioning.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelFilterSlotPositioning.java @@ -6,6 +6,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelGenerator.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelGenerator.java index 12cd17b3d..b41d3384f 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelGenerator.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelGenerator.java @@ -6,6 +6,7 @@ import com.tterrag.registrate.providers.DataGenContext; import com.tterrag.registrate.providers.RegistrateBlockstateProvider; import com.tterrag.registrate.providers.RegistrateItemModelProvider; import com.tterrag.registrate.util.nullness.NonNullBiConsumer; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.item.Item; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java index d0f496d2c..32207fd68 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelInstance.java @@ -1,15 +1,20 @@ package com.simibubi.create.content.logistics.block.funnel; +import java.util.ArrayList; + import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.KineticRenderMaterials; import com.simibubi.create.content.logistics.block.FlapData; -import com.simibubi.create.foundation.render.backend.instancing.*; +import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; +import com.simibubi.create.foundation.render.backend.instancing.InstanceData; +import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; +import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; +import com.simibubi.create.foundation.render.backend.instancing.TileEntityInstance; import com.simibubi.create.foundation.utility.AnimationTickHolder; + import net.minecraft.util.Direction; import net.minecraft.world.LightType; -import java.util.ArrayList; - public class FunnelInstance extends TileEntityInstance implements IDynamicInstance { private final ArrayList flaps; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelItem.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelItem.java index 6be897d1c..f127a2b3c 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelItem.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelItem.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.logistics.block.funnel; import com.simibubi.create.foundation.advancement.AllTriggers; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.item.BlockItem; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelMovementBehaviour.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelMovementBehaviour.java index 175ec34b0..78d537c64 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelMovementBehaviour.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelMovementBehaviour.java @@ -1,10 +1,13 @@ package com.simibubi.create.content.logistics.block.funnel; +import java.util.List; + import com.simibubi.create.content.contraptions.components.structureMovement.MovementBehaviour; import com.simibubi.create.content.contraptions.components.structureMovement.MovementContext; import com.simibubi.create.content.logistics.item.filter.FilterItem; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.item.ItemHelper; + import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.Direction; @@ -16,8 +19,6 @@ import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.World; import net.minecraftforge.items.ItemHandlerHelper; -import java.util.List; - public class FunnelMovementBehaviour extends MovementBehaviour { private final boolean hasFilter; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelRenderer.java index 1ef640218..d54eb5cd0 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelRenderer.java @@ -9,6 +9,7 @@ import com.simibubi.create.foundation.tileEntity.renderer.SmartTileEntityRendere import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java index 633fa8110..e77b5e2cb 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/funnel/FunnelTileEntity.java @@ -1,5 +1,8 @@ package com.simibubi.create.content.logistics.block.funnel; +import java.lang.ref.WeakReference; +import java.util.List; + import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.goggles.IHaveHoveringInformation; import com.simibubi.create.content.contraptions.relays.belt.BeltHelper; @@ -19,6 +22,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBe import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour; import com.simibubi.create.foundation.utility.BlockFace; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; @@ -31,9 +35,6 @@ import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; -import java.lang.ref.WeakReference; -import java.util.List; - public class FunnelTileEntity extends SmartTileEntity implements IHaveHoveringInformation, IInstanceRendered { private FilteringBehaviour filtering; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateBlock.java index 99ef3e3ea..54af02825 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/inventories/AdjustableCrateBlock.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.logistics.block.inventories; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllTileEntities; import com.simibubi.create.foundation.item.ItemHelper; + import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.ServerPlayerEntity; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmBlock.java index cbf44210c..0e92e2de5 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmBlock.java @@ -1,11 +1,11 @@ package com.simibubi.create.content.logistics.block.mechanicalArm; -import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import org.apache.commons.lang3.mutable.MutableBoolean; import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.KineticBlock; +import com.simibubi.create.content.contraptions.relays.elementary.ICogWheel; import com.simibubi.create.content.logistics.block.mechanicalArm.ArmTileEntity.Phase; import com.simibubi.create.foundation.block.ITE; @@ -27,7 +27,6 @@ import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; -import net.minecraft.world.IWorldReader; import net.minecraft.world.World; public class ArmBlock extends KineticBlock implements ITE, ICogWheel { diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInstance.java index 0ba3ac81a..941b35260 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmInstance.java @@ -1,24 +1,29 @@ package com.simibubi.create.content.logistics.block.mechanicalArm; +import java.util.ArrayList; + import com.google.common.collect.Lists; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; import com.simibubi.create.content.contraptions.base.RotatingData; import com.simibubi.create.content.contraptions.base.SingleRotatingInstance; -import com.simibubi.create.foundation.render.backend.instancing.*; import com.simibubi.create.foundation.render.backend.core.ModelData; +import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; +import com.simibubi.create.foundation.render.backend.instancing.InstanceData; +import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; +import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; +import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.MatrixStacker; + import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.ItemRenderer; import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; -import java.util.ArrayList; - public class ArmInstance extends SingleRotatingInstance implements IDynamicInstance { final ModelData base; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmRenderer.java index 5cffe0e56..6553f676c 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmRenderer.java @@ -12,6 +12,7 @@ import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.MatrixStacker; + import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java index bf6f12d55..7c0c0105c 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/mechanicalArm/ArmTileEntity.java @@ -1,5 +1,10 @@ package com.simibubi.create.content.logistics.block.mechanicalArm; +import java.util.ArrayList; +import java.util.List; + +import javax.annotation.Nullable; + import com.simibubi.create.content.contraptions.base.KineticTileEntity; import com.simibubi.create.content.logistics.block.mechanicalArm.ArmInteractionPoint.Jukebox; import com.simibubi.create.content.logistics.block.mechanicalArm.ArmInteractionPoint.Mode; @@ -16,6 +21,7 @@ import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.block.JukeboxBlock; import net.minecraft.item.ItemStack; @@ -32,10 +38,6 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.util.Constants.NBT; -import javax.annotation.Nullable; -import java.util.ArrayList; -import java.util.List; - public class ArmTileEntity extends KineticTileEntity { // Server diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverInstance.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverInstance.java index dc3e83671..416766dcf 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverInstance.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverInstance.java @@ -2,12 +2,17 @@ package com.simibubi.create.content.logistics.block.redstone; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.foundation.render.backend.instancing.*; import com.simibubi.create.foundation.render.backend.core.ModelData; +import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; +import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; +import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; +import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial; +import com.simibubi.create.foundation.render.backend.instancing.TileEntityInstance; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ColorHelper; import com.simibubi.create.foundation.utility.MatrixStacker; + import net.minecraft.state.properties.AttachFace; import net.minecraft.util.Direction; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverRenderer.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverRenderer.java index 54f71a879..cbde2d0e5 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverRenderer.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverRenderer.java @@ -8,6 +8,7 @@ import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.ColorHelper; + import net.minecraft.block.BlockState; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverTileEntity.java index 202d74898..2862ad0fe 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/AnalogLeverTileEntity.java @@ -1,19 +1,20 @@ package com.simibubi.create.content.logistics.block.redstone; +import java.util.List; + import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation; import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue; import com.simibubi.create.foundation.render.backend.instancing.IInstanceRendered; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.utility.Lang; + import net.minecraft.block.BlockState; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.ITextComponent; -import java.util.List; - public class AnalogLeverTileEntity extends SmartTileEntity implements IHaveGoggleInformation, IInstanceRendered { int state = 0; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/ContentObserverBlock.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/ContentObserverBlock.java index 175f0b30e..a5f568dbf 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/ContentObserverBlock.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/ContentObserverBlock.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.logistics.block.redstone; +import java.util.Random; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; @@ -11,6 +13,7 @@ import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemS import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.HorizontalBlock; @@ -29,8 +32,6 @@ import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.items.CapabilityItemHandler; -import java.util.Random; - public class ContentObserverBlock extends HorizontalBlock implements ITE, IWrenchable { public static final BooleanProperty POWERED = BlockStateProperties.POWERED; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchScreen.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchScreen.java index a7bcdca6e..84f468933 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchScreen.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.logistics.block.redstone; +import static com.simibubi.create.foundation.gui.AllGuiTextures.STOCKSWITCH; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlocks; import com.simibubi.create.content.logistics.packet.ConfigureStockswitchPacket; @@ -13,13 +15,12 @@ import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.animation.LerpedFloat; import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser; + import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; -import static com.simibubi.create.foundation.gui.AllGuiTextures.STOCKSWITCH; - public class StockpileSwitchScreen extends AbstractSimiScreen { private ScrollInput offBelow; diff --git a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java index c50dc2204..87f406177 100644 --- a/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java +++ b/src/main/java/com/simibubi/create/content/logistics/block/redstone/StockpileSwitchTileEntity.java @@ -1,10 +1,13 @@ package com.simibubi.create.content.logistics.block.redstone; +import java.util.List; + import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.inventory.InvManipulationBehaviour.InterfaceProvider; + import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; @@ -13,8 +16,6 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.items.IItemHandler; -import java.util.List; - public class StockpileSwitchTileEntity extends SmartTileEntity { public float onWhenAbove; diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java index 8615f546a..ab37bf0bd 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/AbstractFilterScreen.java @@ -1,5 +1,11 @@ package com.simibubi.create.content.logistics.item.filter; +import static com.simibubi.create.foundation.gui.AllGuiTextures.PLAYER_INVENTORY; +import static net.minecraft.util.text.TextFormatting.GRAY; + +import java.util.Collections; +import java.util.List; + import com.google.common.collect.ImmutableList; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket.Option; @@ -13,6 +19,7 @@ import com.simibubi.create.foundation.gui.widgets.Indicator.State; import com.simibubi.create.foundation.item.ItemDescription.Palette; import com.simibubi.create.foundation.item.TooltipHelper; import com.simibubi.create.foundation.networking.AllPackets; + import net.minecraft.client.gui.widget.Widget; import net.minecraft.client.renderer.Rectangle2d; import net.minecraft.client.resources.I18n; @@ -20,12 +27,6 @@ import net.minecraft.entity.player.PlayerInventory; import net.minecraft.util.text.IFormattableTextComponent; import net.minecraft.util.text.ITextComponent; -import java.util.Collections; -import java.util.List; - -import static com.simibubi.create.foundation.gui.AllGuiTextures.PLAYER_INVENTORY; -import static net.minecraft.util.text.TextFormatting.GRAY; - public abstract class AbstractFilterScreen extends AbstractSimiContainerScreen { protected AllGuiTextures background; diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterContainer.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterContainer.java index c4a16244e..8d4b209e8 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterContainer.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterContainer.java @@ -1,7 +1,11 @@ package com.simibubi.create.content.logistics.item.filter; +import java.util.ArrayList; +import java.util.List; + import com.simibubi.create.AllContainerTypes; import com.simibubi.create.foundation.utility.Pair; + import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerInventory; import net.minecraft.inventory.container.ClickType; @@ -17,9 +21,6 @@ import net.minecraftforge.common.util.Constants.NBT; import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.SlotItemHandler; -import java.util.ArrayList; -import java.util.List; - public class AttributeFilterContainer extends AbstractFilterContainer { public enum WhitelistMode { diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java index 862df6ed6..b71172708 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/AttributeFilterScreen.java @@ -1,5 +1,10 @@ package com.simibubi.create.content.logistics.item.filter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; +import java.util.stream.Collectors; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.logistics.item.filter.AttributeFilterContainer.WhitelistMode; import com.simibubi.create.content.logistics.item.filter.FilterScreenPacket.Option; @@ -12,6 +17,7 @@ import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.Pair; + import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; @@ -20,11 +26,6 @@ import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; import net.minecraft.util.text.TextFormatting; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; -import java.util.stream.Collectors; - public class AttributeFilterScreen extends AbstractFilterScreen { private static final String PREFIX = "gui.attribute_filter."; diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterContainer.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterContainer.java index 2f93d9bbc..c14b007fe 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterContainer.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/FilterContainer.java @@ -1,6 +1,7 @@ package com.simibubi.create.content.logistics.item.filter; import com.simibubi.create.AllContainerTypes; + import net.minecraft.entity.player.PlayerInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.CompoundNBT; diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java index 0a9c46236..884156c60 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/ItemAttribute.java @@ -1,13 +1,30 @@ package com.simibubi.create.content.logistics.item.filter; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.Collections; +import java.util.List; +import java.util.Optional; +import java.util.function.BiPredicate; +import java.util.function.Predicate; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.StringUtils; + import com.simibubi.create.AllRecipeTypes; import com.simibubi.create.content.logistics.InWorldProcessing; -import com.simibubi.create.content.logistics.item.filter.attribute.*; +import com.simibubi.create.content.logistics.item.filter.attribute.BookAuthorAttribute; +import com.simibubi.create.content.logistics.item.filter.attribute.BookCopyAttribute; +import com.simibubi.create.content.logistics.item.filter.attribute.ColorAttribute; +import com.simibubi.create.content.logistics.item.filter.attribute.EnchantAttribute; +import com.simibubi.create.content.logistics.item.filter.attribute.FluidContentsAttribute; +import com.simibubi.create.content.logistics.item.filter.attribute.ItemNameAttribute; import com.simibubi.create.content.logistics.item.filter.attribute.astralsorcery.AstralSorceryAmuletAttribute; import com.simibubi.create.content.logistics.item.filter.attribute.astralsorcery.AstralSorceryAttunementAttribute; import com.simibubi.create.content.logistics.item.filter.attribute.astralsorcery.AstralSorceryCrystalAttribute; import com.simibubi.create.content.logistics.item.filter.attribute.astralsorcery.AstralSorceryPerkGemAttribute; import com.simibubi.create.foundation.utility.Lang; + import net.minecraft.enchantment.EnchantmentHelper; import net.minecraft.inventory.IInventory; import net.minecraft.item.BlockItem; @@ -29,12 +46,6 @@ import net.minecraftforge.fml.ModList; import net.minecraftforge.forgespi.language.IModInfo; import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.wrapper.RecipeWrapper; -import org.apache.commons.lang3.StringUtils; - -import java.util.*; -import java.util.function.BiPredicate; -import java.util.function.Predicate; -import java.util.stream.Collectors; public interface ItemAttribute { diff --git a/src/main/java/com/simibubi/create/content/logistics/item/filter/attribute/ColorAttribute.java b/src/main/java/com/simibubi/create/content/logistics/item/filter/attribute/ColorAttribute.java index f847ca02b..f9e5e2380 100644 --- a/src/main/java/com/simibubi/create/content/logistics/item/filter/attribute/ColorAttribute.java +++ b/src/main/java/com/simibubi/create/content/logistics/item/filter/attribute/ColorAttribute.java @@ -1,6 +1,15 @@ package com.simibubi.create.content.logistics.item.filter.attribute; +import java.util.Arrays; +import java.util.Collection; +import java.util.Collections; +import java.util.HashSet; +import java.util.List; +import java.util.Set; +import java.util.stream.Collectors; + import com.simibubi.create.content.logistics.item.filter.ItemAttribute; + import net.minecraft.item.DyeColor; import net.minecraft.item.FireworkRocketItem; import net.minecraft.item.FireworkStarItem; @@ -9,9 +18,6 @@ import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; import net.minecraft.util.text.TranslationTextComponent; -import java.util.*; -import java.util.stream.Collectors; - public class ColorAttribute implements ItemAttribute { public static final ColorAttribute EMPTY = new ColorAttribute(DyeColor.PURPLE); diff --git a/src/main/java/com/simibubi/create/content/logistics/packet/FunnelFlapPacket.java b/src/main/java/com/simibubi/create/content/logistics/packet/FunnelFlapPacket.java index 7f4a67d15..4118817ff 100644 --- a/src/main/java/com/simibubi/create/content/logistics/packet/FunnelFlapPacket.java +++ b/src/main/java/com/simibubi/create/content/logistics/packet/FunnelFlapPacket.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.logistics.packet; import com.simibubi.create.content.logistics.block.funnel.FunnelTileEntity; import com.simibubi.create.foundation.networking.TileEntityDataPacket; + import net.minecraft.network.PacketBuffer; public class FunnelFlapPacket extends TileEntityDataPacket { diff --git a/src/main/java/com/simibubi/create/content/logistics/packet/TunnelFlapPacket.java b/src/main/java/com/simibubi/create/content/logistics/packet/TunnelFlapPacket.java index 4661ad804..0fcf32b4d 100644 --- a/src/main/java/com/simibubi/create/content/logistics/packet/TunnelFlapPacket.java +++ b/src/main/java/com/simibubi/create/content/logistics/packet/TunnelFlapPacket.java @@ -1,14 +1,16 @@ package com.simibubi.create.content.logistics.packet; -import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelTileEntity; -import com.simibubi.create.foundation.networking.TileEntityDataPacket; -import net.minecraft.network.PacketBuffer; -import net.minecraft.util.Direction; -import org.apache.commons.lang3.tuple.Pair; - import java.util.ArrayList; import java.util.List; +import org.apache.commons.lang3.tuple.Pair; + +import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelTileEntity; +import com.simibubi.create.foundation.networking.TileEntityDataPacket; + +import net.minecraft.network.PacketBuffer; +import net.minecraft.util.Direction; + public class TunnelFlapPacket extends TileEntityDataPacket { private List> flaps; diff --git a/src/main/java/com/simibubi/create/content/schematics/ClientSchematicLoader.java b/src/main/java/com/simibubi/create/content/schematics/ClientSchematicLoader.java index 847f69773..9ddd18729 100644 --- a/src/main/java/com/simibubi/create/content/schematics/ClientSchematicLoader.java +++ b/src/main/java/com/simibubi/create/content/schematics/ClientSchematicLoader.java @@ -1,11 +1,26 @@ package com.simibubi.create.content.schematics; +import java.io.IOException; +import java.io.InputStream; +import java.nio.file.Files; +import java.nio.file.NoSuchFileException; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.HashSet; +import java.util.List; +import java.util.Map; + import com.simibubi.create.Create; import com.simibubi.create.content.schematics.packet.SchematicUploadPacket; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.utility.FilesHelper; import com.simibubi.create.foundation.utility.Lang; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.util.text.ITextComponent; @@ -13,11 +28,6 @@ import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import java.io.IOException; -import java.io.InputStream; -import java.nio.file.*; -import java.util.*; - @OnlyIn(Dist.CLIENT) public class ClientSchematicLoader { diff --git a/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java b/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java index a5f9cee52..67c013348 100644 --- a/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java +++ b/src/main/java/com/simibubi/create/content/schematics/ItemRequirement.java @@ -4,8 +4,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import com.simibubi.create.foundation.utility.BlockHelper; - import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; diff --git a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java index e0dc217f2..632bf6870 100644 --- a/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java +++ b/src/main/java/com/simibubi/create/content/schematics/SchematicWorld.java @@ -1,5 +1,14 @@ package com.simibubi.create.content.schematics; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; +import java.util.function.Predicate; +import java.util.stream.Stream; + import com.simibubi.create.Create; import com.simibubi.create.foundation.utility.worldWrappers.WrappedChunkProvider; import com.simibubi.create.foundation.utility.worldWrappers.WrappedWorld; @@ -20,15 +29,15 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MutableBoundingBox; -import net.minecraft.world.*; +import net.minecraft.world.EmptyTickList; +import net.minecraft.world.IServerWorld; +import net.minecraft.world.ITickList; +import net.minecraft.world.LightType; +import net.minecraft.world.World; import net.minecraft.world.biome.Biome; import net.minecraft.world.biome.BiomeRegistry; import net.minecraft.world.server.ServerWorld; -import java.util.*; -import java.util.function.Predicate; -import java.util.stream.Stream; - public class SchematicWorld extends WrappedWorld implements IServerWorld { protected Map blocks; diff --git a/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java b/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java index f1a956435..1e123ebfb 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/LaunchedItem.java @@ -6,7 +6,6 @@ import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.relays.belt.BeltBlock; import com.simibubi.create.content.contraptions.relays.belt.BeltPart; import com.simibubi.create.content.contraptions.relays.belt.item.BeltConnectorItem; -import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.content.contraptions.relays.elementary.AbstractShaftBlock; import com.simibubi.create.foundation.utility.BlockHelper; diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java index 6ad481db5..cd21994a5 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicTableScreen.java @@ -1,5 +1,12 @@ package com.simibubi.create.content.schematics.block; +import static com.simibubi.create.foundation.gui.AllGuiTextures.SCHEMATIC_TABLE; +import static com.simibubi.create.foundation.gui.AllGuiTextures.SCHEMATIC_TABLE_PROGRESS; + +import java.nio.file.Paths; +import java.util.ArrayList; +import java.util.List; + import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlocks; @@ -14,6 +21,7 @@ import com.simibubi.create.foundation.gui.widgets.Label; import com.simibubi.create.foundation.gui.widgets.ScrollInput; import com.simibubi.create.foundation.gui.widgets.SelectionScrollInput; import com.simibubi.create.foundation.utility.Lang; + import net.minecraft.client.gui.IHasContainer; import net.minecraft.client.renderer.Rectangle2d; import net.minecraft.entity.player.PlayerInventory; @@ -23,13 +31,6 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; -import java.nio.file.Paths; -import java.util.ArrayList; -import java.util.List; - -import static com.simibubi.create.foundation.gui.AllGuiTextures.SCHEMATIC_TABLE; -import static com.simibubi.create.foundation.gui.AllGuiTextures.SCHEMATIC_TABLE_PROGRESS; - public class SchematicTableScreen extends AbstractSimiContainerScreen implements IHasContainer { diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonBlock.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonBlock.java index b04e43335..75aa22c64 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonBlock.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonBlock.java @@ -4,6 +4,7 @@ import com.simibubi.create.AllShapes; import com.simibubi.create.AllTileEntities; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.item.ItemHelper; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.material.PushReaction; diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonInstance.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonInstance.java index bb9b77e26..b91ca03a0 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonInstance.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonInstance.java @@ -2,10 +2,15 @@ package com.simibubi.create.content.schematics.block; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.foundation.render.backend.instancing.*; import com.simibubi.create.foundation.render.backend.core.ModelData; +import com.simibubi.create.foundation.render.backend.instancing.IDynamicInstance; +import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; +import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; +import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial; +import com.simibubi.create.foundation.render.backend.instancing.TileEntityInstance; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.MatrixStacker; + import net.minecraft.util.Direction; public class SchematicannonInstance extends TileEntityInstance implements IDynamicInstance { diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonRenderer.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonRenderer.java index b1b66da25..15cc811c8 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonRenderer.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonRenderer.java @@ -1,5 +1,7 @@ package com.simibubi.create.content.schematics.block; +import java.util.Random; + import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.AllBlockPartials; @@ -8,6 +10,7 @@ import com.simibubi.create.content.schematics.block.LaunchedItem.ForEntity; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.tileEntity.renderer.SafeTileEntityRenderer; + import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -23,8 +26,6 @@ import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3f; import net.minecraftforge.client.model.data.EmptyModelData; -import java.util.Random; - public class SchematicannonRenderer extends SafeTileEntityRenderer { public SchematicannonRenderer(TileEntityRendererDispatcher dispatcher) { diff --git a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java index e06bbfec1..f8983ad48 100644 --- a/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java +++ b/src/main/java/com/simibubi/create/content/schematics/block/SchematicannonTileEntity.java @@ -1,5 +1,12 @@ package com.simibubi.create.content.schematics.block; +import java.util.LinkedHashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.stream.Collectors; + +import javax.annotation.Nullable; + import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.AllSoundEvents; @@ -24,6 +31,7 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.NBTProcessors; + import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.PistonHeadBlock; @@ -63,12 +71,6 @@ import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.ItemHandlerHelper; import net.minecraftforge.items.wrapper.EmptyHandler; -import javax.annotation.Nullable; -import java.util.LinkedHashSet; -import java.util.LinkedList; -import java.util.List; -import java.util.stream.Collectors; - public class SchematicannonTileEntity extends SmartTileEntity implements INamedContainerProvider, IInstanceRendered { public static final int NEIGHBOUR_CHECKING = 100; diff --git a/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java b/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java index 581a00cd1..a585b429d 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/SchematicRenderer.java @@ -1,11 +1,21 @@ package com.simibubi.create.content.schematics.client; +import java.util.HashMap; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Map; +import java.util.Set; + +import org.lwjgl.opengl.GL11; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.content.schematics.SchematicWorld; import com.simibubi.create.foundation.render.SuperByteBuffer; import com.simibubi.create.foundation.render.TileEntityRenderHelper; import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer; import com.simibubi.create.foundation.utility.MatrixStacker; + import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.BlockRendererDispatcher; @@ -17,9 +27,6 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.model.data.EmptyModelData; -import org.lwjgl.opengl.GL11; - -import java.util.*; public class SchematicRenderer { diff --git a/src/main/java/com/simibubi/create/content/schematics/client/tools/DeployTool.java b/src/main/java/com/simibubi/create/content/schematics/client/tools/DeployTool.java index 449ef1b7d..b873d5f78 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/tools/DeployTool.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/tools/DeployTool.java @@ -7,6 +7,7 @@ import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.outliner.AABBOutline; + import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTUtil; import net.minecraft.util.math.AxisAlignedBB; diff --git a/src/main/java/com/simibubi/create/content/schematics/client/tools/FlipTool.java b/src/main/java/com/simibubi/create/content/schematics/client/tools/FlipTool.java index efacf8ba2..dc8733e61 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/tools/FlipTool.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/tools/FlipTool.java @@ -5,6 +5,7 @@ import com.simibubi.create.AllSpecialTextures; import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.outliner.AABBOutline; + import net.minecraft.util.Direction; import net.minecraft.util.Direction.AxisDirection; import net.minecraft.util.math.AxisAlignedBB; diff --git a/src/main/java/com/simibubi/create/content/schematics/client/tools/RotateTool.java b/src/main/java/com/simibubi/create/content/schematics/client/tools/RotateTool.java index 4cd4859f2..2e57dd830 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/tools/RotateTool.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/tools/RotateTool.java @@ -4,6 +4,7 @@ import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.outliner.LineOutline; + import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.vector.Vector3d; diff --git a/src/main/java/com/simibubi/create/content/schematics/client/tools/SchematicToolBase.java b/src/main/java/com/simibubi/create/content/schematics/client/tools/SchematicToolBase.java index 0e8ca4ef2..0a60b3433 100644 --- a/src/main/java/com/simibubi/create/content/schematics/client/tools/SchematicToolBase.java +++ b/src/main/java/com/simibubi/create/content/schematics/client/tools/SchematicToolBase.java @@ -1,5 +1,8 @@ package com.simibubi.create.content.schematics.client.tools; +import java.util.Arrays; +import java.util.List; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllKeys; import com.simibubi.create.AllSpecialTextures; @@ -12,6 +15,7 @@ import com.simibubi.create.foundation.utility.RaycastHelper; import com.simibubi.create.foundation.utility.RaycastHelper.PredicateTraceResult; import com.simibubi.create.foundation.utility.VecHelper; import com.simibubi.create.foundation.utility.outliner.AABBOutline; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -22,9 +26,6 @@ import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult.Type; import net.minecraft.util.math.vector.Vector3d; -import java.util.Arrays; -import java.util.List; - public abstract class SchematicToolBase implements ISchematicTool { protected SchematicHandler schematicHandler; diff --git a/src/main/java/com/simibubi/create/events/ClientEvents.java b/src/main/java/com/simibubi/create/events/ClientEvents.java index 61200ad51..25754d8c4 100644 --- a/src/main/java/com/simibubi/create/events/ClientEvents.java +++ b/src/main/java/com/simibubi/create/events/ClientEvents.java @@ -106,7 +106,7 @@ public class ClientEvents { CouplingPhysics.tick(world); PonderTooltipHandler.tick(); - //ScreenOpener.tick(); + // ScreenOpener.tick(); ServerSpeedProvider.clientTick(); BeltConnectorHandler.tick(); FilteringRenderer.tick(); @@ -121,7 +121,7 @@ public class ClientEvents { KineticDebugger.tick(); ZapperRenderHandler.tick(); ExtendoGripRenderHandler.tick(); - // CollisionDebugger.tick(); + // CollisionDebugger.tick(); ArmInteractionPointHandler.tick(); EjectorTargetHandler.tick(); PlacementHelpers.tick(); @@ -147,10 +147,10 @@ public class ClientEvents { } /* - i was getting nullPointers when trying to call this during client setup, - so i assume minecraft's language manager isn't yet fully loaded at that time. - not sure where else to call this tho :S - */ + * i was getting nullPointers when trying to call this during client setup, + * so i assume minecraft's language manager isn't yet fully loaded at that time. + * not sure where else to call this tho :S + */ IHaveGoggleInformation.numberFormat.update(); } @@ -179,7 +179,7 @@ public class ClientEvents { CreateClient.ghostBlocks.renderAll(ms, buffer); CreateClient.outliner.renderOutlines(ms, buffer, pt); - // LightVolumeDebugger.render(ms, buffer); + // LightVolumeDebugger.render(ms, buffer); buffer.draw(); RenderSystem.enableCull(); @@ -199,7 +199,8 @@ public class ClientEvents { .getEntityVertexConsumers(), 0xF000F0, OverlayTexture.DEFAULT_UV, event.getPartialTicks()); } - public static void onRenderHotbar(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay, float partialTicks) { + public static void onRenderHotbar(MatrixStack ms, IRenderTypeBuffer buffer, int light, int overlay, + float partialTicks) { CreateClient.schematicHandler.renderOverlay(ms, buffer, light, overlay, partialTicks); } @@ -229,7 +230,7 @@ public class ClientEvents { .addInformation(toolTip); itemTooltip.addAll(0, toolTip); } - + if (stack.getItem() instanceof BlockItem) { BlockItem item = (BlockItem) stack.getItem(); if (item.getBlock() instanceof IRotate || item.getBlock() instanceof EngineBlock) { diff --git a/src/main/java/com/simibubi/create/events/CommonEvents.java b/src/main/java/com/simibubi/create/events/CommonEvents.java index 8b88e563d..dfcb926a4 100644 --- a/src/main/java/com/simibubi/create/events/CommonEvents.java +++ b/src/main/java/com/simibubi/create/events/CommonEvents.java @@ -17,6 +17,7 @@ import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.ServerSpeedProvider; import com.simibubi.create.foundation.utility.WorldAttached; import com.simibubi.create.foundation.utility.recipe.RecipeFinder; + import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; diff --git a/src/main/java/com/simibubi/create/events/InputEvents.java b/src/main/java/com/simibubi/create/events/InputEvents.java index 260c86182..7447b0a94 100644 --- a/src/main/java/com/simibubi/create/events/InputEvents.java +++ b/src/main/java/com/simibubi/create/events/InputEvents.java @@ -14,7 +14,7 @@ import net.minecraftforge.fml.common.Mod.EventBusSubscriber; @EventBusSubscriber(value = Dist.CLIENT) public class InputEvents { - + @SubscribeEvent public static void onKeyInput(KeyInputEvent event) { int key = event.getKey(); diff --git a/src/main/java/com/simibubi/create/foundation/ResourceReloadHandler.java b/src/main/java/com/simibubi/create/foundation/ResourceReloadHandler.java index 0bb2d6f73..3203fa4d4 100644 --- a/src/main/java/com/simibubi/create/foundation/ResourceReloadHandler.java +++ b/src/main/java/com/simibubi/create/foundation/ResourceReloadHandler.java @@ -3,6 +3,7 @@ package com.simibubi.create.foundation; import com.simibubi.create.CreateClient; import com.simibubi.create.content.contraptions.goggles.IHaveGoggleInformation; import com.simibubi.create.foundation.block.render.SpriteShifter; + import net.minecraft.client.resources.ReloadListener; import net.minecraft.profiler.IProfiler; import net.minecraft.resources.IResourceManager; diff --git a/src/main/java/com/simibubi/create/foundation/advancement/AllAdvancements.java b/src/main/java/com/simibubi/create/foundation/advancement/AllAdvancements.java index 013a6282e..def845bdb 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/AllAdvancements.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/AllAdvancements.java @@ -6,10 +6,6 @@ import java.util.Set; import java.util.function.Consumer; import java.util.function.Supplier; -import com.simibubi.create.content.logistics.InWorldProcessing; -import net.minecraft.fluid.FlowingFluid; -import net.minecraft.fluid.Fluid; -import net.minecraft.fluid.Fluids; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; @@ -23,6 +19,7 @@ import com.simibubi.create.Create; import com.simibubi.create.content.curiosities.zapper.blockzapper.BlockzapperItem; import com.simibubi.create.content.curiosities.zapper.blockzapper.BlockzapperItem.ComponentTier; import com.simibubi.create.content.curiosities.zapper.blockzapper.BlockzapperItem.Components; +import com.simibubi.create.content.logistics.InWorldProcessing; import net.minecraft.advancements.Advancement; import net.minecraft.advancements.Advancement.Builder; @@ -34,6 +31,9 @@ import net.minecraft.block.Blocks; import net.minecraft.data.DataGenerator; import net.minecraft.data.DirectoryCache; import net.minecraft.data.IDataProvider; +import net.minecraft.fluid.FlowingFluid; +import net.minecraft.fluid.Fluid; +import net.minecraft.fluid.Fluids; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.util.IItemProvider; @@ -63,12 +63,13 @@ public class AllAdvancements implements IDataProvider { kineticsBranch(t, andesite_alloy); - Advancement aesthetics = - advancement("aesthetics", AllBlocks.WOODEN_BRACKET.get(), TaskType.NORMAL).withParent(andesite_alloy) - .withCriterion("0", AllTriggers.BRACKET_APPLY_TRIGGER.forEntries(AllBlocks.SHAFT.get())) - .withCriterion("1", AllTriggers.BRACKET_APPLY_TRIGGER.forEntries(AllBlocks.COGWHEEL.get(), AllBlocks.LARGE_COGWHEEL.get())) - .withCriterion("2", AllTriggers.BRACKET_APPLY_TRIGGER.forEntries(AllBlocks.FLUID_PIPE.get())) - .register(t, id + ":aesthetics"); + Advancement aesthetics = advancement("aesthetics", AllBlocks.WOODEN_BRACKET.get(), TaskType.NORMAL) + .withParent(andesite_alloy) + .withCriterion("0", AllTriggers.BRACKET_APPLY_TRIGGER.forEntries(AllBlocks.SHAFT.get())) + .withCriterion("1", + AllTriggers.BRACKET_APPLY_TRIGGER.forEntries(AllBlocks.COGWHEEL.get(), AllBlocks.LARGE_COGWHEEL.get())) + .withCriterion("2", AllTriggers.BRACKET_APPLY_TRIGGER.forEntries(AllBlocks.FLUID_PIPE.get())) + .register(t, id + ":aesthetics"); Advancement reinforced = advancement("reinforced", AllBlocks.ANDESITE_ENCASED_SHAFT.get(), TaskType.NORMAL).withParent(aesthetics) diff --git a/src/main/java/com/simibubi/create/foundation/advancement/AllTriggers.java b/src/main/java/com/simibubi/create/foundation/advancement/AllTriggers.java index b5da3bc49..1e0c67527 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/AllTriggers.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/AllTriggers.java @@ -1,6 +1,11 @@ package com.simibubi.create.foundation.advancement; +import java.util.LinkedList; +import java.util.List; +import java.util.function.Predicate; + import com.simibubi.create.content.logistics.InWorldProcessing; + import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.block.Block; import net.minecraft.entity.player.PlayerEntity; @@ -11,61 +16,35 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IWorld; import net.minecraftforge.registries.ForgeRegistries; -import java.util.LinkedList; -import java.util.List; -import java.util.function.Predicate; - public class AllTriggers { private static final List> triggers = new LinkedList<>(); - public static final StringSerializableTrigger INFINITE_FLUID = add(new RegistryTrigger<>("infinite_fluid", ForgeRegistries.FLUIDS)); - public static final StringSerializableTrigger BRACKET_APPLY_TRIGGER = add(new RegistryTrigger<>("bracket_apply", ForgeRegistries.BLOCKS)); - public static final StringSerializableTrigger FAN_PROCESSING = add(new EnumTrigger<>("fan_processing", InWorldProcessing.Type.class)); + public static final StringSerializableTrigger INFINITE_FLUID = + add(new RegistryTrigger<>("infinite_fluid", ForgeRegistries.FLUIDS)); + public static final StringSerializableTrigger BRACKET_APPLY_TRIGGER = + add(new RegistryTrigger<>("bracket_apply", ForgeRegistries.BLOCKS)); + public static final StringSerializableTrigger FAN_PROCESSING = + add(new EnumTrigger<>("fan_processing", InWorldProcessing.Type.class)); - public static final SimpleTrigger - ROTATION = simple("rotation"), - OVERSTRESSED = simple("overstressed"), - SHIFTING_GEARS = simple("shifting_gears"), - CONNECT_BELT = simple("connect_belt"), - BONK = simple("bonk"), - WATER_WHEEL = simple("water_wheel"), - LAVA_WHEEL = simple("lava_wheel"), - CHOCOLATE_WHEEL = simple("chocolate_wheel"), - DEPLOYER_BOOP = simple("deployer"), - SPEED_READ = simple("speed_read"), - BASIN_THROW = simple("basin"), - PRESS_COMPACT = simple("compact"), - UPGRADED_ZAPPER = simple("upgraded_zapper"), - EXTENDO = simple("extendo"), - GIGA_EXTENDO = simple("giga_extendo"), - MECHANICAL_ARM = simple("mechanical_arm"), - MUSICAL_ARM = simple("musical_arm"), - CUCKOO = simple("cuckoo"), - CASING_SHAFT = simple("casing_shaft"), - CASING_BELT = simple("casing_belt"), - CASING_PIPE = simple("casing_pipe"), - WINDMILL = simple("windmill"), - MAXED_WINDMILL = simple("maxed_windmill"), - PLACE_TUNNEL = simple("place_tunnel"), - CONNECT_TUNNEL = simple("connect_tunnel"), - UPWARD_CHUTE = simple("upward_chute"), - BELT_FUNNEL = simple("belt_funnel"), - BELT_FUNNEL_KISS = simple("belt_funnel_kiss"), - CLOCKWORK_BEARING = simple("clockwork_bearing"), - ARM_MANY_TARGETS = simple("arm_many_targets"), - ARM_BLAZE_BURNER = simple("arm_blaze_burner"), - FLYWHEEL = simple("flywheel"), - OVERSTRESS_FLYWHEEL = simple("overstress_flywheel"), - ITEM_DRAIN = simple("item_drain"), - CHAINED_ITEM_DRAIN = simple("chained_item_drain"), - SPOUT = simple("spout"), - SPOUT_POTION = simple("spout_potion"), - GLASS_PIPE = simple("glass_pipe"), - PIPE_COLLISION = simple("pipe_collision"), - PIPE_SPILL = simple("pipe_spill"), - HOSE_PULLEY = simple("hose_pulley"), - MIXER_MIX = simple("mixer"); + public static final SimpleTrigger ROTATION = simple("rotation"), OVERSTRESSED = simple("overstressed"), + SHIFTING_GEARS = simple("shifting_gears"), CONNECT_BELT = simple("connect_belt"), BONK = simple("bonk"), + WATER_WHEEL = simple("water_wheel"), LAVA_WHEEL = simple("lava_wheel"), + CHOCOLATE_WHEEL = simple("chocolate_wheel"), DEPLOYER_BOOP = simple("deployer"), + SPEED_READ = simple("speed_read"), BASIN_THROW = simple("basin"), PRESS_COMPACT = simple("compact"), + UPGRADED_ZAPPER = simple("upgraded_zapper"), EXTENDO = simple("extendo"), GIGA_EXTENDO = simple("giga_extendo"), + MECHANICAL_ARM = simple("mechanical_arm"), MUSICAL_ARM = simple("musical_arm"), CUCKOO = simple("cuckoo"), + CASING_SHAFT = simple("casing_shaft"), CASING_BELT = simple("casing_belt"), CASING_PIPE = simple("casing_pipe"), + WINDMILL = simple("windmill"), MAXED_WINDMILL = simple("maxed_windmill"), PLACE_TUNNEL = simple("place_tunnel"), + CONNECT_TUNNEL = simple("connect_tunnel"), UPWARD_CHUTE = simple("upward_chute"), + BELT_FUNNEL = simple("belt_funnel"), BELT_FUNNEL_KISS = simple("belt_funnel_kiss"), + CLOCKWORK_BEARING = simple("clockwork_bearing"), ARM_MANY_TARGETS = simple("arm_many_targets"), + ARM_BLAZE_BURNER = simple("arm_blaze_burner"), FLYWHEEL = simple("flywheel"), + OVERSTRESS_FLYWHEEL = simple("overstress_flywheel"), ITEM_DRAIN = simple("item_drain"), + CHAINED_ITEM_DRAIN = simple("chained_item_drain"), SPOUT = simple("spout"), + SPOUT_POTION = simple("spout_potion"), GLASS_PIPE = simple("glass_pipe"), + PIPE_COLLISION = simple("pipe_collision"), PIPE_SPILL = simple("pipe_spill"), + HOSE_PULLEY = simple("hose_pulley"), MIXER_MIX = simple("mixer"); private static SimpleTrigger simple(String id) { return add(new SimpleTrigger(id)); @@ -90,13 +69,15 @@ public class AllTriggers { } public static void triggerForNearbyPlayers(ITriggerable trigger, IWorld world, BlockPos pos, int range, - Predicate playerFilter) { + Predicate playerFilter) { if (world == null) return; if (world.isRemote()) return; List players = getPlayersInRange(world, pos, range); - players.stream().filter(playerFilter).forEach(trigger::trigger); + players.stream() + .filter(playerFilter) + .forEach(trigger::trigger); } public static List getPlayersInRange(IWorld world, BlockPos pos, int range) { diff --git a/src/main/java/com/simibubi/create/foundation/advancement/CriterionTriggerBase.java b/src/main/java/com/simibubi/create/foundation/advancement/CriterionTriggerBase.java index 4f6eaaf1b..c1acd07f4 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/CriterionTriggerBase.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/CriterionTriggerBase.java @@ -7,6 +7,9 @@ import java.util.Map; import java.util.Set; import java.util.function.Supplier; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + import com.google.common.collect.Maps; import com.simibubi.create.Create; @@ -18,9 +21,6 @@ import net.minecraft.advancements.criterion.EntityPredicate; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.util.ResourceLocation; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; - @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public abstract class CriterionTriggerBase implements ICriterionTrigger { @@ -42,9 +42,9 @@ public abstract class CriterionTriggerBase listener) { Set> playerListeners = this.listeners.get(playerAdvancementsIn); - if (playerListeners != null){ + if (playerListeners != null) { playerListeners.remove(listener); - if (playerListeners.isEmpty()){ + if (playerListeners.isEmpty()) { this.listeners.remove(playerAdvancementsIn); } } @@ -60,15 +60,15 @@ public abstract class CriterionTriggerBase> suppliers){ + protected void trigger(ServerPlayerEntity player, @Nullable List> suppliers) { PlayerAdvancements playerAdvancements = player.getAdvancements(); Set> playerListeners = this.listeners.get(playerAdvancements); - if (playerListeners != null){ + if (playerListeners != null) { List> list = new LinkedList<>(); - for (Listener listener : - playerListeners) { - if (listener.getCriterionInstance().test(suppliers)) { + for (Listener listener : playerListeners) { + if (listener.getCriterionInstance() + .test(suppliers)) { list.add(listener); } } @@ -87,5 +87,4 @@ public abstract class CriterionTriggerBase> suppliers); } - } diff --git a/src/main/java/com/simibubi/create/foundation/advancement/EnumTrigger.java b/src/main/java/com/simibubi/create/foundation/advancement/EnumTrigger.java index ed3952658..4450a49c8 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/EnumTrigger.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/EnumTrigger.java @@ -1,10 +1,10 @@ package com.simibubi.create.foundation.advancement; -import mcp.MethodsReturnNonnullByDefault; - import javax.annotation.Nullable; import javax.annotation.ParametersAreNonnullByDefault; +import mcp.MethodsReturnNonnullByDefault; + @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class EnumTrigger> extends StringSerializableTrigger { diff --git a/src/main/java/com/simibubi/create/foundation/advancement/ITriggerable.java b/src/main/java/com/simibubi/create/foundation/advancement/ITriggerable.java index 3356815d2..2bb7d2563 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/ITriggerable.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/ITriggerable.java @@ -3,7 +3,7 @@ package com.simibubi.create.foundation.advancement; import net.minecraft.entity.player.ServerPlayerEntity; public interface ITriggerable { - + public void trigger(ServerPlayerEntity player); } diff --git a/src/main/java/com/simibubi/create/foundation/advancement/RegistryTrigger.java b/src/main/java/com/simibubi/create/foundation/advancement/RegistryTrigger.java index 9a57c528e..a87c9d0e0 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/RegistryTrigger.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/RegistryTrigger.java @@ -1,13 +1,13 @@ package com.simibubi.create.foundation.advancement; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + import mcp.MethodsReturnNonnullByDefault; import net.minecraft.util.ResourceLocation; import net.minecraftforge.registries.IForgeRegistry; import net.minecraftforge.registries.IForgeRegistryEntry; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; - @ParametersAreNonnullByDefault @MethodsReturnNonnullByDefault public class RegistryTrigger> extends StringSerializableTrigger { diff --git a/src/main/java/com/simibubi/create/foundation/advancement/SimpleTrigger.java b/src/main/java/com/simibubi/create/foundation/advancement/SimpleTrigger.java index 28c71356b..7713bf39d 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/SimpleTrigger.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/SimpleTrigger.java @@ -3,17 +3,17 @@ package com.simibubi.create.foundation.advancement; import java.util.List; import java.util.function.Supplier; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + import com.google.gson.JsonObject; -import net.minecraft.advancements.criterion.EntityPredicate; import mcp.MethodsReturnNonnullByDefault; +import net.minecraft.advancements.criterion.EntityPredicate; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.loot.ConditionArrayParser; import net.minecraft.util.ResourceLocation; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; - @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public class SimpleTrigger extends CriterionTriggerBase implements ITriggerable { @@ -27,10 +27,10 @@ public class SimpleTrigger extends CriterionTriggerBase return new Instance(getId()); } - public void trigger(ServerPlayerEntity player){ + public void trigger(ServerPlayerEntity player) { super.trigger(player, null); } - + public Instance instance() { return new Instance(getId()); } diff --git a/src/main/java/com/simibubi/create/foundation/advancement/StringSerializableTrigger.java b/src/main/java/com/simibubi/create/foundation/advancement/StringSerializableTrigger.java index a52a83d6b..125e4772d 100644 --- a/src/main/java/com/simibubi/create/foundation/advancement/StringSerializableTrigger.java +++ b/src/main/java/com/simibubi/create/foundation/advancement/StringSerializableTrigger.java @@ -1,18 +1,5 @@ package com.simibubi.create.foundation.advancement; -import com.google.common.collect.Sets; -import com.google.gson.JsonArray; -import com.google.gson.JsonElement; -import com.google.gson.JsonObject; -import com.google.gson.JsonSyntaxException; -import mcp.MethodsReturnNonnullByDefault; -import net.minecraft.advancements.criterion.EntityPredicate; -import net.minecraft.entity.player.ServerPlayerEntity; -import net.minecraft.loot.ConditionArrayParser; -import net.minecraft.loot.ConditionArraySerializer; - -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; import java.util.Collections; import java.util.List; import java.util.Set; @@ -20,6 +7,21 @@ import java.util.function.Supplier; import java.util.stream.Collectors; import java.util.stream.StreamSupport; +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + +import com.google.common.collect.Sets; +import com.google.gson.JsonArray; +import com.google.gson.JsonElement; +import com.google.gson.JsonObject; +import com.google.gson.JsonSyntaxException; + +import mcp.MethodsReturnNonnullByDefault; +import net.minecraft.advancements.criterion.EntityPredicate; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.loot.ConditionArrayParser; +import net.minecraft.loot.ConditionArraySerializer; + @MethodsReturnNonnullByDefault @ParametersAreNonnullByDefault public abstract class StringSerializableTrigger extends CriterionTriggerBase> { @@ -49,14 +51,15 @@ public abstract class StringSerializableTrigger extends CriterionTriggerBase< public Instance conditionsFromJson(JsonObject json, ConditionArrayParser context) { if (json.has(getJsonKey())) { JsonArray elements = json.getAsJsonArray(getJsonKey()); - return new Instance<>(this, - StreamSupport.stream(elements.spliterator(), false).map(JsonElement::getAsString) - .map(key -> { - T entry = getValue(key); - if (entry == null) - throw new JsonSyntaxException("Unknown entry '" + key + "'"); - return entry; - }).collect(Collectors.toSet())); + return new Instance<>(this, StreamSupport.stream(elements.spliterator(), false) + .map(JsonElement::getAsString) + .map(key -> { + T entry = getValue(key); + if (entry == null) + throw new JsonSyntaxException("Unknown entry '" + key + "'"); + return entry; + }) + .collect(Collectors.toSet())); } return new Instance<>(this, null); } @@ -83,7 +86,8 @@ public abstract class StringSerializableTrigger extends CriterionTriggerBase< protected boolean test(@Nullable List> suppliers) { if (entries == null || suppliers == null || suppliers.isEmpty()) return false; - return entries.contains(suppliers.get(0).get()); + return entries.contains(suppliers.get(0) + .get()); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/block/IBlockVertexColor.java b/src/main/java/com/simibubi/create/foundation/block/IBlockVertexColor.java index 0a9a9d281..1a4f91dae 100644 --- a/src/main/java/com/simibubi/create/foundation/block/IBlockVertexColor.java +++ b/src/main/java/com/simibubi/create/foundation/block/IBlockVertexColor.java @@ -4,5 +4,5 @@ package com.simibubi.create.foundation.block; public interface IBlockVertexColor { public int getColor(float x, float y, float z); - + } diff --git a/src/main/java/com/simibubi/create/foundation/block/ITE.java b/src/main/java/com/simibubi/create/foundation/block/ITE.java index 42fbcbfe7..8054544e8 100644 --- a/src/main/java/com/simibubi/create/foundation/block/ITE.java +++ b/src/main/java/com/simibubi/create/foundation/block/ITE.java @@ -20,13 +20,15 @@ public interface ITE { default void withTileEntityDo(IBlockReader world, BlockPos pos, Consumer action) { try { action.accept(getTileEntity(world, pos)); - } catch (TileEntityException e) {} + } catch (TileEntityException e) { + } } - + default Optional getTileEntityOptional(IBlockReader world, BlockPos pos) { try { return Optional.of(getTileEntity(world, pos)); - } catch (TileEntityException e) {} + } catch (TileEntityException e) { + } return Optional.empty(); } @@ -61,7 +63,7 @@ public interface ITE { static String makeBaseMessage(IWorld world, BlockPos pos, Class expectedTeClass) { return String.format("[%s] @(%d, %d, %d), expecting a %s", getDimensionName(world), pos.getX(), pos.getY(), - pos.getZ(), expectedTeClass.getSimpleName()); + pos.getZ(), expectedTeClass.getSimpleName()); } static String getDimensionName(IWorld world) { @@ -89,7 +91,7 @@ public interface ITE { public InvalidTileEntityException(IWorld world, BlockPos pos, Class expectedTeClass, Class foundTeClass) { super("Wrong TileEntity: " + makeBaseMessage(world, pos, expectedTeClass) + ", found " - + foundTeClass.getSimpleName()); + + foundTeClass.getSimpleName()); } } diff --git a/src/main/java/com/simibubi/create/foundation/block/ItemUseOverrides.java b/src/main/java/com/simibubi/create/foundation/block/ItemUseOverrides.java index 8aa1000f9..0337a5d08 100644 --- a/src/main/java/com/simibubi/create/foundation/block/ItemUseOverrides.java +++ b/src/main/java/com/simibubi/create/foundation/block/ItemUseOverrides.java @@ -1,7 +1,11 @@ package com.simibubi.create.foundation.block; +import java.util.HashSet; +import java.util.Set; + import com.simibubi.create.AllItems; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.util.ActionResultType; @@ -11,9 +15,6 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import java.util.HashSet; -import java.util.Set; - @Mod.EventBusSubscriber public class ItemUseOverrides { @@ -25,17 +26,23 @@ public class ItemUseOverrides { @SubscribeEvent public static void onBlockActivated(PlayerInteractEvent.RightClickBlock event) { - if (AllItems.WRENCH.isIn(event.getItemStack())) return; + if (AllItems.WRENCH.isIn(event.getItemStack())) + return; - BlockState state = event.getWorld().getBlockState(event.getPos()); - ResourceLocation id = state.getBlock().getRegistryName(); + BlockState state = event.getWorld() + .getBlockState(event.getPos()); + ResourceLocation id = state.getBlock() + .getRegistryName(); - if (!overrides.contains(id)) return; + if (!overrides.contains(id)) + return; - BlockRayTraceResult blockTrace = new BlockRayTraceResult(VecHelper.getCenterOf(event.getPos()), event.getFace(), event.getPos(), true); + BlockRayTraceResult blockTrace = + new BlockRayTraceResult(VecHelper.getCenterOf(event.getPos()), event.getFace(), event.getPos(), true); ActionResultType result = state.onUse(event.getWorld(), event.getPlayer(), event.getHand(), blockTrace); - if (!result.isAccepted()) return; + if (!result.isAccepted()) + return; event.setCanceled(true); event.setCancellationResult(result); diff --git a/src/main/java/com/simibubi/create/foundation/block/ProperDirectionalBlock.java b/src/main/java/com/simibubi/create/foundation/block/ProperDirectionalBlock.java index db0217340..c7e30cb34 100644 --- a/src/main/java/com/simibubi/create/foundation/block/ProperDirectionalBlock.java +++ b/src/main/java/com/simibubi/create/foundation/block/ProperDirectionalBlock.java @@ -17,7 +17,7 @@ public class ProperDirectionalBlock extends DirectionalBlock implements IWrencha public ProperDirectionalBlock(Properties p_i48415_1_) { super(p_i48415_1_); } - + @Override protected void fillStateContainer(Builder builder) { builder.add(FACING); @@ -40,7 +40,7 @@ public class ProperDirectionalBlock extends DirectionalBlock implements IWrencha public BlockState getStateForPlacement(BlockItemUseContext context) { return getDefaultState().with(FACING, context.getNearestLookingDirection()); } - + @Override public BlockState rotate(BlockState state, Rotation rot) { return state.with(FACING, rot.rotate(state.get(FACING))); diff --git a/src/main/java/com/simibubi/create/foundation/block/connected/ConnectedTextureBehaviour.java b/src/main/java/com/simibubi/create/foundation/block/connected/ConnectedTextureBehaviour.java index 411205def..4a373e8c2 100644 --- a/src/main/java/com/simibubi/create/foundation/block/connected/ConnectedTextureBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/block/connected/ConnectedTextureBehaviour.java @@ -1,6 +1,7 @@ package com.simibubi.create.foundation.block.connected; import com.simibubi.create.foundation.block.connected.CTSpriteShifter.CTType; + import net.minecraft.block.BlockState; import net.minecraft.util.Direction; import net.minecraft.util.Direction.Axis; diff --git a/src/main/java/com/simibubi/create/foundation/collision/ContinuousOBBCollider.java b/src/main/java/com/simibubi/create/foundation/collision/ContinuousOBBCollider.java index 0d7afc470..ae561cf1c 100644 --- a/src/main/java/com/simibubi/create/foundation/collision/ContinuousOBBCollider.java +++ b/src/main/java/com/simibubi/create/foundation/collision/ContinuousOBBCollider.java @@ -5,11 +5,10 @@ import static java.lang.Math.signum; import net.minecraft.util.math.vector.Vector3d; - public class ContinuousOBBCollider extends OBBCollider { - public static ContinuousSeparationManifold separateBBs(Vector3d cA, Vector3d cB, Vector3d eA, Vector3d eB, Matrix3d m, - Vector3d motion) { + public static ContinuousSeparationManifold separateBBs(Vector3d cA, Vector3d cB, Vector3d eA, Vector3d eB, + Matrix3d m, Vector3d motion) { ContinuousSeparationManifold mf = new ContinuousSeparationManifold(); Vector3d diff = cB.subtract(cA); @@ -116,7 +115,8 @@ public class ContinuousOBBCollider extends OBBCollider { if (isBestSeperation) { mf.axis = normalizedAxis; mf.separation = seperation; - mf.collisionPosition = normalizedAxis.scale(signum(TL) * (axisOfObjA ? -rB : -rB) - signum(seperation) * .125f); + mf.collisionPosition = + normalizedAxis.scale(signum(TL) * (axisOfObjA ? -rB : -rB) - signum(seperation) * .125f); } return false; @@ -151,7 +151,7 @@ public class ContinuousOBBCollider extends OBBCollider { public Vector3d getCollisionNormal() { return normalAxis == null ? null : createSeparationVec(normalSeparation, normalAxis); } - + public Vector3d getCollisionPosition() { return collisionPosition; } diff --git a/src/main/java/com/simibubi/create/foundation/collision/Matrix3d.java b/src/main/java/com/simibubi/create/foundation/collision/Matrix3d.java index 3e0fcae60..20cbef687 100644 --- a/src/main/java/com/simibubi/create/foundation/collision/Matrix3d.java +++ b/src/main/java/com/simibubi/create/foundation/collision/Matrix3d.java @@ -22,7 +22,7 @@ public class Matrix3d { asIdentity(); if (radians == 0) return this; - + double s = MathHelper.sin(radians); double c = MathHelper.cos(radians); m22 = m11 = c; @@ -35,7 +35,7 @@ public class Matrix3d { asIdentity(); if (radians == 0) return this; - + double s = MathHelper.sin(radians); double c = MathHelper.cos(radians); m00 = m22 = c; @@ -48,7 +48,7 @@ public class Matrix3d { asIdentity(); if (radians == 0) return this; - + double s = MathHelper.sin(radians); double c = MathHelper.cos(radians); m00 = m11 = c; @@ -122,15 +122,15 @@ public class Matrix3d { public Matrix3d copy() { return new Matrix3d().add(this); } - + float[] conversionBuffer = new float[16]; - + @OnlyIn(Dist.CLIENT) public Matrix4f getAsMatrix4f() { for (int i = 0; i < 4; i++) for (int j = 0; j < 4; j++) conversionBuffer[j * 4 + i] = i == j ? 1 : 0; - + conversionBuffer[0] = (float) m00; conversionBuffer[1] = (float) m01; conversionBuffer[2] = (float) m02; @@ -140,7 +140,7 @@ public class Matrix3d { conversionBuffer[8] = (float) m20; conversionBuffer[9] = (float) m21; conversionBuffer[10] = (float) m22; - + return new Matrix4f(conversionBuffer); } diff --git a/src/main/java/com/simibubi/create/foundation/collision/OBBCollider.java b/src/main/java/com/simibubi/create/foundation/collision/OBBCollider.java index fad7b0426..29a29474f 100644 --- a/src/main/java/com/simibubi/create/foundation/collision/OBBCollider.java +++ b/src/main/java/com/simibubi/create/foundation/collision/OBBCollider.java @@ -1,11 +1,9 @@ package com.simibubi.create.foundation.collision; -import net.minecraft.util.math.vector.Vector3d; - import static java.lang.Math.abs; import static java.lang.Math.signum; - +import net.minecraft.util.math.vector.Vector3d; public class OBBCollider { diff --git a/src/main/java/com/simibubi/create/foundation/command/AllCommands.java b/src/main/java/com/simibubi/create/foundation/command/AllCommands.java index 7e1e91774..bf6883875 100644 --- a/src/main/java/com/simibubi/create/foundation/command/AllCommands.java +++ b/src/main/java/com/simibubi/create/foundation/command/AllCommands.java @@ -1,16 +1,17 @@ package com.simibubi.create.foundation.command; +import java.util.Collections; +import java.util.function.Predicate; + import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.builder.LiteralArgumentBuilder; import com.mojang.brigadier.tree.CommandNode; import com.mojang.brigadier.tree.LiteralCommandNode; + import net.minecraft.command.CommandSource; import net.minecraft.command.Commands; import net.minecraft.entity.player.PlayerEntity; -import java.util.Collections; -import java.util.function.Predicate; - public class AllCommands { public static Predicate sourceIsPlayer = (cs) -> cs.getEntity() instanceof PlayerEntity; @@ -20,21 +21,20 @@ public class AllCommands { LiteralCommandNode util = buildUtilityCommands(); LiteralCommandNode createRoot = dispatcher.register(Commands.literal("create") - .requires(cs -> cs.hasPermissionLevel(0)) - //general purpose - .then(new ToggleExperimentalRenderingCommand().register()) - .then(new ToggleDebugCommand().register()) - .then(FabulousWarningCommand.register()) - .then(OverlayConfigCommand.register()) - .then(FixLightingCommand.register()) - .then(HighlightCommand.register()) - .then(CouplingCommand.register()) - .then(CloneCommand.register()) - .then(PonderCommand.register()) + .requires(cs -> cs.hasPermissionLevel(0)) + // general purpose + .then(new ToggleExperimentalRenderingCommand().register()) + .then(new ToggleDebugCommand().register()) + .then(FabulousWarningCommand.register()) + .then(OverlayConfigCommand.register()) + .then(FixLightingCommand.register()) + .then(HighlightCommand.register()) + .then(CouplingCommand.register()) + .then(CloneCommand.register()) + .then(PonderCommand.register()) - //utility - .then(util) - ); + // utility + .then(util)); createRoot.addChild(buildRedirect("u", util)); @@ -42,20 +42,20 @@ public class AllCommands { if (c != null) return; - dispatcher.getRoot().addChild(buildRedirect("c", createRoot)); + dispatcher.getRoot() + .addChild(buildRedirect("c", createRoot)); } - private static LiteralCommandNode buildUtilityCommands() { return Commands.literal("util") - .then(ReplaceInCommandBlocksCommand.register()) - .then(ClearBufferCacheCommand.register()) - .then(ChunkUtilCommand.register()) - .then(FlySpeedCommand.register()) - //.then(KillTPSCommand.register()) - .build(); + .then(ReplaceInCommandBlocksCommand.register()) + .then(ClearBufferCacheCommand.register()) + .then(ChunkUtilCommand.register()) + .then(FlySpeedCommand.register()) + // .then(KillTPSCommand.register()) + .build(); } @@ -72,16 +72,15 @@ public class AllCommands { * * @return the built node */ - public static LiteralCommandNode buildRedirect(final String alias, final LiteralCommandNode destination) { + public static LiteralCommandNode buildRedirect(final String alias, + final LiteralCommandNode destination) { // Redirects only work for nodes with children, but break the top argument-less command. // Manually adding the root command after setting the redirect doesn't fix it. // See https://github.com/Mojang/brigadier/issues/46). Manually clone the node instead. - LiteralArgumentBuilder builder = LiteralArgumentBuilder - .literal(alias) - .requires(destination.getRequirement()) - .forward( - destination.getRedirect(), destination.getRedirectModifier(), destination.isFork()) - .executes(destination.getCommand()); + LiteralArgumentBuilder builder = LiteralArgumentBuilder.literal(alias) + .requires(destination.getRequirement()) + .forward(destination.getRedirect(), destination.getRedirectModifier(), destination.isFork()) + .executes(destination.getCommand()); for (CommandNode child : destination.getChildren()) { builder.then(child); } diff --git a/src/main/java/com/simibubi/create/foundation/command/ChunkUtil.java b/src/main/java/com/simibubi/create/foundation/command/ChunkUtil.java index 52e687cf5..df7abeb39 100644 --- a/src/main/java/com/simibubi/create/foundation/command/ChunkUtil.java +++ b/src/main/java/com/simibubi/create/foundation/command/ChunkUtil.java @@ -17,7 +17,8 @@ import net.minecraftforge.eventbus.api.SubscribeEvent; public class ChunkUtil { private static final Logger LOGGER = LogManager.getLogger("Create/ChunkUtil"); - final EnumSet POST_FEATURES = EnumSet.of(Heightmap.Type.OCEAN_FLOOR, Heightmap.Type.WORLD_SURFACE, Heightmap.Type.MOTION_BLOCKING, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES); + final EnumSet POST_FEATURES = EnumSet.of(Heightmap.Type.OCEAN_FLOOR, Heightmap.Type.WORLD_SURFACE, + Heightmap.Type.MOTION_BLOCKING, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES); private final List markedChunks; private final List interestingChunks; @@ -29,15 +30,17 @@ public class ChunkUtil { } public void init() { - ChunkStatus.FULL = new ChunkStatus("full", ChunkStatus.HEIGHTMAPS, 0, POST_FEATURES, ChunkStatus.Type.LEVELCHUNK, - (_0, _1, _2, _3, _4, future, _6, chunk) -> future.apply(chunk), - (_0, _1, _2, _3, future, chunk) -> { - if (markedChunks.contains(chunk.getPos().asLong())) { - LOGGER.debug("trying to load unforced chunk " + chunk.getPos().toString() + ", returning chunk loading error"); - //this.reloadChunk(world.getChunkProvider(), chunk.getPos()); + ChunkStatus.FULL = + new ChunkStatus("full", ChunkStatus.HEIGHTMAPS, 0, POST_FEATURES, ChunkStatus.Type.LEVELCHUNK, + (_0, _1, _2, _3, _4, future, _6, chunk) -> future.apply(chunk), (_0, _1, _2, _3, future, chunk) -> { + if (markedChunks.contains(chunk.getPos() + .asLong())) { + LOGGER.debug("trying to load unforced chunk " + chunk.getPos() + .toString() + ", returning chunk loading error"); + // this.reloadChunk(world.getChunkProvider(), chunk.getPos()); return ChunkHolder.MISSING_CHUNK_FUTURE; } else { - //LOGGER.debug("regular, chunkStatus: " + chunk.getStatus().toString()); + // LOGGER.debug("regular, chunkStatus: " + chunk.getStatus().toString()); return future.apply(chunk); } }); @@ -81,24 +84,28 @@ public class ChunkUtil { @SubscribeEvent public void chunkUnload(ChunkEvent.Unload event) { - //LOGGER.debug("Chunk Unload: " + event.getChunk().getPos().toString()); - if (interestingChunks.contains(event.getChunk().getPos().asLong())) { - LOGGER.info("Interesting Chunk Unload: " + event.getChunk().getPos().toString()); + // LOGGER.debug("Chunk Unload: " + event.getChunk().getPos().toString()); + if (interestingChunks.contains(event.getChunk() + .getPos() + .asLong())) { + LOGGER.info("Interesting Chunk Unload: " + event.getChunk() + .getPos() + .toString()); } } @SubscribeEvent public void chunkLoad(ChunkEvent.Load event) { - //LOGGER.debug("Chunk Load: " + event.getChunk().getPos().toString()); + // LOGGER.debug("Chunk Load: " + event.getChunk().getPos().toString()); - ChunkPos pos = event.getChunk().getPos(); + ChunkPos pos = event.getChunk() + .getPos(); if (interestingChunks.contains(pos.asLong())) { LOGGER.info("Interesting Chunk Load: " + pos.toString()); if (!markedChunks.contains(pos.asLong())) interestingChunks.remove(pos.asLong()); } - } } diff --git a/src/main/java/com/simibubi/create/foundation/command/ChunkUtilCommand.java b/src/main/java/com/simibubi/create/foundation/command/ChunkUtilCommand.java index c470ea90c..4a67e3d82 100644 --- a/src/main/java/com/simibubi/create/foundation/command/ChunkUtilCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/ChunkUtilCommand.java @@ -15,53 +15,74 @@ public class ChunkUtilCommand { public static ArgumentBuilder register() { return Commands.literal("chunk") - .requires(cs -> cs.hasPermissionLevel(2)) - .then(Commands.literal("reload").then(Commands.argument("pos", ColumnPosArgument.columnPos()) - .executes(ctx -> { - //chunk reload - ColumnPos columnPos = ColumnPosArgument.fromBlockPos(ctx, "pos"); - ChunkPos chunkPos = new ChunkPos(columnPos.x >> 4, columnPos.z >> 4); - ServerChunkProvider chunkProvider = ctx.getSource().getWorld().getChunkProvider(); + .requires(cs -> cs.hasPermissionLevel(2)) + .then(Commands.literal("reload") + .then(Commands.argument("pos", ColumnPosArgument.columnPos()) + .executes(ctx -> { + // chunk reload + ColumnPos columnPos = ColumnPosArgument.fromBlockPos(ctx, "pos"); + ChunkPos chunkPos = new ChunkPos(columnPos.x >> 4, columnPos.z >> 4); + ServerChunkProvider chunkProvider = ctx.getSource() + .getWorld() + .getChunkProvider(); - boolean success = Create.chunkUtil.reloadChunk(chunkProvider, chunkPos); - - if (success) { - ctx.getSource().sendFeedback(new StringTextComponent("scheduled unload for chunk " + chunkPos.toString() + ", might need to repeat command"), true); - return 1; - } else { - ctx.getSource().sendFeedback(new StringTextComponent("unable to schedule unload, is chunk " + chunkPos.toString() + " loaded?"), true); - return 0; - } - }) - )) - .then(Commands.literal("unload").then(Commands.argument("pos", ColumnPosArgument.columnPos()) - .executes(ctx -> { - //chunk unload - ColumnPos columnPos = ColumnPosArgument.fromBlockPos(ctx, "pos"); - ChunkPos chunkPos = new ChunkPos(columnPos.x >> 4, columnPos.z >> 4); - ServerChunkProvider chunkProvider = ctx.getSource().getWorld().getChunkProvider(); - - boolean success = Create.chunkUtil.unloadChunk(chunkProvider, chunkPos); - ctx.getSource().sendFeedback(new StringTextComponent("added chunk " + chunkPos.toString() + " to unload list"), true); - - if (success) { - ctx.getSource().sendFeedback(new StringTextComponent("scheduled unload for chunk " + chunkPos.toString() + ", might need to repeat command"), true); - return 1; - } else { - ctx.getSource().sendFeedback(new StringTextComponent("unable to schedule unload, is chunk " + chunkPos.toString() + " loaded?"), true); - return 0; - } - }) - )) - .then(Commands.literal("clear") - .executes(ctx -> { - //chunk clear - int count = Create.chunkUtil.clear(ctx.getSource().getWorld().getChunkProvider()); - ctx.getSource().sendFeedback(new StringTextComponent("removed " + count + " entries from unload list"), false); + boolean success = Create.chunkUtil.reloadChunk(chunkProvider, chunkPos); + if (success) { + ctx.getSource() + .sendFeedback(new StringTextComponent("scheduled unload for chunk " + + chunkPos.toString() + ", might need to repeat command"), true); return 1; - }) - ); + } else { + ctx.getSource() + .sendFeedback( + new StringTextComponent( + "unable to schedule unload, is chunk " + chunkPos.toString() + " loaded?"), + true); + return 0; + } + }))) + .then(Commands.literal("unload") + .then(Commands.argument("pos", ColumnPosArgument.columnPos()) + .executes(ctx -> { + // chunk unload + ColumnPos columnPos = ColumnPosArgument.fromBlockPos(ctx, "pos"); + ChunkPos chunkPos = new ChunkPos(columnPos.x >> 4, columnPos.z >> 4); + ServerChunkProvider chunkProvider = ctx.getSource() + .getWorld() + .getChunkProvider(); + + boolean success = Create.chunkUtil.unloadChunk(chunkProvider, chunkPos); + ctx.getSource() + .sendFeedback( + new StringTextComponent("added chunk " + chunkPos.toString() + " to unload list"), + true); + + if (success) { + ctx.getSource() + .sendFeedback(new StringTextComponent("scheduled unload for chunk " + + chunkPos.toString() + ", might need to repeat command"), true); + return 1; + } else { + ctx.getSource() + .sendFeedback( + new StringTextComponent( + "unable to schedule unload, is chunk " + chunkPos.toString() + " loaded?"), + true); + return 0; + } + }))) + .then(Commands.literal("clear") + .executes(ctx -> { + // chunk clear + int count = Create.chunkUtil.clear(ctx.getSource() + .getWorld() + .getChunkProvider()); + ctx.getSource() + .sendFeedback(new StringTextComponent("removed " + count + " entries from unload list"), false); + + return 1; + })); } } diff --git a/src/main/java/com/simibubi/create/foundation/command/ClearBufferCacheCommand.java b/src/main/java/com/simibubi/create/foundation/command/ClearBufferCacheCommand.java index d3c5a8962..3cc35646e 100644 --- a/src/main/java/com/simibubi/create/foundation/command/ClearBufferCacheCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/ClearBufferCacheCommand.java @@ -13,11 +13,14 @@ import net.minecraftforge.fml.DistExecutor; public class ClearBufferCacheCommand { static ArgumentBuilder register() { - return Commands.literal("clearRenderBuffers").requires(cs -> cs.hasPermissionLevel(0)).executes(ctx -> { - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> ClearBufferCacheCommand::execute); - ctx.getSource().sendFeedback(new StringTextComponent("Cleared rendering buffers."), true); - return 1; - }); + return Commands.literal("clearRenderBuffers") + .requires(cs -> cs.hasPermissionLevel(0)) + .executes(ctx -> { + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> ClearBufferCacheCommand::execute); + ctx.getSource() + .sendFeedback(new StringTextComponent("Cleared rendering buffers."), true); + return 1; + }); } @OnlyIn(Dist.CLIENT) diff --git a/src/main/java/com/simibubi/create/foundation/command/CloneCommand.java b/src/main/java/com/simibubi/create/foundation/command/CloneCommand.java index 09a0193b3..5147a4bae 100644 --- a/src/main/java/com/simibubi/create/foundation/command/CloneCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/CloneCommand.java @@ -1,5 +1,7 @@ package com.simibubi.create.foundation.command; +import java.util.List; + import com.google.common.collect.Lists; import com.mojang.brigadier.Command; import com.mojang.brigadier.builder.ArgumentBuilder; @@ -7,6 +9,7 @@ import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.Dynamic2CommandExceptionType; import com.simibubi.create.content.contraptions.components.structureMovement.glue.SuperGlueEntity; import com.simibubi.create.foundation.utility.Pair; + import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.command.CommandSource; @@ -25,35 +28,37 @@ import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.gen.feature.template.Template; import net.minecraft.world.server.ServerWorld; -import java.util.List; - public class CloneCommand { - private static final Dynamic2CommandExceptionType CLONE_TOO_BIG_EXCEPTION = new Dynamic2CommandExceptionType((arg1, arg2) -> new TranslationTextComponent("commands.clone.toobig", arg1, arg2)); + private static final Dynamic2CommandExceptionType CLONE_TOO_BIG_EXCEPTION = new Dynamic2CommandExceptionType( + (arg1, arg2) -> new TranslationTextComponent("commands.clone.toobig", arg1, arg2)); public static ArgumentBuilder register() { return Commands.literal("clone") - .requires(cs -> cs.hasPermissionLevel(2)) - .then(Commands.argument("begin", BlockPosArgument.blockPos()) - .then(Commands.argument("end", BlockPosArgument.blockPos()) - .then(Commands.argument("destination", BlockPosArgument.blockPos()) - .then(Commands.literal("skipBlocks") - .executes(ctx -> doClone(ctx.getSource(), BlockPosArgument.getLoadedBlockPos(ctx, "begin"), BlockPosArgument.getLoadedBlockPos(ctx, "end"), BlockPosArgument.getLoadedBlockPos(ctx, "destination"), false)) - ) - .executes(ctx -> doClone(ctx.getSource(), BlockPosArgument.getLoadedBlockPos(ctx, "begin"), BlockPosArgument.getLoadedBlockPos(ctx, "end"), BlockPosArgument.getLoadedBlockPos(ctx, "destination"), true)) - ) - ) - ) - .executes(ctx -> { - ctx.getSource().sendFeedback(new StringTextComponent("Clones all blocks as well as super glue from the specified area to the target destination"), true); - - return Command.SINGLE_SUCCESS; - }); + .requires(cs -> cs.hasPermissionLevel(2)) + .then(Commands.argument("begin", BlockPosArgument.blockPos()) + .then(Commands.argument("end", BlockPosArgument.blockPos()) + .then(Commands.argument("destination", BlockPosArgument.blockPos()) + .then(Commands.literal("skipBlocks") + .executes(ctx -> doClone(ctx.getSource(), BlockPosArgument.getLoadedBlockPos(ctx, "begin"), + BlockPosArgument.getLoadedBlockPos(ctx, "end"), + BlockPosArgument.getLoadedBlockPos(ctx, "destination"), false))) + .executes(ctx -> doClone(ctx.getSource(), BlockPosArgument.getLoadedBlockPos(ctx, "begin"), + BlockPosArgument.getLoadedBlockPos(ctx, "end"), + BlockPosArgument.getLoadedBlockPos(ctx, "destination"), true))))) + .executes(ctx -> { + ctx.getSource() + .sendFeedback(new StringTextComponent( + "Clones all blocks as well as super glue from the specified area to the target destination"), + true); + return Command.SINGLE_SUCCESS; + }); } - private static int doClone(CommandSource source, BlockPos begin, BlockPos end, BlockPos destination, boolean cloneBlocks) throws CommandSyntaxException { + private static int doClone(CommandSource source, BlockPos begin, BlockPos end, BlockPos destination, + boolean cloneBlocks) throws CommandSyntaxException { MutableBoundingBox sourceArea = new MutableBoundingBox(begin, end); BlockPos destinationEnd = destination.add(sourceArea.getLength()); MutableBoundingBox destinationArea = new MutableBoundingBox(destination, destinationEnd); @@ -67,7 +72,8 @@ public class CloneCommand { if (!world.isAreaLoaded(begin, end) || !world.isAreaLoaded(destination, destinationEnd)) throw BlockPosArgument.POS_UNLOADED.create(); - BlockPos diffToTarget = new BlockPos(destinationArea.minX - sourceArea.minX, destinationArea.minY - sourceArea.minY, destinationArea.minZ - sourceArea.minZ); + BlockPos diffToTarget = new BlockPos(destinationArea.minX - sourceArea.minX, + destinationArea.minY - sourceArea.minY, destinationArea.minZ - sourceArea.minZ); int blockPastes = cloneBlocks ? cloneBlocks(sourceArea, world, diffToTarget) : 0; int gluePastes = cloneGlue(sourceArea, world, diffToTarget); @@ -83,7 +89,8 @@ public class CloneCommand { private static int cloneGlue(MutableBoundingBox sourceArea, ServerWorld world, BlockPos diffToTarget) { int gluePastes = 0; - List glue = world.getEntitiesWithinAABB(SuperGlueEntity.class, AxisAlignedBB.func_216363_a(sourceArea)); + List glue = + world.getEntitiesWithinAABB(SuperGlueEntity.class, AxisAlignedBB.func_216363_a(sourceArea)); List> newGlue = Lists.newArrayList(); for (SuperGlueEntity g : glue) { @@ -94,7 +101,7 @@ public class CloneCommand { for (Pair p : newGlue) { SuperGlueEntity g = new SuperGlueEntity(world, p.getFirst(), p.getSecond()); - if (g.onValidSurface()){ + if (g.onValidSurface()) { world.addEntity(g); gluePastes++; } @@ -153,7 +160,7 @@ public class CloneCommand { te.markDirty(); } - //idk why the state is set twice for a te, but its done like this in the original clone command + // idk why the state is set twice for a te, but its done like this in the original clone command world.setBlockState(info.pos, info.state, 2); } @@ -161,8 +168,8 @@ public class CloneCommand { world.updateNeighbors(info.pos, info.state.getBlock()); } - - world.getPendingBlockTicks().copyTicks(sourceArea, diffToTarget); + world.getPendingBlockTicks() + .copyTicks(sourceArea, diffToTarget); return blockPastes; } diff --git a/src/main/java/com/simibubi/create/foundation/command/ConfigureConfigCommand.java b/src/main/java/com/simibubi/create/foundation/command/ConfigureConfigCommand.java index 7937764cb..bcb8206d6 100644 --- a/src/main/java/com/simibubi/create/foundation/command/ConfigureConfigCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/ConfigureConfigCommand.java @@ -2,6 +2,7 @@ package com.simibubi.create.foundation.command; import com.mojang.brigadier.Command; import com.mojang.brigadier.builder.ArgumentBuilder; + import net.minecraft.command.CommandSource; import net.minecraft.command.Commands; import net.minecraft.entity.player.ServerPlayerEntity; @@ -16,29 +17,30 @@ public abstract class ConfigureConfigCommand { ArgumentBuilder register() { return Commands.literal(this.commandLiteral) - .requires(cs -> cs.hasPermissionLevel(0)) - .then(Commands.literal("on") - .executes(ctx -> { - ServerPlayerEntity player = ctx.getSource().asPlayer(); - sendPacket(player, String.valueOf(true)); - - return Command.SINGLE_SUCCESS; - }) - ) - .then(Commands.literal("off") - .executes(ctx -> { - ServerPlayerEntity player = ctx.getSource().asPlayer(); - sendPacket(player, String.valueOf(false)); - - return Command.SINGLE_SUCCESS; - }) - ) + .requires(cs -> cs.hasPermissionLevel(0)) + .then(Commands.literal("on") .executes(ctx -> { - ServerPlayerEntity player = ctx.getSource().asPlayer(); - sendPacket(player, "info"); + ServerPlayerEntity player = ctx.getSource() + .asPlayer(); + sendPacket(player, String.valueOf(true)); return Command.SINGLE_SUCCESS; - }); + })) + .then(Commands.literal("off") + .executes(ctx -> { + ServerPlayerEntity player = ctx.getSource() + .asPlayer(); + sendPacket(player, String.valueOf(false)); + + return Command.SINGLE_SUCCESS; + })) + .executes(ctx -> { + ServerPlayerEntity player = ctx.getSource() + .asPlayer(); + sendPacket(player, "info"); + + return Command.SINGLE_SUCCESS; + }); } protected abstract void sendPacket(ServerPlayerEntity player, String option); diff --git a/src/main/java/com/simibubi/create/foundation/command/ConfigureConfigPacket.java b/src/main/java/com/simibubi/create/foundation/command/ConfigureConfigPacket.java index 70fd35984..28339f5c0 100644 --- a/src/main/java/com/simibubi/create/foundation/command/ConfigureConfigPacket.java +++ b/src/main/java/com/simibubi/create/foundation/command/ConfigureConfigPacket.java @@ -1,5 +1,10 @@ package com.simibubi.create.foundation.command; +import java.util.function.Consumer; +import java.util.function.Supplier; + +import org.apache.logging.log4j.LogManager; + import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.goggles.GoggleConfigScreen; import com.simibubi.create.foundation.config.AllConfigs; @@ -10,6 +15,7 @@ import com.simibubi.create.foundation.ponder.PonderUI; import com.simibubi.create.foundation.ponder.content.PonderIndexScreen; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.render.backend.OptifineHandler; + import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; import net.minecraft.network.PacketBuffer; @@ -24,10 +30,6 @@ import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.ForgeConfig; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.network.NetworkEvent; -import org.apache.logging.log4j.LogManager; - -import java.util.function.Consumer; -import java.util.function.Supplier; public class ConfigureConfigPacket extends SimplePacketBase { @@ -92,38 +94,44 @@ public class ConfigureConfigPacket extends SimplePacketBase { @OnlyIn(Dist.CLIENT) private static void rainbowDebug(String value) { ClientPlayerEntity player = Minecraft.getInstance().player; - if (player == null || "".equals(value)) return; + if (player == null || "".equals(value)) + return; if (value.equals("info")) { - ITextComponent text = new StringTextComponent("Rainbow Debug Utility is currently: ").append(boolToText(AllConfigs.CLIENT.rainbowDebug.get())); + ITextComponent text = new StringTextComponent("Rainbow Debug Utility is currently: ") + .append(boolToText(AllConfigs.CLIENT.rainbowDebug.get())); player.sendStatusMessage(text, false); return; } AllConfigs.CLIENT.rainbowDebug.set(Boolean.parseBoolean(value)); - ITextComponent text = boolToText(AllConfigs.CLIENT.rainbowDebug.get()).append(new StringTextComponent(" Rainbow Debug Utility").formatted(TextFormatting.WHITE)); + ITextComponent text = boolToText(AllConfigs.CLIENT.rainbowDebug.get()) + .append(new StringTextComponent(" Rainbow Debug Utility").formatted(TextFormatting.WHITE)); player.sendStatusMessage(text, false); } @OnlyIn(Dist.CLIENT) private static void experimentalRendering(String value) { ClientPlayerEntity player = Minecraft.getInstance().player; - if (player == null || "".equals(value)) return; + if (player == null || "".equals(value)) + return; if (value.equals("info")) { - ITextComponent text = new StringTextComponent("Experimental Rendering is currently: ").append(boolToText(AllConfigs.CLIENT.experimentalRendering.get())); + ITextComponent text = new StringTextComponent("Experimental Rendering is currently: ") + .append(boolToText(AllConfigs.CLIENT.experimentalRendering.get())); player.sendStatusMessage(text, false); return; } boolean parsedBoolean = Boolean.parseBoolean(value); boolean cannotUseER = OptifineHandler.usingShaders() && parsedBoolean; - + AllConfigs.CLIENT.experimentalRendering.set(parsedBoolean); - + ITextComponent text = boolToText(AllConfigs.CLIENT.experimentalRendering.get()) .append(new StringTextComponent(" Experimental Rendering").formatted(TextFormatting.WHITE)); - ITextComponent error = new StringTextComponent("Experimental Rendering does not support Optifine Shaders").formatted(TextFormatting.RED); + ITextComponent error = new StringTextComponent("Experimental Rendering does not support Optifine Shaders") + .formatted(TextFormatting.RED); player.sendStatusMessage(cannotUseER ? error : text, false); FastRenderDispatcher.refresh(); @@ -166,13 +174,14 @@ public class ConfigureConfigPacket extends SimplePacketBase { @OnlyIn(Dist.CLIENT) private static void fabulousWarning(String value) { AllConfigs.CLIENT.ignoreFabulousWarning.set(true); - Minecraft.getInstance().ingameGUI.addChatMessage(ChatType.CHAT, new StringTextComponent("Disabled Fabulous graphics warning"), Minecraft.getInstance().player.getUniqueID()); + Minecraft.getInstance().ingameGUI.addChatMessage(ChatType.CHAT, + new StringTextComponent("Disabled Fabulous graphics warning"), + Minecraft.getInstance().player.getUniqueID()); } private static IFormattableTextComponent boolToText(boolean b) { - return b - ? new StringTextComponent("enabled").formatted(TextFormatting.DARK_GREEN) - : new StringTextComponent("disabled").formatted(TextFormatting.RED); + return b ? new StringTextComponent("enabled").formatted(TextFormatting.DARK_GREEN) + : new StringTextComponent("disabled").formatted(TextFormatting.RED); } } } diff --git a/src/main/java/com/simibubi/create/foundation/command/CouplingCommand.java b/src/main/java/com/simibubi/create/foundation/command/CouplingCommand.java index 62cb360f1..4cec64866 100644 --- a/src/main/java/com/simibubi/create/foundation/command/CouplingCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/CouplingCommand.java @@ -1,5 +1,9 @@ package com.simibubi.create.foundation.command; +import java.util.ArrayList; +import java.util.Collection; +import java.util.UUID; + import com.google.common.collect.Lists; import com.mojang.brigadier.Command; import com.mojang.brigadier.builder.ArgumentBuilder; @@ -9,6 +13,7 @@ import com.simibubi.create.content.contraptions.components.structureMovement.tra import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.CapabilityMinecartController; import com.simibubi.create.content.contraptions.components.structureMovement.train.capability.MinecartController; import com.simibubi.create.foundation.utility.Iterate; + import net.minecraft.command.CommandSource; import net.minecraft.command.Commands; import net.minecraft.command.arguments.EntityArgument; @@ -18,148 +23,158 @@ import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.text.StringTextComponent; import net.minecraftforge.common.util.LazyOptional; -import java.util.ArrayList; -import java.util.Collection; -import java.util.UUID; - public class CouplingCommand { - public static final SimpleCommandExceptionType ONLY_MINECARTS_ALLOWED = new SimpleCommandExceptionType(new StringTextComponent("Only Minecarts can be coupled")); - public static final SimpleCommandExceptionType SAME_DIMENSION = new SimpleCommandExceptionType(new StringTextComponent("Minecarts have to be in the same Dimension")); - public static final DynamicCommandExceptionType TWO_CARTS = new DynamicCommandExceptionType(a -> new StringTextComponent("Your selector targeted " + a + " entities. You can only couple 2 Minecarts at a time.")); + public static final SimpleCommandExceptionType ONLY_MINECARTS_ALLOWED = + new SimpleCommandExceptionType(new StringTextComponent("Only Minecarts can be coupled")); + public static final SimpleCommandExceptionType SAME_DIMENSION = + new SimpleCommandExceptionType(new StringTextComponent("Minecarts have to be in the same Dimension")); + public static final DynamicCommandExceptionType TWO_CARTS = + new DynamicCommandExceptionType(a -> new StringTextComponent( + "Your selector targeted " + a + " entities. You can only couple 2 Minecarts at a time.")); public static ArgumentBuilder register() { return Commands.literal("coupling") - .requires(cs -> cs.hasPermissionLevel(2)) - .then(Commands.literal("add") - .then(Commands.argument("cart1", EntityArgument.entity()) - .then(Commands.argument("cart2", EntityArgument.entity()) - .executes(ctx -> { - Entity cart1 = EntityArgument.getEntity(ctx, "cart1"); - if (!(cart1 instanceof AbstractMinecartEntity)) - throw ONLY_MINECARTS_ALLOWED.create(); + .requires(cs -> cs.hasPermissionLevel(2)) + .then(Commands.literal("add") + .then(Commands.argument("cart1", EntityArgument.entity()) + .then(Commands.argument("cart2", EntityArgument.entity()) + .executes(ctx -> { + Entity cart1 = EntityArgument.getEntity(ctx, "cart1"); + if (!(cart1 instanceof AbstractMinecartEntity)) + throw ONLY_MINECARTS_ALLOWED.create(); - Entity cart2 = EntityArgument.getEntity(ctx, "cart2"); - if (!(cart2 instanceof AbstractMinecartEntity)) - throw ONLY_MINECARTS_ALLOWED.create(); + Entity cart2 = EntityArgument.getEntity(ctx, "cart2"); + if (!(cart2 instanceof AbstractMinecartEntity)) + throw ONLY_MINECARTS_ALLOWED.create(); - if (!cart1.getEntityWorld().equals(cart2.getEntityWorld())) - throw SAME_DIMENSION.create(); + if (!cart1.getEntityWorld() + .equals(cart2.getEntityWorld())) + throw SAME_DIMENSION.create(); - Entity source = ctx.getSource().getEntity(); + Entity source = ctx.getSource() + .getEntity(); - CouplingHandler.tryToCoupleCarts(source instanceof PlayerEntity ? (PlayerEntity) source : null, cart1.getEntityWorld(), cart1.getEntityId(), cart2.getEntityId()); + CouplingHandler.tryToCoupleCarts( + source instanceof PlayerEntity ? (PlayerEntity) source : null, cart1.getEntityWorld(), + cart1.getEntityId(), cart2.getEntityId()); - return Command.SINGLE_SUCCESS; - }) - ) - ) - .then(Commands.argument("carts", EntityArgument.entities()) - .executes(ctx -> { - Collection entities = EntityArgument.getEntities(ctx, "carts"); - if (entities.size() != 2) - throw TWO_CARTS.create(entities.size()); + return Command.SINGLE_SUCCESS; + }))) + .then(Commands.argument("carts", EntityArgument.entities()) + .executes(ctx -> { + Collection entities = EntityArgument.getEntities(ctx, "carts"); + if (entities.size() != 2) + throw TWO_CARTS.create(entities.size()); - ArrayList eList = Lists.newArrayList(entities); - Entity cart1 = eList.get(0); - if (!(cart1 instanceof AbstractMinecartEntity)) - throw ONLY_MINECARTS_ALLOWED.create(); + ArrayList eList = Lists.newArrayList(entities); + Entity cart1 = eList.get(0); + if (!(cart1 instanceof AbstractMinecartEntity)) + throw ONLY_MINECARTS_ALLOWED.create(); - Entity cart2 = eList.get(1); - if (!(cart2 instanceof AbstractMinecartEntity)) - throw ONLY_MINECARTS_ALLOWED.create(); + Entity cart2 = eList.get(1); + if (!(cart2 instanceof AbstractMinecartEntity)) + throw ONLY_MINECARTS_ALLOWED.create(); - if (!cart1.getEntityWorld().equals(cart2.getEntityWorld())) - throw SAME_DIMENSION.create(); + if (!cart1.getEntityWorld() + .equals(cart2.getEntityWorld())) + throw SAME_DIMENSION.create(); - Entity source = ctx.getSource().getEntity(); + Entity source = ctx.getSource() + .getEntity(); - CouplingHandler.tryToCoupleCarts(source instanceof PlayerEntity ? (PlayerEntity) source : null, cart1.getEntityWorld(), cart1.getEntityId(), cart2.getEntityId()); + CouplingHandler.tryToCoupleCarts(source instanceof PlayerEntity ? (PlayerEntity) source : null, + cart1.getEntityWorld(), cart1.getEntityId(), cart2.getEntityId()); - return Command.SINGLE_SUCCESS; - }) - ) - ) - .then(Commands.literal("remove") - .then(Commands.argument("cart1", EntityArgument.entity()) - .then(Commands.argument("cart2", EntityArgument.entity()) - .executes(ctx -> { - Entity cart1 = EntityArgument.getEntity(ctx, "cart1"); - if (!(cart1 instanceof AbstractMinecartEntity)) - throw ONLY_MINECARTS_ALLOWED.create(); + return Command.SINGLE_SUCCESS; + }))) + .then(Commands.literal("remove") + .then(Commands.argument("cart1", EntityArgument.entity()) + .then(Commands.argument("cart2", EntityArgument.entity()) + .executes(ctx -> { + Entity cart1 = EntityArgument.getEntity(ctx, "cart1"); + if (!(cart1 instanceof AbstractMinecartEntity)) + throw ONLY_MINECARTS_ALLOWED.create(); - Entity cart2 = EntityArgument.getEntity(ctx, "cart2"); - if (!(cart2 instanceof AbstractMinecartEntity)) - throw ONLY_MINECARTS_ALLOWED.create(); + Entity cart2 = EntityArgument.getEntity(ctx, "cart2"); + if (!(cart2 instanceof AbstractMinecartEntity)) + throw ONLY_MINECARTS_ALLOWED.create(); - LazyOptional cart1Capability = cart1.getCapability(CapabilityMinecartController.MINECART_CONTROLLER_CAPABILITY); - if (!cart1Capability.isPresent()) { - ctx.getSource().sendFeedback(new StringTextComponent("Minecart has no Couplings Attached"), true); - return 0; - } + LazyOptional cart1Capability = + cart1.getCapability(CapabilityMinecartController.MINECART_CONTROLLER_CAPABILITY); + if (!cart1Capability.isPresent()) { + ctx.getSource() + .sendFeedback(new StringTextComponent("Minecart has no Couplings Attached"), true); + return 0; + } - MinecartController cart1Controller = cart1Capability.orElse(null); + MinecartController cart1Controller = cart1Capability.orElse(null); - int cart1Couplings = (cart1Controller.isConnectedToCoupling() ? 1 : 0) + (cart1Controller.isLeadingCoupling() ? 1 : 0); - if (cart1Couplings == 0) { - ctx.getSource().sendFeedback(new StringTextComponent("Minecart has no Couplings Attached"), true); - return 0; - } + int cart1Couplings = (cart1Controller.isConnectedToCoupling() ? 1 : 0) + + (cart1Controller.isLeadingCoupling() ? 1 : 0); + if (cart1Couplings == 0) { + ctx.getSource() + .sendFeedback(new StringTextComponent("Minecart has no Couplings Attached"), true); + return 0; + } - for (boolean bool : Iterate.trueAndFalse) { - UUID coupledCart = cart1Controller.getCoupledCart(bool); - if (coupledCart == null) - continue; + for (boolean bool : Iterate.trueAndFalse) { + UUID coupledCart = cart1Controller.getCoupledCart(bool); + if (coupledCart == null) + continue; - if (coupledCart != cart2.getUniqueID()) - continue; + if (coupledCart != cart2.getUniqueID()) + continue; - MinecartController cart2Controller = CapabilityMinecartController.getIfPresent(cart1.getEntityWorld(), coupledCart); - if (cart2Controller == null) - return 0; + MinecartController cart2Controller = + CapabilityMinecartController.getIfPresent(cart1.getEntityWorld(), coupledCart); + if (cart2Controller == null) + return 0; - cart1Controller.removeConnection(bool); - cart2Controller.removeConnection(!bool); - return Command.SINGLE_SUCCESS; - } + cart1Controller.removeConnection(bool); + cart2Controller.removeConnection(!bool); + return Command.SINGLE_SUCCESS; + } - ctx.getSource().sendFeedback(new StringTextComponent("The specified Carts are not coupled"), true); + ctx.getSource() + .sendFeedback(new StringTextComponent("The specified Carts are not coupled"), true); - return 0; - }) - ) - ) - ) - .then(Commands.literal("removeAll") - .then(Commands.argument("cart", EntityArgument.entity()) - .executes(ctx -> { - Entity cart = EntityArgument.getEntity(ctx, "cart"); - if (!(cart instanceof AbstractMinecartEntity)) - throw ONLY_MINECARTS_ALLOWED.create(); + return 0; + })))) + .then(Commands.literal("removeAll") + .then(Commands.argument("cart", EntityArgument.entity()) + .executes(ctx -> { + Entity cart = EntityArgument.getEntity(ctx, "cart"); + if (!(cart instanceof AbstractMinecartEntity)) + throw ONLY_MINECARTS_ALLOWED.create(); - LazyOptional capability = cart.getCapability(CapabilityMinecartController.MINECART_CONTROLLER_CAPABILITY); - if (!capability.isPresent()) { - ctx.getSource().sendFeedback(new StringTextComponent("Minecart has no Couplings Attached"), true); - return 0; - } + LazyOptional capability = + cart.getCapability(CapabilityMinecartController.MINECART_CONTROLLER_CAPABILITY); + if (!capability.isPresent()) { + ctx.getSource() + .sendFeedback(new StringTextComponent("Minecart has no Couplings Attached"), true); + return 0; + } - MinecartController controller = capability.orElse(null); + MinecartController controller = capability.orElse(null); - int couplings = (controller.isConnectedToCoupling() ? 1 : 0) + (controller.isLeadingCoupling() ? 1 : 0); - if (couplings == 0) { - ctx.getSource().sendFeedback(new StringTextComponent("Minecart has no Couplings Attached"), true); - return 0; - } + int couplings = + (controller.isConnectedToCoupling() ? 1 : 0) + (controller.isLeadingCoupling() ? 1 : 0); + if (couplings == 0) { + ctx.getSource() + .sendFeedback(new StringTextComponent("Minecart has no Couplings Attached"), true); + return 0; + } - controller.decouple(); + controller.decouple(); - ctx.getSource().sendFeedback(new StringTextComponent("Removed " + couplings + " couplings from the Minecart"), true); + ctx.getSource() + .sendFeedback( + new StringTextComponent("Removed " + couplings + " couplings from the Minecart"), true); - return couplings; - }) - ) - ); + return couplings; + }))); } diff --git a/src/main/java/com/simibubi/create/foundation/command/FabulousWarningCommand.java b/src/main/java/com/simibubi/create/foundation/command/FabulousWarningCommand.java index 9a417a1a4..c2f9c5eb1 100644 --- a/src/main/java/com/simibubi/create/foundation/command/FabulousWarningCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/FabulousWarningCommand.java @@ -1,29 +1,28 @@ package com.simibubi.create.foundation.command; +import com.mojang.brigadier.Command; +import com.mojang.brigadier.builder.ArgumentBuilder; +import com.simibubi.create.foundation.networking.AllPackets; + import net.minecraft.command.CommandSource; import net.minecraft.command.Commands; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraftforge.fml.network.PacketDistributor; -import com.mojang.brigadier.Command; -import com.mojang.brigadier.builder.ArgumentBuilder; -import com.simibubi.create.foundation.networking.AllPackets; - public class FabulousWarningCommand { public static ArgumentBuilder register() { return Commands.literal("dismissFabulousWarning") - .requires(AllCommands.sourceIsPlayer) - .executes(ctx -> { - ServerPlayerEntity player = ctx.getSource().asPlayer(); + .requires(AllCommands.sourceIsPlayer) + .executes(ctx -> { + ServerPlayerEntity player = ctx.getSource() + .asPlayer(); - AllPackets.channel.send( - PacketDistributor.PLAYER.with(() -> player), - new ConfigureConfigPacket(ConfigureConfigPacket.Actions.fabulousWarning.name(), "") - ); + AllPackets.channel.send(PacketDistributor.PLAYER.with(() -> player), + new ConfigureConfigPacket(ConfigureConfigPacket.Actions.fabulousWarning.name(), "")); - return Command.SINGLE_SUCCESS; - }); + return Command.SINGLE_SUCCESS; + }); } } diff --git a/src/main/java/com/simibubi/create/foundation/command/FlySpeedCommand.java b/src/main/java/com/simibubi/create/foundation/command/FlySpeedCommand.java index fbc941a58..2a8a1c189 100644 --- a/src/main/java/com/simibubi/create/foundation/command/FlySpeedCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/FlySpeedCommand.java @@ -4,6 +4,7 @@ import com.mojang.brigadier.Command; import com.mojang.brigadier.arguments.FloatArgumentType; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.context.CommandContext; + import net.minecraft.command.CommandSource; import net.minecraft.command.Commands; import net.minecraft.command.arguments.EntityArgument; @@ -16,49 +17,31 @@ public class FlySpeedCommand { public static ArgumentBuilder register() { return Commands.literal("flySpeed") - .requires(cs -> cs.hasPermissionLevel(2)) - .then(Commands.argument("speed", FloatArgumentType.floatArg(0)) - .then(Commands.argument("target", EntityArgument.player()) - .executes(ctx -> sendFlySpeedUpdate( - ctx, - EntityArgument.getPlayer(ctx, "target"), - FloatArgumentType.getFloat(ctx, "speed") - ) - ) - ) - .executes(ctx -> sendFlySpeedUpdate( - ctx, - ctx.getSource().asPlayer(), - FloatArgumentType.getFloat(ctx, "speed") - ) - ) - ) - .then(Commands.literal("reset") - .then(Commands.argument("target", EntityArgument.player()) - .executes(ctx -> sendFlySpeedUpdate( - ctx, - EntityArgument.getPlayer(ctx, "target"), - 0.05f - ) - ) - ) - .executes(ctx -> sendFlySpeedUpdate( - ctx, - ctx.getSource().asPlayer(), - 0.05f - ) - ) + .requires(cs -> cs.hasPermissionLevel(2)) + .then(Commands.argument("speed", FloatArgumentType.floatArg(0)) + .then(Commands.argument("target", EntityArgument.player()) + .executes(ctx -> sendFlySpeedUpdate(ctx, EntityArgument.getPlayer(ctx, "target"), + FloatArgumentType.getFloat(ctx, "speed")))) + .executes(ctx -> sendFlySpeedUpdate(ctx, ctx.getSource() + .asPlayer(), FloatArgumentType.getFloat(ctx, "speed")))) + .then(Commands.literal("reset") + .then(Commands.argument("target", EntityArgument.player()) + .executes(ctx -> sendFlySpeedUpdate(ctx, EntityArgument.getPlayer(ctx, "target"), 0.05f))) + .executes(ctx -> sendFlySpeedUpdate(ctx, ctx.getSource() + .asPlayer(), 0.05f)) - ); + ); } private static int sendFlySpeedUpdate(CommandContext ctx, ServerPlayerEntity player, float speed) { SPlayerAbilitiesPacket packet = new SPlayerAbilitiesPacket(player.abilities); - //packet.setFlySpeed(speed); + // packet.setFlySpeed(speed); ObfuscationReflectionHelper.setPrivateValue(SPlayerAbilitiesPacket.class, packet, speed, "field_149116_e"); player.connection.sendPacket(packet); - ctx.getSource().sendFeedback(new StringTextComponent("Temporarily set " + player.getName().getString() + "'s Flying Speed to: " + speed), true); + ctx.getSource() + .sendFeedback(new StringTextComponent("Temporarily set " + player.getName() + .getString() + "'s Flying Speed to: " + speed), true); return Command.SINGLE_SUCCESS; } diff --git a/src/main/java/com/simibubi/create/foundation/command/HighlightCommand.java b/src/main/java/com/simibubi/create/foundation/command/HighlightCommand.java index a152ddad6..2d242ee4f 100644 --- a/src/main/java/com/simibubi/create/foundation/command/HighlightCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/HighlightCommand.java @@ -28,55 +28,53 @@ public class HighlightCommand { public static ArgumentBuilder register() { return Commands.literal("highlight") - .requires(cs -> cs.hasPermissionLevel(0)) - .then(Commands.argument("pos", BlockPosArgument.blockPos()) - .then(Commands.argument("players", EntityArgument.players()) - .executes(ctx -> { - Collection players = EntityArgument.getPlayers(ctx, "players"); - BlockPos pos = BlockPosArgument.getBlockPos(ctx, "pos"); + .requires(cs -> cs.hasPermissionLevel(0)) + .then(Commands.argument("pos", BlockPosArgument.blockPos()) + .then(Commands.argument("players", EntityArgument.players()) + .executes(ctx -> { + Collection players = EntityArgument.getPlayers(ctx, "players"); + BlockPos pos = BlockPosArgument.getBlockPos(ctx, "pos"); - for (ServerPlayerEntity p : players) { - AllPackets.channel.send( - PacketDistributor.PLAYER.with(() -> p), - new HighlightPacket(pos) - ); - } + for (ServerPlayerEntity p : players) { + AllPackets.channel.send(PacketDistributor.PLAYER.with(() -> p), new HighlightPacket(pos)); + } - return players.size(); - }) - ) - //.requires(AllCommands.sourceIsPlayer) - .executes(ctx -> { - BlockPos pos = BlockPosArgument.getLoadedBlockPos(ctx, "pos"); - - AllPackets.channel.send( - PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) ctx.getSource().getEntity()), - new HighlightPacket(pos) - ); - - return Command.SINGLE_SUCCESS; - }) - ) - //.requires(AllCommands.sourceIsPlayer) + return players.size(); + })) + // .requires(AllCommands.sourceIsPlayer) .executes(ctx -> { - ServerPlayerEntity player = ctx.getSource().asPlayer(); - return highlightAssemblyExceptionFor(player, ctx.getSource()); - }); + BlockPos pos = BlockPosArgument.getLoadedBlockPos(ctx, "pos"); + + AllPackets.channel.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) ctx.getSource() + .getEntity()), new HighlightPacket(pos)); + + return Command.SINGLE_SUCCESS; + })) + // .requires(AllCommands.sourceIsPlayer) + .executes(ctx -> { + ServerPlayerEntity player = ctx.getSource() + .asPlayer(); + return highlightAssemblyExceptionFor(player, ctx.getSource()); + }); } private static void sendMissMessage(CommandSource source) { - source.sendFeedback(new StringTextComponent("Try looking at a Block that has failed to assemble a Contraption and try again."), true); + source.sendFeedback( + new StringTextComponent("Try looking at a Block that has failed to assemble a Contraption and try again."), + true); } private static int highlightAssemblyExceptionFor(ServerPlayerEntity player, CommandSource source) { - double distance = player.getAttribute(ForgeMod.REACH_DISTANCE.get()).getValue(); + double distance = player.getAttribute(ForgeMod.REACH_DISTANCE.get()) + .getValue(); Vector3d start = player.getEyePosition(1); Vector3d look = player.getLook(1); Vector3d end = start.add(look.x * distance, look.y * distance, look.z * distance); World world = player.world; - BlockRayTraceResult ray = world.rayTraceBlocks(new RayTraceContext(start, end, RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, player)); + BlockRayTraceResult ray = world.rayTraceBlocks( + new RayTraceContext(start, end, RayTraceContext.BlockMode.OUTLINE, RayTraceContext.FluidMode.NONE, player)); if (ray.getType() == RayTraceResult.Type.MISS) { sendMissMessage(source); return 0; @@ -103,6 +101,7 @@ public class HighlightCommand { BlockPos p = exception.getPosition(); String command = "/create highlight " + p.getX() + " " + p.getY() + " " + p.getZ(); - return player.server.getCommandManager().handleCommand(source, command); + return player.server.getCommandManager() + .handleCommand(source, command); } } diff --git a/src/main/java/com/simibubi/create/foundation/command/HighlightPacket.java b/src/main/java/com/simibubi/create/foundation/command/HighlightPacket.java index fe7cf6f0f..a66bbb06e 100644 --- a/src/main/java/com/simibubi/create/foundation/command/HighlightPacket.java +++ b/src/main/java/com/simibubi/create/foundation/command/HighlightPacket.java @@ -34,11 +34,13 @@ public class HighlightPacket extends SimplePacketBase { @Override public void handle(Supplier ctx) { - ctx.get().enqueueWork(() -> DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> { - performHighlight(pos); - })); + ctx.get() + .enqueueWork(() -> DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> { + performHighlight(pos); + })); - ctx.get().setPacketHandled(true); + ctx.get() + .setPacketHandled(true); } @OnlyIn(Dist.CLIENT) @@ -46,11 +48,13 @@ public class HighlightPacket extends SimplePacketBase { if (Minecraft.getInstance().world == null || !Minecraft.getInstance().world.isBlockPresent(pos)) return; - CreateClient.outliner.showAABB("highlightCommand", VoxelShapes.fullCube().getBoundingBox().offset(pos), 200) - .lineWidth(1 / 32f) - .colored(0xEeEeEe) - //.colored(0x243B50) - .withFaceTexture(AllSpecialTextures.SELECTION); + CreateClient.outliner.showAABB("highlightCommand", VoxelShapes.fullCube() + .getBoundingBox() + .offset(pos), 200) + .lineWidth(1 / 32f) + .colored(0xEeEeEe) + // .colored(0x243B50) + .withFaceTexture(AllSpecialTextures.SELECTION); } } diff --git a/src/main/java/com/simibubi/create/foundation/command/KillTPSCommand.java b/src/main/java/com/simibubi/create/foundation/command/KillTPSCommand.java index 1badf0b3c..22ecbce81 100644 --- a/src/main/java/com/simibubi/create/foundation/command/KillTPSCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/KillTPSCommand.java @@ -10,57 +10,72 @@ import net.minecraft.command.Commands; public class KillTPSCommand { - public static ArgumentBuilder register() { + public static ArgumentBuilder register() { return Commands.literal("killtps") - .requires(cs -> cs.hasPermissionLevel(2)).executes(ctx -> { - // killtps no arguments - ctx.getSource().sendFeedback( - Lang.createTranslationTextComponent("command.killTPSCommand.status.slowed_by.0", - Create.lagger.isLagging() ? Create.lagger.getTickTime() : 0), + .requires(cs -> cs.hasPermissionLevel(2)) + .executes(ctx -> { + // killtps no arguments + ctx.getSource() + .sendFeedback(Lang.createTranslationTextComponent("command.killTPSCommand.status.slowed_by.0", + Create.lagger.isLagging() ? Create.lagger.getTickTime() : 0), true); + if (Create.lagger.isLagging()) + ctx.getSource() + .sendFeedback(Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.0"), + true); + else + ctx.getSource() + .sendFeedback(Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.1"), true); - if (Create.lagger.isLagging()) - ctx.getSource().sendFeedback( - Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.0"), true); - else - ctx.getSource().sendFeedback( - Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.1"), true); - return 1; - }).then(Commands.literal("start").executes(ctx -> { + return 1; + }) + .then(Commands.literal("start") + .executes(ctx -> { // killtps start no time int tickTime = Create.lagger.getTickTime(); if (tickTime > 0) { Create.lagger.setLagging(true); - ctx.getSource().sendFeedback((Lang + ctx.getSource() + .sendFeedback((Lang .createTranslationTextComponent("command.killTPSCommand.status.slowed_by.1", tickTime)), true); - ctx.getSource().sendFeedback( - Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.0"), true); + ctx.getSource() + .sendFeedback(Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.0"), + true); } else { - ctx.getSource().sendFeedback( - Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.1"), true); + ctx.getSource() + .sendFeedback(Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.1"), + true); } return 1; - }).then(Commands.argument(Lang.translate("command.killTPSCommand.argument.tickTime").getUnformattedComponentText(), - IntegerArgumentType.integer(1)).executes(ctx -> { - // killtps start tickTime - int tickTime = IntegerArgumentType.getInteger(ctx, - Lang.translate("command.killTPSCommand.argument.tickTime").getUnformattedComponentText()); - Create.lagger.setTickTime(tickTime); - Create.lagger.setLagging(true); - ctx.getSource().sendFeedback((Lang.createTranslationTextComponent( - "command.killTPSCommand.status.slowed_by.1", tickTime)), true); - ctx.getSource().sendFeedback( - Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.0"), true); + }) + .then(Commands.argument(Lang.translate("command.killTPSCommand.argument.tickTime") + .getUnformattedComponentText(), IntegerArgumentType.integer(1)) + .executes(ctx -> { + // killtps start tickTime + int tickTime = IntegerArgumentType.getInteger(ctx, + Lang.translate("command.killTPSCommand.argument.tickTime") + .getUnformattedComponentText()); + Create.lagger.setTickTime(tickTime); + Create.lagger.setLagging(true); + ctx.getSource() + .sendFeedback((Lang + .createTranslationTextComponent("command.killTPSCommand.status.slowed_by.1", tickTime)), + true); + ctx.getSource() + .sendFeedback(Lang.createTranslationTextComponent("command.killTPSCommand.status.usage.0"), + true); - return 1; - }))) - .then(Commands.literal("stop").executes(ctx -> { + return 1; + }))) + .then(Commands.literal("stop") + .executes(ctx -> { // killtps stop Create.lagger.setLagging(false); - ctx.getSource().sendFeedback( - Lang.createTranslationTextComponent("command.killTPSCommand.status.slowed_by.2"), false); + ctx.getSource() + .sendFeedback(Lang.createTranslationTextComponent("command.killTPSCommand.status.slowed_by.2"), + false); return 1; })); diff --git a/src/main/java/com/simibubi/create/foundation/command/OverlayConfigCommand.java b/src/main/java/com/simibubi/create/foundation/command/OverlayConfigCommand.java index 850b910e5..bb17a4b02 100644 --- a/src/main/java/com/simibubi/create/foundation/command/OverlayConfigCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/OverlayConfigCommand.java @@ -15,33 +15,38 @@ public class OverlayConfigCommand { public static ArgumentBuilder register() { return Commands.literal("overlay") - .requires(cs -> cs.hasPermissionLevel(0)) - .then(Commands.literal("reset") - .executes(ctx -> { - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> ConfigureConfigPacket.Actions.overlayReset.performAction("")); - - DistExecutor.unsafeRunWhenOn(Dist.DEDICATED_SERVER, () -> () -> - AllPackets.channel.send( - PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) ctx.getSource().getEntity()), - new ConfigureConfigPacket(ConfigureConfigPacket.Actions.overlayReset.name(), ""))); - - ctx.getSource().sendFeedback(new StringTextComponent("reset overlay offset"), true); - - return 1; - }) - ) + .requires(cs -> cs.hasPermissionLevel(0)) + .then(Commands.literal("reset") .executes(ctx -> { - DistExecutor.unsafeRunWhenOn(Dist.CLIENT, () -> () -> ConfigureConfigPacket.Actions.overlayScreen.performAction("")); + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, + () -> () -> ConfigureConfigPacket.Actions.overlayReset.performAction("")); - DistExecutor.unsafeRunWhenOn(Dist.DEDICATED_SERVER, () -> () -> - AllPackets.channel.send( - PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) ctx.getSource().getEntity()), - new ConfigureConfigPacket(ConfigureConfigPacket.Actions.overlayScreen.name(), ""))); + DistExecutor.unsafeRunWhenOn(Dist.DEDICATED_SERVER, + () -> () -> AllPackets.channel.send( + PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) ctx.getSource() + .getEntity()), + new ConfigureConfigPacket(ConfigureConfigPacket.Actions.overlayReset.name(), ""))); - ctx.getSource().sendFeedback(new StringTextComponent("window opened"), true); + ctx.getSource() + .sendFeedback(new StringTextComponent("reset overlay offset"), true); return 1; - }); + })) + .executes(ctx -> { + DistExecutor.unsafeRunWhenOn(Dist.CLIENT, + () -> () -> ConfigureConfigPacket.Actions.overlayScreen.performAction("")); + + DistExecutor.unsafeRunWhenOn(Dist.DEDICATED_SERVER, + () -> () -> AllPackets.channel.send( + PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) ctx.getSource() + .getEntity()), + new ConfigureConfigPacket(ConfigureConfigPacket.Actions.overlayScreen.name(), ""))); + + ctx.getSource() + .sendFeedback(new StringTextComponent("window opened"), true); + + return 1; + }); } } diff --git a/src/main/java/com/simibubi/create/foundation/command/PonderCommand.java b/src/main/java/com/simibubi/create/foundation/command/PonderCommand.java index f4e2cfb90..8fe17795e 100644 --- a/src/main/java/com/simibubi/create/foundation/command/PonderCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/PonderCommand.java @@ -1,11 +1,14 @@ package com.simibubi.create.foundation.command; +import java.util.Collection; + import com.google.common.collect.ImmutableList; import com.mojang.brigadier.Command; import com.mojang.brigadier.builder.ArgumentBuilder; import com.mojang.brigadier.suggestion.SuggestionProvider; import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.ponder.PonderRegistry; + import net.minecraft.command.CommandSource; import net.minecraft.command.Commands; import net.minecraft.command.ISuggestionProvider; @@ -17,23 +20,27 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.fml.network.PacketDistributor; -import java.util.Collection; - public class PonderCommand { - public static final SuggestionProvider ITEM_PONDERS = SuggestionProviders.register(new ResourceLocation("all_ponders"), (iSuggestionProviderCommandContext, builder) -> ISuggestionProvider.func_212476_a(PonderRegistry.all.keySet().stream(), builder)); + public static final SuggestionProvider ITEM_PONDERS = SuggestionProviders.register( + new ResourceLocation("all_ponders"), + (iSuggestionProviderCommandContext, builder) -> ISuggestionProvider.func_212476_a(PonderRegistry.all.keySet() + .stream(), builder)); static ArgumentBuilder register() { return Commands.literal("ponder") - .requires(cs -> cs.hasPermissionLevel(0)) - .executes(ctx -> openScene("index", ctx.getSource().asPlayer())) - .then(Commands.argument("scene", ResourceLocationArgument.resourceLocation()) - .suggests(ITEM_PONDERS) - .executes(ctx -> openScene(ResourceLocationArgument.getResourceLocation(ctx, "scene").toString(), ctx.getSource().asPlayer())) - .then(Commands.argument("targets", EntityArgument.players()) - .requires(cs -> cs.hasPermissionLevel(2)) - .executes(ctx -> openScene(ResourceLocationArgument.getResourceLocation(ctx, "scene").toString(), EntityArgument.getPlayers(ctx, "targets"))) - ) - ); + .requires(cs -> cs.hasPermissionLevel(0)) + .executes(ctx -> openScene("index", ctx.getSource() + .asPlayer())) + .then(Commands.argument("scene", ResourceLocationArgument.resourceLocation()) + .suggests(ITEM_PONDERS) + .executes(ctx -> openScene(ResourceLocationArgument.getResourceLocation(ctx, "scene") + .toString(), + ctx.getSource() + .asPlayer())) + .then(Commands.argument("targets", EntityArgument.players()) + .requires(cs -> cs.hasPermissionLevel(2)) + .executes(ctx -> openScene(ResourceLocationArgument.getResourceLocation(ctx, "scene") + .toString(), EntityArgument.getPlayers(ctx, "targets"))))); } @@ -46,9 +53,8 @@ public class PonderCommand { if (player instanceof FakePlayer) continue; - AllPackets.channel.send( - PacketDistributor.PLAYER.with(() -> player), - new ConfigureConfigPacket(ConfigureConfigPacket.Actions.openPonder.name(), sceneId)); + AllPackets.channel.send(PacketDistributor.PLAYER.with(() -> player), + new ConfigureConfigPacket(ConfigureConfigPacket.Actions.openPonder.name(), sceneId)); } return Command.SINGLE_SUCCESS; } diff --git a/src/main/java/com/simibubi/create/foundation/command/ReplaceInCommandBlocksCommand.java b/src/main/java/com/simibubi/create/foundation/command/ReplaceInCommandBlocksCommand.java index 30d3a5101..7a7e136e6 100644 --- a/src/main/java/com/simibubi/create/foundation/command/ReplaceInCommandBlocksCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/ReplaceInCommandBlocksCommand.java @@ -62,9 +62,7 @@ public class ReplaceInCommandBlocksCommand { source.sendFeedback(new StringTextComponent("Couldn't find \"" + toReplace + "\" anywhere."), true); return; } - source.sendFeedback( - new StringTextComponent("Replaced occurrences in " + intValue + " blocks."), - true); + source.sendFeedback(new StringTextComponent("Replaced occurrences in " + intValue + " blocks."), true); } } diff --git a/src/main/java/com/simibubi/create/foundation/command/ServerLagger.java b/src/main/java/com/simibubi/create/foundation/command/ServerLagger.java index fed8e3a39..5ab858221 100644 --- a/src/main/java/com/simibubi/create/foundation/command/ServerLagger.java +++ b/src/main/java/com/simibubi/create/foundation/command/ServerLagger.java @@ -5,11 +5,10 @@ public class ServerLagger { private int tickTime; private boolean isLagging = false; - public void tick(){ + public void tick() { if (!isLagging || tickTime <= 0) return; - try { Thread.sleep(tickTime); } catch (InterruptedException e) { @@ -17,11 +16,11 @@ public class ServerLagger { } } - public void setTickTime(int tickTime){ + public void setTickTime(int tickTime) { this.tickTime = Math.max(tickTime, 0); } - public void setLagging(boolean lagging){ + public void setLagging(boolean lagging) { this.isLagging = lagging; } diff --git a/src/main/java/com/simibubi/create/foundation/command/ToggleDebugCommand.java b/src/main/java/com/simibubi/create/foundation/command/ToggleDebugCommand.java index d8953c8f1..59673f15e 100644 --- a/src/main/java/com/simibubi/create/foundation/command/ToggleDebugCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/ToggleDebugCommand.java @@ -1,6 +1,7 @@ package com.simibubi.create.foundation.command; import com.simibubi.create.foundation.networking.AllPackets; + import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraftforge.fml.network.PacketDistributor; @@ -12,9 +13,7 @@ public class ToggleDebugCommand extends ConfigureConfigCommand { @Override protected void sendPacket(ServerPlayerEntity player, String option) { - AllPackets.channel.send( - PacketDistributor.PLAYER.with(() -> player), - new ConfigureConfigPacket(ConfigureConfigPacket.Actions.rainbowDebug.name(), option) - ); + AllPackets.channel.send(PacketDistributor.PLAYER.with(() -> player), + new ConfigureConfigPacket(ConfigureConfigPacket.Actions.rainbowDebug.name(), option)); } } diff --git a/src/main/java/com/simibubi/create/foundation/command/ToggleExperimentalRenderingCommand.java b/src/main/java/com/simibubi/create/foundation/command/ToggleExperimentalRenderingCommand.java index e80862f33..4c01fa62a 100644 --- a/src/main/java/com/simibubi/create/foundation/command/ToggleExperimentalRenderingCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/ToggleExperimentalRenderingCommand.java @@ -1,6 +1,7 @@ package com.simibubi.create.foundation.command; import com.simibubi.create.foundation.networking.AllPackets; + import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraftforge.fml.network.PacketDistributor; @@ -12,9 +13,7 @@ public class ToggleExperimentalRenderingCommand extends ConfigureConfigCommand { @Override protected void sendPacket(ServerPlayerEntity player, String option) { - AllPackets.channel.send( - PacketDistributor.PLAYER.with(() -> player), - new ConfigureConfigPacket(ConfigureConfigPacket.Actions.experimentalRendering.name(), option) - ); + AllPackets.channel.send(PacketDistributor.PLAYER.with(() -> player), + new ConfigureConfigPacket(ConfigureConfigPacket.Actions.experimentalRendering.name(), option)); } } diff --git a/src/main/java/com/simibubi/create/foundation/config/CClient.java b/src/main/java/com/simibubi/create/foundation/config/CClient.java index 3a09d5c81..ce9017241 100644 --- a/src/main/java/com/simibubi/create/foundation/config/CClient.java +++ b/src/main/java/com/simibubi/create/foundation/config/CClient.java @@ -19,11 +19,16 @@ public class CClient extends ConfigBase { public ConfigInt overlayOffsetY = i(0, Integer.MIN_VALUE, Integer.MAX_VALUE, "overlayOffsetY", "Offset the overlay from goggle- and hover- information by this many pixels on the Y axis; Use /create overlay"); - public ConfigBool ignoreFabulousWarning = b(false, "ignoreFabulousWarning", "Setting this to true will prevent Create from sending you a warning when playing with Fabulous graphics enabled"); + public ConfigBool ignoreFabulousWarning = b(false, "ignoreFabulousWarning", + "Setting this to true will prevent Create from sending you a warning when playing with Fabulous graphics enabled"); public ConfigGroup placementAssist = group(1, "placementAssist", "Settings for the Placement Assist"); - public ConfigEnum placementIndicator = e(PlacementIndicatorSetting.TEXTURE, "indicatorType", "What indicator should be used when showing where the assisted placement ends up relative to your crosshair", "Choose 'NONE' to disable the Indicator altogether"); - public ConfigFloat indicatorScale = f(1.0f, 0f, "indicatorScale", "Change the size of the Indicator by this multiplier"); + public ConfigEnum placementIndicator = e(PlacementIndicatorSetting.TEXTURE, + "indicatorType", + "What indicator should be used when showing where the assisted placement ends up relative to your crosshair", + "Choose 'NONE' to disable the Indicator altogether"); + public ConfigFloat indicatorScale = + f(1.0f, 0f, "indicatorScale", "Change the size of the Indicator by this multiplier"); public ConfigGroup ponder = group(1, "ponder", "Ponder settings"); public ConfigBool comfyReading = diff --git a/src/main/java/com/simibubi/create/foundation/config/CCuriosities.java b/src/main/java/com/simibubi/create/foundation/config/CCuriosities.java index 6bc63467d..fda20ec53 100644 --- a/src/main/java/com/simibubi/create/foundation/config/CCuriosities.java +++ b/src/main/java/com/simibubi/create/foundation/config/CCuriosities.java @@ -13,7 +13,8 @@ public class CCuriosities extends ConfigBase { private static class Comments { static String symmetryRange = "The Maximum Distance to an active mirror for the symmetry wand to trigger."; - static String placementRange = "The Maximum Distance a Block placed by Create's placement assist will have to its interaction point."; + static String placementRange = + "The Maximum Distance a Block placed by Create's placement assist will have to its interaction point."; // static String zapperUndoLogLength = "The maximum amount of operations, a blockzapper can remember for undoing. (0 to disable undo)"; } diff --git a/src/main/java/com/simibubi/create/foundation/config/CKinetics.java b/src/main/java/com/simibubi/create/foundation/config/CKinetics.java index 711b3e4dd..ec9218eb1 100644 --- a/src/main/java/com/simibubi/create/foundation/config/CKinetics.java +++ b/src/main/java/com/simibubi/create/foundation/config/CKinetics.java @@ -12,7 +12,8 @@ public class CKinetics extends ConfigBase { public ConfigInt maxRotationSpeed = i(256, 64, "maxRotationSpeed", Comments.rpm, Comments.maxRotationSpeed); public ConfigEnum ignoreDeployerAttacks = e(DeployerAggroSetting.CREEPERS, "ignoreDeployerAttacks", Comments.ignoreDeployerAttacks); - public ConfigInt kineticValidationFrequency = i(60, 5, "kineticValidationFrequency", Comments.kineticValidationFrequency); + public ConfigInt kineticValidationFrequency = + i(60, 5, "kineticValidationFrequency", Comments.kineticValidationFrequency); public ConfigFloat crankHungerMultiplier = f(.01f, 0, 1, "crankHungerMultiplier", Comments.crankHungerMultiplier); public ConfigInt minimumWindmillSails = i(8, 0, "minimumWindmillSails", Comments.minimumWindmillSails); public ConfigInt maxEjectorDistance = i(32, 0, "maxEjectorDistance", Comments.maxEjectorDistance); @@ -32,7 +33,7 @@ public class CKinetics extends ConfigBase { public ConfigInt maxPistonPoles = i(64, 1, "maxPistonPoles", Comments.maxPistonPoles); public ConfigInt maxRopeLength = i(128, 1, "maxRopeLength", Comments.maxRopeLength); public ConfigInt maxCartCouplingLength = i(32, 1, "maxCartCouplingLength", Comments.maxCartCouplingLength); - + public CStress stressValues = nested(1, CStress::new, Comments.stress); public ConfigGroup state = group(1, "stats", Comments.stats); @@ -60,8 +61,10 @@ public class CKinetics extends ConfigBase { static String fanRotationArgmax = "Rotation speed at which the maximum stats of fans are reached."; static String generatingFanSpeed = "Rotation speed generated by a vertical fan above fire."; static String inWorldProcessingTime = "Game ticks required for a Fan-based processing recipe to take effect."; - static String crankHungerMultiplier = "multiplier used for calculating exhaustion from speed when a crank is turned."; - static String maxBlocksMoved = "Maximum amount of blocks in a structure movable by Pistons, Bearings or other means."; + static String crankHungerMultiplier = + "multiplier used for calculating exhaustion from speed when a crank is turned."; + static String maxBlocksMoved = + "Maximum amount of blocks in a structure movable by Pistons, Bearings or other means."; static String maxChassisRange = "Maximum value of a chassis attachment range."; static String maxPistonPoles = "Maximum amount of extension poles behind a Mechanical Piston."; static String maxRopeLength = "Max length of rope available off a Rope Pulley."; @@ -78,13 +81,17 @@ public class CKinetics extends ConfigBase { static String stress = "Fine tune the kinetic stats of individual components"; static String ignoreDeployerAttacks = "Select what mobs should ignore Deployers when attacked by them."; static String waterWheelBaseSpeed = "Added rotation speed by a water wheel when at least one flow is present."; - static String waterWheelFlowSpeed = "Rotation speed gained by a water wheel for each side with running fluids. (halved if not against blades)"; + static String waterWheelFlowSpeed = + "Rotation speed gained by a water wheel for each side with running fluids. (halved if not against blades)"; static String furnaceEngineSpeed = "Base rotation speed for the furnace engine generator"; static String disableStress = "Disable the Stress mechanic altogether."; - static String kineticValidationFrequency = "Game ticks between Kinetic Blocks checking whether their source is still valid."; - static String minimumWindmillSails = "Amount of sail-type blocks required for a windmill to assemble successfully."; + static String kineticValidationFrequency = + "Game ticks between Kinetic Blocks checking whether their source is still valid."; + static String minimumWindmillSails = + "Amount of sail-type blocks required for a windmill to assemble successfully."; static String maxEjectorDistance = "Max Distance in blocks a Weighted Ejector can throw"; - static String ejectorScanInterval = "Time in ticks until the next item launched by an ejector scans blocks for potential collisions"; + static String ejectorScanInterval = + "Time in ticks until the next item launched by an ejector scans blocks for potential collisions"; } public static enum DeployerAggroSetting { diff --git a/src/main/java/com/simibubi/create/foundation/config/CLogistics.java b/src/main/java/com/simibubi/create/foundation/config/CLogistics.java index 4fa8cc416..33e4333cb 100644 --- a/src/main/java/com/simibubi/create/foundation/config/CLogistics.java +++ b/src/main/java/com/simibubi/create/foundation/config/CLogistics.java @@ -19,7 +19,8 @@ public class CLogistics extends ConfigBase { static String defaultExtractionTimer = "The amount of ticks a funnel waits between item transferrals, when it is not re-activated by redstone."; static String linkRange = "Maximum possible range in blocks of redstone link connections."; - static String psiTimeout = "The amount of ticks a portable storage interface waits for transfers until letting contraptions move along."; + static String psiTimeout = + "The amount of ticks a portable storage interface waits for transfers until letting contraptions move along."; static String mechanicalArmRange = "Maximum distance in blocks a Mechanical Arm can reach across."; } diff --git a/src/main/java/com/simibubi/create/foundation/config/CSchematics.java b/src/main/java/com/simibubi/create/foundation/config/CSchematics.java index 0b6d99f9d..21a38ef34 100644 --- a/src/main/java/com/simibubi/create/foundation/config/CSchematics.java +++ b/src/main/java/com/simibubi/create/foundation/config/CSchematics.java @@ -11,7 +11,8 @@ public class CSchematics extends ConfigBase { public ConfigGroup schematicannon = group(0, "schematicannon", "Schematicannon"); public ConfigInt schematicannonDelay = i(10, 1, "schematicannonDelay", Comments.delay); public ConfigInt schematicannonSkips = i(10, 1, "schematicannonSkips", Comments.skips); - public ConfigFloat schematicannonGunpowderWorth = f(20, 0, 100, "schematicannonGunpowderWorth", Comments.gunpowderWorth); + public ConfigFloat schematicannonGunpowderWorth = + f(20, 0, 100, "schematicannonGunpowderWorth", Comments.gunpowderWorth); public ConfigFloat schematicannonFuelUsage = f(0.05f, 0, 100, "schematicannonFuelUsage", Comments.fuelUsage); @Override diff --git a/src/main/java/com/simibubi/create/foundation/config/ConfigBase.java b/src/main/java/com/simibubi/create/foundation/config/ConfigBase.java index e9a84e696..213f8ff51 100644 --- a/src/main/java/com/simibubi/create/foundation/config/ConfigBase.java +++ b/src/main/java/com/simibubi/create/foundation/config/ConfigBase.java @@ -22,7 +22,7 @@ public abstract class ConfigBase { protected List children; protected void registerAll(final ForgeConfigSpec.Builder builder) { - for (CValue cValue : allValues) + for (CValue cValue : allValues) cValue.register(builder); } @@ -40,7 +40,7 @@ public abstract class ConfigBase { @FunctionalInterface protected static interface IValueProvider> - extends Function { + extends Function { } protected ConfigBool b(boolean current, String name, String... comment) { @@ -62,7 +62,7 @@ public abstract class ConfigBase { protected ConfigInt i(int current, int min, String name, String... comment) { return i(current, min, Integer.MAX_VALUE, name, comment); } - + protected > ConfigEnum e(T defaultValue, String name, String... comment) { return new ConfigEnum<>(name, defaultValue, comment); } @@ -163,13 +163,13 @@ public abstract class ConfigBase { super(name, builder -> builder.define(name, def), comment); } } - + public class ConfigEnum> extends CValue> { public ConfigEnum(String name, T defaultValue, String[] comment) { super(name, builder -> builder.defineEnum(name, defaultValue), comment); } - + } public class ConfigFloat extends CValue { diff --git a/src/main/java/com/simibubi/create/foundation/config/StressConfigDefaults.java b/src/main/java/com/simibubi/create/foundation/config/StressConfigDefaults.java index d7fd7aef7..682fc14cc 100644 --- a/src/main/java/com/simibubi/create/foundation/config/StressConfigDefaults.java +++ b/src/main/java/com/simibubi/create/foundation/config/StressConfigDefaults.java @@ -25,19 +25,19 @@ public class StressConfigDefaults { public static NonNullUnaryOperator> setNoImpact() { return setImpact(0); } - + public static NonNullUnaryOperator> setImpact(double impact) { return b -> { registeredDefaultImpacts.put(Create.asResource(b.getName()), impact); return b; }; } - + public static NonNullUnaryOperator> setCapacity(double capacity) { return b -> { registeredDefaultCapacities.put(Create.asResource(b.getName()), capacity); return b; }; } - + } diff --git a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java index cca0af6c0..455bbe2be 100644 --- a/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/BlockStateGen.java @@ -227,8 +227,8 @@ public class BlockStateGen { return ConfiguredModel.builder() .modelFile(p.models() - .getExistingFile(p - .modLoc("block/" + c.getName() + "/block_" + type.getString() + (powered ? "_powered" : "")))) + .getExistingFile(p.modLoc( + "block/" + c.getName() + "/block_" + type.getString() + (powered ? "_powered" : "")))) .rotationY(yRotation % 360) .build(); }); diff --git a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java index 5e70123ba..06851d0f3 100644 --- a/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java +++ b/src/main/java/com/simibubi/create/foundation/data/CreateRegistrate.java @@ -1,5 +1,14 @@ package com.simibubi.create.foundation.data; +import java.util.Collection; +import java.util.IdentityHashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.function.BiConsumer; +import java.util.function.BiFunction; +import java.util.function.Supplier; +import java.util.stream.Collectors; + import com.simibubi.create.Create; import com.simibubi.create.CreateClient; import com.simibubi.create.content.AllSections; @@ -16,7 +25,12 @@ import com.tterrag.registrate.builders.FluidBuilder; import com.tterrag.registrate.builders.ItemBuilder; import com.tterrag.registrate.util.NonNullLazyValue; import com.tterrag.registrate.util.entry.RegistryEntry; -import com.tterrag.registrate.util.nullness.*; +import com.tterrag.registrate.util.nullness.NonNullBiFunction; +import com.tterrag.registrate.util.nullness.NonNullConsumer; +import com.tterrag.registrate.util.nullness.NonNullFunction; +import com.tterrag.registrate.util.nullness.NonNullSupplier; +import com.tterrag.registrate.util.nullness.NonNullUnaryOperator; + import net.minecraft.block.AbstractBlock.Properties; import net.minecraft.block.Block; import net.minecraft.client.renderer.color.IBlockColor; @@ -36,15 +50,6 @@ import net.minecraftforge.fml.RegistryObject; import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; import net.minecraftforge.registries.IForgeRegistryEntry; -import java.util.Collection; -import java.util.IdentityHashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.function.BiConsumer; -import java.util.function.BiFunction; -import java.util.function.Supplier; -import java.util.stream.Collectors; - public class CreateRegistrate extends AbstractRegistrate { protected CreateRegistrate(String modid) { @@ -106,12 +111,14 @@ public class CreateRegistrate extends AbstractRegistrate { .collect(Collectors.toList()); } - public CreateTileEntityBuilder tileEntity(String name, NonNullFunction, ? extends T> factory) { - return this.tileEntity(this.self(), name, (NonNullFunction)factory); + public CreateTileEntityBuilder tileEntity(String name, + NonNullFunction, ? extends T> factory) { + return this.tileEntity(this.self(), name, (NonNullFunction) factory); } @Override - public CreateTileEntityBuilder tileEntity(P parent, String name, NonNullFunction, ? extends T> factory) { + public CreateTileEntityBuilder tileEntity(P parent, String name, + NonNullFunction, ? extends T> factory) { return (CreateTileEntityBuilder) this.entry(name, (callback) -> { return CreateTileEntityBuilder.create(this, parent, name, callback, factory); }); diff --git a/src/main/java/com/simibubi/create/foundation/data/CreateTileEntityBuilder.java b/src/main/java/com/simibubi/create/foundation/data/CreateTileEntityBuilder.java index 4b4637576..64286f525 100644 --- a/src/main/java/com/simibubi/create/foundation/data/CreateTileEntityBuilder.java +++ b/src/main/java/com/simibubi/create/foundation/data/CreateTileEntityBuilder.java @@ -1,5 +1,7 @@ package com.simibubi.create.foundation.data; +import javax.annotation.Nullable; + import com.simibubi.create.foundation.render.backend.instancing.IRendererFactory; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderRegistry; import com.tterrag.registrate.AbstractRegistrate; @@ -8,44 +10,45 @@ import com.tterrag.registrate.builders.TileEntityBuilder; import com.tterrag.registrate.util.OneTimeEventReceiver; import com.tterrag.registrate.util.nullness.NonNullFunction; import com.tterrag.registrate.util.nullness.NonNullSupplier; + import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityType; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; -import javax.annotation.Nullable; - public class CreateTileEntityBuilder extends TileEntityBuilder { - @Nullable - private NonNullSupplier> instanceFactory; + @Nullable + private NonNullSupplier> instanceFactory; - public static TileEntityBuilder create(AbstractRegistrate owner, P parent, String name, BuilderCallback callback, NonNullFunction, ? extends T> factory) { - return new CreateTileEntityBuilder<>(owner, parent, name, callback, factory); - } + public static TileEntityBuilder create(AbstractRegistrate owner, P parent, + String name, BuilderCallback callback, NonNullFunction, ? extends T> factory) { + return new CreateTileEntityBuilder<>(owner, parent, name, callback, factory); + } - protected CreateTileEntityBuilder(AbstractRegistrate owner, P parent, String name, BuilderCallback callback, NonNullFunction, ? extends T> factory) { - super(owner, parent, name, callback, factory); - } + protected CreateTileEntityBuilder(AbstractRegistrate owner, P parent, String name, BuilderCallback callback, + NonNullFunction, ? extends T> factory) { + super(owner, parent, name, callback, factory); + } - public CreateTileEntityBuilder instance(NonNullSupplier> instanceFactory) { - if (this.instanceFactory == null) { - DistExecutor.runWhenOn(Dist.CLIENT, () -> this::registerInstance); - } + public CreateTileEntityBuilder instance(NonNullSupplier> instanceFactory) { + if (this.instanceFactory == null) { + DistExecutor.runWhenOn(Dist.CLIENT, () -> this::registerInstance); + } - this.instanceFactory = instanceFactory; + this.instanceFactory = instanceFactory; - return this; - } + return this; + } - protected void registerInstance() { - OneTimeEventReceiver.addModListener(FMLClientSetupEvent.class, ($) -> { - NonNullSupplier> instanceFactory = this.instanceFactory; - if (instanceFactory != null) { - InstancedTileRenderRegistry.instance.register(getEntry(), instanceFactory.get()); - } + protected void registerInstance() { + OneTimeEventReceiver.addModListener(FMLClientSetupEvent.class, ($) -> { + NonNullSupplier> instanceFactory = this.instanceFactory; + if (instanceFactory != null) { + InstancedTileRenderRegistry.instance.register(getEntry(), instanceFactory.get()); + } - }); - } + }); + } } diff --git a/src/main/java/com/simibubi/create/foundation/data/SpecialBlockStateGen.java b/src/main/java/com/simibubi/create/foundation/data/SpecialBlockStateGen.java index e011078dd..98aea3c9c 100644 --- a/src/main/java/com/simibubi/create/foundation/data/SpecialBlockStateGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/SpecialBlockStateGen.java @@ -15,7 +15,7 @@ public abstract class SpecialBlockStateGen { protected Property[] getIgnoredProperties() { return new Property[0]; } - + public final void generate(DataGenContext ctx, RegistrateBlockstateProvider prov) { prov.getVariantBuilder(ctx.getEntry()) .forAllStatesExcept(state -> { @@ -28,11 +28,12 @@ public abstract class SpecialBlockStateGen { } protected int horizontalAngle(Direction direction) { - if (direction.getAxis().isVertical()) + if (direction.getAxis() + .isVertical()) return 0; return (int) direction.getHorizontalAngle(); } - + protected abstract int getXRotation(BlockState state); protected abstract int getYRotation(BlockState state); diff --git a/src/main/java/com/simibubi/create/foundation/data/WindowGen.java b/src/main/java/com/simibubi/create/foundation/data/WindowGen.java index 001eb5e9a..3aabbe3d3 100644 --- a/src/main/java/com/simibubi/create/foundation/data/WindowGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/WindowGen.java @@ -44,8 +44,10 @@ public class WindowGen { private static final CreateRegistrate REGISTRATE = Create.registrate(); private static Properties glassProperties(Properties p) { - return p.allowsSpawning(WindowGen::never).solidBlock(WindowGen::never).suffocates(WindowGen::never) - .blockVision(WindowGen::never); + return p.allowsSpawning(WindowGen::never) + .solidBlock(WindowGen::never) + .suffocates(WindowGen::never) + .blockVision(WindowGen::never); } private static boolean never(BlockState p_235436_0_, IBlockReader p_235436_1_, BlockPos p_235436_2_) { @@ -53,7 +55,7 @@ public class WindowGen { } private static Boolean never(BlockState p_235427_0_, IBlockReader p_235427_1_, BlockPos p_235427_2_, - EntityType p_235427_3_) { + EntityType p_235427_3_) { return false; } diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/FillingRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/FillingRecipeGen.java index 60faad0fa..b677d9fa7 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/FillingRecipeGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/FillingRecipeGen.java @@ -5,6 +5,7 @@ import com.simibubi.create.AllItems; import com.simibubi.create.AllRecipeTypes; import com.simibubi.create.AllTags; import com.simibubi.create.content.contraptions.fluids.potion.PotionFluidHandler; + import net.minecraft.data.DataGenerator; import net.minecraft.fluid.Fluids; import net.minecraft.item.Items; diff --git a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java index 9f0be9e2f..7473a1b8d 100644 --- a/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java +++ b/src/main/java/com/simibubi/create/foundation/data/recipe/StandardRecipeGen.java @@ -1,5 +1,17 @@ package com.simibubi.create.foundation.data.recipe; +import static com.simibubi.create.foundation.data.recipe.Mods.EID; +import static com.simibubi.create.foundation.data.recipe.Mods.IE; +import static com.simibubi.create.foundation.data.recipe.Mods.INF; +import static com.simibubi.create.foundation.data.recipe.Mods.MEK; +import static com.simibubi.create.foundation.data.recipe.Mods.MW; +import static com.simibubi.create.foundation.data.recipe.Mods.SM; +import static com.simibubi.create.foundation.data.recipe.Mods.TH; + +import java.util.ArrayList; +import java.util.List; +import java.util.function.UnaryOperator; + import com.google.common.base.Supplier; import com.google.common.collect.ImmutableList; import com.google.gson.JsonArray; @@ -15,10 +27,15 @@ import com.simibubi.create.foundation.utility.Lang; import com.tterrag.registrate.util.entry.BlockEntry; import com.tterrag.registrate.util.entry.ItemEntry; import com.tterrag.registrate.util.entry.ItemProviderEntry; + import net.minecraft.advancements.criterion.ItemPredicate; import net.minecraft.block.Block; import net.minecraft.block.Blocks; -import net.minecraft.data.*; +import net.minecraft.data.CookingRecipeBuilder; +import net.minecraft.data.DataGenerator; +import net.minecraft.data.IFinishedRecipe; +import net.minecraft.data.ShapedRecipeBuilder; +import net.minecraft.data.ShapelessRecipeBuilder; import net.minecraft.item.Item; import net.minecraft.item.Items; import net.minecraft.item.crafting.CookingRecipeSerializer; @@ -34,12 +51,6 @@ import net.minecraftforge.common.crafting.conditions.ICondition; import net.minecraftforge.common.crafting.conditions.ModLoadedCondition; import net.minecraftforge.common.crafting.conditions.NotCondition; -import java.util.ArrayList; -import java.util.List; -import java.util.function.UnaryOperator; - -import static com.simibubi.create.foundation.data.recipe.Mods.*; - @SuppressWarnings("unused") public class StandardRecipeGen extends CreateRecipeProvider { diff --git a/src/main/java/com/simibubi/create/foundation/fluid/FluidHelper.java b/src/main/java/com/simibubi/create/foundation/fluid/FluidHelper.java index b5bdb822c..96d61a412 100644 --- a/src/main/java/com/simibubi/create/foundation/fluid/FluidHelper.java +++ b/src/main/java/com/simibubi/create/foundation/fluid/FluidHelper.java @@ -45,12 +45,13 @@ public class FluidHelper { public static boolean isLava(Fluid fluid) { return convertToStill(fluid) == Fluids.LAVA; } - + public static boolean hasBlockState(Fluid fluid) { - BlockState blockState = fluid.getDefaultState().getBlockState(); + BlockState blockState = fluid.getDefaultState() + .getBlockState(); return blockState != null && blockState != Blocks.AIR.getDefaultState(); } - + public static FluidStack copyStackWithAmount(FluidStack fs, int amount) { if (fs.isEmpty()) return FluidStack.EMPTY; diff --git a/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java b/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java index 4aadb6995..1082cb755 100644 --- a/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java +++ b/src/main/java/com/simibubi/create/foundation/fluid/FluidIngredient.java @@ -143,7 +143,7 @@ public abstract class FluidIngredient implements Predicate { public FluidStackIngredient() { tagToMatch = new CompoundNBT(); } - + void fixFlowing() { if (fluid instanceof FlowingFluid) fluid = ((FlowingFluid) fluid).getStillFluid(); diff --git a/src/main/java/com/simibubi/create/foundation/fluid/SmartFluidTank.java b/src/main/java/com/simibubi/create/foundation/fluid/SmartFluidTank.java index a9a79d132..db37ecc02 100644 --- a/src/main/java/com/simibubi/create/foundation/fluid/SmartFluidTank.java +++ b/src/main/java/com/simibubi/create/foundation/fluid/SmartFluidTank.java @@ -13,13 +13,13 @@ public class SmartFluidTank extends FluidTank { super(capacity); this.updateCallback = updateCallback; } - + @Override protected void onContentsChanged() { super.onContentsChanged(); updateCallback.accept(getFluid()); } - + @Override public void setFluid(FluidStack stack) { super.setFluid(stack); diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java index 7e3364131..9ad3a705e 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java @@ -46,21 +46,22 @@ public abstract class AbstractSimiContainerScreen extends C @Override protected void drawForeground(MatrixStack p_230451_1_, int p_230451_2_, int p_230451_3_) { - //no-op to prevent screen- and inventory-title from being rendered at incorrect location - //could also set this.titleX/Y and this.playerInventoryTitleX/Y to the proper values instead + // no-op to prevent screen- and inventory-title from being rendered at incorrect location + // could also set this.titleX/Y and this.playerInventoryTitleX/Y to the proper values instead } @Override public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) { - partialTicks = Minecraft.getInstance().getRenderPartialTicks(); + partialTicks = Minecraft.getInstance() + .getRenderPartialTicks(); renderBackground(matrixStack); renderWindow(matrixStack, mouseX, mouseY, partialTicks); - + for (Widget widget : widgets) widget.render(matrixStack, mouseX, mouseY, partialTicks); - + super.render(matrixStack, mouseX, mouseY, partialTicks); - + RenderSystem.enableAlphaTest(); RenderSystem.enableBlend(); RenderSystem.disableRescaleNormal(); @@ -88,7 +89,7 @@ public abstract class AbstractSimiContainerScreen extends C if (widget.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_)) return true; } - + if (super.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_)) return true; @@ -117,7 +118,7 @@ public abstract class AbstractSimiContainerScreen extends C } return super.mouseScrolled(mouseX, mouseY, delta); } - + @Override public boolean mouseReleased(double x, double y, int button) { boolean result = false; @@ -151,16 +152,18 @@ public abstract class AbstractSimiContainerScreen extends C if (!widget.isHovered()) continue; - if (widget instanceof AbstractSimiWidget && !((AbstractSimiWidget) widget).getToolTip().isEmpty()) { + if (widget instanceof AbstractSimiWidget && !((AbstractSimiWidget) widget).getToolTip() + .isEmpty()) { renderTooltip(matrixStack, ((AbstractSimiWidget) widget).getToolTip(), mouseX, mouseY); } } } - - protected void renderItemOverlayIntoGUI(MatrixStack matrixStack, FontRenderer fr, ItemStack stack, int xPosition, int yPosition, - @Nullable String text, int textColor) { + + protected void renderItemOverlayIntoGUI(MatrixStack matrixStack, FontRenderer fr, ItemStack stack, int xPosition, + int yPosition, @Nullable String text, int textColor) { if (!stack.isEmpty()) { - if (stack.getItem().showDurabilityBar(stack)) { + if (stack.getItem() + .showDurabilityBar(stack)) { RenderSystem.disableLighting(); RenderSystem.disableDepthTest(); RenderSystem.disableTexture(); @@ -168,12 +171,14 @@ public abstract class AbstractSimiContainerScreen extends C RenderSystem.disableBlend(); Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); - double health = stack.getItem().getDurabilityForDisplay(stack); + double health = stack.getItem() + .getDurabilityForDisplay(stack); int i = Math.round(13.0F - (float) health * 13.0F); - int j = stack.getItem().getRGBDurabilityForDisplay(stack); + int j = stack.getItem() + .getRGBDurabilityForDisplay(stack); this.draw(bufferbuilder, xPosition + 2, yPosition + 13, 13, 2, 0, 0, 0, 255); this.draw(bufferbuilder, xPosition + 2, yPosition + 13, i, 1, j >> 16 & 255, j >> 8 & 255, j & 255, - 255); + 255); RenderSystem.enableBlend(); RenderSystem.enableAlphaTest(); RenderSystem.enableTexture(); @@ -188,13 +193,14 @@ public abstract class AbstractSimiContainerScreen extends C RenderSystem.disableBlend(); matrixStack.push(); - int guiScaleFactor = (int) client.getWindow().getGuiScaleFactor(); + int guiScaleFactor = (int) client.getWindow() + .getGuiScaleFactor(); matrixStack.translate(xPosition + 16.5f, yPosition + 16.5f, 0); double scale = getItemCountTextScale(); matrixStack.scale((float) scale, (float) scale, 0); matrixStack.translate(-fr.getStringWidth(s) - (guiScaleFactor > 1 ? 0 : -.5f), - -textRenderer.FONT_HEIGHT + (guiScaleFactor > 1 ? 1 : 1.75f), 0); + -textRenderer.FONT_HEIGHT + (guiScaleFactor > 1 ? 1 : 1.75f), 0); fr.drawWithShadow(matrixStack, s, 0, 0, textColor); matrixStack.pop(); @@ -207,7 +213,8 @@ public abstract class AbstractSimiContainerScreen extends C } public double getItemCountTextScale() { - int guiScaleFactor = (int) client.getWindow().getGuiScaleFactor(); + int guiScaleFactor = (int) client.getWindow() + .getGuiScaleFactor(); double scale = 1; switch (guiScaleFactor) { case 1: @@ -229,13 +236,22 @@ public abstract class AbstractSimiContainerScreen extends C } private void draw(BufferBuilder renderer, int x, int y, int width, int height, int red, int green, int blue, - int alpha) { + int alpha) { renderer.begin(7, DefaultVertexFormats.POSITION_COLOR); - renderer.vertex((double) (x + 0), (double) (y + 0), 0.0D).color(red, green, blue, alpha).endVertex(); - renderer.vertex((double) (x + 0), (double) (y + height), 0.0D).color(red, green, blue, alpha).endVertex(); - renderer.vertex((double) (x + width), (double) (y + height), 0.0D).color(red, green, blue, alpha).endVertex(); - renderer.vertex((double) (x + width), (double) (y + 0), 0.0D).color(red, green, blue, alpha).endVertex(); - Tessellator.getInstance().draw(); + renderer.vertex((double) (x + 0), (double) (y + 0), 0.0D) + .color(red, green, blue, alpha) + .endVertex(); + renderer.vertex((double) (x + 0), (double) (y + height), 0.0D) + .color(red, green, blue, alpha) + .endVertex(); + renderer.vertex((double) (x + width), (double) (y + height), 0.0D) + .color(red, green, blue, alpha) + .endVertex(); + renderer.vertex((double) (x + width), (double) (y + 0), 0.0D) + .color(red, green, blue, alpha) + .endVertex(); + Tessellator.getInstance() + .draw(); } /** diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java index 1e2174214..7de342c26 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiScreen.java @@ -70,7 +70,7 @@ public abstract class AbstractSimiScreen extends Screen { for (Widget widget : widgets) if (widget.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_)) return true; - + if (super.keyPressed(code, p_keyPressed_2_, p_keyPressed_3_)) return true; @@ -127,7 +127,8 @@ public abstract class AbstractSimiScreen extends Screen { if (!widget.isHovered()) continue; - if (widget instanceof AbstractSimiWidget && !((AbstractSimiWidget) widget).getToolTip().isEmpty()) { + if (widget instanceof AbstractSimiWidget && !((AbstractSimiWidget) widget).getToolTip() + .isEmpty()) { renderTooltip(ms, ((AbstractSimiWidget) widget).getToolTip(), mouseX, mouseY); } } diff --git a/src/main/java/com/simibubi/create/foundation/gui/AllGuiTextures.java b/src/main/java/com/simibubi/create/foundation/gui/AllGuiTextures.java index 0048dae4f..610721e21 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AllGuiTextures.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AllGuiTextures.java @@ -2,6 +2,7 @@ package com.simibubi.create.foundation.gui; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.Create; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.AbstractGui; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java b/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java index fc489f449..5e404da1f 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java @@ -5,6 +5,7 @@ import com.mojang.blaze3d.matrix.MatrixStack.Entry; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.Create; import com.simibubi.create.foundation.utility.ColorHelper; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.renderer.IRenderTypeBuffer; @@ -21,111 +22,46 @@ public class AllIcons implements IScreenRenderable { private int iconX; private int iconY; - public static final AllIcons - I_ADD = newRow(), - I_TRASH = next(), - I_3x3 = next(), - I_TARGET = next(), - I_PRIORITY_VERY_LOW = next(), - I_PRIORITY_LOW = next(), - I_PRIORITY_HIGH = next(), - I_PRIORITY_VERY_HIGH = next(), - I_BLACKLIST = next(), - I_WHITELIST = next(), - I_WHITELIST_OR = next(), - I_WHITELIST_AND = next(), - I_WHITELIST_NOT = next(), - I_RESPECT_NBT = next(), - I_IGNORE_NBT = next(); + public static final AllIcons I_ADD = newRow(), I_TRASH = next(), I_3x3 = next(), I_TARGET = next(), + I_PRIORITY_VERY_LOW = next(), I_PRIORITY_LOW = next(), I_PRIORITY_HIGH = next(), I_PRIORITY_VERY_HIGH = next(), + I_BLACKLIST = next(), I_WHITELIST = next(), I_WHITELIST_OR = next(), I_WHITELIST_AND = next(), + I_WHITELIST_NOT = next(), I_RESPECT_NBT = next(), I_IGNORE_NBT = next(); - public static final AllIcons - I_CONFIRM = newRow(), - I_NONE = next(), - I_OPEN_FOLDER = next(), - I_REFRESH = next(), - I_ACTIVE = next(), - I_PASSIVE = next(), - I_ROTATE_PLACE = next(), - I_ROTATE_PLACE_RETURNED = next(), - I_ROTATE_NEVER_PLACE = next(), - I_MOVE_PLACE = next(), - I_MOVE_PLACE_RETURNED = next(), - I_MOVE_NEVER_PLACE = next(), - I_CART_ROTATE = next(), - I_CART_ROTATE_PAUSED = next(), + public static final AllIcons I_CONFIRM = newRow(), I_NONE = next(), I_OPEN_FOLDER = next(), I_REFRESH = next(), + I_ACTIVE = next(), I_PASSIVE = next(), I_ROTATE_PLACE = next(), I_ROTATE_PLACE_RETURNED = next(), + I_ROTATE_NEVER_PLACE = next(), I_MOVE_PLACE = next(), I_MOVE_PLACE_RETURNED = next(), + I_MOVE_NEVER_PLACE = next(), I_CART_ROTATE = next(), I_CART_ROTATE_PAUSED = next(), I_CART_ROTATE_LOCKED = next(); - - public static final AllIcons - I_DONT_REPLACE = newRow(), - I_REPLACE_SOLID = next(), - I_REPLACE_ANY = next(), - I_REPLACE_EMPTY = next(), - I_CENTERED = next(), - I_ATTACHED = next(), - I_INSERTED = next(), - I_FILL = next(), - I_PLACE = next(), - I_REPLACE = next(), - I_CLEAR = next(), - I_OVERLAY = next(), - I_FLATTEN = next(), - I_LMB = next(), - I_SCROLL = next(), - I_RMB = next(); - - public static final AllIcons - I_TOOL_DEPLOY = newRow(), - I_SKIP_MISSING = next(), - I_SKIP_TILES = next(), - I_DICE = next(), - I_TUNNEL_SPLIT = next(), - I_TUNNEL_FORCED_SPLIT = next(), - I_TUNNEL_ROUND_ROBIN = next(), - I_TUNNEL_FORCED_ROUND_ROBIN = next(), - I_TUNNEL_PREFER_NEAREST = next(), - I_TUNNEL_RANDOMIZE = next(), + + public static final AllIcons I_DONT_REPLACE = newRow(), I_REPLACE_SOLID = next(), I_REPLACE_ANY = next(), + I_REPLACE_EMPTY = next(), I_CENTERED = next(), I_ATTACHED = next(), I_INSERTED = next(), I_FILL = next(), + I_PLACE = next(), I_REPLACE = next(), I_CLEAR = next(), I_OVERLAY = next(), I_FLATTEN = next(), I_LMB = next(), + I_SCROLL = next(), I_RMB = next(); + + public static final AllIcons I_TOOL_DEPLOY = newRow(), I_SKIP_MISSING = next(), I_SKIP_TILES = next(), + I_DICE = next(), I_TUNNEL_SPLIT = next(), I_TUNNEL_FORCED_SPLIT = next(), I_TUNNEL_ROUND_ROBIN = next(), + I_TUNNEL_FORCED_ROUND_ROBIN = next(), I_TUNNEL_PREFER_NEAREST = next(), I_TUNNEL_RANDOMIZE = next(), I_TUNNEL_SYNCHRONIZE = next(), - - I_TOOL_MOVE_XZ = newRow(), - I_TOOL_MOVE_Y = next(), - I_TOOL_ROTATE = next(), - I_TOOL_MIRROR = next(), - I_ARM_ROUND_ROBIN = next(), - I_ARM_FORCED_ROUND_ROBIN = next(), - I_ARM_PREFER_FIRST = next(), - - I_ADD_INVERTED_ATTRIBUTE = next(), - I_FLIP = next(), - - I_PLAY = newRow(), - I_PAUSE = next(), - I_STOP = next(), - I_PLACEMENT_SETTINGS = next(), - I_ROTATE_CCW = next(), - I_HOUR_HAND_FIRST = next(), - I_MINUTE_HAND_FIRST = next(), - I_HOUR_HAND_FIRST_24 = next(), - - I_PATTERN_SOLID = newRow(), - I_PATTERN_CHECKERED = next(), - I_PATTERN_CHECKERED_INVERSED = next(), + + I_TOOL_MOVE_XZ = newRow(), I_TOOL_MOVE_Y = next(), I_TOOL_ROTATE = next(), I_TOOL_MIRROR = next(), + I_ARM_ROUND_ROBIN = next(), I_ARM_FORCED_ROUND_ROBIN = next(), I_ARM_PREFER_FIRST = next(), + + I_ADD_INVERTED_ATTRIBUTE = next(), I_FLIP = next(), + + I_PLAY = newRow(), I_PAUSE = next(), I_STOP = next(), I_PLACEMENT_SETTINGS = next(), I_ROTATE_CCW = next(), + I_HOUR_HAND_FIRST = next(), I_MINUTE_HAND_FIRST = next(), I_HOUR_HAND_FIRST_24 = next(), + + I_PATTERN_SOLID = newRow(), I_PATTERN_CHECKERED = next(), I_PATTERN_CHECKERED_INVERSED = next(), I_PATTERN_CHANCE_25 = next(), - - I_PATTERN_CHANCE_50 = newRow(), - I_PATTERN_CHANCE_75 = next(), - I_FOLLOW_DIAGONAL = next(), + + I_PATTERN_CHANCE_50 = newRow(), I_PATTERN_CHANCE_75 = next(), I_FOLLOW_DIAGONAL = next(), I_FOLLOW_MATERIAL = next(), - + I_SCHEMATIC = newRow(), - I_MTD_LEFT = newRow(), - I_MTD_CLOSE = next(), - I_MTD_RIGHT = next(), - I_MTD_SCAN = next(), - I_MTD_REPLAY = next(), - I_MTD_USER_MODE = next(), - I_MTD_SLOW_MODE = next(); - + I_MTD_LEFT = newRow(), I_MTD_CLOSE = next(), I_MTD_RIGHT = next(), I_MTD_SCAN = next(), I_MTD_REPLAY = next(), + I_MTD_USER_MODE = next(), I_MTD_SLOW_MODE = next(); + public AllIcons(int x, int y) { iconX = x * 16; iconY = y * 16; @@ -180,7 +116,8 @@ public class AllIcons implements IScreenRenderable { } @OnlyIn(Dist.CLIENT) - private void vertex(Entry peek, IVertexBuilder builder, int j, int k, Vector3d rgb, Vector3d vec, float u, float v) { + private void vertex(Entry peek, IVertexBuilder builder, int j, int k, Vector3d rgb, Vector3d vec, float u, + float v) { builder.vertex(peek.getModel(), (float) vec.x, (float) vec.y, (float) vec.z) .color((float) rgb.x, (float) rgb.y, (float) rgb.z, 1) .texture(u, v) diff --git a/src/main/java/com/simibubi/create/foundation/gui/GuiGameElement.java b/src/main/java/com/simibubi/create/foundation/gui/GuiGameElement.java index e87bb3457..a9b3c24a4 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/GuiGameElement.java +++ b/src/main/java/com/simibubi/create/foundation/gui/GuiGameElement.java @@ -202,7 +202,9 @@ public class GuiGameElement { protected void renderModel(BlockRendererDispatcher blockRenderer, IRenderTypeBuffer.Impl buffer, RenderType renderType, IVertexBuilder vb, MatrixStack ms) { - int color = Minecraft.getInstance().getBlockColors().getColor(blockState, null, null, 0); + int color = Minecraft.getInstance() + .getBlockColors() + .getColor(blockState, null, null, 0); Vector3d rgb = ColorHelper.getRGB(color == -1 ? this.color : color); blockRenderer.getBlockModelRenderer() .renderModel(ms.peek(), vb, blockState, blockmodel, (float) rgb.x, (float) rgb.y, (float) rgb.z, @@ -276,16 +278,16 @@ public class GuiGameElement { cleanUpMatrix(matrixStack); } /* - public void render() { - prepare(); - transform(); - RenderSystem.scaled(1, -1, 1); - RenderSystem.translated(0, 0, -75); - Minecraft.getInstance() - .getItemRenderer() - .renderItemIntoGUI(stack, 0, 0); - cleanUp(); - } + * public void render() { + * prepare(); + * transform(); + * RenderSystem.scaled(1, -1, 1); + * RenderSystem.translated(0, 0, -75); + * Minecraft.getInstance() + * .getItemRenderer() + * .renderItemIntoGUI(stack, 0, 0); + * cleanUp(); + * } */ public static void renderItemIntoGUI(MatrixStack matrixStack, ItemStack stack) { diff --git a/src/main/java/com/simibubi/create/foundation/gui/IScreenRenderable.java b/src/main/java/com/simibubi/create/foundation/gui/IScreenRenderable.java index c17fcad75..161bb01e2 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/IScreenRenderable.java +++ b/src/main/java/com/simibubi/create/foundation/gui/IScreenRenderable.java @@ -1,6 +1,7 @@ package com.simibubi.create.foundation.gui; import com.mojang.blaze3d.matrix.MatrixStack; + import net.minecraft.client.gui.AbstractGui; import net.minecraft.client.gui.screen.Screen; import net.minecraft.util.text.StringTextComponent; @@ -14,6 +15,7 @@ public interface IScreenRenderable { @OnlyIn(Dist.CLIENT) default void draw(MatrixStack ms, int x, int y) { - draw(ms, new Screen(new StringTextComponent("")) {}, x, y); + draw(ms, new Screen(new StringTextComponent("")) { + }, x, y); } } diff --git a/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java b/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java index b8dfbb8a2..e177813cf 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/gui/UIRenderHelper.java @@ -1,10 +1,8 @@ package com.simibubi.create.foundation.gui; -import com.mojang.blaze3d.matrix.MatrixStack; -import net.minecraft.util.math.vector.Matrix4f; -import net.minecraft.util.math.vector.Vector3f; import org.lwjgl.opengl.GL11; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.utility.ColorHelper; @@ -14,6 +12,8 @@ import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.client.shader.Framebuffer; +import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.util.math.vector.Vector3f; import net.minecraftforge.fml.client.gui.GuiUtils; public class UIRenderHelper { @@ -22,24 +22,29 @@ public class UIRenderHelper { public static void init() { RenderSystem.recordRenderCall(() -> { - MainWindow mainWindow = Minecraft.getInstance().getWindow(); - framebuffer = new Framebuffer(mainWindow.getFramebufferWidth(), mainWindow.getFramebufferHeight(), true, Minecraft.IS_RUNNING_ON_MAC); + MainWindow mainWindow = Minecraft.getInstance() + .getWindow(); + framebuffer = new Framebuffer(mainWindow.getFramebufferWidth(), mainWindow.getFramebufferHeight(), true, + Minecraft.IS_RUNNING_ON_MAC); framebuffer.setFramebufferColor(0, 0, 0, 0); // framebuffer.deleteFramebuffer(); }); } public static void prepFramebufferSize() { - MainWindow window = Minecraft.getInstance().getWindow(); - if (framebuffer.framebufferWidth != window.getFramebufferWidth() || framebuffer.framebufferHeight != window.getFramebufferHeight()) { - framebuffer.func_216491_a(window.getFramebufferWidth(), window.getFramebufferHeight(), Minecraft.IS_RUNNING_ON_MAC); + MainWindow window = Minecraft.getInstance() + .getWindow(); + if (framebuffer.framebufferWidth != window.getFramebufferWidth() + || framebuffer.framebufferHeight != window.getFramebufferHeight()) { + framebuffer.func_216491_a(window.getFramebufferWidth(), window.getFramebufferHeight(), + Minecraft.IS_RUNNING_ON_MAC); } } public static void drawFramebuffer(float alpha) { MainWindow window = Minecraft.getInstance() .getWindow(); - + float vx = (float) window.getScaledWidth(); float vy = (float) window.getScaledHeight(); float tx = (float) framebuffer.framebufferWidth / (float) framebuffer.framebufferTextureWidth; @@ -58,10 +63,22 @@ public class UIRenderHelper { BufferBuilder bufferbuilder = tessellator.getBuffer(); bufferbuilder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEXTURE); - bufferbuilder.vertex(0, vy, 0).color(1, 1, 1, alpha).texture(0,0).endVertex(); - bufferbuilder.vertex(vx, vy, 0).color(1, 1, 1, alpha).texture(tx,0).endVertex(); - bufferbuilder.vertex(vx, 0, 0).color(1, 1, 1, alpha).texture(tx, ty).endVertex(); - bufferbuilder.vertex(0, 0, 0).color(1, 1, 1, alpha).texture(0, ty).endVertex(); + bufferbuilder.vertex(0, vy, 0) + .color(1, 1, 1, alpha) + .texture(0, 0) + .endVertex(); + bufferbuilder.vertex(vx, vy, 0) + .color(1, 1, 1, alpha) + .texture(tx, 0) + .endVertex(); + bufferbuilder.vertex(vx, 0, 0) + .color(1, 1, 1, alpha) + .texture(tx, ty) + .endVertex(); + bufferbuilder.vertex(0, 0, 0) + .color(1, 1, 1, alpha) + .texture(0, ty) + .endVertex(); tessellator.draw(); framebuffer.unbindFramebufferTexture(); @@ -69,9 +86,9 @@ public class UIRenderHelper { RenderSystem.enableAlphaTest(); } - //angle in degrees; 0° -> fading to the right - //x and y specify the middle point of the starting edge - //width is the total width of the streak + // angle in degrees; 0° -> fading to the right + // x and y specify the middle point of the starting edge + // width is the total width of the streak public static void streak(MatrixStack ms, float angle, int x, int y, int width, int length, int color) { int a1 = 0xa0 << 24; int a2 = 0x80 << 24; @@ -88,7 +105,7 @@ public class UIRenderHelper { ms.translate(x, y, 0); ms.multiply(Vector3f.POSITIVE_Z.getDegreesQuaternion(angle - 90)); - streak(ms, width/2, length, c1, c2, c3, c4); + streak(ms, width / 2, length, c1, c2, c3, c4); ms.pop(); } @@ -96,14 +113,16 @@ public class UIRenderHelper { private static void streak(MatrixStack ms, int width, int height, int c1, int c2, int c3, int c4) { double split1 = .5; double split2 = .75; - Matrix4f model = ms.peek().getModel(); + Matrix4f model = ms.peek() + .getModel(); GuiUtils.drawGradientRect(model, 0, -width, 0, width, (int) (split1 * height), c1, c2); GuiUtils.drawGradientRect(model, 0, -width, (int) (split1 * height), width, (int) (split2 * height), c2, c3); GuiUtils.drawGradientRect(model, 0, -width, (int) (split2 * height), width, height, c3, c4); } - //draws a wide chevron-style breadcrumb arrow pointing left - public static void breadcrumbArrow(MatrixStack matrixStack, int x, int y, int z, int width, int height, int indent, int startColor, int endColor) { + // draws a wide chevron-style breadcrumb arrow pointing left + public static void breadcrumbArrow(MatrixStack matrixStack, int x, int y, int z, int width, int height, int indent, + int startColor, int endColor) { matrixStack.push(); matrixStack.translate(x - indent, y, z); @@ -115,15 +134,15 @@ public class UIRenderHelper { private static void breadcrumbArrow(MatrixStack ms, int width, int height, int indent, int c1, int c2) { /* - * 0,0 x1,y1 ********************* x4,y4 ***** x7,y7 - * **** **** - * **** **** - * x0,y0 x2,y2 x5,y5 - * **** **** - * **** **** - * x3,y3 ********************* x6,y6 ***** x8,y8 - * - * */ + * 0,0 x1,y1 ********************* x4,y4 ***** x7,y7 + * **** **** + * **** **** + * x0,y0 x2,y2 x5,y5 + * **** **** + * **** **** + * x3,y3 ********************* x6,y6 ***** x8,y8 + * + */ float x0 = 0, y0 = height / 2f; float x1 = indent, y1 = 0; @@ -138,8 +157,8 @@ public class UIRenderHelper { indent = Math.abs(indent); width = Math.abs(width); int fc1 = ColorHelper.mixAlphaColors(c1, c2, 0); - int fc2 = ColorHelper.mixAlphaColors(c1, c2, (indent)/(width + 2f * indent)); - int fc3 = ColorHelper.mixAlphaColors(c1, c2, (indent + width)/(width + 2f * indent)); + int fc2 = ColorHelper.mixAlphaColors(c1, c2, (indent) / (width + 2f * indent)); + int fc3 = ColorHelper.mixAlphaColors(c1, c2, (indent + width) / (width + 2f * indent)); int fc4 = ColorHelper.mixAlphaColors(c1, c2, 1); RenderSystem.disableTexture(); @@ -151,32 +170,69 @@ public class UIRenderHelper { Tessellator tessellator = Tessellator.getInstance(); BufferBuilder bufferbuilder = tessellator.getBuffer(); - Matrix4f model = ms.peek().getModel(); + Matrix4f model = ms.peek() + .getModel(); bufferbuilder.begin(GL11.GL_TRIANGLES, DefaultVertexFormats.POSITION_COLOR); - bufferbuilder.vertex(model, x0, y0, 0).color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF).endVertex(); - bufferbuilder.vertex(model, x1, y1, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex(); - bufferbuilder.vertex(model, x2, y2, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex(); + bufferbuilder.vertex(model, x0, y0, 0) + .color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF) + .endVertex(); + bufferbuilder.vertex(model, x1, y1, 0) + .color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF) + .endVertex(); + bufferbuilder.vertex(model, x2, y2, 0) + .color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF) + .endVertex(); - bufferbuilder.vertex(model, x0, y0, 0).color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF).endVertex(); - bufferbuilder.vertex(model, x2, y2, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex(); - bufferbuilder.vertex(model, x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex(); + bufferbuilder.vertex(model, x0, y0, 0) + .color(fc1 >> 16 & 0xFF, fc1 >> 8 & 0xFF, fc1 & 0xFF, fc1 >> 24 & 0xFF) + .endVertex(); + bufferbuilder.vertex(model, x2, y2, 0) + .color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF) + .endVertex(); + bufferbuilder.vertex(model, x3, y3, 0) + .color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF) + .endVertex(); - bufferbuilder.vertex(model, x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex(); - bufferbuilder.vertex(model, x1, y1, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex(); - bufferbuilder.vertex(model, x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex(); + bufferbuilder.vertex(model, x3, y3, 0) + .color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF) + .endVertex(); + bufferbuilder.vertex(model, x1, y1, 0) + .color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF) + .endVertex(); + bufferbuilder.vertex(model, x4, y4, 0) + .color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF) + .endVertex(); - bufferbuilder.vertex(model, x3, y3, 0).color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF).endVertex(); - bufferbuilder.vertex(model, x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex(); - bufferbuilder.vertex(model, x6, y6, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex(); + bufferbuilder.vertex(model, x3, y3, 0) + .color(fc2 >> 16 & 0xFF, fc2 >> 8 & 0xFF, fc2 & 0xFF, fc2 >> 24 & 0xFF) + .endVertex(); + bufferbuilder.vertex(model, x4, y4, 0) + .color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF) + .endVertex(); + bufferbuilder.vertex(model, x6, y6, 0) + .color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF) + .endVertex(); - bufferbuilder.vertex(model, x5, y5, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex(); - bufferbuilder.vertex(model, x4, y4, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex(); - bufferbuilder.vertex(model, x7, y7, 0).color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF).endVertex(); + bufferbuilder.vertex(model, x5, y5, 0) + .color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF) + .endVertex(); + bufferbuilder.vertex(model, x4, y4, 0) + .color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF) + .endVertex(); + bufferbuilder.vertex(model, x7, y7, 0) + .color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF) + .endVertex(); - bufferbuilder.vertex(model, x6, y6, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex(); - bufferbuilder.vertex(model, x5, y5, 0).color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF).endVertex(); - bufferbuilder.vertex(model, x8, y8, 0).color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF).endVertex(); + bufferbuilder.vertex(model, x6, y6, 0) + .color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF) + .endVertex(); + bufferbuilder.vertex(model, x5, y5, 0) + .color(fc3 >> 16 & 0xFF, fc3 >> 8 & 0xFF, fc3 & 0xFF, fc3 >> 24 & 0xFF) + .endVertex(); + bufferbuilder.vertex(model, x8, y8, 0) + .color(fc4 >> 16 & 0xFF, fc4 >> 8 & 0xFF, fc4 & 0xFF, fc4 >> 24 & 0xFF) + .endVertex(); tessellator.draw(); RenderSystem.shadeModel(GL11.GL_FLAT); diff --git a/src/main/java/com/simibubi/create/foundation/item/CreateItemGroupBase.java b/src/main/java/com/simibubi/create/foundation/item/CreateItemGroupBase.java index 24595ff0a..82d5afc13 100644 --- a/src/main/java/com/simibubi/create/foundation/item/CreateItemGroupBase.java +++ b/src/main/java/com/simibubi/create/foundation/item/CreateItemGroupBase.java @@ -45,13 +45,13 @@ public abstract class CreateItemGroupBase extends ItemGroup { def.fillItemGroup(this, items); } } - + @OnlyIn(Dist.CLIENT) public void addItems(NonNullList items, boolean specialItems) { Minecraft mc = Minecraft.getInstance(); ItemRenderer itemRenderer = mc.getItemRenderer(); ClientWorld world = mc.world; - + for (RegistryEntry entry : getItems()) { Item item = entry.get(); if (item instanceof BlockItem) diff --git a/src/main/java/com/simibubi/create/foundation/item/CustomItemModels.java b/src/main/java/com/simibubi/create/foundation/item/CustomItemModels.java index 089d613ec..805d8e3f6 100644 --- a/src/main/java/com/simibubi/create/foundation/item/CustomItemModels.java +++ b/src/main/java/com/simibubi/create/foundation/item/CustomItemModels.java @@ -18,7 +18,7 @@ public class CustomItemModels { private List, NonNullFunction>> registered; private Map> customModels; - + public CustomItemModels() { registered = new ArrayList<>(); customModels = new IdentityHashMap<>(); @@ -28,7 +28,7 @@ public class CustomItemModels { NonNullFunction behaviour) { registered.add(Pair.of(entry, behaviour)); } - + public void foreach(NonNullBiConsumer> consumer) { loadEntriesIfMissing(); customModels.forEach(consumer); diff --git a/src/main/java/com/simibubi/create/foundation/item/CustomRenderedItems.java b/src/main/java/com/simibubi/create/foundation/item/CustomRenderedItems.java index f7f61cc41..37e5e5f17 100644 --- a/src/main/java/com/simibubi/create/foundation/item/CustomRenderedItems.java +++ b/src/main/java/com/simibubi/create/foundation/item/CustomRenderedItems.java @@ -19,7 +19,7 @@ public class CustomRenderedItems { private List, NonNullFunction>> registered; private Map> customModels; - + public CustomRenderedItems() { registered = new ArrayList<>(); customModels = new IdentityHashMap<>(); @@ -29,8 +29,9 @@ public class CustomRenderedItems { NonNullFunction behaviour) { registered.add(Pair.of(entry, behaviour)); } - - public void foreach(NonNullBiConsumer> consumer) { + + public void foreach( + NonNullBiConsumer> consumer) { loadEntriesIfMissing(); customModels.forEach(consumer); } diff --git a/src/main/java/com/simibubi/create/foundation/item/HiddenIngredientItem.java b/src/main/java/com/simibubi/create/foundation/item/HiddenIngredientItem.java index 210db152d..c565d81e9 100644 --- a/src/main/java/com/simibubi/create/foundation/item/HiddenIngredientItem.java +++ b/src/main/java/com/simibubi/create/foundation/item/HiddenIngredientItem.java @@ -10,7 +10,7 @@ public class HiddenIngredientItem extends Item { public HiddenIngredientItem(Properties p_i48487_1_) { super(p_i48487_1_); } - + @Override public void fillItemGroup(ItemGroup p_150895_1_, NonNullList p_150895_2_) { if (p_150895_1_ != ItemGroup.SEARCH) diff --git a/src/main/java/com/simibubi/create/foundation/item/IItemHandlerModifiableIntermediate.java b/src/main/java/com/simibubi/create/foundation/item/IItemHandlerModifiableIntermediate.java index 9e035eb1f..e45744b0d 100644 --- a/src/main/java/com/simibubi/create/foundation/item/IItemHandlerModifiableIntermediate.java +++ b/src/main/java/com/simibubi/create/foundation/item/IItemHandlerModifiableIntermediate.java @@ -4,12 +4,12 @@ import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandlerModifiable; interface IItemHandlerModifiableIntermediate extends IItemHandlerModifiable { - + @Override public default ItemStack getStackInSlot(int slot) { return getStackInSlotIntermediate(slot); } - + public ItemStack getStackInSlotIntermediate(int slot); - + } \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java index fdd9e74b9..6c8a9afd0 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemDescription.java @@ -108,16 +108,21 @@ public class ItemDescription { ITextComponent rpmUnit = Lang.translate("generic.unit.rpm"); if (hasSpeedRequirement) { - List speedLevels = Lang.translatedOptions("tooltip.speedRequirement", "none", "medium", "high"); + List speedLevels = + Lang.translatedOptions("tooltip.speedRequirement", "none", "medium", "high"); int index = minimumRequiredSpeedLevel.ordinal(); - IFormattableTextComponent level = new StringTextComponent(makeProgressBar(3, index)).formatted(minimumRequiredSpeedLevel.getTextColor()); + IFormattableTextComponent level = + new StringTextComponent(makeProgressBar(3, index)).formatted(minimumRequiredSpeedLevel.getTextColor()); if (hasGlasses) - level.append(String.valueOf(minimumRequiredSpeedLevel.getSpeedValue())).append(rpmUnit).append("+"); + level.append(String.valueOf(minimumRequiredSpeedLevel.getSpeedValue())) + .append(rpmUnit) + .append("+"); else level.append(speedLevels.get(index)); - list.add(Lang.translate("tooltip.speedRequirement").formatted(GRAY)); + list.add(Lang.translate("tooltip.speedRequirement") + .formatted(GRAY)); list.add(level); } @@ -128,15 +133,18 @@ public class ItemDescription { StressImpact impactId = impact >= config.highStressImpact.get() ? StressImpact.HIGH : (impact >= config.mediumStressImpact.get() ? StressImpact.MEDIUM : StressImpact.LOW); int index = impactId.ordinal(); - IFormattableTextComponent level = new StringTextComponent(makeProgressBar(3, index)).formatted(impactId.getAbsoluteColor()); + IFormattableTextComponent level = + new StringTextComponent(makeProgressBar(3, index)).formatted(impactId.getAbsoluteColor()); if (hasGlasses) level.append(impacts.get(id) - .get() + "x ").append(rpmUnit); + .get() + "x ") + .append(rpmUnit); else level.append(stressLevels.get(index)); - list.add(Lang.translate("tooltip.stressImpact").formatted(GRAY)); + list.add(Lang.translate("tooltip.stressImpact") + .formatted(GRAY)); list.add(level); } @@ -148,27 +156,32 @@ public class ItemDescription { StressImpact impactId = capacity >= config.highCapacity.get() ? StressImpact.LOW : (capacity >= config.mediumCapacity.get() ? StressImpact.MEDIUM : StressImpact.HIGH); int index = StressImpact.values().length - 2 - impactId.ordinal(); - IFormattableTextComponent level = new StringTextComponent(makeProgressBar(3, index)).formatted(impactId.getAbsoluteColor()); + IFormattableTextComponent level = + new StringTextComponent(makeProgressBar(3, index)).formatted(impactId.getAbsoluteColor()); if (hasGlasses) - level.append(capacity + "x ").append(rpmUnit); + level.append(capacity + "x ") + .append(rpmUnit); else level.append(stressCapacityLevels.get(index)); - + // if (!isEngine && ((IRotate) block).showCapacityWithAnnotation()) // level += // " " + DARK_GRAY + TextFormatting.ITALIC + Lang.translate("tooltip.capacityProvided.asGenerator"); - list.add(Lang.translate("tooltip.capacityProvided").formatted(GRAY)); + list.add(Lang.translate("tooltip.capacityProvided") + .formatted(GRAY)); list.add(level); IFormattableTextComponent genSpeed = generatorSpeed(block, rpmUnit); - if (!genSpeed.getString().isEmpty()) - list.add(new StringTextComponent(" ").append(genSpeed).formatted(DARK_GRAY)); + if (!genSpeed.getString() + .isEmpty()) + list.add(new StringTextComponent(" ").append(genSpeed) + .formatted(DARK_GRAY)); } - // if (hasSpeedRequirement || hasStressImpact || hasStressCapacity) - // add(linesOnShift, ""); + // if (hasSpeedRequirement || hasStressImpact || hasStressCapacity) + // add(linesOnShift, ""); return list; } @@ -217,19 +230,21 @@ public class ItemDescription { if (hasControls) { IFormattableTextComponent tabBuilder = new StringTextComponent(""); tabBuilder.append(new StringTextComponent(holdCtrl[0]).formatted(DARK_GRAY)); - tabBuilder.append(keyCtrl.copy().formatted(ctrl? WHITE : GRAY)); + tabBuilder.append(keyCtrl.copy() + .formatted(ctrl ? WHITE : GRAY)); tabBuilder.append(new StringTextComponent(holdCtrl[1]).formatted(DARK_GRAY)); list.add(0, tabBuilder); } - + if (hasDescription) { IFormattableTextComponent tabBuilder = new StringTextComponent(""); tabBuilder.append(new StringTextComponent(holdDesc[0]).formatted(DARK_GRAY)); - tabBuilder.append(keyShift.copy().formatted(shift? WHITE : GRAY)); + tabBuilder.append(keyShift.copy() + .formatted(shift ? WHITE : GRAY)); tabBuilder.append(new StringTextComponent(holdDesc[1]).formatted(DARK_GRAY)); list.add(0, tabBuilder); } - + if (shift || ctrl) list.add(hasDescription && hasControls ? 2 : 1, new StringTextComponent("")); } @@ -308,7 +323,8 @@ public class ItemDescription { value = baseSpeed + "-" + (baseSpeed * 2); } - return !value.equals("") ? Lang.translate("tooltip.generationSpeed", value, unitRPM) : StringTextComponent.EMPTY.copy(); + return !value.equals("") ? Lang.translate("tooltip.generationSpeed", value, unitRPM) + : StringTextComponent.EMPTY.copy(); } } diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemHandlerWrapper.java b/src/main/java/com/simibubi/create/foundation/item/ItemHandlerWrapper.java index 6a2190269..2b2c6b4a0 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemHandlerWrapper.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemHandlerWrapper.java @@ -10,7 +10,7 @@ public class ItemHandlerWrapper implements IItemHandlerModifiable { public ItemHandlerWrapper(IItemHandlerModifiable wrapped) { this.wrapped = wrapped; } - + @Override public int getSlots() { return wrapped.getSlots(); diff --git a/src/main/java/com/simibubi/create/foundation/item/ItemHelper.java b/src/main/java/com/simibubi/create/foundation/item/ItemHelper.java index 0263c476f..e8a901d58 100644 --- a/src/main/java/com/simibubi/create/foundation/item/ItemHelper.java +++ b/src/main/java/com/simibubi/create/foundation/item/ItemHelper.java @@ -174,7 +174,8 @@ public class ItemHelper { if (!simulate && hasEnoughItems) inv.extractItem(slot, stack.getCount(), false); - if (extracting.getCount() >= maxExtractionCount || extracting.getCount() >= extracting.getMaxStackSize()) { + if (extracting.getCount() >= maxExtractionCount + || extracting.getCount() >= extracting.getMaxStackSize()) { if (checkHasEnoughItems) { hasEnoughItems = true; checkHasEnoughItems = false; diff --git a/src/main/java/com/simibubi/create/foundation/item/PartialItemModelRenderer.java b/src/main/java/com/simibubi/create/foundation/item/PartialItemModelRenderer.java index d8d331439..8e4d0a60d 100644 --- a/src/main/java/com/simibubi/create/foundation/item/PartialItemModelRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/item/PartialItemModelRenderer.java @@ -34,7 +34,8 @@ public class PartialItemModelRenderer { return instance; } - public static PartialItemModelRenderer of(ItemStack stack, ItemCameraTransforms.TransformType transformType, MatrixStack ms, IRenderTypeBuffer buffer, int overlay) { + public static PartialItemModelRenderer of(ItemStack stack, ItemCameraTransforms.TransformType transformType, + MatrixStack ms, IRenderTypeBuffer buffer, int overlay) { PartialItemModelRenderer instance = get(); instance.stack = stack; instance.buffer = buffer; @@ -47,15 +48,15 @@ public class PartialItemModelRenderer { public void render(IBakedModel model, int light) { render(model, RenderTypes.getItemPartialTranslucent(), light); } - + public void renderSolid(IBakedModel model, int light) { render(model, RenderTypes.getItemPartialSolid(), light); } - + public void renderSolidGlowing(IBakedModel model, int light) { render(model, RenderTypes.getGlowingSolid(), light); } - + public void renderGlowing(IBakedModel model, int light) { render(model, RenderTypes.getGlowingTranslucent(), light); } @@ -86,13 +87,12 @@ public class PartialItemModelRenderer { for (Direction direction : Iterate.directions) { random.setSeed(42L); - ir.renderBakedItemQuads(ms, p_229114_6_, model.getQuads(null, direction, random, data), stack, - light, overlay); + ir.renderBakedItemQuads(ms, p_229114_6_, model.getQuads(null, direction, random, data), stack, light, + overlay); } random.setSeed(42L); - ir.renderBakedItemQuads(ms, p_229114_6_, model.getQuads(null, null, random, data), - stack, light, overlay); + ir.renderBakedItemQuads(ms, p_229114_6_, model.getQuads(null, null, random, data), stack, light, overlay); } } diff --git a/src/main/java/com/simibubi/create/foundation/item/TagDependentIngredientItem.java b/src/main/java/com/simibubi/create/foundation/item/TagDependentIngredientItem.java index edebe8926..55e6f5d8f 100644 --- a/src/main/java/com/simibubi/create/foundation/item/TagDependentIngredientItem.java +++ b/src/main/java/com/simibubi/create/foundation/item/TagDependentIngredientItem.java @@ -5,7 +5,6 @@ import net.minecraft.item.ItemGroup; import net.minecraft.item.ItemStack; import net.minecraft.tags.ITag; import net.minecraft.tags.ItemTags; -import net.minecraft.tags.Tag; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java b/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java index 4c0dadaa3..4b89f7a4f 100644 --- a/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java +++ b/src/main/java/com/simibubi/create/foundation/item/TooltipHelper.java @@ -49,17 +49,22 @@ public class TooltipHelper { public static IFormattableTextComponent holdShift(Palette color, boolean highlighted) { TextFormatting colorFormat = highlighted ? color.hColor : color.color; return Lang.translate("tooltip.holdKey", Lang.translate("tooltip.keyShift") - .formatted(colorFormat)).formatted(TextFormatting.DARK_GRAY); + .formatted(colorFormat)) + .formatted(TextFormatting.DARK_GRAY); } public static void addHint(List tooltip, String hintKey, Object... messageParams) { ITextComponent spacing = IHaveGoggleInformation.componentSpacing; - tooltip.add(spacing.copy().append(Lang.translate(hintKey + ".title")).formatted(GOLD)); + tooltip.add(spacing.copy() + .append(Lang.translate(hintKey + ".title")) + .formatted(GOLD)); ITextComponent hint = Lang.translate(hintKey); List cutComponent = TooltipHelper.cutTextComponent(hint, GRAY, TextFormatting.WHITE); - for (ITextComponent component : cutComponent) tooltip.add(spacing.copy().append(component)); + for (ITextComponent component : cutComponent) + tooltip.add(spacing.copy() + .append(component)); } - + public static void referTo(IItemProvider item, Supplier itemWithTooltip) { tooltipReferrals.put(item.asItem(), () -> itemWithTooltip.get() .asItem() @@ -126,7 +131,7 @@ public class TooltipHelper { String s = getUnformattedDeepText(c); // Apply markup - String markedUp = s;//.replaceAll("_([^_]+)_", highlightColor + "$1" + defaultColor); + String markedUp = s;// .replaceAll("_([^_]+)_", highlightColor + "$1" + defaultColor); // Split words List words = new LinkedList<>(); @@ -182,7 +187,6 @@ public class TooltipHelper { currentlyHighlighted = !currentlyHighlighted; } - return formattedLines; } @@ -300,7 +304,8 @@ public class TooltipHelper { if (!I18n.hasKey(conditionKey)) break; if (i == 1) - tooltip.getLinesOnShift().add(new StringTextComponent("")); + tooltip.getLinesOnShift() + .add(new StringTextComponent("")); tooltip.withBehaviour(I18n.format(conditionKey), I18n.format(behaviourKey)); } @@ -319,7 +324,8 @@ public class TooltipHelper { public static String getTooltipTranslationKey(ItemStack stack) { Item item = stack.getItem(); if (tooltipReferrals.containsKey(item)) - return tooltipReferrals.get(item).get() + ".tooltip"; + return tooltipReferrals.get(item) + .get() + ".tooltip"; return item.getTranslationKey(stack) + ".tooltip"; } diff --git a/src/main/java/com/simibubi/create/foundation/item/WipScription.java b/src/main/java/com/simibubi/create/foundation/item/WipScription.java index 91fd8270b..d16d0b914 100644 --- a/src/main/java/com/simibubi/create/foundation/item/WipScription.java +++ b/src/main/java/com/simibubi/create/foundation/item/WipScription.java @@ -14,7 +14,8 @@ public class WipScription extends ItemDescription { public WipScription(Palette palette) { super(palette); - add(getLines(), Lang.translate("tooltip.workInProgress").formatted(TextFormatting.RED)); + add(getLines(), Lang.translate("tooltip.workInProgress") + .formatted(TextFormatting.RED)); int descriptions = 0; while (I18n.hasKey("create.tooltip.randomWipDescription" + descriptions++)) @@ -27,7 +28,7 @@ public class WipScription extends ItemDescription { lines.addAll(TooltipHelper.cutTextComponent(translate, TextFormatting.DARK_RED, TextFormatting.DARK_RED)); } } - + @Override public List addInformation(List tooltip) { tooltip.set(0, decorateName(tooltip.get(0))); @@ -36,7 +37,12 @@ public class WipScription extends ItemDescription { } public static ITextComponent decorateName(ITextComponent name) { - return StringTextComponent.EMPTY.copy().append(name.copy().formatted(TextFormatting.GRAY, TextFormatting.STRIKETHROUGH)).append(" ").append(Lang.translate("tooltip.wip").formatted(TextFormatting.GOLD)); + return StringTextComponent.EMPTY.copy() + .append(name.copy() + .formatted(TextFormatting.GRAY, TextFormatting.STRIKETHROUGH)) + .append(" ") + .append(Lang.translate("tooltip.wip") + .formatted(TextFormatting.GOLD)); } } diff --git a/src/main/java/com/simibubi/create/foundation/mixin/CancelTileEntityRenderMixin.java b/src/main/java/com/simibubi/create/foundation/mixin/CancelTileEntityRenderMixin.java index fe8dfd965..79994972e 100644 --- a/src/main/java/com/simibubi/create/foundation/mixin/CancelTileEntityRenderMixin.java +++ b/src/main/java/com/simibubi/create/foundation/mixin/CancelTileEntityRenderMixin.java @@ -19,18 +19,18 @@ import net.minecraftforge.api.distmarker.OnlyIn; @Mixin(ChunkRenderDispatcher.CompiledChunk.class) public class CancelTileEntityRenderMixin { - /** - * JUSTIFICATION: when instanced rendering is enabled, many tile entities no longer need - * to be processed by the normal game renderer. This method is only called to retrieve the - * list of tile entities to render. By filtering the output here, we prevent the game from - * doing unnecessary light lookups and frustum checks. - */ - @Inject(at = @At("RETURN"), method = "getTileEntities", cancellable = true) - private void noRenderInstancedTiles(CallbackInfoReturnable> cir) { - if (FastRenderDispatcher.available()) { - List tiles = cir.getReturnValue(); + /** + * JUSTIFICATION: when instanced rendering is enabled, many tile entities no longer need + * to be processed by the normal game renderer. This method is only called to retrieve the + * list of tile entities to render. By filtering the output here, we prevent the game from + * doing unnecessary light lookups and frustum checks. + */ + @Inject(at = @At("RETURN"), method = "getTileEntities", cancellable = true) + private void noRenderInstancedTiles(CallbackInfoReturnable> cir) { + if (FastRenderDispatcher.available()) { + List tiles = cir.getReturnValue(); - tiles.removeIf(tile -> tile instanceof IInstanceRendered && !((IInstanceRendered) tile).shouldRenderAsTE()); - } - } + tiles.removeIf(tile -> tile instanceof IInstanceRendered && !((IInstanceRendered) tile).shouldRenderAsTE()); + } + } } diff --git a/src/main/java/com/simibubi/create/foundation/mixin/EntityContraptionInteractionMixin.java b/src/main/java/com/simibubi/create/foundation/mixin/EntityContraptionInteractionMixin.java index a4ae369e3..76122d409 100644 --- a/src/main/java/com/simibubi/create/foundation/mixin/EntityContraptionInteractionMixin.java +++ b/src/main/java/com/simibubi/create/foundation/mixin/EntityContraptionInteractionMixin.java @@ -63,7 +63,8 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid .filter(cEntity -> cEntity != null && cEntity.collidingEntities.containsKey(self)) .collect(Collectors.toSet()); - contraptions.addAll(self.world.getEntitiesWithinAABB(AbstractContraptionEntity.class, self.getBoundingBox().grow(1f))); + contraptions.addAll(self.world.getEntitiesWithinAABB(AbstractContraptionEntity.class, self.getBoundingBox() + .grow(1f))); return contraptions; } @@ -75,7 +76,8 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid BlockPos blockPos = new BlockPos(localPos); Contraption contraption = cEntity.getContraption(); - Template.BlockInfo info = contraption.getBlocks().get(blockPos); + Template.BlockInfo info = contraption.getBlocks() + .get(blockPos); if (info != null) { BlockState blockstate = info.state; @@ -84,15 +86,11 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid }); } - @Inject(at = @At( - value = "JUMP", - opcode = 154, // IFNE line 587 injecting before `!blockstate.isAir(this.world, blockpos)` - ordinal = 4 - ), - method = "move" - ) + @Inject(at = @At(value = "JUMP", opcode = 154, // IFNE line 587 injecting before `!blockstate.isAir(this.world, blockpos)` + ordinal = 4), method = "move") private void movementMixin(MoverType mover, Vector3d movement, CallbackInfo ci) { - Vector3d worldPos = self.getPositionVec().add(0, -0.2, 0); + Vector3d worldPos = self.getPositionVec() + .add(0, -0.2, 0); AtomicBoolean stepped = new AtomicBoolean(false); forCollision(worldPos, (contraption, blockstate, blockPos) -> { @@ -106,18 +104,20 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid this.nextStepDistance = this.determineNextStepDistance(); } - @Inject(method = {"spawnSprintingParticles"}, at = @At(value = "TAIL")) + @Inject(method = { "spawnSprintingParticles" }, at = @At(value = "TAIL")) private void createRunningParticlesMixin(CallbackInfo ci) { - Vector3d worldPos = self.getPositionVec().add(0, -0.2, 0); + Vector3d worldPos = self.getPositionVec() + .add(0, -0.2, 0); BlockPos pos = new BlockPos(worldPos); // pos where particles are spawned forCollision(worldPos, (contraption, blockstate, blockpos) -> { - if (!blockstate.addRunningEffects(self.world, blockpos, self) && blockstate.getRenderType() != BlockRenderType.INVISIBLE) { + if (!blockstate.addRunningEffects(self.world, blockpos, self) + && blockstate.getRenderType() != BlockRenderType.INVISIBLE) { Vector3d vec3d = self.getMotion(); self.world.addParticle(new BlockParticleData(ParticleTypes.BLOCK, blockstate).setPos(pos), - self.getX() + ((double) rand.nextFloat() - 0.5D) * (double) self.getWidth(), - self.getY() + 0.1D, self.getZ() + ((double) rand.nextFloat() - 0.5D) * (double) self.getWidth(), - vec3d.x * -4.0D, 1.5D, vec3d.z * -4.0D); + self.getX() + ((double) rand.nextFloat() - 0.5D) * (double) self.getWidth(), self.getY() + 0.1D, + self.getZ() + ((double) rand.nextFloat() - 0.5D) * (double) self.getWidth(), vec3d.x * -4.0D, 1.5D, + vec3d.z * -4.0D); } }); } @@ -132,7 +132,8 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid worldPos = worldPos.add(x, y, z); - self.world.playSound(null, worldPos.x + x, worldPos.y + y, worldPos.z + z, event, self.getSoundCategory(), pitch, volume); + self.world.playSound(null, worldPos.x + x, worldPos.y + y, worldPos.z + z, event, self.getSoundCategory(), + pitch, volume); ci.cancel(); } @@ -150,4 +151,3 @@ public abstract class EntityContraptionInteractionMixin extends CapabilityProvid this.contraption = null; } } - diff --git a/src/main/java/com/simibubi/create/foundation/mixin/FogColorTrackerMixin.java b/src/main/java/com/simibubi/create/foundation/mixin/FogColorTrackerMixin.java index 2fe7e98cf..d4cb97910 100644 --- a/src/main/java/com/simibubi/create/foundation/mixin/FogColorTrackerMixin.java +++ b/src/main/java/com/simibubi/create/foundation/mixin/FogColorTrackerMixin.java @@ -12,10 +12,10 @@ import com.simibubi.create.foundation.render.backend.gl.GlFog; @Mixin(GlStateManager.class) public class FogColorTrackerMixin { - @Inject(at = @At("TAIL"), method = "fog") - private static void copyFogColor(int pname, float[] params, CallbackInfo ci) { - if (pname == GL11.GL_FOG_COLOR) { - GlFog.FOG_COLOR = params; - } - } + @Inject(at = @At("TAIL"), method = "fog") + private static void copyFogColor(int pname, float[] params, CallbackInfo ci) { + if (pname == GL11.GL_FOG_COLOR) { + GlFog.FOG_COLOR = params; + } + } } diff --git a/src/main/java/com/simibubi/create/foundation/mixin/LightUpdateMixin.java b/src/main/java/com/simibubi/create/foundation/mixin/LightUpdateMixin.java index f2a4366b8..440a3f68b 100644 --- a/src/main/java/com/simibubi/create/foundation/mixin/LightUpdateMixin.java +++ b/src/main/java/com/simibubi/create/foundation/mixin/LightUpdateMixin.java @@ -2,19 +2,17 @@ package com.simibubi.create.foundation.mixin; import java.util.Map; -import com.simibubi.create.CreateClient; -import net.minecraft.client.world.ClientWorld; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; -import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher; +import com.simibubi.create.CreateClient; import com.simibubi.create.foundation.render.backend.light.LightUpdater; import net.minecraft.client.multiplayer.ClientChunkProvider; +import net.minecraft.client.world.ClientWorld; import net.minecraft.util.math.SectionPos; -import net.minecraft.world.IBlockDisplayReader; import net.minecraft.world.LightType; import net.minecraft.world.chunk.AbstractChunkProvider; import net.minecraft.world.chunk.Chunk; @@ -25,32 +23,35 @@ import net.minecraftforge.api.distmarker.OnlyIn; @Mixin(ClientChunkProvider.class) public abstract class LightUpdateMixin extends AbstractChunkProvider { - /** - * JUSTIFICATION: This method is called after a lighting tick once per subchunk where a - * lighting change occurred that tick. On the client, Minecraft uses this method to inform - * the rendering system that it needs to redraw a chunk. It does all that work asynchronously, - * and we should too. - */ - @Inject(at = @At("HEAD"), method = "markLightChanged") - private void onLightUpdate(LightType type, SectionPos pos, CallbackInfo ci) { - ClientChunkProvider thi = ((ClientChunkProvider) (Object) this); - ClientWorld world = (ClientWorld) thi.getWorld(); + /** + * JUSTIFICATION: This method is called after a lighting tick once per subchunk where a + * lighting change occurred that tick. On the client, Minecraft uses this method to inform + * the rendering system that it needs to redraw a chunk. It does all that work asynchronously, + * and we should too. + */ + @Inject(at = @At("HEAD"), method = "markLightChanged") + private void onLightUpdate(LightType type, SectionPos pos, CallbackInfo ci) { + ClientChunkProvider thi = ((ClientChunkProvider) (Object) this); + ClientWorld world = (ClientWorld) thi.getWorld(); - Chunk chunk = thi.getChunk(pos.getSectionX(), pos.getSectionZ(), false); + Chunk chunk = thi.getChunk(pos.getSectionX(), pos.getSectionZ(), false); - int sectionY = pos.getSectionY(); + int sectionY = pos.getSectionY(); - if (chunk != null) { - chunk.getTileEntityMap() - .entrySet() - .stream() - .filter(entry -> SectionPos.toChunk(entry.getKey().getY()) == sectionY) - .map(Map.Entry::getValue) - .forEach(tile -> { - CreateClient.kineticRenderer.get(world).onLightUpdate(tile); - }); - } + if (chunk != null) { + chunk.getTileEntityMap() + .entrySet() + .stream() + .filter(entry -> SectionPos.toChunk(entry.getKey() + .getY()) == sectionY) + .map(Map.Entry::getValue) + .forEach(tile -> { + CreateClient.kineticRenderer.get(world) + .onLightUpdate(tile); + }); + } - LightUpdater.getInstance().onLightUpdate(world, type, pos.asLong()); - } + LightUpdater.getInstance() + .onLightUpdate(world, type, pos.asLong()); + } } diff --git a/src/main/java/com/simibubi/create/foundation/mixin/NetworkLightUpdateMixin.java b/src/main/java/com/simibubi/create/foundation/mixin/NetworkLightUpdateMixin.java index e3eda853e..06ddf0c30 100644 --- a/src/main/java/com/simibubi/create/foundation/mixin/NetworkLightUpdateMixin.java +++ b/src/main/java/com/simibubi/create/foundation/mixin/NetworkLightUpdateMixin.java @@ -1,7 +1,11 @@ package com.simibubi.create.foundation.mixin; +import org.spongepowered.asm.mixin.Mixin; +import org.spongepowered.asm.mixin.injection.At; +import org.spongepowered.asm.mixin.injection.Inject; +import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + import com.simibubi.create.CreateClient; -import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher; import com.simibubi.create.foundation.render.backend.RenderWork; import com.simibubi.create.foundation.render.backend.light.LightUpdater; @@ -9,39 +13,36 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.network.play.ClientPlayNetHandler; import net.minecraft.client.world.ClientWorld; import net.minecraft.network.play.server.SUpdateLightPacket; -import net.minecraft.util.math.SectionPos; import net.minecraft.world.chunk.Chunk; -import java.util.Map; -import org.spongepowered.asm.mixin.Mixin; -import org.spongepowered.asm.mixin.injection.At; -import org.spongepowered.asm.mixin.injection.Inject; -import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; - @Mixin(ClientPlayNetHandler.class) public class NetworkLightUpdateMixin { - @Inject(at = @At("TAIL"), method = "handleUpdateLight") - private void onLightPacket(SUpdateLightPacket packet, CallbackInfo ci) { - RenderWork.enqueue(() -> { - ClientWorld world = Minecraft.getInstance().world; + @Inject(at = @At("TAIL"), method = "handleUpdateLight") + private void onLightPacket(SUpdateLightPacket packet, CallbackInfo ci) { + RenderWork.enqueue(() -> { + ClientWorld world = Minecraft.getInstance().world; - if (world == null) return; + if (world == null) + return; - int chunkX = packet.getChunkX(); - int chunkZ = packet.getChunkZ(); + int chunkX = packet.getChunkX(); + int chunkZ = packet.getChunkZ(); - Chunk chunk = world.getChunkProvider().getChunk(chunkX, chunkZ, false); + Chunk chunk = world.getChunkProvider() + .getChunk(chunkX, chunkZ, false); - if (chunk != null) { - chunk.getTileEntityMap() - .values() - .forEach(tile -> { - CreateClient.kineticRenderer.get(world).onLightUpdate(tile); - }); - } + if (chunk != null) { + chunk.getTileEntityMap() + .values() + .forEach(tile -> { + CreateClient.kineticRenderer.get(world) + .onLightUpdate(tile); + }); + } - LightUpdater.getInstance().onLightPacket(world, chunkX, chunkZ); - }); - } + LightUpdater.getInstance() + .onLightPacket(world, chunkX, chunkZ); + }); + } } diff --git a/src/main/java/com/simibubi/create/foundation/mixin/RenderHooksMixin.java b/src/main/java/com/simibubi/create/foundation/mixin/RenderHooksMixin.java index 935e884ca..bf97e3c9b 100644 --- a/src/main/java/com/simibubi/create/foundation/mixin/RenderHooksMixin.java +++ b/src/main/java/com/simibubi/create/foundation/mixin/RenderHooksMixin.java @@ -1,11 +1,5 @@ package com.simibubi.create.foundation.mixin; -import com.simibubi.create.foundation.render.KineticRenderer; - -import net.minecraft.block.BlockState; -import net.minecraft.client.renderer.*; -import net.minecraft.util.math.vector.Vector3d; -import net.minecraft.util.math.BlockPos; import org.lwjgl.opengl.GL20; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -16,14 +10,21 @@ import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.CreateClient; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher; +import com.simibubi.create.foundation.render.KineticRenderer; import com.simibubi.create.foundation.render.backend.Backend; import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; import com.simibubi.create.foundation.render.backend.OptifineHandler; +import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.ActiveRenderInfo; +import net.minecraft.client.renderer.GameRenderer; +import net.minecraft.client.renderer.LightTexture; import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.world.ClientWorld; +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -31,53 +32,62 @@ import net.minecraftforge.api.distmarker.OnlyIn; @Mixin(WorldRenderer.class) public class RenderHooksMixin { - @Shadow private ClientWorld world; + @Shadow + private ClientWorld world; - /** - * JUSTIFICATION: This method is called once per layer per frame. It allows us to perform - * layer-correct custom rendering. RenderWorldLast is not refined enough for rendering world objects. - * This should probably be a forge event. - */ - @Inject(at = @At("TAIL"), method = "renderLayer") - private void renderLayer(RenderType type, MatrixStack stack, double camX, double camY, double camZ, CallbackInfo ci) { - if (!Backend.available()) return; + /** + * JUSTIFICATION: This method is called once per layer per frame. It allows us to perform + * layer-correct custom rendering. RenderWorldLast is not refined enough for rendering world objects. + * This should probably be a forge event. + */ + @Inject(at = @At("TAIL"), method = "renderLayer") + private void renderLayer(RenderType type, MatrixStack stack, double camX, double camY, double camZ, + CallbackInfo ci) { + if (!Backend.available()) + return; - Matrix4f viewProjection = stack.peek().getModel().copy(); - viewProjection.multiplyBackward(FastRenderDispatcher.getProjectionMatrix()); + Matrix4f viewProjection = stack.peek() + .getModel() + .copy(); + viewProjection.multiplyBackward(FastRenderDispatcher.getProjectionMatrix()); - FastRenderDispatcher.renderLayer(type, viewProjection, camX, camY, camZ); + FastRenderDispatcher.renderLayer(type, viewProjection, camX, camY, camZ); - ContraptionRenderDispatcher.renderLayer(type, viewProjection, camX, camY, camZ); + ContraptionRenderDispatcher.renderLayer(type, viewProjection, camX, camY, camZ); - GL20.glUseProgram(0); - } + GL20.glUseProgram(0); + } - @Inject(at = @At(value = "INVOKE", target = "net.minecraft.client.renderer.WorldRenderer.updateChunks(J)V"), method = "render") - private void setupFrame(MatrixStack p_228426_1_, float p_228426_2_, long p_228426_3_, boolean p_228426_5_, ActiveRenderInfo info, GameRenderer p_228426_7_, LightTexture p_228426_8_, Matrix4f p_228426_9_, CallbackInfo ci) { - Vector3d cameraPos = info.getProjectedView(); - double camX = cameraPos.getX(); - double camY = cameraPos.getY(); - double camZ = cameraPos.getZ(); + @Inject(at = @At(value = "INVOKE", target = "net.minecraft.client.renderer.WorldRenderer.updateChunks(J)V"), method = "render") + private void setupFrame(MatrixStack p_228426_1_, float p_228426_2_, long p_228426_3_, boolean p_228426_5_, + ActiveRenderInfo info, GameRenderer p_228426_7_, LightTexture p_228426_8_, Matrix4f p_228426_9_, + CallbackInfo ci) { + Vector3d cameraPos = info.getProjectedView(); + double camX = cameraPos.getX(); + double camY = cameraPos.getY(); + double camZ = cameraPos.getZ(); - CreateClient.kineticRenderer.get(world).beginFrame(info, camX, camY, camZ); - ContraptionRenderDispatcher.beginFrame(info, camX, camY, camZ); - } + CreateClient.kineticRenderer.get(world) + .beginFrame(info, camX, camY, camZ); + ContraptionRenderDispatcher.beginFrame(info, camX, camY, camZ); + } - @Inject(at = @At("TAIL"), method = "scheduleBlockRerenderIfNeeded") - private void checkUpdate(BlockPos pos, BlockState lastState, BlockState newState, CallbackInfo ci) { - CreateClient.kineticRenderer.get(world).update(world.getTileEntity(pos)); - } + @Inject(at = @At("TAIL"), method = "scheduleBlockRerenderIfNeeded") + private void checkUpdate(BlockPos pos, BlockState lastState, BlockState newState, CallbackInfo ci) { + CreateClient.kineticRenderer.get(world) + .update(world.getTileEntity(pos)); + } - @Inject(at = @At("TAIL"), method = "loadRenderers") - private void refresh(CallbackInfo ci) { - ContraptionRenderDispatcher.invalidateAll(); - OptifineHandler.refresh(); - Backend.refresh(); + @Inject(at = @At("TAIL"), method = "loadRenderers") + private void refresh(CallbackInfo ci) { + ContraptionRenderDispatcher.invalidateAll(); + OptifineHandler.refresh(); + Backend.refresh(); - if (Backend.canUseInstancing() && world != null) { - KineticRenderer kineticRenderer = CreateClient.kineticRenderer.get(world); - kineticRenderer.invalidate(); - world.loadedTileEntityList.forEach(kineticRenderer::add); - } - } + if (Backend.canUseInstancing() && world != null) { + KineticRenderer kineticRenderer = CreateClient.kineticRenderer.get(world); + kineticRenderer.invalidate(); + world.loadedTileEntityList.forEach(kineticRenderer::add); + } + } } diff --git a/src/main/java/com/simibubi/create/foundation/mixin/ShaderCloseMixin.java b/src/main/java/com/simibubi/create/foundation/mixin/ShaderCloseMixin.java index ed2ada21e..d779d6582 100644 --- a/src/main/java/com/simibubi/create/foundation/mixin/ShaderCloseMixin.java +++ b/src/main/java/com/simibubi/create/foundation/mixin/ShaderCloseMixin.java @@ -17,15 +17,19 @@ import net.minecraft.client.gui.screen.VideoSettingsScreen; @Mixin(Minecraft.class) public class ShaderCloseMixin { - @Shadow @Nullable public Screen currentScreen; + @Shadow + @Nullable + public Screen currentScreen; - @Inject(at = @At("HEAD"), method = "displayGuiScreen") - private void whenScreenChanges(Screen screen, CallbackInfo info) { - if (OptifineHandler.optifineInstalled() && screen instanceof VideoSettingsScreen) { - Screen old = this.currentScreen; - if (old != null && old.getClass().getName().startsWith(OptifineHandler.SHADER_PACKAGE)) { - OptifineHandler.refresh(); - } - } - } + @Inject(at = @At("HEAD"), method = "displayGuiScreen") + private void whenScreenChanges(Screen screen, CallbackInfo info) { + if (OptifineHandler.optifineInstalled() && screen instanceof VideoSettingsScreen) { + Screen old = this.currentScreen; + if (old != null && old.getClass() + .getName() + .startsWith(OptifineHandler.SHADER_PACKAGE)) { + OptifineHandler.refresh(); + } + } + } } diff --git a/src/main/java/com/simibubi/create/foundation/mixin/TileRemoveMixin.java b/src/main/java/com/simibubi/create/foundation/mixin/TileRemoveMixin.java index c34c25c79..b2907a127 100644 --- a/src/main/java/com/simibubi/create/foundation/mixin/TileRemoveMixin.java +++ b/src/main/java/com/simibubi/create/foundation/mixin/TileRemoveMixin.java @@ -1,25 +1,30 @@ package com.simibubi.create.foundation.mixin; -import net.minecraft.client.world.ClientWorld; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.world.World; - import javax.annotation.Nullable; + import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; import org.spongepowered.asm.mixin.injection.callback.CallbackInfo; + import com.simibubi.create.CreateClient; +import net.minecraft.client.world.ClientWorld; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.world.World; + @Mixin(TileEntity.class) public class TileRemoveMixin { - @Shadow @Nullable protected World world; + @Shadow + @Nullable + protected World world; @Inject(at = @At("TAIL"), method = "remove") private void onRemove(CallbackInfo ci) { if (world instanceof ClientWorld) - CreateClient.kineticRenderer.get(this.world).remove((TileEntity) (Object) this); + CreateClient.kineticRenderer.get(this.world) + .remove((TileEntity) (Object) this); } } diff --git a/src/main/java/com/simibubi/create/foundation/mixin/TileWorldHookMixin.java b/src/main/java/com/simibubi/create/foundation/mixin/TileWorldHookMixin.java index 0d7bca29c..a50fbc6ec 100644 --- a/src/main/java/com/simibubi/create/foundation/mixin/TileWorldHookMixin.java +++ b/src/main/java/com/simibubi/create/foundation/mixin/TileWorldHookMixin.java @@ -1,5 +1,7 @@ package com.simibubi.create.foundation.mixin; +import java.util.Set; + import org.spongepowered.asm.mixin.Final; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.Shadow; @@ -16,33 +18,32 @@ import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import java.util.Set; - @OnlyIn(Dist.CLIENT) @Mixin(value = World.class, priority = 1100) // this and create.mixins.json have high priority to load after Performant public class TileWorldHookMixin { final World self = (World) (Object) this; - @Shadow @Final public boolean isRemote; + @Shadow + @Final + public boolean isRemote; - @Shadow @Final protected Set tileEntitiesToBeRemoved; + @Shadow + @Final + protected Set tileEntitiesToBeRemoved; @Inject(at = @At("TAIL"), method = "addTileEntity") private void onAddTile(TileEntity te, CallbackInfoReturnable cir) { if (isRemote) { - CreateClient.kineticRenderer.get(self).queueAdd(te); + CreateClient.kineticRenderer.get(self) + .queueAdd(te); } } /** * Without this we don't unload instances when a chunk unloads. */ - @Inject(at = @At( - value = "INVOKE", - target = "Ljava/util/Set;clear()V", ordinal = 0 - ), - method = "tickBlockEntities") + @Inject(at = @At(value = "INVOKE", target = "Ljava/util/Set;clear()V", ordinal = 0), method = "tickBlockEntities") private void onChunkUnload(CallbackInfo ci) { if (isRemote) { KineticRenderer kineticRenderer = CreateClient.kineticRenderer.get(self); diff --git a/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java b/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java index da35f421f..3e417d17f 100644 --- a/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java +++ b/src/main/java/com/simibubi/create/foundation/networking/AllPackets.java @@ -62,7 +62,8 @@ public enum AllPackets { CONFIGURE_SCHEMATICANNON(ConfigureSchematicannonPacket.class, ConfigureSchematicannonPacket::new, PLAY_TO_SERVER), CONFIGURE_FLEXCRATE(ConfigureFlexcratePacket.class, ConfigureFlexcratePacket::new, PLAY_TO_SERVER), CONFIGURE_STOCKSWITCH(ConfigureStockswitchPacket.class, ConfigureStockswitchPacket::new, PLAY_TO_SERVER), - CONFIGURE_SEQUENCER(ConfigureSequencedGearshiftPacket.class, ConfigureSequencedGearshiftPacket::new, PLAY_TO_SERVER), + CONFIGURE_SEQUENCER(ConfigureSequencedGearshiftPacket.class, ConfigureSequencedGearshiftPacket::new, + PLAY_TO_SERVER), PLACE_SCHEMATIC(SchematicPlacePacket.class, SchematicPlacePacket::new, PLAY_TO_SERVER), UPLOAD_SCHEMATIC(SchematicUploadPacket.class, SchematicUploadPacket::new, PLAY_TO_SERVER), CONFIGURE_FILTER(FilterScreenPacket.class, FilterScreenPacket::new, PLAY_TO_SERVER), @@ -106,7 +107,8 @@ public enum AllPackets { private LoadedPacket packet; - private AllPackets(Class type, Function factory, NetworkDirection direction) { + private AllPackets(Class type, Function factory, + NetworkDirection direction) { packet = new LoadedPacket<>(type, factory, direction); } @@ -121,9 +123,8 @@ public enum AllPackets { } public static void sendToNear(World world, BlockPos pos, int range, Object message) { - channel.send( - PacketDistributor.NEAR.with(TargetPoint.p(pos.getX(), pos.getY(), pos.getZ(), range, world.getRegistryKey())), - message); + channel.send(PacketDistributor.NEAR + .with(TargetPoint.p(pos.getX(), pos.getY(), pos.getZ(), range, world.getRegistryKey())), message); } private static class LoadedPacket { diff --git a/src/main/java/com/simibubi/create/foundation/networking/LeftClickPacket.java b/src/main/java/com/simibubi/create/foundation/networking/LeftClickPacket.java index 8ce69099b..57597dbb7 100644 --- a/src/main/java/com/simibubi/create/foundation/networking/LeftClickPacket.java +++ b/src/main/java/com/simibubi/create/foundation/networking/LeftClickPacket.java @@ -10,15 +10,12 @@ import net.minecraftforge.fml.network.NetworkEvent.Context; public class LeftClickPacket extends SimplePacketBase { - public LeftClickPacket() { - } + public LeftClickPacket() {} - LeftClickPacket(PacketBuffer buffer) { - } + LeftClickPacket(PacketBuffer buffer) {} @Override - public void write(PacketBuffer buffer) { - } + public void write(PacketBuffer buffer) {} @Override public void handle(Supplier context) { diff --git a/src/main/java/com/simibubi/create/foundation/networking/NbtPacket.java b/src/main/java/com/simibubi/create/foundation/networking/NbtPacket.java index 27e60d111..b42262760 100644 --- a/src/main/java/com/simibubi/create/foundation/networking/NbtPacket.java +++ b/src/main/java/com/simibubi/create/foundation/networking/NbtPacket.java @@ -22,7 +22,7 @@ public class NbtPacket extends SimplePacketBase { this(stack, -1); this.hand = hand; } - + public NbtPacket(ItemStack stack, int slot) { this.stack = stack; this.slot = slot; @@ -34,7 +34,7 @@ public class NbtPacket extends SimplePacketBase { slot = buffer.readInt(); hand = Hand.values()[buffer.readInt()]; } - + public void write(PacketBuffer buffer) { buffer.writeItemStack(stack); buffer.writeInt(slot); @@ -42,29 +42,32 @@ public class NbtPacket extends SimplePacketBase { } public void handle(Supplier context) { - context.get().enqueueWork(() -> { - ServerPlayerEntity player = context.get().getSender(); - if (player == null) - return; - if (!(stack.getItem() instanceof SymmetryWandItem || stack.getItem() instanceof ZapperItem)) { - return; - } - stack.removeChildTag("AttributeModifiers"); - if (slot == -1) { - ItemStack heldItem = player.getHeldItem(hand); - if (heldItem.getItem() == stack.getItem()) { - heldItem.setTag(stack.getTag()); + context.get() + .enqueueWork(() -> { + ServerPlayerEntity player = context.get() + .getSender(); + if (player == null) + return; + if (!(stack.getItem() instanceof SymmetryWandItem || stack.getItem() instanceof ZapperItem)) { + return; } - return; - } - - ItemStack heldInSlot = player.inventory.getStackInSlot(slot); - if (heldInSlot.getItem() == stack.getItem()) { - heldInSlot.setTag(stack.getTag()); - } - - }); - context.get().setPacketHandled(true); + stack.removeChildTag("AttributeModifiers"); + if (slot == -1) { + ItemStack heldItem = player.getHeldItem(hand); + if (heldItem.getItem() == stack.getItem()) { + heldItem.setTag(stack.getTag()); + } + return; + } + + ItemStack heldInSlot = player.inventory.getStackInSlot(slot); + if (heldInSlot.getItem() == stack.getItem()) { + heldInSlot.setTag(stack.getTag()); + } + + }); + context.get() + .setPacketHandled(true); } } diff --git a/src/main/java/com/simibubi/create/foundation/networking/SimplePacketBase.java b/src/main/java/com/simibubi/create/foundation/networking/SimplePacketBase.java index 293bc8dd0..6285599fd 100644 --- a/src/main/java/com/simibubi/create/foundation/networking/SimplePacketBase.java +++ b/src/main/java/com/simibubi/create/foundation/networking/SimplePacketBase.java @@ -8,6 +8,7 @@ import net.minecraftforge.fml.network.NetworkEvent.Context; public abstract class SimplePacketBase { public abstract void write(PacketBuffer buffer); + public abstract void handle(Supplier context); - + } diff --git a/src/main/java/com/simibubi/create/foundation/networking/TileEntityConfigurationPacket.java b/src/main/java/com/simibubi/create/foundation/networking/TileEntityConfigurationPacket.java index 8260a5821..4bb198dcc 100644 --- a/src/main/java/com/simibubi/create/foundation/networking/TileEntityConfigurationPacket.java +++ b/src/main/java/com/simibubi/create/foundation/networking/TileEntityConfigurationPacket.java @@ -19,11 +19,11 @@ public abstract class TileEntityConfigurationPacket pos = buffer.readBlockPos(); readSettings(buffer); } - + public TileEntityConfigurationPacket(BlockPos pos) { this.pos = pos; } - + @Override public void write(PacketBuffer buffer) { buffer.writeBlockPos(pos); @@ -33,27 +33,32 @@ public abstract class TileEntityConfigurationPacket @SuppressWarnings("unchecked") @Override public void handle(Supplier context) { - context.get().enqueueWork(() -> { - ServerPlayerEntity player = context.get().getSender(); - if (player == null) - return; - World world = player.world; + context.get() + .enqueueWork(() -> { + ServerPlayerEntity player = context.get() + .getSender(); + if (player == null) + return; + World world = player.world; + + if (world == null || !world.isBlockPresent(pos)) + return; + TileEntity tileEntity = world.getTileEntity(pos); + if (tileEntity instanceof SyncedTileEntity) { + applySettings((TE) tileEntity); + ((SyncedTileEntity) tileEntity).sendData(); + tileEntity.markDirty(); + } + }); + context.get() + .setPacketHandled(true); - if (world == null || !world.isBlockPresent(pos)) - return; - TileEntity tileEntity = world.getTileEntity(pos); - if (tileEntity instanceof SyncedTileEntity) { - applySettings((TE) tileEntity); - ((SyncedTileEntity) tileEntity).sendData(); - tileEntity.markDirty(); - } - }); - context.get().setPacketHandled(true); - } - + protected abstract void writeSettings(PacketBuffer buffer); + protected abstract void readSettings(PacketBuffer buffer); + protected abstract void applySettings(TE te); } diff --git a/src/main/java/com/simibubi/create/foundation/networking/TileEntityDataPacket.java b/src/main/java/com/simibubi/create/foundation/networking/TileEntityDataPacket.java index 2acdffb6d..0be7edd6d 100644 --- a/src/main/java/com/simibubi/create/foundation/networking/TileEntityDataPacket.java +++ b/src/main/java/com/simibubi/create/foundation/networking/TileEntityDataPacket.java @@ -1,7 +1,9 @@ package com.simibubi.create.foundation.networking; -import com.simibubi.create.content.logistics.block.belts.tunnel.BeltTunnelTileEntity; +import java.util.function.Supplier; + import com.simibubi.create.foundation.tileEntity.SyncedTileEntity; + import net.minecraft.client.Minecraft; import net.minecraft.client.world.ClientWorld; import net.minecraft.network.PacketBuffer; @@ -9,48 +11,48 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.network.NetworkEvent; -import java.util.function.Supplier; - /** * A server to client version of {@link TileEntityConfigurationPacket} + * * @param */ public abstract class TileEntityDataPacket extends SimplePacketBase { - protected BlockPos tilePos; + protected BlockPos tilePos; - public TileEntityDataPacket(PacketBuffer buffer) { - tilePos = buffer.readBlockPos(); - } + public TileEntityDataPacket(PacketBuffer buffer) { + tilePos = buffer.readBlockPos(); + } - public TileEntityDataPacket(BlockPos pos) { - this.tilePos = pos; - } + public TileEntityDataPacket(BlockPos pos) { + this.tilePos = pos; + } - @Override - public void write(PacketBuffer buffer) { - buffer.writeBlockPos(tilePos); - writeData(buffer); - } + @Override + public void write(PacketBuffer buffer) { + buffer.writeBlockPos(tilePos); + writeData(buffer); + } - @Override - public void handle(Supplier context) { - NetworkEvent.Context ctx = context.get(); - ctx.enqueueWork(() -> { - ClientWorld world = Minecraft.getInstance().world; + @Override + public void handle(Supplier context) { + NetworkEvent.Context ctx = context.get(); + ctx.enqueueWork(() -> { + ClientWorld world = Minecraft.getInstance().world; - if (world == null) return; + if (world == null) + return; - TileEntity tile = world.getTileEntity(tilePos); + TileEntity tile = world.getTileEntity(tilePos); - if (tile instanceof SyncedTileEntity) { - handlePacket((TE) tile); - } - }); - ctx.setPacketHandled(true); - } + if (tile instanceof SyncedTileEntity) { + handlePacket((TE) tile); + } + }); + ctx.setPacketHandled(true); + } - protected abstract void writeData(PacketBuffer buffer); + protected abstract void writeData(PacketBuffer buffer); - protected abstract void handlePacket(TE tile); + protected abstract void handlePacket(TE tile); } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/ElementLink.java b/src/main/java/com/simibubi/create/foundation/ponder/ElementLink.java index cc336981c..92853a2d5 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/ElementLink.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/ElementLink.java @@ -10,7 +10,7 @@ public class ElementLink { public ElementLink(Class elementClass) { this(elementClass, UUID.randomUUID()); } - + public ElementLink(Class elementClass, UUID id) { this.elementClass = elementClass; this.id = id; @@ -19,9 +19,9 @@ public class ElementLink { public UUID getId() { return id; } - + public T cast(PonderElement e) { return elementClass.cast(e); } - + } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/NavigatableSimiScreen.java b/src/main/java/com/simibubi/create/foundation/ponder/NavigatableSimiScreen.java index 124a4967e..9f834b83c 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/NavigatableSimiScreen.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/NavigatableSimiScreen.java @@ -1,5 +1,13 @@ package com.simibubi.create.foundation.ponder; +import java.util.List; +import java.util.Optional; +import java.util.stream.Collectors; + +import org.apache.commons.lang3.mutable.MutableBoolean; +import org.apache.commons.lang3.mutable.MutableInt; +import org.lwjgl.glfw.GLFW; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.gui.AbstractSimiScreen; import com.simibubi.create.foundation.gui.IScreenRenderable; @@ -9,18 +17,12 @@ import com.simibubi.create.foundation.ponder.content.PonderTagScreen; import com.simibubi.create.foundation.ponder.ui.PonderButton; import com.simibubi.create.foundation.utility.Lang; import com.simibubi.create.foundation.utility.animation.LerpedFloat; + import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.screen.Screen; import net.minecraft.item.ItemStack; import net.minecraft.util.math.MathHelper; -import org.apache.commons.lang3.mutable.MutableBoolean; -import org.apache.commons.lang3.mutable.MutableInt; -import org.lwjgl.glfw.GLFW; - -import java.util.List; -import java.util.Optional; -import java.util.stream.Collectors; public abstract class NavigatableSimiScreen extends AbstractSimiScreen { @@ -31,8 +33,8 @@ public abstract class NavigatableSimiScreen extends AbstractSimiScreen { .startWithValue(0) .chase(0, .1f, LerpedFloat.Chaser.LINEAR); protected final LerpedFloat arrowAnimation = LerpedFloat.linear() - .startWithValue(0) - .chase(0, 0.075f, LerpedFloat.Chaser.LINEAR); + .startWithValue(0) + .chase(0, 0.075f, LerpedFloat.Chaser.LINEAR); protected PonderButton backTrack; public NavigatableSimiScreen() { @@ -98,7 +100,7 @@ public abstract class NavigatableSimiScreen extends AbstractSimiScreen { textRenderer.draw(ms, Lang.translate(THINK_BACK), 15, height - 16, 0xffa3a3a3); if (MathHelper.epsilonEquals(arrowAnimation.getValue(), arrowAnimation.getChaseTarget())) { arrowAnimation.setValue(1); - arrowAnimation.setValue(1);//called twice to also set the previous value to 1 + arrowAnimation.setValue(1);// called twice to also set the previous value to 1 } } ms.pop(); @@ -162,7 +164,8 @@ public abstract class NavigatableSimiScreen extends AbstractSimiScreen { int maxX = backTrack.x + backTrack.getWidth(); if (x + 30 < backTrack.x) - UIRenderHelper.breadcrumbArrow(ms, x + 30, height - 51, 0, maxX - (x + 30), 20, 5, 0x40aa9999, 0x10aa9999); + UIRenderHelper.breadcrumbArrow(ms, x + 30, height - 51, 0, maxX - (x + 30), 20, 5, 0x40aa9999, + 0x10aa9999); UIRenderHelper.breadcrumbArrow(ms, x, height - 51, 0, 30, 20, 5, 0x40aa9999, 0x10aa9999); UIRenderHelper.breadcrumbArrow(ms, x - 30, height - 51, 0, 30, 20, 5, 0x40aa9999, 0x10aa9999); @@ -223,8 +226,8 @@ public abstract class NavigatableSimiScreen extends AbstractSimiScreen { ms.translate(0, 0, 600); names.forEach(s -> { int sWidth = textRenderer.getStringWidth(s); - UIRenderHelper.breadcrumbArrow(ms, x.getValue(), y.getValue(), 0, sWidth + spacing, 14, spacing / 2, 0xdd101010, - 0x44101010); + UIRenderHelper.breadcrumbArrow(ms, x.getValue(), y.getValue(), 0, sWidth + spacing, 14, spacing / 2, + 0xdd101010, 0x44101010); textRenderer.draw(ms, s, x.getValue() + 5, y.getValue() + 3, first.getValue() ? 0xffeeffee : 0xffddeeff); first.setFalse(); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderElement.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderElement.java index 7d1c61f71..5b7df27ac 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderElement.java @@ -5,9 +5,9 @@ public class PonderElement { boolean visible = true; public void whileSkipping(PonderScene scene) {} - + public void tick(PonderScene scene) {} - + public void reset(PonderScene scene) {} public boolean isVisible() { @@ -17,5 +17,5 @@ public class PonderElement { public void setVisible(boolean visible) { this.visible = visible; } - + } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderInstruction.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderInstruction.java index 1cee38f86..1309d33f0 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderInstruction.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderInstruction.java @@ -13,13 +13,13 @@ public abstract class PonderInstruction { public abstract boolean isComplete(); public void onScheduled(PonderScene scene) {} - + public abstract void tick(PonderScene scene); public static PonderInstruction simple(Consumer callback) { return new Simple(callback); } - + private static class Simple extends PonderInstruction { private Consumer callback; @@ -27,7 +27,7 @@ public abstract class PonderInstruction { public Simple(Consumer callback) { this.callback = callback; } - + @Override public boolean isComplete() { return true; @@ -37,7 +37,7 @@ public abstract class PonderInstruction { public void tick(PonderScene scene) { callback.accept(scene); } - + } - + } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java index 674e3b5d2..64d61230b 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderLocalization.java @@ -37,28 +37,32 @@ public class PonderLocalization { public static String getShared(String key) { if (PonderIndex.EDITOR_MODE) return shared.containsKey(key) ? shared.get(key) : ("unregistered shared entry:" + key); - return Lang.translate(langKeyForShared(key)).getString(); + return Lang.translate(langKeyForShared(key)) + .getString(); } public static String getSpecific(String sceneId, String k) { if (PonderIndex.EDITOR_MODE) return specific.get(sceneId) .get(k); - return Lang.translate(langKeyForSpecific(sceneId, k)).getString(); + return Lang.translate(langKeyForSpecific(sceneId, k)) + .getString(); } public static String getTag(String key) { if (PonderIndex.EDITOR_MODE) return tag.containsKey(key) ? tag.get(key) .getFirst() : ("unregistered tag entry:" + key); - return Lang.translate(langKeyForTag(key)).getString(); + return Lang.translate(langKeyForTag(key)) + .getString(); } public static String getTagDescription(String key) { if (PonderIndex.EDITOR_MODE) return tag.containsKey(key) ? tag.get(key) .getSecond() : ("unregistered tag entry:" + key); - return Lang.translate(langKeyForTagDescription(key)).getString(); + return Lang.translate(langKeyForTagDescription(key)) + .getString(); } // @@ -73,7 +77,7 @@ public class PonderLocalization { addGeneral(object, PonderUI.PONDERING, "Pondering about..."); addGeneral(object, PonderUI.IDENTIFY_MODE, "Identify mode active.\nUnpause with [%1$s]"); addGeneral(object, PonderTagScreen.ASSOCIATED, "Associated Entries"); - + addGeneral(object, PonderUI.CLOSE, "Close"); addGeneral(object, PonderUI.IDENTIFY, "Identify"); addGeneral(object, PonderUI.NEXT, "Next Scene"); @@ -96,8 +100,8 @@ public class PonderLocalization { .entrySet() .stream() .sorted(Map.Entry.comparingByKey()) - .forEach(subEntry -> object.addProperty(Create.ID + "." + langKeyForSpecific(entry.getKey(), subEntry.getKey()), - subEntry.getValue())); + .forEach(subEntry -> object.addProperty( + Create.ID + "." + langKeyForSpecific(entry.getKey(), subEntry.getKey()), subEntry.getValue())); }); return object; } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderProgressBar.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderProgressBar.java index fc2921ef2..07411ad8f 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderProgressBar.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderProgressBar.java @@ -1,7 +1,8 @@ package com.simibubi.create.foundation.ponder; +import org.antlr.v4.runtime.misc.IntegerList; + import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.ColorHelper; @@ -11,7 +12,6 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.audio.SoundHandler; import net.minecraft.client.gui.FontRenderer; import net.minecraftforge.fml.client.gui.GuiUtils; -import org.antlr.v4.runtime.misc.IntegerList; public class PonderProgressBar extends AbstractSimiWidget { @@ -58,8 +58,8 @@ public class PonderProgressBar extends AbstractSimiWidget { @Override public void onClick(double mouseX, double mouseY) { - PonderScene activeScene = ponder.getActiveScene(); - IntegerList keyframeTimes = activeScene.keyframeTimes; + PonderScene activeScene = ponder.getActiveScene(); + IntegerList keyframeTimes = activeScene.keyframeTimes; int keyframeIndex = getHoveredKeyframeIndex(activeScene, mouseX); @@ -109,10 +109,11 @@ public class PonderProgressBar extends AbstractSimiWidget { ms.push(); ms.translate(0, 0, 150); - /* ponderButtons are at z+400 - * renderBox is at z+100 - * gradients have to be in front of the box so z>+100 - * */ + /* + * ponderButtons are at z+400 + * renderBox is at z+100 + * gradients have to be in front of the box so z>+100 + */ ms.push(); PonderUI.renderBox(ms, x, y, width, height, false); @@ -123,8 +124,10 @@ public class PonderProgressBar extends AbstractSimiWidget { ms.push(); ms.scale((width + 4) * progress.getValue(partialTicks), 1, 1); - GuiUtils.drawGradientRect(ms.peek().getModel(), 110, 0, 3, 1, 4, 0x80ffeedd, 0x80ffeedd); - GuiUtils.drawGradientRect(ms.peek().getModel(), 110, 0, 4, 1, 5, 0x50ffeedd, 0x50ffeedd); + GuiUtils.drawGradientRect(ms.peek() + .getModel(), 110, 0, 3, 1, 4, 0x80ffeedd, 0x80ffeedd); + GuiUtils.drawGradientRect(ms.peek() + .getModel(), 110, 0, 4, 1, 5, 0x50ffeedd, 0x50ffeedd); ms.pop(); renderKeyframes(ms, mouseX, partialTicks); @@ -174,10 +177,12 @@ public class PonderProgressBar extends AbstractSimiWidget { } } - private void drawKeyframe(MatrixStack ms, PonderScene activeScene, boolean selected, int keyframeTime, int keyframePos, int startColor, int endColor, int height) { + private void drawKeyframe(MatrixStack ms, PonderScene activeScene, boolean selected, int keyframeTime, + int keyframePos, int startColor, int endColor, int height) { if (selected) { FontRenderer font = Minecraft.getInstance().fontRenderer; - GuiUtils.drawGradientRect(ms.peek().getModel(), 500, keyframePos, 10, keyframePos + 1, 10 + height, endColor, startColor); + GuiUtils.drawGradientRect(ms.peek() + .getModel(), 500, keyframePos, 10, keyframePos + 1, 10 + height, endColor, startColor); ms.push(); ms.translate(0, 0, 400); String text; @@ -185,8 +190,7 @@ public class PonderProgressBar extends AbstractSimiWidget { if (activeScene.currentTime < keyframeTime) { text = ">"; offset = -1 - font.getStringWidth(text); - } - else { + } else { text = "<"; offset = 3; } @@ -194,7 +198,8 @@ public class PonderProgressBar extends AbstractSimiWidget { ms.pop(); } - GuiUtils.drawGradientRect(ms.peek().getModel(), 500, keyframePos, -1, keyframePos + 1, 2 + height, startColor, endColor); + GuiUtils.drawGradientRect(ms.peek() + .getModel(), 500, keyframePos, -1, keyframePos + 1, 2 + height, startColor, endColor); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java index 6d1235190..60f10f109 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderScene.java @@ -13,7 +13,6 @@ import java.util.function.Consumer; import java.util.function.Function; import java.util.function.Supplier; -import net.minecraft.util.math.vector.*; import org.antlr.v4.runtime.misc.IntegerList; import org.apache.commons.lang3.mutable.MutableDouble; import org.apache.commons.lang3.mutable.MutableObject; @@ -46,7 +45,11 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.MutableBoundingBox; +import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.util.math.vector.Vector2f; import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.math.vector.Vector3i; +import net.minecraft.util.math.vector.Vector4f; public class PonderScene { @@ -344,13 +347,15 @@ public class PonderScene { public void forEachWorldEntity(Class type, Consumer function) { world.getEntities() - .filter(type::isInstance) - .map(type::cast) - .forEach(function); - /*for (Entity element : world.getEntities()) { - if (type.isInstance(element)) - function.accept(type.cast(element)); - }*/ + .filter(type::isInstance) + .map(type::cast) + .forEach(function); + /* + * for (Entity element : world.getEntities()) { + * if (type.isInstance(element)) + * function.accept(type.cast(element)); + * } + */ } public void forEach(Class type, Consumer function) { @@ -453,7 +458,6 @@ public class PonderScene { return ms; } - public void updateSceneRVE(float pt) { Vector3d v = screenToScene(width / 2, height / 2, 500, pt); renderViewEntity.setPosition(v.x, v.y, v.z); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderStoryBoardEntry.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderStoryBoardEntry.java index 7de4ccf5e..6d6ab1c98 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderStoryBoardEntry.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderStoryBoardEntry.java @@ -1,11 +1,12 @@ package com.simibubi.create.foundation.ponder; -import com.simibubi.create.foundation.ponder.content.PonderTag; -import net.minecraft.util.ResourceLocation; - import java.util.ArrayList; import java.util.List; +import com.simibubi.create.foundation.ponder.content.PonderTag; + +import net.minecraft.util.ResourceLocation; + public class PonderStoryBoardEntry { private final String schematicName; @@ -23,11 +24,11 @@ public class PonderStoryBoardEntry { public interface PonderStoryBoard { void program(SceneBuilder scene, SceneBuildingUtil util); } - + public String getSchematicName() { return schematicName; } - + public PonderStoryBoard getBoard() { return board; } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java index 92ba62c38..0cb380252 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderTooltipHandler.java @@ -35,7 +35,7 @@ public class PonderTooltipHandler { public static void tick() { deferTick = true; } - + public static void deferredTick() { deferTick = false; if (hoveredStack.isEmpty() || trackingStack.isEmpty()) { @@ -69,8 +69,8 @@ public class PonderTooltipHandler { public static void addToTooltip(List toolTip, ItemStack stack) { updateHovered(stack); - - if (deferTick) + + if (deferTick) deferredTick(); if (trackingStack != stack) @@ -78,7 +78,8 @@ public class PonderTooltipHandler { float renderPartialTicks = Minecraft.getInstance() .getRenderPartialTicks(); - ITextComponent component = subject ? Lang.createTranslationTextComponent(SUBJECT).formatted(TextFormatting.GREEN) + ITextComponent component = subject ? Lang.createTranslationTextComponent(SUBJECT) + .formatted(TextFormatting.GREEN) : makeProgressBar(Math.min(1, holdWProgress.getValue(renderPartialTicks) * 8 / 7f)); if (toolTip.size() < 2) toolTip.add(component); @@ -137,10 +138,10 @@ public class PonderTooltipHandler { } private static ITextComponent makeProgressBar(float progress) { - IFormattableTextComponent holdW = Lang.translate( - HOLD_TO_PONDER, - ((IFormattableTextComponent) ponderKeybind().getBoundKeyLocalizedText()).formatted(TextFormatting.GRAY) - ).formatted(TextFormatting.DARK_GRAY); + IFormattableTextComponent holdW = Lang + .translate(HOLD_TO_PONDER, + ((IFormattableTextComponent) ponderKeybind().getBoundKeyLocalizedText()).formatted(TextFormatting.GRAY)) + .formatted(TextFormatting.DARK_GRAY); FontRenderer fontRenderer = Minecraft.getInstance().fontRenderer; float charWidth = fontRenderer.getStringWidth("|"); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java index 8ccb33911..fe97ce39c 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderUI.java @@ -213,7 +213,7 @@ public class PonderUI extends NavigatableSimiScreen { setComfyReadingEnabled(!isComfyReadingEnabled()); }).showing(AllIcons.I_MTD_SLOW_MODE) .fade(0, -1)); - + if (PonderIndex.EDITOR_MODE) { widgets.add(userMode = new PonderButton(width - 50 - 31, bY, () -> { userViewMode = !userViewMode; @@ -274,9 +274,9 @@ public class PonderUI extends NavigatableSimiScreen { PonderScene activeScene = scenes.get(index); extendedTickLength = 0; - if (isComfyReadingEnabled()) + if (isComfyReadingEnabled()) activeScene.forEachVisible(TextWindowElement.class, twe -> extendedTickLength = 2); - + if (extendedTickTimer == 0) { if (!identifyMode) { ponderTicks++; @@ -429,7 +429,7 @@ public class PonderUI extends NavigatableSimiScreen { MutableBoundingBox bounds = story.getBounds(); ms.push(); - //ms.peek().getModel().multiply(ms.peek().getModel()); + // ms.peek().getModel().multiply(ms.peek().getModel()); // kool shadow fx { @@ -453,12 +453,14 @@ public class PonderUI extends NavigatableSimiScreen { if (flash > 0) { ms.push(); ms.scale(1, .5f + flash * .75f, 1); - GuiUtils.drawGradientRect(ms.peek().getModel(),0, 0, -1, -story.basePlateSize, 0, 0x00_c6ffc9, + GuiUtils.drawGradientRect(ms.peek() + .getModel(), 0, 0, -1, -story.basePlateSize, 0, 0x00_c6ffc9, ColorHelper.applyAlpha(0xaa_c6ffc9, alpha)); ms.pop(); } ms.translate(0, 0, 2 / 1024f); - GuiUtils.drawGradientRect(ms.peek().getModel(), 0, 0, 0, -story.basePlateSize, 4, 0x66_000000, 0x00_000000); + GuiUtils.drawGradientRect(ms.peek() + .getModel(), 0, 0, 0, -story.basePlateSize, 4, 0x66_000000, 0x00_000000); ms.pop(); ms.multiply(Vector3f.POSITIVE_Y.getDegreesQuaternion(-90)); } @@ -505,7 +507,8 @@ public class PonderUI extends NavigatableSimiScreen { ms.push(); ms.translate(0, 0, bounds.getZSize() * 16); ms.multiply(Vector3f.POSITIVE_X.getDegreesQuaternion(-90)); - textRenderer.draw(ms, d.name().substring(0, 1), 0, 0, 0x66FFFFFF); + textRenderer.draw(ms, d.name() + .substring(0, 1), 0, 0, 0x66FFFFFF); textRenderer.draw(ms, "|", 2, 10, 0x44FFFFFF); textRenderer.draw(ms, ".", 2, 14, 0x22FFFFFF); ms.pop(); @@ -568,9 +571,10 @@ public class PonderUI extends NavigatableSimiScreen { ms.translate(chap.x - 4 - 4, chap.y, 0); UIRenderHelper.streak(ms, 180, 4, 10, 26, (int) (150 * fade), 0x101010); - drawRightAlignedString(textRenderer, ms, Lang.translate(IN_CHAPTER).getString(), 0, 0, tooltipColor); - drawRightAlignedString(textRenderer, ms, - Lang.translate(LANG_PREFIX + "chapter." + chapter.getId()).getString(), 0, 12, 0xffeeeeee); + drawRightAlignedString(textRenderer, ms, Lang.translate(IN_CHAPTER) + .getString(), 0, 0, tooltipColor); + drawRightAlignedString(textRenderer, ms, Lang.translate(LANG_PREFIX + "chapter." + chapter.getId()) + .getString(), 0, 12, 0xffeeeeee); ms.pop(); } @@ -586,24 +590,29 @@ public class PonderUI extends NavigatableSimiScreen { ms.push(); ms.translate(mouseX, mouseY, 100); if (hoveredTooltipItem.isEmpty()) { - IFormattableTextComponent text = Lang.translate( - IDENTIFY_MODE, - ((IFormattableTextComponent) client.gameSettings.keyBindDrop.getBoundKeyLocalizedText()).formatted(TextFormatting.WHITE) - ).formatted(TextFormatting.GRAY); + IFormattableTextComponent text = Lang + .translate(IDENTIFY_MODE, + ((IFormattableTextComponent) client.gameSettings.keyBindDrop.getBoundKeyLocalizedText()) + .formatted(TextFormatting.WHITE)) + .formatted(TextFormatting.GRAY); - //renderOrderedTooltip(ms, textRenderer.wrapLines(text, width / 3), 0, 0); - renderWrappedToolTip(ms, textRenderer.getTextHandler().wrapLines(text, width / 3, Style.EMPTY), 0, 0, textRenderer); - /*String tooltip = Lang - .createTranslationTextComponent(IDENTIFY_MODE, client.gameSettings.keyBindDrop.getBoundKeyLocalizedText().applyTextStyle(TextFormatting.WHITE)) - .applyTextStyle(TextFormatting.GRAY) - .getFormattedText(); - renderTooltip(font.listFormattedStringToWidth(tooltip, width / 3), 0, 0);*/ + // renderOrderedTooltip(ms, textRenderer.wrapLines(text, width / 3), 0, 0); + renderWrappedToolTip(ms, textRenderer.getTextHandler() + .wrapLines(text, width / 3, Style.EMPTY), 0, 0, textRenderer); + /* + * String tooltip = Lang + * .createTranslationTextComponent(IDENTIFY_MODE, client.gameSettings.keyBindDrop.getBoundKeyLocalizedText().applyTextStyle(TextFormatting.WHITE)) + * .applyTextStyle(TextFormatting.GRAY) + * .getFormattedText(); + * renderTooltip(font.listFormattedStringToWidth(tooltip, width / 3), 0, 0); + */ } else renderTooltip(ms, hoveredTooltipItem, 0, 0); if (hoveredBlockPos != null && PonderIndex.EDITOR_MODE && !userViewMode) { ms.translate(0, -15, 0); boolean copied = copiedBlockPos != null && hoveredBlockPos.equals(copiedBlockPos); - IFormattableTextComponent coords = new StringTextComponent(hoveredBlockPos.getX() + ", " + hoveredBlockPos.getY() + ", " + hoveredBlockPos.getZ()) + IFormattableTextComponent coords = new StringTextComponent( + hoveredBlockPos.getX() + ", " + hoveredBlockPos.getY() + ", " + hoveredBlockPos.getZ()) .formatted(copied ? TextFormatting.GREEN : TextFormatting.GOLD); renderTooltip(ms, coords, 0, 0); } @@ -620,7 +629,7 @@ public class PonderUI extends NavigatableSimiScreen { else userMode.dim(); } - + if (isComfyReadingEnabled()) slowMode.flash(); else @@ -710,7 +719,7 @@ public class PonderUI extends NavigatableSimiScreen { if (index != scenes.size() - 1 && right.isHovered()) drawCenteredText(ms, textRenderer, Lang.translate(NEXT), right.x + 10, tooltipY, tooltipColor); if (replay.isHovered()) - drawCenteredText(ms, textRenderer, Lang.translate(REPLAY), replay.x + 10, tooltipY, tooltipColor); + drawCenteredText(ms, textRenderer, Lang.translate(REPLAY), replay.x + 10, tooltipY, tooltipColor); if (slowMode.isHovered()) drawCenteredText(ms, textRenderer, Lang.translate(SLOW_TEXT), slowMode.x + 5, tooltipY, tooltipColor); if (PonderIndex.EDITOR_MODE && userMode.isHovered()) @@ -718,7 +727,8 @@ public class PonderUI extends NavigatableSimiScreen { ms.pop(); } - protected void lowerButtonGroup(MatrixStack ms, int index, int mouseX, int mouseY, float fade, AllIcons icon, KeyBinding key) { + protected void lowerButtonGroup(MatrixStack ms, int index, int mouseX, int mouseY, float fade, AllIcons icon, + KeyBinding key) { int bWidth = 20; int bHeight = 20; int bX = (width - bWidth) / 2 + (index - 1) * (bWidth + 8); @@ -730,7 +740,8 @@ public class PonderUI extends NavigatableSimiScreen { boolean hovered = isMouseOver(mouseX, mouseY, bX, bY, bWidth, bHeight); renderBox(ms, bX, bY, bWidth, bHeight, hovered); icon.draw(ms, bX + 2, bY + 2); - drawCenteredText(ms, textRenderer, key.getBoundKeyLocalizedText(), bX + bWidth / 2 + 8, bY + bHeight - 6, 0xff606060); + drawCenteredText(ms, textRenderer, key.getBoundKeyLocalizedText(), bX + bWidth / 2 + 8, bY + bHeight - 6, + 0xff606060); ms.pop(); } @@ -828,11 +839,12 @@ public class PonderUI extends NavigatableSimiScreen { @Override protected String getBreadcrumbTitle() { if (chapter != null) - return Lang.translate(LANG_PREFIX + "chapter." + chapter.getId()).getString(); + return Lang.translate(LANG_PREFIX + "chapter." + chapter.getId()) + .getString(); return stack.getItem() - .getName() - .getString(); + .getName() + .getString(); } public FontRenderer getFontRenderer() { @@ -846,11 +858,12 @@ public class PonderUI extends NavigatableSimiScreen { } public static void renderBox(MatrixStack ms, int x, int y, int w, int h, boolean highlighted) { - renderBox(ms, x, y, w, h, 0xff000000, highlighted ? 0xf0ffeedd : 0x40ffeedd, highlighted ? 0x60ffeedd : 0x20ffeedd); + renderBox(ms, x, y, w, h, 0xff000000, highlighted ? 0xf0ffeedd : 0x40ffeedd, + highlighted ? 0x60ffeedd : 0x20ffeedd); } - public static void renderSpeechBox(MatrixStack ms, int x, int y, int w, int h, boolean highlighted, Pointing pointing, - boolean returnWithLocalTransform) { + public static void renderSpeechBox(MatrixStack ms, int x, int y, int w, int h, boolean highlighted, + Pointing pointing, boolean returnWithLocalTransform) { if (!returnWithLocalTransform) ms.push(); @@ -917,14 +930,17 @@ public class PonderUI extends NavigatableSimiScreen { public static void renderBox(MatrixStack ms, int x, int y, int w, int h, int backgroundColor, int borderColorStart, int borderColorEnd) { int z = 100; - Matrix4f model = ms.peek().getModel(); + Matrix4f model = ms.peek() + .getModel(); GuiUtils.drawGradientRect(model, z, x - 3, y - 4, x + w + 3, y - 3, backgroundColor, backgroundColor); GuiUtils.drawGradientRect(model, z, x - 3, y + h + 3, x + w + 3, y + h + 4, backgroundColor, backgroundColor); GuiUtils.drawGradientRect(model, z, x - 3, y - 3, x + w + 3, y + h + 3, backgroundColor, backgroundColor); GuiUtils.drawGradientRect(model, z, x - 4, y - 3, x - 3, y + h + 3, backgroundColor, backgroundColor); GuiUtils.drawGradientRect(model, z, x + w + 3, y - 3, x + w + 4, y + h + 3, backgroundColor, backgroundColor); - GuiUtils.drawGradientRect(model, z, x - 3, y - 3 + 1, x - 3 + 1, y + h + 3 - 1, borderColorStart, borderColorEnd); - GuiUtils.drawGradientRect(model, z, x + w + 2, y - 3 + 1, x + w + 3, y + h + 3 - 1, borderColorStart, borderColorEnd); + GuiUtils.drawGradientRect(model, z, x - 3, y - 3 + 1, x - 3 + 1, y + h + 3 - 1, borderColorStart, + borderColorEnd); + GuiUtils.drawGradientRect(model, z, x + w + 2, y - 3 + 1, x + w + 3, y + h + 3 - 1, borderColorStart, + borderColorEnd); GuiUtils.drawGradientRect(model, z, x - 3, y - 3, x + w + 3, y - 3 + 1, borderColorStart, borderColorStart); GuiUtils.drawGradientRect(model, z, x - 3, y + h + 2, x + w + 3, y + h + 3, borderColorEnd, borderColorEnd); } @@ -975,17 +991,18 @@ public class PonderUI extends NavigatableSimiScreen { public void coolDownAfterSkip() { skipCooling = 15; } - + @Override public void removed() { super.removed(); hoveredTooltipItem = ItemStack.EMPTY; } - public void drawRightAlignedString(FontRenderer fontRenderer, MatrixStack ms, String string, int x, int y, int color) { - fontRenderer.draw(ms, string, (float)(x - fontRenderer.getStringWidth(string)), (float)y, color); + public void drawRightAlignedString(FontRenderer fontRenderer, MatrixStack ms, String string, int x, int y, + int color) { + fontRenderer.draw(ms, string, (float) (x - fontRenderer.getStringWidth(string)), (float) y, color); } - + public boolean isComfyReadingEnabled() { return AllConfigs.CLIENT.comfyReading.get(); } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java index b9aaf11f6..b6f5b5f84 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderWorld.java @@ -15,8 +15,8 @@ import com.simibubi.create.content.schematics.SchematicWorld; import com.simibubi.create.foundation.ponder.elements.WorldSectionElement; import com.simibubi.create.foundation.renderState.SuperRenderTypeBuffer; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; - import com.simibubi.create.foundation.utility.worldWrappers.WrappedClientWorld; + import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.client.Minecraft; @@ -41,8 +41,8 @@ import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.vector.Vector3d; import net.minecraft.world.IBlockReader; import net.minecraft.world.LightType; import net.minecraft.world.World; @@ -82,7 +82,8 @@ public class PonderWorld extends SchematicWorld { originalBlocks.clear(); originalTileEntities.clear(); blocks.forEach((k, v) -> originalBlocks.put(k, v)); - tileEntities.forEach((k, v) -> originalTileEntities.put(k, TileEntity.createFromTag(blocks.get(k), v.write(new CompoundNBT())))); + tileEntities.forEach( + (k, v) -> originalTileEntities.put(k, TileEntity.createFromTag(blocks.get(k), v.write(new CompoundNBT())))); entities.forEach(e -> EntityType.loadEntityUnchecked(e.serializeNBT(), this) .ifPresent(originalEntities::add)); } @@ -221,7 +222,8 @@ public class PonderWorld extends SchematicWorld { double mz) { ResourceLocation key = ForgeRegistries.PARTICLE_TYPES.getKey(data.getType()); IParticleFactory iparticlefactory = (IParticleFactory) particleFactories.get(key); - return iparticlefactory == null ? null : iparticlefactory.makeParticle(data, asClientWorld.getValue(), x, y, z, mx, my, mz); + return iparticlefactory == null ? null + : iparticlefactory.makeParticle(data, asClientWorld.getValue(), x, y, z, mx, my, mz); } public void addParticle(Particle p) { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/PonderWorldParticles.java b/src/main/java/com/simibubi/create/foundation/ponder/PonderWorldParticles.java index 5e1ca9774..3ff9774bb 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/PonderWorldParticles.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/PonderWorldParticles.java @@ -71,8 +71,9 @@ public class PonderWorldParticles { RenderSystem.enableFog(); }; RenderSystem.pushMatrix(); - RenderSystem.multMatrix(ms.peek().getModel()); - //check ParticleManager#renderParticles for a replacement if RenderSystem#multMatrix gets removed + RenderSystem.multMatrix(ms.peek() + .getModel()); + // check ParticleManager#renderParticles for a replacement if RenderSystem#multMatrix gets removed for (IParticleRenderType iparticlerendertype : this.byType.keySet()) { // Forge: allow custom // IParticleRenderType's diff --git a/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java b/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java index 93f719c52..2767b1b02 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/SceneBuilder.java @@ -407,7 +407,8 @@ public class SceneBuilder { public void rotateParrot(ElementLink link, double xRotation, double yRotation, double zRotation, int duration) { - addInstruction(AnimateParrotInstruction.rotate(link, new Vector3d(xRotation, yRotation, zRotation), duration)); + addInstruction( + AnimateParrotInstruction.rotate(link, new Vector3d(xRotation, yRotation, zRotation), duration)); } public void moveParrot(ElementLink link, Vector3d offset, int duration) { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/SceneBuildingUtil.java b/src/main/java/com/simibubi/create/foundation/ponder/SceneBuildingUtil.java index e69c5967c..a7eed2600 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/SceneBuildingUtil.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/SceneBuildingUtil.java @@ -61,7 +61,8 @@ public class SceneBuildingUtil { } public Vector3d blockSurface(BlockPos pos, Direction face, float margin) { - return centerOf(pos).add(Vector3d.of(face.getDirectionVec()).scale(.5f + margin)); + return centerOf(pos).add(Vector3d.of(face.getDirectionVec()) + .scale(.5f + margin)); } public Vector3d of(double x, double y, double z) { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/Selection.java b/src/main/java/com/simibubi/create/foundation/ponder/Selection.java index 2d2cd47c7..4541f1cbe 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/Selection.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/Selection.java @@ -28,9 +28,9 @@ public abstract class Selection implements Predicate { public abstract Vector3d getCenter(); public abstract void forEach(Consumer callback); - + public abstract OutlineParams makeOutline(Outliner outliner, Object slot); - + public OutlineParams makeOutline(Outliner outliner) { return makeOutline(outliner, this); } @@ -44,7 +44,7 @@ public abstract class Selection implements Predicate { posSet = new HashSet<>(); add(initial); } - + private Compound(Set template) { posSet = new HashSet<>(template); } @@ -127,7 +127,8 @@ public abstract class Selection implements Predicate { @Override public void forEach(Consumer callback) { - BlockPos.stream(bb).forEach(callback); + BlockPos.stream(bb) + .forEach(callback); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderChapter.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderChapter.java index 579142852..616708342 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderChapter.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderChapter.java @@ -1,16 +1,16 @@ package com.simibubi.create.foundation.ponder.content; +import javax.annotation.Nonnull; + import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.Create; import com.simibubi.create.foundation.gui.IScreenRenderable; import com.simibubi.create.foundation.ponder.PonderRegistry; + import net.minecraft.client.Minecraft; import net.minecraft.client.gui.AbstractGui; import net.minecraft.util.ResourceLocation; -import javax.annotation.Nonnull; - public class PonderChapter implements IScreenRenderable { private final String id; diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderChapterRegistry.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderChapterRegistry.java index 66da66763..ec861ed1a 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderChapterRegistry.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderChapterRegistry.java @@ -1,12 +1,17 @@ package com.simibubi.create.foundation.ponder.content; -import com.simibubi.create.foundation.ponder.PonderStoryBoardEntry; -import com.simibubi.create.foundation.utility.Pair; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.stream.Collectors; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.*; -import java.util.stream.Collectors; + +import com.simibubi.create.foundation.ponder.PonderStoryBoardEntry; +import com.simibubi.create.foundation.utility.Pair; public class PonderChapterRegistry { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndexScreen.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndexScreen.java index 1bdb5dfd2..8166eabf6 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndexScreen.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderIndexScreen.java @@ -4,9 +4,9 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; -import com.mojang.blaze3d.matrix.MatrixStack; import org.apache.commons.lang3.mutable.MutableBoolean; +import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlocks; import com.simibubi.create.content.contraptions.components.crank.ValveHandleBlock; import com.simibubi.create.foundation.gui.ScreenOpener; diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java index c5ef66ffb..ab9a6b172 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTag.java @@ -1,7 +1,6 @@ package com.simibubi.create.foundation.ponder.content; import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.AllBlocks; import com.simibubi.create.AllItems; import com.simibubi.create.foundation.gui.GuiGameElement; diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java index ae9e29c54..321b7c6d6 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/PonderTagScreen.java @@ -4,9 +4,9 @@ import java.util.ArrayList; import java.util.List; import java.util.Objects; -import com.mojang.blaze3d.matrix.MatrixStack; import org.apache.commons.lang3.mutable.MutableBoolean; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.Create; import com.simibubi.create.foundation.gui.ScreenOpener; diff --git a/src/main/java/com/simibubi/create/foundation/ponder/elements/AnimatedSceneElement.java b/src/main/java/com/simibubi/create/foundation/ponder/elements/AnimatedSceneElement.java index fa5e0ff54..d4c619e61 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/elements/AnimatedSceneElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/elements/AnimatedSceneElement.java @@ -2,8 +2,8 @@ package com.simibubi.create.foundation.ponder.elements; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.ponder.PonderWorld; -import com.simibubi.create.foundation.utility.animation.LerpedFloat; import com.simibubi.create.foundation.utility.MatrixStacker; +import com.simibubi.create.foundation.utility.animation.LerpedFloat; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; diff --git a/src/main/java/com/simibubi/create/foundation/ponder/elements/WorldSectionElement.java b/src/main/java/com/simibubi/create/foundation/ponder/elements/WorldSectionElement.java index 3d28d0283..2f9c86278 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/elements/WorldSectionElement.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/elements/WorldSectionElement.java @@ -6,8 +6,6 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Random; -import net.minecraft.fluid.FluidState; -import net.minecraft.util.math.vector.Vector3d; import org.lwjgl.opengl.GL11; import com.mojang.blaze3d.matrix.MatrixStack; @@ -41,6 +39,7 @@ import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.model.ModelBakery; import net.minecraft.client.renderer.texture.OverlayTexture; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.fluid.FluidState; import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction.Axis; @@ -52,6 +51,7 @@ import net.minecraft.util.math.RayTraceContext.BlockMode; import net.minecraft.util.math.RayTraceContext.FluidMode; import net.minecraft.util.math.shapes.ISelectionContext; import net.minecraft.util.math.shapes.VoxelShape; +import net.minecraft.util.math.vector.Vector3d; import net.minecraftforge.client.ForgeHooksClient; import net.minecraftforge.client.model.data.EmptyModelData; diff --git a/src/main/java/com/simibubi/create/foundation/ponder/ui/ChapterLabel.java b/src/main/java/com/simibubi/create/foundation/ponder/ui/ChapterLabel.java index f8c5bad15..a50f1432f 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/ui/ChapterLabel.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/ui/ChapterLabel.java @@ -2,8 +2,9 @@ package com.simibubi.create.foundation.ponder.ui; import java.util.function.BiConsumer; +import javax.annotation.Nonnull; + import com.mojang.blaze3d.matrix.MatrixStack; -import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.gui.UIRenderHelper; import com.simibubi.create.foundation.gui.widgets.AbstractSimiWidget; import com.simibubi.create.foundation.ponder.content.PonderChapter; @@ -11,8 +12,6 @@ import com.simibubi.create.foundation.utility.Lang; import net.minecraft.client.Minecraft; -import javax.annotation.Nonnull; - public class ChapterLabel extends AbstractSimiWidget { private final PonderChapter chapter; diff --git a/src/main/java/com/simibubi/create/foundation/render/AllProgramSpecs.java b/src/main/java/com/simibubi/create/foundation/render/AllProgramSpecs.java index d49cf8ca2..840732670 100644 --- a/src/main/java/com/simibubi/create/foundation/render/AllProgramSpecs.java +++ b/src/main/java/com/simibubi/create/foundation/render/AllProgramSpecs.java @@ -6,15 +6,15 @@ import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.base.KineticAttributes; import com.simibubi.create.content.contraptions.base.RotatingAttributes; import com.simibubi.create.content.contraptions.components.actors.ActorVertexAttributes; -import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionProgram; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionAttributes; +import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionProgram; import com.simibubi.create.content.contraptions.relays.belt.BeltAttributes; import com.simibubi.create.content.logistics.block.FlapAttributes; -import com.simibubi.create.foundation.render.backend.gl.BasicProgram; import com.simibubi.create.foundation.render.backend.core.BasicAttributes; -import com.simibubi.create.foundation.render.backend.core.TransformAttributes; import com.simibubi.create.foundation.render.backend.core.ModelAttributes; import com.simibubi.create.foundation.render.backend.core.OrientedAttributes; +import com.simibubi.create.foundation.render.backend.core.TransformAttributes; +import com.simibubi.create.foundation.render.backend.gl.BasicProgram; import com.simibubi.create.foundation.render.backend.gl.shader.ProgramSpec; import com.simibubi.create.foundation.render.backend.gl.shader.ShaderConstants; diff --git a/src/main/java/com/simibubi/create/foundation/render/Compartment.java b/src/main/java/com/simibubi/create/foundation/render/Compartment.java index 4d929dc3f..33d1ba678 100644 --- a/src/main/java/com/simibubi/create/foundation/render/Compartment.java +++ b/src/main/java/com/simibubi/create/foundation/render/Compartment.java @@ -8,7 +8,7 @@ import net.minecraft.block.BlockState; import net.minecraft.util.Direction; public class Compartment { - public static final Compartment GENERIC_TILE = new Compartment<>(); - public static final Compartment PARTIAL = new Compartment<>(); - public static final Compartment> DIRECTIONAL_PARTIAL = new Compartment<>(); + public static final Compartment GENERIC_TILE = new Compartment<>(); + public static final Compartment PARTIAL = new Compartment<>(); + public static final Compartment> DIRECTIONAL_PARTIAL = new Compartment<>(); } diff --git a/src/main/java/com/simibubi/create/foundation/render/KineticRenderer.java b/src/main/java/com/simibubi/create/foundation/render/KineticRenderer.java index 580a671c4..451122105 100644 --- a/src/main/java/com/simibubi/create/foundation/render/KineticRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/render/KineticRenderer.java @@ -7,14 +7,13 @@ import com.simibubi.create.content.contraptions.base.RotatingModel; import com.simibubi.create.content.contraptions.relays.belt.BeltInstancedModel; import com.simibubi.create.content.logistics.block.FlapModel; import com.simibubi.create.foundation.render.backend.MaterialTypes; +import com.simibubi.create.foundation.render.backend.core.OrientedModel; +import com.simibubi.create.foundation.render.backend.core.TransformedModel; import com.simibubi.create.foundation.render.backend.gl.BasicProgram; import com.simibubi.create.foundation.render.backend.gl.shader.ShaderCallback; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; import com.simibubi.create.foundation.render.backend.instancing.RenderMaterial; -import com.simibubi.create.foundation.render.backend.core.OrientedModel; -import com.simibubi.create.foundation.render.backend.core.TransformedModel; - import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.RenderType; import net.minecraft.tileentity.TileEntity; @@ -23,61 +22,63 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.vector.Matrix4f; public class KineticRenderer extends InstancedTileRenderer { - public static int MAX_ORIGIN_DISTANCE = 100; + public static int MAX_ORIGIN_DISTANCE = 100; - public BlockPos originCoordinate = BlockPos.ZERO; + public BlockPos originCoordinate = BlockPos.ZERO; - @Override - public void registerMaterials() { - materials.put(MaterialTypes.TRANSFORMED, new RenderMaterial<>(this, AllProgramSpecs.MODEL, TransformedModel::new)); - materials.put(MaterialTypes.ORIENTED, new RenderMaterial<>(this, AllProgramSpecs.ORIENTED, OrientedModel::new)); + @Override + public void registerMaterials() { + materials.put(MaterialTypes.TRANSFORMED, + new RenderMaterial<>(this, AllProgramSpecs.MODEL, TransformedModel::new)); + materials.put(MaterialTypes.ORIENTED, new RenderMaterial<>(this, AllProgramSpecs.ORIENTED, OrientedModel::new)); - materials.put(KineticRenderMaterials.BELTS, new RenderMaterial<>(this, AllProgramSpecs.BELT, BeltInstancedModel::new)); - materials.put(KineticRenderMaterials.ROTATING, new RenderMaterial<>(this, AllProgramSpecs.ROTATING, RotatingModel::new)); - materials.put(KineticRenderMaterials.FLAPS, new RenderMaterial<>(this, AllProgramSpecs.FLAPS, FlapModel::new)); - } + materials.put(KineticRenderMaterials.BELTS, + new RenderMaterial<>(this, AllProgramSpecs.BELT, BeltInstancedModel::new)); + materials.put(KineticRenderMaterials.ROTATING, + new RenderMaterial<>(this, AllProgramSpecs.ROTATING, RotatingModel::new)); + materials.put(KineticRenderMaterials.FLAPS, new RenderMaterial<>(this, AllProgramSpecs.FLAPS, FlapModel::new)); + } - @Override - public BlockPos getOriginCoordinate() { - return originCoordinate; - } + @Override + public BlockPos getOriginCoordinate() { + return originCoordinate; + } - @Override - public void beginFrame(ActiveRenderInfo info, double cameraX, double cameraY, double cameraZ) { - int cX = MathHelper.floor(cameraX); - int cY = MathHelper.floor(cameraY); - int cZ = MathHelper.floor(cameraZ); + @Override + public void beginFrame(ActiveRenderInfo info, double cameraX, double cameraY, double cameraZ) { + int cX = MathHelper.floor(cameraX); + int cY = MathHelper.floor(cameraY); + int cZ = MathHelper.floor(cameraZ); - int dX = Math.abs(cX - originCoordinate.getX()); - int dY = Math.abs(cY - originCoordinate.getY()); - int dZ = Math.abs(cZ - originCoordinate.getZ()); + int dX = Math.abs(cX - originCoordinate.getX()); + int dY = Math.abs(cY - originCoordinate.getY()); + int dZ = Math.abs(cZ - originCoordinate.getZ()); - if (dX > MAX_ORIGIN_DISTANCE || - dY > MAX_ORIGIN_DISTANCE || - dZ > MAX_ORIGIN_DISTANCE) { + if (dX > MAX_ORIGIN_DISTANCE || dY > MAX_ORIGIN_DISTANCE || dZ > MAX_ORIGIN_DISTANCE) { - originCoordinate = new BlockPos(cX, cY, cZ); + originCoordinate = new BlockPos(cX, cY, cZ); - ArrayList instancedTiles = new ArrayList<>(instances.keySet()); - invalidate(); - instancedTiles.forEach(this::add); - } + ArrayList instancedTiles = new ArrayList<>(instances.keySet()); + invalidate(); + instancedTiles.forEach(this::add); + } - super.beginFrame(info, cameraX, cameraY, cameraZ); - } + super.beginFrame(info, cameraX, cameraY, cameraZ); + } - @Override - public void render(RenderType layer, Matrix4f viewProjection, double camX, double camY, double camZ, ShaderCallback callback) { - BlockPos originCoordinate = getOriginCoordinate(); + @Override + public void render(RenderType layer, Matrix4f viewProjection, double camX, double camY, double camZ, + ShaderCallback callback) { + BlockPos originCoordinate = getOriginCoordinate(); - camX -= originCoordinate.getX(); - camY -= originCoordinate.getY(); - camZ -= originCoordinate.getZ(); + camX -= originCoordinate.getX(); + camY -= originCoordinate.getY(); + camZ -= originCoordinate.getZ(); - Matrix4f translate = Matrix4f.translate((float) -camX, (float) -camY, (float) -camZ); + Matrix4f translate = Matrix4f.translate((float) -camX, (float) -camY, (float) -camZ); - translate.multiplyBackward(viewProjection); + translate.multiplyBackward(viewProjection); - super.render(layer, translate, camX, camY, camZ, callback); - } + super.render(layer, translate, camX, camY, camZ, callback); + } } diff --git a/src/main/java/com/simibubi/create/foundation/render/ShadowRenderHelper.java b/src/main/java/com/simibubi/create/foundation/render/ShadowRenderHelper.java index 07720331a..e5d31c07f 100644 --- a/src/main/java/com/simibubi/create/foundation/render/ShadowRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/render/ShadowRenderHelper.java @@ -22,10 +22,11 @@ import net.minecraft.world.IWorldReader; */ public class ShadowRenderHelper { - private static final RenderType SHADOW_LAYER = RenderType.getEntityNoOutline(new ResourceLocation("textures/misc/shadow.png")); + private static final RenderType SHADOW_LAYER = + RenderType.getEntityNoOutline(new ResourceLocation("textures/misc/shadow.png")); public static void renderShadow(MatrixStack p_229096_0_, IRenderTypeBuffer p_229096_1_, Vector3d pos, - float p_229096_3_, float p_229096_6_) { + float p_229096_3_, float p_229096_6_) { float f = p_229096_6_; double d2 = pos.getX(); @@ -41,14 +42,15 @@ public class ShadowRenderHelper { IVertexBuilder ivertexbuilder = p_229096_1_.getBuffer(SHADOW_LAYER); for (BlockPos blockpos : BlockPos.getAllInBoxMutable(new BlockPos(i, k, i1), new BlockPos(j, l, j1))) { - renderShadowPart(matrixstack$entry, ivertexbuilder, Minecraft.getInstance().world, blockpos, d2, d0, d1, f, p_229096_3_); + renderShadowPart(matrixstack$entry, ivertexbuilder, Minecraft.getInstance().world, blockpos, d2, d0, d1, f, + p_229096_3_); } } private static void renderShadowPart(MatrixStack.Entry p_229092_0_, IVertexBuilder p_229092_1_, - IWorldReader p_229092_2_, BlockPos p_229092_3_, double p_229092_4_, double p_229092_6_, double p_229092_8_, - float p_229092_10_, float p_229092_11_) { + IWorldReader p_229092_2_, BlockPos p_229092_3_, double p_229092_4_, double p_229092_6_, double p_229092_8_, + float p_229092_10_, float p_229092_11_) { BlockPos blockpos = p_229092_3_.down(); BlockState blockstate = p_229092_2_.getBlockState(blockpos); if (blockstate.getRenderType() != BlockRenderType.INVISIBLE && p_229092_2_.getLight(p_229092_3_) > 3) { @@ -57,7 +59,7 @@ public class ShadowRenderHelper { if (!voxelshape.isEmpty()) { @SuppressWarnings("deprecation") float f = (float) (((double) p_229092_11_ - (p_229092_6_ - (double) p_229092_3_.getY()) / 2.0D) - * 0.5D * (double) p_229092_2_.getBrightness(p_229092_3_)); + * 0.5D * (double) p_229092_2_.getBrightness(p_229092_3_)); if (f >= 0.0F) { if (f > 1.0F) { f = 1.0F; @@ -90,10 +92,13 @@ public class ShadowRenderHelper { } private static void shadowVertex(MatrixStack.Entry p_229091_0_, IVertexBuilder p_229091_1_, float p_229091_2_, - float p_229091_3_, float p_229091_4_, float p_229091_5_, float p_229091_6_, float p_229091_7_) { + float p_229091_3_, float p_229091_4_, float p_229091_5_, float p_229091_6_, float p_229091_7_) { p_229091_1_.vertex(p_229091_0_.getModel(), p_229091_3_, p_229091_4_, p_229091_5_) - .color(1.0F, 1.0F, 1.0F, p_229091_2_).texture(p_229091_6_, p_229091_7_) - .overlay(OverlayTexture.DEFAULT_UV).light(15728880).normal(p_229091_0_.getNormal(), 0.0F, 1.0F, 0.0F) - .endVertex(); + .color(1.0F, 1.0F, 1.0F, p_229091_2_) + .texture(p_229091_6_, p_229091_7_) + .overlay(OverlayTexture.DEFAULT_UV) + .light(15728880) + .normal(p_229091_0_.getNormal(), 0.0F, 1.0F, 0.0F) + .endVertex(); } } diff --git a/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java b/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java index 415e62acf..f3ff7ef80 100644 --- a/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java +++ b/src/main/java/com/simibubi/create/foundation/render/SuperByteBuffer.java @@ -7,8 +7,8 @@ import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.vertex.IVertexBuilder; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher; import com.simibubi.create.foundation.block.render.SpriteShiftEntry; - import com.simibubi.create.foundation.utility.MatrixStacker; + import it.unimi.dsi.fastutil.longs.Long2DoubleMap; import it.unimi.dsi.fastutil.longs.Long2DoubleOpenHashMap; import net.minecraft.client.Minecraft; @@ -16,7 +16,12 @@ import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.texture.TextureAtlasSprite; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.vector.*; +import net.minecraft.util.math.vector.Matrix3f; +import net.minecraft.util.math.vector.Matrix4f; +import net.minecraft.util.math.vector.Quaternion; +import net.minecraft.util.math.vector.Vector3d; +import net.minecraft.util.math.vector.Vector3f; +import net.minecraft.util.math.vector.Vector4f; import net.minecraft.world.LightType; import net.minecraft.world.World; import net.minecraftforge.client.model.pipeline.LightUtil; @@ -71,16 +76,16 @@ public class SuperByteBuffer extends TemplateBuffer { ((Buffer) buffer).rewind(); Matrix3f normalMat = transforms.peek() - .getNormal() - .copy(); - //normalMat.multiply(transforms.peek().getNormal()); + .getNormal() + .copy(); + // normalMat.multiply(transforms.peek().getNormal()); Matrix4f modelMat = input.peek() - .getModel() - .copy(); + .getModel() + .copy(); Matrix4f localTransforms = transforms.peek() - .getModel(); + .getModel(); modelMat.multiply(localTransforms); if (shouldLight && lightTransform != null) { @@ -114,9 +119,9 @@ public class SuperByteBuffer extends TemplateBuffer { pos.transform(modelMat); builder.vertex(pos.getX(), pos.getY(), pos.getZ()); - //builder.color((byte) Math.max(0, nx * 255), (byte) Math.max(0, ny * 255), (byte) Math.max(0, nz * 255), a); + // builder.color((byte) Math.max(0, nx * 255), (byte) Math.max(0, ny * 255), (byte) Math.max(0, nz * 255), a); if (shouldColor) { - //float lum = (r < 0 ? 255 + r : r) / 256f; + // float lum = (r < 0 ? 255 + r : r) / 256f; int colorR = Math.min(255, (int) (((float) this.r) * instanceDiffuse)); int colorG = Math.min(255, (int) (((float) this.g) * instanceDiffuse)); int colorB = Math.min(255, (int) (((float) this.b) * instanceDiffuse)); @@ -183,8 +188,14 @@ public class SuperByteBuffer extends TemplateBuffer { } public SuperByteBuffer transform(MatrixStack stack) { - transforms.peek().getModel().multiply(stack.peek().getModel()); - transforms.peek().getNormal().multiply(stack.peek().getNormal()); + transforms.peek() + .getModel() + .multiply(stack.peek() + .getModel()); + transforms.peek() + .getNormal() + .multiply(stack.peek() + .getNormal()); return this; } @@ -213,8 +224,10 @@ public class SuperByteBuffer extends TemplateBuffer { public SuperByteBuffer shiftUV(SpriteShiftEntry entry) { this.spriteShiftFunc = (builder, u, v) -> { - float targetU = entry.getTarget().getInterpolatedU((getUnInterpolatedU(entry.getOriginal(), u))); - float targetV = entry.getTarget().getInterpolatedV((getUnInterpolatedV(entry.getOriginal(), v))); + float targetU = entry.getTarget() + .getInterpolatedU((getUnInterpolatedU(entry.getOriginal(), u))); + float targetV = entry.getTarget() + .getInterpolatedV((getUnInterpolatedV(entry.getOriginal(), v))); builder.texture(targetU, targetV); }; return this; @@ -222,8 +235,13 @@ public class SuperByteBuffer extends TemplateBuffer { public SuperByteBuffer shiftUVScrolling(SpriteShiftEntry entry, float scrollV) { this.spriteShiftFunc = (builder, u, v) -> { - float targetU = u - entry.getOriginal().getMinU() + entry.getTarget().getMinU(); - float targetV = v - entry.getOriginal().getMinV() + entry.getTarget().getMinV() + scrollV; + float targetU = u - entry.getOriginal() + .getMinU() + entry.getTarget() + .getMinU(); + float targetV = v - entry.getOriginal() + .getMinV() + entry.getTarget() + .getMinV() + + scrollV; builder.texture(targetU, targetV); }; return this; @@ -231,8 +249,10 @@ public class SuperByteBuffer extends TemplateBuffer { public SuperByteBuffer shiftUVtoSheet(SpriteShiftEntry entry, float uTarget, float vTarget, int sheetSize) { this.spriteShiftFunc = (builder, u, v) -> { - float targetU = entry.getTarget().getInterpolatedU((getUnInterpolatedU(entry.getOriginal(), u) / sheetSize) + uTarget * 16); - float targetV = entry.getTarget().getInterpolatedV((getUnInterpolatedV(entry.getOriginal(), v) / sheetSize) + vTarget * 16); + float targetU = entry.getTarget() + .getInterpolatedU((getUnInterpolatedU(entry.getOriginal(), u) / sheetSize) + uTarget * 16); + float targetV = entry.getTarget() + .getInterpolatedV((getUnInterpolatedV(entry.getOriginal(), v) / sheetSize) + vTarget * 16); builder.texture(targetU, targetV); }; return this; diff --git a/src/main/java/com/simibubi/create/foundation/render/SuperByteBufferCache.java b/src/main/java/com/simibubi/create/foundation/render/SuperByteBufferCache.java index 0ebf74157..93407bc6b 100644 --- a/src/main/java/com/simibubi/create/foundation/render/SuperByteBufferCache.java +++ b/src/main/java/com/simibubi/create/foundation/render/SuperByteBufferCache.java @@ -44,21 +44,23 @@ public class SuperByteBufferCache { public SuperByteBuffer renderPartial(AllBlockPartials partial, BlockState referenceState) { return get(Compartment.PARTIAL, partial, () -> standardModelRender(partial.get(), referenceState)); } + public SuperByteBuffer renderPartial(AllBlockPartials partial, BlockState referenceState, MatrixStack modelTransform) { - return get(Compartment.PARTIAL, partial, () -> standardModelRender(partial.get(), referenceState, modelTransform)); + return get(Compartment.PARTIAL, partial, + () -> standardModelRender(partial.get(), referenceState, modelTransform)); } public SuperByteBuffer renderDirectionalPartial(AllBlockPartials partial, BlockState referenceState, Direction dir) { return get(Compartment.DIRECTIONAL_PARTIAL, Pair.of(dir, partial), - () -> standardModelRender(partial.get(), referenceState)); + () -> standardModelRender(partial.get(), referenceState)); } public SuperByteBuffer renderDirectionalPartial(AllBlockPartials partial, BlockState referenceState, Direction dir, MatrixStack modelTransform) { return get(Compartment.DIRECTIONAL_PARTIAL, Pair.of(dir, partial), - () -> standardModelRender(partial.get(), referenceState, modelTransform)); + () -> standardModelRender(partial.get(), referenceState, modelTransform)); } public SuperByteBuffer renderBlockIn(Compartment compartment, BlockState toRender) { @@ -78,7 +80,7 @@ public class SuperByteBufferCache { return null; } } - + public void invalidate(Compartment compartment, T key) { Cache compartmentCache = this.cache.get(compartment); compartmentCache.invalidate(key); @@ -118,12 +120,12 @@ public class SuperByteBufferCache { BufferBuilder builder = new BufferBuilder(512); builder.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK); - blockRenderer.renderModel(mc.world, model, referenceState, BlockPos.ZERO.up(255), ms, builder, true, mc.world.rand, 42, OverlayTexture.DEFAULT_UV, VirtualEmptyModelData.INSTANCE); + blockRenderer.renderModel(mc.world, model, referenceState, BlockPos.ZERO.up(255), ms, builder, true, + mc.world.rand, 42, OverlayTexture.DEFAULT_UV, VirtualEmptyModelData.INSTANCE); builder.finishDrawing(); return builder; } - public void invalidate() { cache.forEach((comp, cache) -> cache.invalidateAll()); } diff --git a/src/main/java/com/simibubi/create/foundation/render/TemplateBuffer.java b/src/main/java/com/simibubi/create/foundation/render/TemplateBuffer.java index 16afba34e..858fad8a8 100644 --- a/src/main/java/com/simibubi/create/foundation/render/TemplateBuffer.java +++ b/src/main/java/com/simibubi/create/foundation/render/TemplateBuffer.java @@ -9,88 +9,89 @@ import com.mojang.datafixers.util.Pair; import net.minecraft.client.renderer.BufferBuilder; public class TemplateBuffer { - protected ByteBuffer template; - protected int formatSize; - protected int vertexCount; + protected ByteBuffer template; + protected int formatSize; + protected int vertexCount; - public TemplateBuffer(BufferBuilder buf) { - Pair state = buf.popData(); - ByteBuffer rendered = state.getSecond(); - rendered.order(ByteOrder.nativeOrder()); // Vanilla bug, endianness does not carry over into sliced buffers + public TemplateBuffer(BufferBuilder buf) { + Pair state = buf.popData(); + ByteBuffer rendered = state.getSecond(); + rendered.order(ByteOrder.nativeOrder()); // Vanilla bug, endianness does not carry over into sliced buffers - formatSize = buf.getVertexFormat() - .getSize(); - vertexCount = state.getFirst().getCount(); - int size = vertexCount * formatSize; + formatSize = buf.getVertexFormat() + .getSize(); + vertexCount = state.getFirst() + .getCount(); + int size = vertexCount * formatSize; - template = ByteBuffer.allocate(size); - template.order(rendered.order()); - ((Buffer)template).limit(((Buffer)rendered).limit()); - template.put(rendered); - ((Buffer)template).rewind(); - } + template = ByteBuffer.allocate(size); + template.order(rendered.order()); + ((Buffer) template).limit(((Buffer) rendered).limit()); + template.put(rendered); + ((Buffer) template).rewind(); + } - public boolean isEmpty() { - return ((Buffer) template).limit() == 0; - } + public boolean isEmpty() { + return ((Buffer) template).limit() == 0; + } - protected int vertexCount(ByteBuffer buffer) { - return ((Buffer)buffer).limit() / formatSize; - } + protected int vertexCount(ByteBuffer buffer) { + return ((Buffer) buffer).limit() / formatSize; + } - protected int getBufferPosition(int vertexIndex) { - return vertexIndex * formatSize; - } + protected int getBufferPosition(int vertexIndex) { + return vertexIndex * formatSize; + } - protected float getX(ByteBuffer buffer, int index) { - return buffer.getFloat(getBufferPosition(index)); - } + protected float getX(ByteBuffer buffer, int index) { + return buffer.getFloat(getBufferPosition(index)); + } - protected float getY(ByteBuffer buffer, int index) { - return buffer.getFloat(getBufferPosition(index) + 4); - } + protected float getY(ByteBuffer buffer, int index) { + return buffer.getFloat(getBufferPosition(index) + 4); + } - protected float getZ(ByteBuffer buffer, int index) { - return buffer.getFloat(getBufferPosition(index) + 8); - } + protected float getZ(ByteBuffer buffer, int index) { + return buffer.getFloat(getBufferPosition(index) + 8); + } - protected byte getR(ByteBuffer buffer, int index) { - return buffer.get(getBufferPosition(index) + 12); - } + protected byte getR(ByteBuffer buffer, int index) { + return buffer.get(getBufferPosition(index) + 12); + } - protected byte getG(ByteBuffer buffer, int index) { - return buffer.get(getBufferPosition(index) + 13); - } + protected byte getG(ByteBuffer buffer, int index) { + return buffer.get(getBufferPosition(index) + 13); + } - protected byte getB(ByteBuffer buffer, int index) { - return buffer.get(getBufferPosition(index) + 14); - } + protected byte getB(ByteBuffer buffer, int index) { + return buffer.get(getBufferPosition(index) + 14); + } - protected byte getA(ByteBuffer buffer, int index) { - return buffer.get(getBufferPosition(index) + 15); - } + protected byte getA(ByteBuffer buffer, int index) { + return buffer.get(getBufferPosition(index) + 15); + } - protected float getU(ByteBuffer buffer, int index) { - return buffer.getFloat(getBufferPosition(index) + 16); - } + protected float getU(ByteBuffer buffer, int index) { + return buffer.getFloat(getBufferPosition(index) + 16); + } - protected float getV(ByteBuffer buffer, int index) { - return buffer.getFloat(getBufferPosition(index) + 20); - } + protected float getV(ByteBuffer buffer, int index) { + return buffer.getFloat(getBufferPosition(index) + 20); + } - protected int getLight(ByteBuffer buffer, int index) { - return buffer.getInt(getBufferPosition(index) + 24); - } + protected int getLight(ByteBuffer buffer, int index) { + return buffer.getInt(getBufferPosition(index) + 24); + } - protected byte getNX(ByteBuffer buffer, int index) { - return buffer.get(getBufferPosition(index) + 28); - } + protected byte getNX(ByteBuffer buffer, int index) { + return buffer.get(getBufferPosition(index) + 28); + } - protected byte getNY(ByteBuffer buffer, int index) { - return buffer.get(getBufferPosition(index) + 29); - } + protected byte getNY(ByteBuffer buffer, int index) { + return buffer.get(getBufferPosition(index) + 29); + } - protected byte getNZ(ByteBuffer buffer, int index) { - return buffer.get(getBufferPosition(index) + 30); - } + protected byte getNZ(ByteBuffer buffer, int index) { + return buffer.get(getBufferPosition(index) + 30); + } } diff --git a/src/main/java/com/simibubi/create/foundation/render/TileEntityRenderHelper.java b/src/main/java/com/simibubi/create/foundation/render/TileEntityRenderHelper.java index 0384ab8fd..2e22b22e4 100644 --- a/src/main/java/com/simibubi/create/foundation/render/TileEntityRenderHelper.java +++ b/src/main/java/com/simibubi/create/foundation/render/TileEntityRenderHelper.java @@ -7,7 +7,6 @@ import com.simibubi.create.Create; import com.simibubi.create.content.contraptions.components.structureMovement.render.ContraptionRenderDispatcher; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.utility.AnimationTickHolder; -import com.simibubi.create.foundation.utility.Debug; import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld; @@ -27,7 +26,7 @@ public class TileEntityRenderHelper { MatrixStack localTransform, IRenderTypeBuffer buffer) { renderTileEntities(world, null, customRenderTEs, ms, localTransform, buffer); } - + public static void renderTileEntities(World world, Iterable customRenderTEs, MatrixStack ms, MatrixStack localTransform, IRenderTypeBuffer buffer, float pt) { renderTileEntities(world, null, customRenderTEs, ms, localTransform, buffer, pt); @@ -38,7 +37,7 @@ public class TileEntityRenderHelper { renderTileEntities(world, renderWorld, customRenderTEs, ms, localTransform, buffer, AnimationTickHolder.getPartialTicks()); } - + public static void renderTileEntities(World world, PlacementSimulationWorld renderWorld, Iterable customRenderTEs, MatrixStack ms, MatrixStack localTransform, IRenderTypeBuffer buffer, float pt) { @@ -47,7 +46,7 @@ public class TileEntityRenderHelper { for (Iterator iterator = customRenderTEs.iterator(); iterator.hasNext();) { TileEntity tileEntity = iterator.next(); - //if (tileEntity instanceof IInstanceRendered) continue; // TODO: some things still need to render + // if (tileEntity instanceof IInstanceRendered) continue; // TODO: some things still need to render TileEntityRenderer renderer = TileEntityRendererDispatcher.instance.getRenderer(tileEntity); if (renderer == null) { @@ -66,13 +65,12 @@ public class TileEntityRenderHelper { BlockPos lightPos = new BlockPos(vec.getX(), vec.getY(), vec.getZ()); int worldLight = ContraptionRenderDispatcher.getLightOnContraption(world, renderWorld, pos, lightPos); - renderer.render(tileEntity, pt, ms, buffer, worldLight, - OverlayTexture.DEFAULT_UV); + renderer.render(tileEntity, pt, ms, buffer, worldLight, OverlayTexture.DEFAULT_UV); ms.pop(); } catch (Exception e) { iterator.remove(); - + String message = "TileEntity " + tileEntity.getType() .getRegistryName() .toString() + " didn't want to render while moved.\n"; @@ -80,7 +78,7 @@ public class TileEntityRenderHelper { Create.logger.error(message, e); continue; } - + Create.logger.error(message); continue; } diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/Backend.java b/src/main/java/com/simibubi/create/foundation/render/backend/Backend.java index b8393ae4a..2e9f181b2 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/Backend.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/Backend.java @@ -3,22 +3,24 @@ package com.simibubi.create.foundation.render.backend; import java.util.HashMap; import java.util.Map; -import com.simibubi.create.foundation.render.backend.gl.GlFog; -import com.simibubi.create.foundation.render.backend.gl.shader.*; -import com.simibubi.create.foundation.render.backend.gl.versioned.GlCompat; -import com.simibubi.create.foundation.render.backend.instancing.IFlywheelWorld; -import net.minecraft.world.World; import org.apache.logging.log4j.LogManager; import org.apache.logging.log4j.Logger; import org.lwjgl.opengl.GL; import org.lwjgl.opengl.GLCapabilities; import com.simibubi.create.foundation.config.AllConfigs; +import com.simibubi.create.foundation.render.backend.gl.GlFog; +import com.simibubi.create.foundation.render.backend.gl.shader.GlProgram; +import com.simibubi.create.foundation.render.backend.gl.shader.ProgramGroup; +import com.simibubi.create.foundation.render.backend.gl.shader.ProgramSpec; +import com.simibubi.create.foundation.render.backend.gl.versioned.GlCompat; +import com.simibubi.create.foundation.render.backend.instancing.IFlywheelWorld; import net.minecraft.client.Minecraft; import net.minecraft.resources.IReloadableResourceManager; import net.minecraft.resources.IResourceManager; import net.minecraft.util.ResourceLocation; +import net.minecraft.world.World; import net.minecraftforge.resource.ISelectiveResourceReloadListener; public class Backend { diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/BufferedModel.java b/src/main/java/com/simibubi/create/foundation/render/backend/BufferedModel.java index 1050da53c..ecd90508a 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/BufferedModel.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/BufferedModel.java @@ -7,7 +7,6 @@ import org.lwjgl.opengl.GL20; import com.simibubi.create.foundation.render.TemplateBuffer; import com.simibubi.create.foundation.render.backend.gl.GlBuffer; -import com.simibubi.create.foundation.render.backend.gl.GlPrimitiveType; import com.simibubi.create.foundation.render.backend.gl.attrib.VertexFormat; import net.minecraft.client.renderer.BufferBuilder; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/FastRenderDispatcher.java b/src/main/java/com/simibubi/create/foundation/render/backend/FastRenderDispatcher.java index b0f0c78db..5658a30b3 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/FastRenderDispatcher.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/FastRenderDispatcher.java @@ -2,11 +2,10 @@ package com.simibubi.create.foundation.render.backend; import java.util.concurrent.ConcurrentHashMap; -import com.simibubi.create.foundation.render.KineticRenderer; - import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.CreateClient; import com.simibubi.create.content.contraptions.KineticDebugger; +import com.simibubi.create.foundation.render.KineticRenderer; import com.simibubi.create.foundation.utility.AnimationTickHolder; import com.simibubi.create.foundation.utility.WorldAttached; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/MaterialTypes.java b/src/main/java/com/simibubi/create/foundation/render/backend/MaterialTypes.java index 59d519b79..66d838f08 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/MaterialTypes.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/MaterialTypes.java @@ -1,8 +1,8 @@ package com.simibubi.create.foundation.render.backend; -import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.core.ModelData; import com.simibubi.create.foundation.render.backend.core.OrientedData; +import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; public class MaterialTypes { public static final MaterialType> TRANSFORMED = new MaterialType<>(); diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/RenderUtil.java b/src/main/java/com/simibubi/create/foundation/render/backend/RenderUtil.java index e4e72b402..30f21fff8 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/RenderUtil.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/RenderUtil.java @@ -1,10 +1,10 @@ package com.simibubi.create.foundation.render.backend; +import com.mojang.blaze3d.matrix.MatrixStack; + import net.minecraft.util.math.vector.Matrix3f; import net.minecraft.util.math.vector.Matrix4f; -import com.mojang.blaze3d.matrix.MatrixStack; - public class RenderUtil { public static int nextPowerOf2(int a) { int h = Integer.highestOneBit(a); diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/ShaderLoader.java b/src/main/java/com/simibubi/create/foundation/render/backend/ShaderLoader.java index 4c6592720..9a8c9ec79 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/ShaderLoader.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/ShaderLoader.java @@ -1,9 +1,39 @@ package com.simibubi.create.foundation.render.backend; +import java.io.BufferedReader; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; +import java.io.StringReader; +import java.nio.Buffer; +import java.nio.ByteBuffer; +import java.nio.channels.Channels; +import java.nio.channels.FileChannel; +import java.nio.channels.ReadableByteChannel; +import java.util.ArrayList; +import java.util.Collection; +import java.util.EnumMap; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; +import java.util.function.Predicate; +import java.util.regex.Matcher; +import java.util.regex.Pattern; +import java.util.stream.Collectors; +import java.util.stream.Stream; + +import org.lwjgl.system.MemoryUtil; + import com.google.common.collect.Lists; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.render.backend.gl.GlFogMode; -import com.simibubi.create.foundation.render.backend.gl.shader.*; +import com.simibubi.create.foundation.render.backend.gl.shader.GlProgram; +import com.simibubi.create.foundation.render.backend.gl.shader.GlShader; +import com.simibubi.create.foundation.render.backend.gl.shader.ProgramGroup; +import com.simibubi.create.foundation.render.backend.gl.shader.ProgramSpec; +import com.simibubi.create.foundation.render.backend.gl.shader.ShaderConstants; +import com.simibubi.create.foundation.render.backend.gl.shader.ShaderType; import net.minecraft.resources.IResource; import net.minecraft.resources.IResourceManager; @@ -11,21 +41,6 @@ import net.minecraft.util.ResourceLocation; import net.minecraftforge.resource.IResourceType; import net.minecraftforge.resource.VanillaResourceType; -import org.lwjgl.system.MemoryUtil; - -import java.io.*; -import java.nio.Buffer; -import java.nio.ByteBuffer; -import java.nio.channels.Channels; -import java.nio.channels.FileChannel; -import java.nio.channels.ReadableByteChannel; -import java.util.*; -import java.util.function.Predicate; -import java.util.regex.Matcher; -import java.util.regex.Pattern; -import java.util.stream.Collectors; -import java.util.stream.Stream; - public class ShaderLoader { public static final String SHADER_DIR = "flywheel/shaders/"; public static final ArrayList EXTENSIONS = Lists.newArrayList(".vert", ".vsh", ".frag", ".fsh", ".glsl"); diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/core/BasicData.java b/src/main/java/com/simibubi/create/foundation/render/backend/core/BasicData.java index 7d27c8eb1..2a555ede7 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/core/BasicData.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/core/BasicData.java @@ -1,6 +1,7 @@ package com.simibubi.create.foundation.render.backend.core; import java.nio.ByteBuffer; + import com.simibubi.create.foundation.render.backend.instancing.InstanceData; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/core/ModelData.java b/src/main/java/com/simibubi/create/foundation/render/backend/core/ModelData.java index 1db0f88da..99e3192bd 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/core/ModelData.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/core/ModelData.java @@ -1,11 +1,11 @@ package com.simibubi.create.foundation.render.backend.core; +import java.nio.ByteBuffer; + import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.render.backend.RenderUtil; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; -import java.nio.ByteBuffer; - public class ModelData extends BasicData { private static final float[] empty = new float[25]; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/core/OrientedData.java b/src/main/java/com/simibubi/create/foundation/render/backend/core/OrientedData.java index d46a6c247..dd3b6640d 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/core/OrientedData.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/core/OrientedData.java @@ -1,9 +1,10 @@ package com.simibubi.create.foundation.render.backend.core; -import net.minecraft.util.math.BlockPos; - import java.nio.ByteBuffer; + import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; + +import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Quaternion; import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3f; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/core/OrientedModel.java b/src/main/java/com/simibubi/create/foundation/render/backend/core/OrientedModel.java index 562bb9a74..e1cd0b00b 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/core/OrientedModel.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/core/OrientedModel.java @@ -1,11 +1,11 @@ package com.simibubi.create.foundation.render.backend.core; -import net.minecraft.client.renderer.BufferBuilder; - import com.simibubi.create.foundation.render.backend.gl.attrib.VertexFormat; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; +import net.minecraft.client.renderer.BufferBuilder; + public class OrientedModel extends InstancedModel { public static final VertexFormat INSTANCE_FORMAT = VertexFormat.builder() .addAttributes(BasicAttributes.class) diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/core/TransformedModel.java b/src/main/java/com/simibubi/create/foundation/render/backend/core/TransformedModel.java index 50a86fe80..b5d80ded6 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/core/TransformedModel.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/core/TransformedModel.java @@ -3,6 +3,7 @@ package com.simibubi.create.foundation.render.backend.core; import com.simibubi.create.foundation.render.backend.gl.attrib.VertexFormat; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; import com.simibubi.create.foundation.render.backend.instancing.InstancedTileRenderer; + import net.minecraft.client.renderer.BufferBuilder; public class TransformedModel extends InstancedModel { diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/BasicProgram.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/BasicProgram.java index 5ca030770..2087795b0 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/BasicProgram.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/BasicProgram.java @@ -1,11 +1,10 @@ package com.simibubi.create.foundation.render.backend.gl; -import com.simibubi.create.foundation.render.backend.RenderUtil; -import com.simibubi.create.foundation.render.backend.gl.shader.ProgramFogMode; import org.lwjgl.opengl.GL20; -import com.simibubi.create.foundation.render.backend.Backend; +import com.simibubi.create.foundation.render.backend.RenderUtil; import com.simibubi.create.foundation.render.backend.gl.shader.GlProgram; +import com.simibubi.create.foundation.render.backend.gl.shader.ProgramFogMode; import com.simibubi.create.foundation.utility.AnimationTickHolder; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlBuffer.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlBuffer.java index 1dbd256e5..f39913ccd 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlBuffer.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlBuffer.java @@ -3,9 +3,10 @@ package com.simibubi.create.foundation.render.backend.gl; import java.nio.ByteBuffer; import java.util.function.Consumer; -import com.simibubi.create.foundation.render.backend.Backend; import org.lwjgl.opengl.GL20; +import com.simibubi.create.foundation.render.backend.Backend; + public class GlBuffer extends GlObject { protected final int bufferType; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlFog.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlFog.java index c56a789a8..02172e02e 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlFog.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlFog.java @@ -1,8 +1,9 @@ package com.simibubi.create.foundation.render.backend.gl; -import com.mojang.blaze3d.platform.GlStateManager; import org.lwjgl.opengl.GL11; +import com.mojang.blaze3d.platform.GlStateManager; + public class GlFog { public static float[] FOG_COLOR = new float[] {0, 0, 0, 0}; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlFogMode.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlFogMode.java index 996763bab..ff35e7e12 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlFogMode.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlFogMode.java @@ -1,13 +1,11 @@ package com.simibubi.create.foundation.render.backend.gl; -import com.google.common.collect.Lists; -import com.simibubi.create.foundation.render.backend.gl.shader.GlShader; -import com.simibubi.create.foundation.render.backend.gl.shader.ProgramFogMode; -import org.lwjgl.opengl.GL11; - import java.util.Collections; import java.util.List; +import com.google.common.collect.Lists; +import com.simibubi.create.foundation.render.backend.gl.shader.ProgramFogMode; + public enum GlFogMode { NONE(ProgramFogMode.None::new), LINEAR(ProgramFogMode.Linear::new, "USE_FOG_LINEAR"), diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlPrimitiveType.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlPrimitiveType.java index c82b02a00..1850b3670 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlPrimitiveType.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/GlPrimitiveType.java @@ -1,9 +1,9 @@ package com.simibubi.create.foundation.render.backend.gl; +import org.lwjgl.opengl.GL11; + import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import org.lwjgl.opengl.GL11; -import org.lwjgl.opengl.GL20; @OnlyIn(Dist.CLIENT) public enum GlPrimitiveType { diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/attrib/IAttribSpec.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/attrib/IAttribSpec.java index f16d1deb1..01f762f07 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/attrib/IAttribSpec.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/attrib/IAttribSpec.java @@ -1,7 +1,5 @@ package com.simibubi.create.foundation.render.backend.gl.attrib; -import org.lwjgl.opengl.GL20; - public interface IAttribSpec { void vertexAttribPointer(int stride, int index, int pointer); diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/attrib/MatrixAttributes.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/attrib/MatrixAttributes.java index f7eb4d85f..22bbf16c9 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/attrib/MatrixAttributes.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/attrib/MatrixAttributes.java @@ -1,8 +1,9 @@ package com.simibubi.create.foundation.render.backend.gl.attrib; -import com.simibubi.create.foundation.render.backend.gl.GlPrimitiveType; import org.lwjgl.opengl.GL20; +import com.simibubi.create.foundation.render.backend.gl.GlPrimitiveType; + public enum MatrixAttributes implements IAttribSpec { MAT3(3, 3), MAT4(4, 4), diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/GlProgram.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/GlProgram.java index 0b550b448..d450144b6 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/GlProgram.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/GlProgram.java @@ -1,9 +1,9 @@ package com.simibubi.create.foundation.render.backend.gl.shader; -import com.simibubi.create.foundation.render.backend.gl.GlFogMode; import org.lwjgl.opengl.GL20; import com.simibubi.create.foundation.render.backend.Backend; +import com.simibubi.create.foundation.render.backend.gl.GlFogMode; import com.simibubi.create.foundation.render.backend.gl.GlObject; import com.simibubi.create.foundation.render.backend.gl.attrib.IVertexAttrib; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/ProgramFogMode.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/ProgramFogMode.java index 804aa5073..b614601fb 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/ProgramFogMode.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/ProgramFogMode.java @@ -1,8 +1,9 @@ package com.simibubi.create.foundation.render.backend.gl.shader; -import com.simibubi.create.foundation.render.backend.gl.GlFog; import org.lwjgl.opengl.GL20; +import com.simibubi.create.foundation.render.backend.gl.GlFog; + public abstract class ProgramFogMode { public abstract void bind(); diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/ProgramGroup.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/ProgramGroup.java index b31ae0237..732a2f196 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/ProgramGroup.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/ProgramGroup.java @@ -1,9 +1,9 @@ package com.simibubi.create.foundation.render.backend.gl.shader; -import com.simibubi.create.foundation.render.backend.gl.GlFogMode; - import java.util.Map; +import com.simibubi.create.foundation.render.backend.gl.GlFogMode; + public class ProgramGroup

{ private final Map programs; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/ShaderConstants.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/ShaderConstants.java index 9c509cc7d..0ff228099 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/ShaderConstants.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/shader/ShaderConstants.java @@ -1,7 +1,5 @@ package com.simibubi.create.foundation.render.backend.gl.shader; -import com.google.common.collect.Lists; - import java.io.BufferedReader; import java.io.StringReader; import java.util.ArrayList; @@ -9,6 +7,8 @@ import java.util.Collection; import java.util.stream.Collectors; import java.util.stream.Stream; +import com.google.common.collect.Lists; + public class ShaderConstants implements GlShader.PreProcessor { public static final ShaderConstants EMPTY = new ShaderConstants(); diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/DrawInstanced.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/DrawInstanced.java index 4c206581d..d8cca0eb5 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/DrawInstanced.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/DrawInstanced.java @@ -1,6 +1,9 @@ package com.simibubi.create.foundation.render.backend.gl.versioned; -import org.lwjgl.opengl.*; +import org.lwjgl.opengl.ARBDrawInstanced; +import org.lwjgl.opengl.EXTDrawInstanced; +import org.lwjgl.opengl.GL31; +import org.lwjgl.opengl.GLCapabilities; public enum DrawInstanced implements GlVersioned { GL31_DRAW_INSTANCED { diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/GlCompat.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/GlCompat.java index 9cb150a51..1c152fce3 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/GlCompat.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/GlCompat.java @@ -1,15 +1,15 @@ package com.simibubi.create.foundation.render.backend.gl.versioned; +import java.nio.ByteBuffer; +import java.util.Arrays; +import java.util.function.Consumer; + import org.lwjgl.PointerBuffer; import org.lwjgl.opengl.GL20C; import org.lwjgl.opengl.GLCapabilities; import org.lwjgl.system.MemoryStack; import org.lwjgl.system.MemoryUtil; -import java.nio.ByteBuffer; -import java.util.Arrays; -import java.util.function.Consumer; - /** * An instance of this class stores information * about what OpenGL features are available. diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/InstancedArrays.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/InstancedArrays.java index 1c000a37d..ee00f760f 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/InstancedArrays.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/InstancedArrays.java @@ -1,6 +1,8 @@ package com.simibubi.create.foundation.render.backend.gl.versioned; -import org.lwjgl.opengl.*; +import org.lwjgl.opengl.ARBInstancedArrays; +import org.lwjgl.opengl.GL33; +import org.lwjgl.opengl.GLCapabilities; public enum InstancedArrays implements GlVersioned { GL33_INSTANCED_ARRAYS { diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/RGPixelFormat.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/RGPixelFormat.java index 9cf035535..e886fcfe5 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/RGPixelFormat.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/RGPixelFormat.java @@ -1,6 +1,8 @@ package com.simibubi.create.foundation.render.backend.gl.versioned; -import org.lwjgl.opengl.*; +import org.lwjgl.opengl.GL11; +import org.lwjgl.opengl.GL30; +import org.lwjgl.opengl.GLCapabilities; public enum RGPixelFormat implements GlVersioned { GL30_RG { diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/VertexArrayObject.java b/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/VertexArrayObject.java index 58b9f0fc8..356970877 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/VertexArrayObject.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/gl/versioned/VertexArrayObject.java @@ -1,6 +1,8 @@ package com.simibubi.create.foundation.render.backend.gl.versioned; -import org.lwjgl.opengl.*; +import org.lwjgl.opengl.ARBVertexArrayObject; +import org.lwjgl.opengl.GL30; +import org.lwjgl.opengl.GLCapabilities; public enum VertexArrayObject implements GlVersioned { GL30_VAO { diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/InstancedModel.java b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/InstancedModel.java index 5bc5465dc..fc6be1b40 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/InstancedModel.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/InstancedModel.java @@ -2,17 +2,18 @@ package com.simibubi.create.foundation.render.backend.instancing; import java.nio.ByteBuffer; -import java.util.*; +import java.util.ArrayList; +import java.util.BitSet; -import com.simibubi.create.foundation.render.backend.Backend; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL15; import org.lwjgl.opengl.GL20; +import com.simibubi.create.foundation.render.backend.Backend; import com.simibubi.create.foundation.render.backend.BufferedModel; +import com.simibubi.create.foundation.render.backend.core.ModelAttributes; import com.simibubi.create.foundation.render.backend.gl.GlBuffer; import com.simibubi.create.foundation.render.backend.gl.GlVertexArray; -import com.simibubi.create.foundation.render.backend.core.ModelAttributes; import com.simibubi.create.foundation.render.backend.gl.attrib.VertexFormat; import net.minecraft.client.renderer.BufferBuilder; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/InstancedTileRenderer.java b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/InstancedTileRenderer.java index 78f07111d..a7bdc1dcc 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/InstancedTileRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/InstancedTileRenderer.java @@ -1,20 +1,22 @@ package com.simibubi.create.foundation.render.backend.instancing; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.Map; import javax.annotation.Nullable; import com.simibubi.create.foundation.render.backend.Backend; import com.simibubi.create.foundation.render.backend.MaterialType; import com.simibubi.create.foundation.render.backend.MaterialTypes; -import com.simibubi.create.foundation.render.backend.gl.BasicProgram; -import com.simibubi.create.foundation.render.backend.gl.shader.ShaderCallback; import com.simibubi.create.foundation.render.backend.core.ModelData; import com.simibubi.create.foundation.render.backend.core.OrientedData; +import com.simibubi.create.foundation.render.backend.gl.BasicProgram; +import com.simibubi.create.foundation.render.backend.gl.shader.ShaderCallback; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.*; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.vector.Matrix4f; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/RenderMaterial.java b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/RenderMaterial.java index 3b8f18a95..f2f3e1bc7 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/RenderMaterial.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/RenderMaterial.java @@ -15,7 +15,6 @@ import com.google.common.cache.Cache; import com.google.common.cache.CacheBuilder; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.AllBlockPartials; -import com.simibubi.create.content.contraptions.base.KineticTileEntityRenderer; import com.simibubi.create.foundation.render.Compartment; import com.simibubi.create.foundation.render.SuperByteBufferCache; import com.simibubi.create.foundation.render.backend.Backend; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/TileEntityInstance.java b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/TileEntityInstance.java index cddd81123..aece43527 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/TileEntityInstance.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/TileEntityInstance.java @@ -1,5 +1,8 @@ package com.simibubi.create.foundation.render.backend.instancing; +import java.util.Arrays; +import java.util.stream.Stream; + import com.simibubi.create.foundation.render.backend.core.IFlatLight; import com.simibubi.create.foundation.render.backend.core.ModelData; import com.simibubi.create.foundation.render.backend.core.OrientedData; @@ -10,9 +13,6 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.LightType; import net.minecraft.world.World; -import java.util.Arrays; -import java.util.stream.Stream; - /** * The layer between a {@link TileEntity} and the Flywheel backend. * diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/util/ConditionalInstance.java b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/util/ConditionalInstance.java index 462bc6b38..386794900 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/util/ConditionalInstance.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/util/ConditionalInstance.java @@ -1,7 +1,9 @@ package com.simibubi.create.foundation.render.backend.instancing.util; import java.util.Optional; + import javax.annotation.Nullable; + import com.simibubi.create.foundation.render.backend.instancing.InstanceData; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/util/InstanceGroup.java b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/util/InstanceGroup.java index 15c5871fe..f550f4e46 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/util/InstanceGroup.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/util/InstanceGroup.java @@ -1,8 +1,10 @@ package com.simibubi.create.foundation.render.backend.instancing.util; -import net.minecraft.util.NonNullList; +import java.util.AbstractCollection; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.List; -import java.util.*; import com.simibubi.create.foundation.render.backend.instancing.InstanceData; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/util/SelectInstance.java b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/util/SelectInstance.java index 217b7666f..25a6445d8 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/instancing/util/SelectInstance.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/instancing/util/SelectInstance.java @@ -3,7 +3,9 @@ package com.simibubi.create.foundation.render.backend.instancing.util; import java.util.ArrayList; import java.util.List; import java.util.Optional; + import javax.annotation.Nullable; + import com.simibubi.create.foundation.render.backend.instancing.InstanceData; import com.simibubi.create.foundation.render.backend.instancing.InstancedModel; diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/light/LightUpdater.java b/src/main/java/com/simibubi/create/foundation/render/backend/light/LightUpdater.java index 6c77f3180..dd63bef83 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/light/LightUpdater.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/light/LightUpdater.java @@ -1,5 +1,10 @@ package com.simibubi.create.foundation.render.backend.light; +import java.util.WeakHashMap; +import java.util.function.LongConsumer; + +import com.simibubi.create.foundation.utility.WeakHashSet; + import it.unimi.dsi.fastutil.longs.Long2ObjectMap; import it.unimi.dsi.fastutil.longs.Long2ObjectOpenHashMap; import it.unimi.dsi.fastutil.longs.LongRBTreeSet; @@ -8,10 +13,6 @@ import net.minecraft.util.math.SectionPos; import net.minecraft.world.IBlockDisplayReader; import net.minecraft.world.LightType; -import java.util.*; -import java.util.function.LongConsumer; -import com.simibubi.create.foundation.utility.WeakHashSet; - /** * By using WeakReferences we can automatically remove listeners when they are garbage collected. * This allows us to easily be more clever about how we store the listeners. Each listener is associated diff --git a/src/main/java/com/simibubi/create/foundation/render/backend/light/LightVolume.java b/src/main/java/com/simibubi/create/foundation/render/backend/light/LightVolume.java index 095d179db..e201550f7 100644 --- a/src/main/java/com/simibubi/create/foundation/render/backend/light/LightVolume.java +++ b/src/main/java/com/simibubi/create/foundation/render/backend/light/LightVolume.java @@ -2,19 +2,18 @@ package com.simibubi.create.foundation.render.backend.light; import java.nio.ByteBuffer; -import com.simibubi.create.foundation.render.backend.Backend; -import com.simibubi.create.foundation.render.backend.gl.versioned.RGPixelFormat; import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL12; import org.lwjgl.opengl.GL13; import org.lwjgl.opengl.GL20; import org.lwjgl.system.MemoryUtil; +import com.simibubi.create.foundation.render.backend.Backend; import com.simibubi.create.foundation.render.backend.RenderWork; import com.simibubi.create.foundation.render.backend.gl.GlTexture; +import com.simibubi.create.foundation.render.backend.gl.versioned.RGPixelFormat; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.math.SectionPos; import net.minecraft.world.IBlockDisplayReader; import net.minecraft.world.LightType; diff --git a/src/main/java/com/simibubi/create/foundation/renderState/RenderTypes.java b/src/main/java/com/simibubi/create/foundation/renderState/RenderTypes.java index 078af3975..31c129642 100644 --- a/src/main/java/com/simibubi/create/foundation/renderState/RenderTypes.java +++ b/src/main/java/com/simibubi/create/foundation/renderState/RenderTypes.java @@ -91,7 +91,7 @@ public class RenderTypes extends RenderState { public static RenderType getItemPartialSolid() { return ITEM_PARTIAL_SOLID; } - + public static RenderType getItemPartialTranslucent() { return ITEM_PARTIAL_TRANSLUCENT; } diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java b/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java index 5f5c1693a..a589bc7ca 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/SmartTileEntity.java @@ -173,11 +173,11 @@ public abstract class SmartTileEntity extends SyncedTileEntity implements ITicka protected boolean isFluidHandlerCap(Capability cap) { return cap == CapabilityFluidHandler.FLUID_HANDLER_CAPABILITY; } - + public void markVirtual() { virtualMode = true; } - + public boolean isVirtual() { return virtualMode; } diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java b/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java index c31c91252..2c8929358 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/SyncedTileEntity.java @@ -45,7 +45,7 @@ public abstract class SyncedTileEntity extends TileEntity { if (world != null) world.notifyBlockUpdate(getPos(), getBlockState(), getBlockState(), 1); } - + @Override public SUpdateTileEntityPacket getUpdatePacket() { return new SUpdateTileEntityPacket(getPos(), 1, writeToClient(new CompoundNBT())); @@ -65,7 +65,7 @@ public abstract class SyncedTileEntity extends TileEntity { public CompoundNBT writeToClient(CompoundNBT tag) { return write(tag); } - + public void notifyUpdate() { markDirty(); sendData(); diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/TileEntityBehaviour.java b/src/main/java/com/simibubi/create/foundation/tileEntity/TileEntityBehaviour.java index 859346c4a..925677123 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/TileEntityBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/TileEntityBehaviour.java @@ -75,13 +75,12 @@ public abstract class TileEntityBehaviour { return tileEntity.getWorld(); } - public static T get(IBlockReader reader, BlockPos pos, - BehaviourType type) { + public static T get(IBlockReader reader, BlockPos pos, BehaviourType type) { return get(reader.getTileEntity(pos), type); } - + public static void destroy(IBlockReader reader, BlockPos pos, - BehaviourType type) { + BehaviourType type) { T behaviour = get(reader.getTileEntity(pos), type); if (behaviour != null) behaviour.destroy(); diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBoxTransform.java b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBoxTransform.java index 2c2494baf..0d74f4e52 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBoxTransform.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/ValueBoxTransform.java @@ -6,7 +6,6 @@ import org.apache.commons.lang3.tuple.Pair; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.MatrixStacker; import com.simibubi.create.foundation.utility.VecHelper; diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/fluid/SmartFluidTankBehaviour.java b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/fluid/SmartFluidTankBehaviour.java index 8775f16d3..05ddc710a 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/fluid/SmartFluidTankBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/fluid/SmartFluidTankBehaviour.java @@ -9,9 +9,9 @@ import com.simibubi.create.foundation.fluid.SmartFluidTank; import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType; +import com.simibubi.create.foundation.utility.NBTHelper; import com.simibubi.create.foundation.utility.animation.LerpedFloat; import com.simibubi.create.foundation.utility.animation.LerpedFloat.Chaser; -import com.simibubi.create.foundation.utility.NBTHelper; import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.ListNBT; diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/inventory/InvManipulationBehaviour.java b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/inventory/InvManipulationBehaviour.java index 0dc89a893..54336ccdc 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/inventory/InvManipulationBehaviour.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/inventory/InvManipulationBehaviour.java @@ -12,7 +12,6 @@ import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.BehaviourType; import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import com.simibubi.create.foundation.utility.BlockFace; -import com.simibubi.create.foundation.utility.BlockHelper; import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollValueHandler.java b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollValueHandler.java index 87dd0a1fb..4d88b26a8 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollValueHandler.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/behaviour/scrollvalue/ScrollValueHandler.java @@ -6,8 +6,8 @@ import com.simibubi.create.foundation.tileEntity.SmartTileEntity; import com.simibubi.create.foundation.tileEntity.TileEntityBehaviour; import com.simibubi.create.foundation.tileEntity.behaviour.ValueBoxTransform.Sided; import com.simibubi.create.foundation.tileEntity.behaviour.scrollvalue.ScrollValueBehaviour.StepContext; - import com.simibubi.create.foundation.utility.animation.PhysicalFloat; + import net.minecraft.client.Minecraft; import net.minecraft.client.world.ClientWorld; import net.minecraft.util.math.BlockPos; diff --git a/src/main/java/com/simibubi/create/foundation/tileEntity/renderer/ColoredOverlayTileEntityRenderer.java b/src/main/java/com/simibubi/create/foundation/tileEntity/renderer/ColoredOverlayTileEntityRenderer.java index a72e40dc2..c7b6ac979 100644 --- a/src/main/java/com/simibubi/create/foundation/tileEntity/renderer/ColoredOverlayTileEntityRenderer.java +++ b/src/main/java/com/simibubi/create/foundation/tileEntity/renderer/ColoredOverlayTileEntityRenderer.java @@ -2,16 +2,12 @@ package com.simibubi.create.foundation.tileEntity.renderer; import com.mojang.blaze3d.matrix.MatrixStack; import com.simibubi.create.foundation.render.SuperByteBuffer; - import com.simibubi.create.foundation.render.backend.FastRenderDispatcher; -import net.minecraft.block.BlockState; + import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.RenderType; -import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; public abstract class ColoredOverlayTileEntityRenderer extends SafeTileEntityRenderer { diff --git a/src/main/java/com/simibubi/create/foundation/utility/AbstractBlockBreakQueue.java b/src/main/java/com/simibubi/create/foundation/utility/AbstractBlockBreakQueue.java index 69886577e..cc4989e8d 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/AbstractBlockBreakQueue.java +++ b/src/main/java/com/simibubi/create/foundation/utility/AbstractBlockBreakQueue.java @@ -1,5 +1,10 @@ package com.simibubi.create.foundation.utility; +import java.util.function.BiConsumer; +import java.util.function.Consumer; + +import javax.annotation.Nullable; + import net.minecraft.entity.LivingEntity; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; @@ -8,15 +13,13 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.event.ForgeEventFactory; -import javax.annotation.Nullable; -import java.util.function.BiConsumer; -import java.util.function.Consumer; - public abstract class AbstractBlockBreakQueue { - protected Consumer makeCallbackFor(World world, float effectChance, ItemStack toDamage, @Nullable PlayerEntity playerEntity, BiConsumer drop) { + protected Consumer makeCallbackFor(World world, float effectChance, ItemStack toDamage, + @Nullable PlayerEntity playerEntity, BiConsumer drop) { return pos -> { ItemStack usedTool = toDamage.copy(); - BlockHelper.destroyBlockAs(world, pos, playerEntity, toDamage, effectChance, stack -> drop.accept(pos, stack)); + BlockHelper.destroyBlockAs(world, pos, playerEntity, toDamage, effectChance, + stack -> drop.accept(pos, stack)); if (toDamage.isEmpty() && !usedTool.isEmpty()) ForgeEventFactory.onPlayerDestroyItem(playerEntity, usedTool, Hand.MAIN_HAND); }; @@ -24,9 +27,11 @@ public abstract class AbstractBlockBreakQueue { public void destroyBlocks(World world, @Nullable LivingEntity entity, BiConsumer drop) { PlayerEntity playerEntity = entity instanceof PlayerEntity ? ((PlayerEntity) entity) : null; - ItemStack toDamage = playerEntity != null && !playerEntity.isCreative() ? playerEntity.getHeldItemMainhand() : ItemStack.EMPTY; + ItemStack toDamage = + playerEntity != null && !playerEntity.isCreative() ? playerEntity.getHeldItemMainhand() : ItemStack.EMPTY; destroyBlocks(world, toDamage, playerEntity, drop); } - public abstract void destroyBlocks(World world, ItemStack toDamage, @Nullable PlayerEntity playerEntity, BiConsumer drop); + public abstract void destroyBlocks(World world, ItemStack toDamage, @Nullable PlayerEntity playerEntity, + BiConsumer drop); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/AnimationTickHolder.java b/src/main/java/com/simibubi/create/foundation/utility/AnimationTickHolder.java index e75f5ff1d..762c873c2 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/AnimationTickHolder.java +++ b/src/main/java/com/simibubi/create/foundation/utility/AnimationTickHolder.java @@ -2,8 +2,8 @@ package com.simibubi.create.foundation.utility; import com.simibubi.create.foundation.ponder.PonderUI; import com.simibubi.create.foundation.ponder.PonderWorld; - import com.simibubi.create.foundation.utility.worldWrappers.WrappedClientWorld; + import net.minecraft.client.Minecraft; import net.minecraft.world.IWorld; @@ -16,11 +16,12 @@ public class AnimationTickHolder { } public static void tick() { - if (!Minecraft.getInstance().isGamePaused()) { + if (!Minecraft.getInstance() + .isGamePaused()) { ticks = (ticks + 1) % 1_728_000; // wrap around every 24 hours so we maintain enough floating point precision } } - + public static int getTicks() { return ticks; } @@ -33,17 +34,17 @@ public class AnimationTickHolder { Minecraft mc = Minecraft.getInstance(); return (mc.isGamePaused() ? mc.renderPartialTicksPaused : mc.getRenderPartialTicks()); } - + public static int getTicks(IWorld world) { if (world instanceof WrappedClientWorld) return getTicks(((WrappedClientWorld) world).getWrappedWorld()); return world instanceof PonderWorld ? PonderUI.ponderTicks : getTicks(); } - + public static float getRenderTime(IWorld world) { return getTicks(world) + getPartialTicks(world); } - + public static float getPartialTicks(IWorld world) { return world instanceof PonderWorld ? PonderUI.getPartialTicks() : getPartialTicks(); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/BlockFace.java b/src/main/java/com/simibubi/create/foundation/utility/BlockFace.java index 272c6adc8..b26edb76c 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/BlockFace.java +++ b/src/main/java/com/simibubi/create/foundation/utility/BlockFace.java @@ -24,7 +24,7 @@ public class BlockFace extends Pair { public Direction getFace() { return getSecond(); } - + public Direction getOppositeFace() { return getSecond().getOpposite(); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java index 035828332..a70af7ca1 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java @@ -4,9 +4,6 @@ import java.util.function.Consumer; import javax.annotation.Nullable; -import net.minecraft.stats.Stats; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.world.BlockEvent; import org.apache.commons.lang3.mutable.MutableInt; import com.simibubi.create.AllBlocks; @@ -26,11 +23,12 @@ import net.minecraft.fluid.FluidState; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.Items; -import net.minecraft.state.properties.BlockStateProperties; -import net.minecraft.state.properties.SlabType; -import net.minecraft.tags.BlockTags; import net.minecraft.nbt.CompoundNBT; import net.minecraft.particles.ParticleTypes; +import net.minecraft.state.properties.BlockStateProperties; +import net.minecraft.state.properties.SlabType; +import net.minecraft.stats.Stats; +import net.minecraft.tags.BlockTags; import net.minecraft.tags.FluidTags; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.Direction; @@ -46,11 +44,14 @@ import net.minecraft.world.server.ServerWorld; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.IPlantable; +import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.event.world.BlockEvent; public class BlockHelper { @OnlyIn(Dist.CLIENT) - public static void addReducedDestroyEffects(BlockState state, World worldIn, BlockPos pos, ParticleManager manager) { + public static void addReducedDestroyEffects(BlockState state, World worldIn, BlockPos pos, + ParticleManager manager) { if (!(worldIn instanceof ClientWorld)) return; ClientWorld world = (ClientWorld) worldIn; @@ -123,8 +124,8 @@ public class BlockHelper { int amountFound = 0; Item required = getRequiredItem(block).getItem(); - boolean needsTwo = - block.contains(BlockStateProperties.SLAB_TYPE) && block.get(BlockStateProperties.SLAB_TYPE) == SlabType.DOUBLE; + boolean needsTwo = block.contains(BlockStateProperties.SLAB_TYPE) + && block.get(BlockStateProperties.SLAB_TYPE) == SlabType.DOUBLE; if (needsTwo) amount *= 2; @@ -190,8 +191,8 @@ public class BlockHelper { destroyBlockAs(world, pos, null, ItemStack.EMPTY, effectChance, droppedItemCallback); } - public static void destroyBlockAs(World world, BlockPos pos, @Nullable PlayerEntity player, ItemStack usedTool, float effectChance, - Consumer droppedItemCallback) { + public static void destroyBlockAs(World world, BlockPos pos, @Nullable PlayerEntity player, ItemStack usedTool, + float effectChance, Consumer droppedItemCallback) { FluidState fluidState = world.getFluidState(pos); BlockState state = world.getBlockState(pos); if (world.rand.nextFloat() < effectChance) @@ -204,16 +205,17 @@ public class BlockHelper { return; if (event.getExpToDrop() > 0 && world instanceof ServerWorld) - state.getBlock().dropXpOnBlockBreak((ServerWorld) world, pos, event.getExpToDrop()); + state.getBlock() + .dropXpOnBlockBreak((ServerWorld) world, pos, event.getExpToDrop()); usedTool.onBlockDestroyed(world, state, pos, player); player.addStat(Stats.BLOCK_MINED.get(state.getBlock())); } if (world instanceof ServerWorld && world.getGameRules() - .getBoolean(GameRules.DO_TILE_DROPS) && !world.restoringBlockSnapshots && (player == null || !player.isCreative())) { - for (ItemStack itemStack : Block.getDrops(state, (ServerWorld) world, pos, tileentity, - player, usedTool)) + .getBoolean(GameRules.DO_TILE_DROPS) && !world.restoringBlockSnapshots + && (player == null || !player.isCreative())) { + for (ItemStack itemStack : Block.getDrops(state, (ServerWorld) world, pos, tileentity, player, usedTool)) droppedItemCallback.accept(itemStack); state.spawnAdditionalDrops((ServerWorld) world, pos, ItemStack.EMPTY); } @@ -222,8 +224,8 @@ public class BlockHelper { } public static boolean isSolidWall(IBlockReader reader, BlockPos fromPos, Direction toDirection) { - return hasBlockSolidSide(reader.getBlockState(fromPos.offset(toDirection)), reader, - fromPos.offset(toDirection), toDirection.getOpposite()); + return hasBlockSolidSide(reader.getBlockState(fromPos.offset(toDirection)), reader, fromPos.offset(toDirection), + toDirection.getOpposite()); } public static boolean noCollisionInSpace(IBlockReader reader, BlockPos pos) { @@ -248,9 +250,11 @@ public class BlockHelper { else if (state.getBlock() != Blocks.SEA_PICKLE && state.getBlock() instanceof IPlantable) state = ((IPlantable) state.getBlock()).getPlant(world, target); - if (world.getDimension().isUltrawarm() && state.getFluidState() - .getFluid() - .isIn(FluidTags.WATER)) { + if (world.getDimension() + .isUltrawarm() + && state.getFluidState() + .getFluid() + .isIn(FluidTags.WATER)) { int i = target.getX(); int j = target.getY(); int k = target.getZ(); @@ -283,7 +287,7 @@ public class BlockHelper { } catch (Exception e) { } } - + public static double getBounceMultiplier(Block block) { if (block instanceof SlimeBlock) return 0.8D; @@ -292,13 +296,17 @@ public class BlockHelper { return 0; } - public static boolean hasBlockSolidSide(BlockState p_220056_0_, IBlockReader p_220056_1_, BlockPos p_220056_2_, Direction p_220056_3_) { - return !p_220056_0_.isIn(BlockTags.LEAVES) && Block.doesSideFillSquare(p_220056_0_.getCollisionShape(p_220056_1_, p_220056_2_), p_220056_3_); + public static boolean hasBlockSolidSide(BlockState p_220056_0_, IBlockReader p_220056_1_, BlockPos p_220056_2_, + Direction p_220056_3_) { + return !p_220056_0_.isIn(BlockTags.LEAVES) + && Block.doesSideFillSquare(p_220056_0_.getCollisionShape(p_220056_1_, p_220056_2_), p_220056_3_); } - public static boolean extinguishFire(World world, @Nullable PlayerEntity p_175719_1_, BlockPos p_175719_2_, Direction p_175719_3_) { + public static boolean extinguishFire(World world, @Nullable PlayerEntity p_175719_1_, BlockPos p_175719_2_, + Direction p_175719_3_) { p_175719_2_ = p_175719_2_.offset(p_175719_3_); - if (world.getBlockState(p_175719_2_).getBlock() == Blocks.FIRE) { + if (world.getBlockState(p_175719_2_) + .getBlock() == Blocks.FIRE) { world.playEvent(p_175719_1_, 1009, p_175719_2_, 0); world.removeBlock(p_175719_2_, false); return true; diff --git a/src/main/java/com/simibubi/create/foundation/utility/Coordinate.java b/src/main/java/com/simibubi/create/foundation/utility/Coordinate.java index adb419c3e..6d1a246c7 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/Coordinate.java +++ b/src/main/java/com/simibubi/create/foundation/utility/Coordinate.java @@ -4,5 +4,5 @@ import net.minecraft.util.math.BlockPos; @FunctionalInterface public interface Coordinate { - float get(BlockPos from); + float get(BlockPos from); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/Couple.java b/src/main/java/com/simibubi/create/foundation/utility/Couple.java index 1c0cf6153..79b4bc1ce 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/Couple.java +++ b/src/main/java/com/simibubi/create/foundation/utility/Couple.java @@ -53,7 +53,7 @@ public class Couple extends Pair implements Iterable { public Couple mapWithContext(BiFunction function) { return Couple.create(function.apply(first, true), function.apply(second, false)); } - + public Couple mapWithParams(BiFunction function, Couple values) { return Couple.create(function.apply(first, values.first), function.apply(second, values.second)); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/Debug.java b/src/main/java/com/simibubi/create/foundation/utility/Debug.java index e83ced50c..b52612b30 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/Debug.java +++ b/src/main/java/com/simibubi/create/foundation/utility/Debug.java @@ -22,8 +22,9 @@ public class Debug { @Deprecated public static void debugChatAndShowStack(ITextComponent message, int depth) { if (Minecraft.getInstance().player != null) - Minecraft.getInstance().player - .sendStatusMessage(message.copy().append("@").append(debugStack(depth)), false); + Minecraft.getInstance().player.sendStatusMessage(message.copy() + .append("@") + .append(debugStack(depth)), false); } @Deprecated @@ -34,22 +35,28 @@ public class Debug { @Deprecated public static String getLogicalSide() { - return EffectiveSide.get().isClient() ? "CL" : "SV"; + return EffectiveSide.get() + .isClient() ? "CL" : "SV"; } @Deprecated public static ITextComponent debugStack(int depth) { - StackTraceElement[] stackTraceElements = Thread.currentThread().getStackTrace(); - IFormattableTextComponent text = new StringTextComponent("[").append(new StringTextComponent(getLogicalSide()).formatted(TextFormatting.GOLD)).append("] "); + StackTraceElement[] stackTraceElements = Thread.currentThread() + .getStackTrace(); + IFormattableTextComponent text = new StringTextComponent("[") + .append(new StringTextComponent(getLogicalSide()).formatted(TextFormatting.GOLD)) + .append("] "); for (int i = 1; i < depth + 2 && i < stackTraceElements.length; i++) { StackTraceElement e = stackTraceElements[i]; - if (e.getClassName().equals(Debug.class.getName())) + if (e.getClassName() + .equals(Debug.class.getName())) continue; - text.append(new StringTextComponent(e.getMethodName()).formatted(TextFormatting.YELLOW)).append(", "); + text.append(new StringTextComponent(e.getMethodName()).formatted(TextFormatting.YELLOW)) + .append(", "); } return text.append(new StringTextComponent(" ...").formatted(TextFormatting.GRAY)); } - + @Deprecated public static void markTemporary() {} diff --git a/src/main/java/com/simibubi/create/foundation/utility/DirectionHelper.java b/src/main/java/com/simibubi/create/foundation/utility/DirectionHelper.java index 17f134c80..88ce27061 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/DirectionHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/DirectionHelper.java @@ -74,9 +74,9 @@ public class DirectionHelper { return WEST; } } - + public static Direction getPositivePerpendicular(Axis horizontalAxis) { return horizontalAxis == Axis.X ? SOUTH : EAST; } - + } diff --git a/src/main/java/com/simibubi/create/foundation/utility/EmptyNamedTag.java b/src/main/java/com/simibubi/create/foundation/utility/EmptyNamedTag.java index f58694653..6e33ff6d1 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/EmptyNamedTag.java +++ b/src/main/java/com/simibubi/create/foundation/utility/EmptyNamedTag.java @@ -35,6 +35,6 @@ public class EmptyNamedTag implements Tags.IOptionalNamedTag { @Override public List values() { - return Collections.emptyList() ; + return Collections.emptyList(); } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/FilesHelper.java b/src/main/java/com/simibubi/create/foundation/utility/FilesHelper.java index cd916fd4a..38a66f0b0 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/FilesHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/FilesHelper.java @@ -40,7 +40,8 @@ public class FilesHelper { } public static String slug(String name) { - return Lang.asId(name).replaceAll("\\W+", "_"); + return Lang.asId(name) + .replaceAll("\\W+", "_"); } public static boolean saveTagCompoundAsJson(CompoundNBT compound, String path) { diff --git a/src/main/java/com/simibubi/create/foundation/utility/FontHelper.java b/src/main/java/com/simibubi/create/foundation/utility/FontHelper.java index f6f01be5e..c81ffef70 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/FontHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/FontHelper.java @@ -5,17 +5,16 @@ import java.util.LinkedList; import java.util.List; import com.mojang.blaze3d.matrix.MatrixStack; + import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.Tessellator; import net.minecraft.util.math.vector.Matrix4f; -import net.minecraft.util.math.vector.TransformationMatrix; import net.minecraftforge.client.MinecraftForgeClient; public final class FontHelper { - private FontHelper() { - } + private FontHelper() {} public static List cutString(FontRenderer font, String text, int maxWidthPerLine) { // Split words @@ -53,9 +52,11 @@ public final class FontHelper { return lines; } - public static void drawSplitString(MatrixStack ms, FontRenderer font, String text, int x, int y, int width, int color) { + public static void drawSplitString(MatrixStack ms, FontRenderer font, String text, int x, int y, int width, + int color) { List list = cutString(font, text, width); - Matrix4f matrix4f = ms.peek().getModel(); + Matrix4f matrix4f = ms.peek() + .getModel(); for (String s : list) { float f = (float) x; @@ -70,14 +71,14 @@ public final class FontHelper { } private static int draw(FontRenderer font, String p_228078_1_, float p_228078_2_, float p_228078_3_, - int p_228078_4_, Matrix4f p_228078_5_, boolean p_228078_6_) { + int p_228078_4_, Matrix4f p_228078_5_, boolean p_228078_6_) { if (p_228078_1_ == null) { return 0; } else { - IRenderTypeBuffer.Impl irendertypebuffer$impl = IRenderTypeBuffer - .immediate(Tessellator.getInstance().getBuffer()); + IRenderTypeBuffer.Impl irendertypebuffer$impl = IRenderTypeBuffer.immediate(Tessellator.getInstance() + .getBuffer()); int i = font.draw(p_228078_1_, p_228078_2_, p_228078_3_, p_228078_4_, p_228078_6_, p_228078_5_, - irendertypebuffer$impl, false, 0, 15728880); + irendertypebuffer$impl, false, 0, 15728880); irendertypebuffer$impl.draw(); return i; } diff --git a/src/main/java/com/simibubi/create/foundation/utility/Iterate.java b/src/main/java/com/simibubi/create/foundation/utility/Iterate.java index 1be8add22..71b621cd2 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/Iterate.java +++ b/src/main/java/com/simibubi/create/foundation/utility/Iterate.java @@ -10,9 +10,9 @@ import net.minecraft.util.math.BlockPos; public class Iterate { - public static final boolean[] trueAndFalse = {true, false}; - public static final int[] zeroAndOne = {0, 1}; - public static final int[] positiveAndNegative = {1, -1}; + public static final boolean[] trueAndFalse = { true, false }; + public static final int[] zeroAndOne = { 0, 1 }; + public static final int[] positiveAndNegative = { 1, -1 }; public static final Direction[] directions = Direction.values(); public static final Direction[] horizontalDirections = getHorizontals(); public static final Axis[] axes = Axis.values(); @@ -27,20 +27,20 @@ public class Iterate { public static Direction[] directionsInAxis(Axis axis) { switch (axis) { - case X: - return new Direction[]{Direction.EAST, Direction.WEST}; - case Y: - return new Direction[]{Direction.UP, Direction.DOWN}; - default: - case Z: - return new Direction[]{Direction.SOUTH, Direction.NORTH}; + case X: + return new Direction[] { Direction.EAST, Direction.WEST }; + case Y: + return new Direction[] { Direction.UP, Direction.DOWN }; + default: + case Z: + return new Direction[] { Direction.SOUTH, Direction.NORTH }; } } public static List hereAndBelow(BlockPos pos) { return Arrays.asList(pos, pos.down()); } - + public static List hereBelowAndAbove(BlockPos pos) { return Arrays.asList(pos, pos.down(), pos.up()); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/MatrixStacker.java b/src/main/java/com/simibubi/create/foundation/utility/MatrixStacker.java index 70cd06f1c..11ff390c7 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/MatrixStacker.java +++ b/src/main/java/com/simibubi/create/foundation/utility/MatrixStacker.java @@ -27,8 +27,10 @@ public class MatrixStacker { public MatrixStacker restoreIdentity() { MatrixStack.Entry entry = ms.peek(); - entry.getModel().loadIdentity(); - entry.getNormal().loadIdentity(); + entry.getModel() + .loadIdentity(); + entry.getNormal() + .loadIdentity(); return this; } @@ -37,7 +39,7 @@ public class MatrixStacker { if (radians == 0) return this; ms.multiply(axis.getUnitVector() - .getRadialQuaternion(radians)); + .getRadialQuaternion(radians)); return this; } diff --git a/src/main/java/com/simibubi/create/foundation/utility/NBTHelper.java b/src/main/java/com/simibubi/create/foundation/utility/NBTHelper.java index 150b47aa5..abb7f39c5 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/NBTHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/NBTHelper.java @@ -19,23 +19,24 @@ public class NBTHelper { public static void putMarker(CompoundNBT nbt, String marker) { nbt.putBoolean(marker, true); } - + public static > T readEnum(CompoundNBT nbt, String key, Class enumClass) { T[] enumConstants = enumClass.getEnumConstants(); String name = nbt.getString(key); if (enumConstants == null) throw new IllegalArgumentException("Non-Enum class passed to readEnum(): " + enumClass.getName()); for (T t : enumConstants) { - if (t.name().equals(name)) + if (t.name() + .equals(name)) return t; } return enumConstants[0]; } - + public static > void writeEnum(CompoundNBT nbt, String key, T enumConstant) { nbt.putString(key, enumConstant.name()); } - + public static ListNBT writeCompoundList(Iterable list, Function serializer) { ListNBT listNBT = new ListNBT(); list.forEach(t -> listNBT.add(serializer.apply(t))); @@ -47,19 +48,19 @@ public class NBTHelper { listNBT.forEach(inbt -> list.add(deserializer.apply((CompoundNBT) inbt))); return list; } - + public static void iterateCompoundList(ListNBT listNBT, Consumer consumer) { listNBT.forEach(inbt -> consumer.accept((CompoundNBT) inbt)); } - + public static ListNBT writeItemList(List stacks) { return writeCompoundList(stacks, ItemStack::serializeNBT); } - + public static List readItemList(ListNBT stacks) { return readCompoundList(stacks, ItemStack::read); } - + public static ListNBT writeAABB(AxisAlignedBB bb) { ListNBT bbtag = new ListNBT(); bbtag.add(FloatNBT.of((float) bb.minX)); @@ -75,7 +76,7 @@ public class NBTHelper { if (bbtag == null || bbtag.isEmpty()) return null; return new AxisAlignedBB(bbtag.getFloat(0), bbtag.getFloat(1), bbtag.getFloat(2), bbtag.getFloat(3), - bbtag.getFloat(4), bbtag.getFloat(5)); + bbtag.getFloat(4), bbtag.getFloat(5)); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/NBTProcessors.java b/src/main/java/com/simibubi/create/foundation/utility/NBTProcessors.java index 73077cc17..d2a119cae 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/NBTProcessors.java +++ b/src/main/java/com/simibubi/create/foundation/utility/NBTProcessors.java @@ -34,8 +34,8 @@ public final class NBTProcessors { for (int i = 0; i < 4; ++i) { String s = data.getString("Text" + (i + 1)); ITextComponent textcomponent = ITextComponent.Serializer.fromJson(s.isEmpty() ? "\"\"" : s); - if (textcomponent != null && textcomponent.getStyle() != null - && textcomponent.getStyle().getClickEvent() != null) + if (textcomponent != null && textcomponent.getStyle() != null && textcomponent.getStyle() + .getClickEvent() != null) return null; } return data; @@ -50,8 +50,7 @@ public final class NBTProcessors { }); } - private NBTProcessors() { - } + private NBTProcessors() {} @Nullable public static CompoundNBT process(TileEntity tileEntity, CompoundNBT compound, boolean survival) { @@ -59,9 +58,11 @@ public final class NBTProcessors { return null; TileEntityType type = tileEntity.getType(); if (survival && survivalProcessors.containsKey(type)) - compound = survivalProcessors.get(type).apply(compound); + compound = survivalProcessors.get(type) + .apply(compound); if (compound != null && processors.containsKey(type)) - return processors.get(type).apply(compound); + return processors.get(type) + .apply(compound); if (tileEntity instanceof MobSpawnerTileEntity) return compound; if (tileEntity.onlyOpsCanSetNbt()) diff --git a/src/main/java/com/simibubi/create/foundation/utility/Pair.java b/src/main/java/com/simibubi/create/foundation/utility/Pair.java index dbd1810a2..7941c090d 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/Pair.java +++ b/src/main/java/com/simibubi/create/foundation/utility/Pair.java @@ -23,19 +23,19 @@ public class Pair { public S getSecond() { return second; } - + public void setFirst(F first) { this.first = first; } - + public void setSecond(S second) { this.second = second; } - + public Pair copy() { return Pair.of(first, second); } - + @Override public boolean equals(final Object obj) { if (obj == this) @@ -56,7 +56,7 @@ public class Pair { public String toString() { return "(" + first + ", " + second + ")"; } - + public Pair swap() { return Pair.of(second, first); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/RaycastHelper.java b/src/main/java/com/simibubi/create/foundation/utility/RaycastHelper.java index 8b11a0226..057c2b378 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/RaycastHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/RaycastHelper.java @@ -23,7 +23,7 @@ public class RaycastHelper { } public static PredicateTraceResult rayTraceUntil(PlayerEntity playerIn, double range, - Predicate predicate) { + Predicate predicate) { Vector3d origin = getTraceOrigin(playerIn); Vector3d target = getTraceTarget(playerIn, range, origin); return rayTraceUntil(origin, target, predicate); diff --git a/src/main/java/com/simibubi/create/foundation/utility/RemapHelper.java b/src/main/java/com/simibubi/create/foundation/utility/RemapHelper.java index 43dd93b5c..52a7648bf 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/RemapHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/RemapHelper.java @@ -191,7 +191,9 @@ public class RemapHelper { @SubscribeEvent public static void onRemapBlocks(RegistryEvent.MissingMappings event) { - ModContainer mod = ModList.get().getModContainerById(Create.ID).orElse(null); + ModContainer mod = ModList.get() + .getModContainerById(Create.ID) + .orElse(null); if (mod == null) return; event.setModContainer(mod); @@ -203,7 +205,8 @@ public class RemapHelper { Create.logger.warn("Remapping block '{}' to '{}'", mapping.key, reMap.get(mapping.key.getPath())); mapping.remap(ForgeRegistries.BLOCKS.getValue(reMap.get(mapping.key.getPath()))); } catch (Throwable t) { - Create.logger.warn("Remapping block '{}' to '{}' failed: {}", mapping.key, reMap.get(mapping.key.getPath()), t); + Create.logger.warn("Remapping block '{}' to '{}' failed: {}", mapping.key, + reMap.get(mapping.key.getPath()), t); } } } @@ -211,7 +214,9 @@ public class RemapHelper { @SubscribeEvent public static void onRemapItems(RegistryEvent.MissingMappings event) { - ModContainer mod = ModList.get().getModContainerById(Create.ID).orElse(null); + ModContainer mod = ModList.get() + .getModContainerById(Create.ID) + .orElse(null); if (mod == null) return; event.setModContainer(mod); @@ -223,7 +228,8 @@ public class RemapHelper { Create.logger.warn("Remapping item '{}' to '{}'", mapping.key, reMap.get(mapping.key.getPath())); mapping.remap(ForgeRegistries.ITEMS.getValue(reMap.get(mapping.key.getPath()))); } catch (Throwable t) { - Create.logger.warn("Remapping item '{}' to '{}' failed: {}", mapping.key, reMap.get(mapping.key.getPath()), t); + Create.logger.warn("Remapping item '{}' to '{}' failed: {}", mapping.key, + reMap.get(mapping.key.getPath()), t); } } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/ServerSpeedProvider.java b/src/main/java/com/simibubi/create/foundation/utility/ServerSpeedProvider.java index 3c6fad18a..45e7e224b 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/ServerSpeedProvider.java +++ b/src/main/java/com/simibubi/create/foundation/utility/ServerSpeedProvider.java @@ -28,10 +28,13 @@ public class ServerSpeedProvider { serverTimer = 0; } } - + @OnlyIn(Dist.CLIENT) public static void clientTick() { - if (Minecraft.getInstance().isSingleplayer() && Minecraft.getInstance().isGamePaused()) + if (Minecraft.getInstance() + .isSingleplayer() + && Minecraft.getInstance() + .isGamePaused()) return; modifier.tick(); clientTimer++; @@ -47,30 +50,29 @@ public class ServerSpeedProvider { public static class Packet extends SimplePacketBase { - public Packet() { - } + public Packet() {} - public Packet(PacketBuffer buffer) { - } + public Packet(PacketBuffer buffer) {} @Override - public void write(PacketBuffer buffer) { - } + public void write(PacketBuffer buffer) {} @Override public void handle(Supplier context) { - context.get().enqueueWork(() -> { - if (!initialized) { - initialized = true; + context.get() + .enqueueWork(() -> { + if (!initialized) { + initialized = true; + clientTimer = 0; + return; + } + float target = ((float) getSyncInterval()) / Math.max(clientTimer, 1); + modifier.target(Math.min(target, 1)); clientTimer = 0; - return; - } - float target = ((float) getSyncInterval()) / Math.max(clientTimer, 1); - modifier.target(Math.min(target, 1)); - clientTimer = 0; - }); - context.get().setPacketHandled(true); + }); + context.get() + .setPacketHandled(true); } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/TreeCutter.java b/src/main/java/com/simibubi/create/foundation/utility/TreeCutter.java index 9b50aaa64..d1191082d 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/TreeCutter.java +++ b/src/main/java/com/simibubi/create/foundation/utility/TreeCutter.java @@ -1,7 +1,30 @@ package com.simibubi.create.foundation.utility; +import java.util.ArrayList; +import java.util.Collections; +import java.util.HashSet; +import java.util.LinkedList; +import java.util.List; +import java.util.Set; +import java.util.function.BiConsumer; +import java.util.function.Predicate; + +import javax.annotation.Nonnull; +import javax.annotation.Nullable; + import com.simibubi.create.AllTags; -import net.minecraft.block.*; + +import net.minecraft.block.BambooBlock; +import net.minecraft.block.Block; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; +import net.minecraft.block.CactusBlock; +import net.minecraft.block.ChorusFlowerBlock; +import net.minecraft.block.ChorusPlantBlock; +import net.minecraft.block.KelpBlock; +import net.minecraft.block.KelpTopBlock; +import net.minecraft.block.LeavesBlock; +import net.minecraft.block.SugarCaneBlock; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.tags.BlockTags; @@ -10,16 +33,9 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; -import javax.annotation.Nonnull; -import javax.annotation.Nullable; -import java.util.*; -import java.util.function.BiConsumer; -import java.util.function.Predicate; - public class TreeCutter { public static final Tree NO_TREE = new Tree(Collections.emptyList(), Collections.emptyList()); - /** * Finds a tree at the given pos. Block at the position should be air * @@ -120,7 +136,8 @@ public class TreeCutter { BlockState state = reader.getBlockState(offset); BlockPos subtract = offset.subtract(pos); int horizontalDistance = Math.max(Math.abs(subtract.getX()), Math.abs(subtract.getZ())); - if (isLeaf(state) && state.get(LeavesBlock.DISTANCE) > distance || isNonDecayingLeaf(state) && horizontalDistance < 4) + if (isLeaf(state) && state.get(LeavesBlock.DISTANCE) > distance + || isNonDecayingLeaf(state) && horizontalDistance < 4) frontier.add(offset); } @@ -205,7 +222,7 @@ public class TreeCutter { return state.contains(LeavesBlock.DISTANCE); } - public static class Tree extends AbstractBlockBreakQueue{ + public static class Tree extends AbstractBlockBreakQueue { private final List logs; private final List leaves; @@ -215,9 +232,10 @@ public class TreeCutter { } @Override - public void destroyBlocks(World world, ItemStack toDamage, @Nullable PlayerEntity playerEntity, BiConsumer drop) { - logs.forEach(makeCallbackFor(world, 1/2f, toDamage, playerEntity, drop)); - leaves.forEach(makeCallbackFor(world, 1/8f, toDamage, playerEntity, drop)); + public void destroyBlocks(World world, ItemStack toDamage, @Nullable PlayerEntity playerEntity, + BiConsumer drop) { + logs.forEach(makeCallbackFor(world, 1 / 2f, toDamage, playerEntity, drop)); + leaves.forEach(makeCallbackFor(world, 1 / 8f, toDamage, playerEntity, drop)); } } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/UniqueLinkedList.java b/src/main/java/com/simibubi/create/foundation/utility/UniqueLinkedList.java index d30c3badb..83a1d82b4 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/UniqueLinkedList.java +++ b/src/main/java/com/simibubi/create/foundation/utility/UniqueLinkedList.java @@ -7,83 +7,92 @@ import java.util.List; import java.util.stream.Collectors; public class UniqueLinkedList extends LinkedList { - private final HashSet contained = new HashSet<>(); + private final HashSet contained = new HashSet<>(); - @Override - public boolean contains(Object o) { - return contained.contains(o); - } + @Override + public boolean contains(Object o) { + return contained.contains(o); + } - @Override - public E poll() { - E e = super.poll(); - contained.remove(e); - return e; - } + @Override + public E poll() { + E e = super.poll(); + contained.remove(e); + return e; + } - @Override - public boolean add(E e) { - if (contained.add(e)) return super.add(e); - else return false; - } + @Override + public boolean add(E e) { + if (contained.add(e)) + return super.add(e); + else + return false; + } - @Override - public void add(int index, E element) { - if (contained.add(element)) super.add(index, element); - } + @Override + public void add(int index, E element) { + if (contained.add(element)) + super.add(index, element); + } - @Override - public void addFirst(E e) { - if (contained.add(e)) super.addFirst(e); - } + @Override + public void addFirst(E e) { + if (contained.add(e)) + super.addFirst(e); + } - @Override - public void addLast(E e) { - if (contained.add(e)) super.addLast(e); - } + @Override + public void addLast(E e) { + if (contained.add(e)) + super.addLast(e); + } - @Override - public boolean addAll(Collection c) { - List filtered = c.stream().filter(it -> !contained.contains(it)).collect(Collectors.toList()); - return super.addAll(filtered); - } + @Override + public boolean addAll(Collection c) { + List filtered = c.stream() + .filter(it -> !contained.contains(it)) + .collect(Collectors.toList()); + return super.addAll(filtered); + } - @Override - public boolean addAll(int index, Collection c) { - List filtered = c.stream().filter(it -> !contained.contains(it)).collect(Collectors.toList()); - return super.addAll(index, filtered); - } + @Override + public boolean addAll(int index, Collection c) { + List filtered = c.stream() + .filter(it -> !contained.contains(it)) + .collect(Collectors.toList()); + return super.addAll(index, filtered); + } - @Override - public boolean remove(Object o) { - contained.remove(o); - return super.remove(o); - } + @Override + public boolean remove(Object o) { + contained.remove(o); + return super.remove(o); + } - @Override - public E remove(int index) { - E e = super.remove(index); - contained.remove(e); - return e; - } + @Override + public E remove(int index) { + E e = super.remove(index); + contained.remove(e); + return e; + } - @Override - public E removeFirst() { - E e = super.removeFirst(); - contained.remove(e); - return e; - } + @Override + public E removeFirst() { + E e = super.removeFirst(); + contained.remove(e); + return e; + } - @Override - public E removeLast() { - E e = super.removeLast(); - contained.remove(e); - return e; - } + @Override + public E removeLast() { + E e = super.removeLast(); + contained.remove(e); + return e; + } - @Override - public void clear() { - super.clear(); - contained.clear(); - } + @Override + public void clear() { + super.clear(); + contained.clear(); + } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/VecHelper.java b/src/main/java/com/simibubi/create/foundation/utility/VecHelper.java index 713d9bedf..665ed1796 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/VecHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/VecHelper.java @@ -60,14 +60,16 @@ public class VecHelper { } public static boolean isVecPointingTowards(Vector3d vec, Direction direction) { - return Vector3d.of(direction.getDirectionVec()).dotProduct(vec.normalize()) > 0; - //return new Vector3d(direction.getDirectionVec()).distanceTo(vec.normalize()) < .75; + return Vector3d.of(direction.getDirectionVec()) + .dotProduct(vec.normalize()) > 0; + // return new Vector3d(direction.getDirectionVec()).distanceTo(vec.normalize()) < .75; } public static Vector3d getCenterOf(Vector3i pos) { if (pos.equals(Vector3i.NULL_VECTOR)) return CENTER_OF_ORIGIN; - return Vector3d.of(pos).add(.5f, .5f, .5f); + return Vector3d.of(pos) + .add(.5f, .5f, .5f); } public static Vector3d offsetRandomly(Vector3d vec, Random r, float radius) { @@ -79,7 +81,7 @@ public class VecHelper { vec = vec.normalize(); return new Vector3d(1, 1, 1).subtract(Math.abs(vec.x), Math.abs(vec.y), Math.abs(vec.z)); } - + public static Vector3d axisAlingedPlaneOf(Direction face) { return axisAlingedPlaneOf(Vector3d.of(face.getDirectionVec())); } @@ -131,8 +133,8 @@ public class VecHelper { } public static Vector3d clampComponentWise(Vector3d vec, float maxLength) { - return new Vector3d(MathHelper.clamp(vec.x, -maxLength, maxLength), MathHelper.clamp(vec.y, -maxLength, maxLength), - MathHelper.clamp(vec.z, -maxLength, maxLength)); + return new Vector3d(MathHelper.clamp(vec.x, -maxLength, maxLength), + MathHelper.clamp(vec.y, -maxLength, maxLength), MathHelper.clamp(vec.z, -maxLength, maxLength)); } public static Vector3d project(Vector3d vec, Vector3d ontoVec) { @@ -142,7 +144,8 @@ public class VecHelper { } @Nullable - public static Vector3d intersectSphere(Vector3d origin, Vector3d lineDirection, Vector3d sphereCenter, double radius) { + public static Vector3d intersectSphere(Vector3d origin, Vector3d lineDirection, Vector3d sphereCenter, + double radius) { if (lineDirection.equals(Vector3d.ZERO)) return null; if (lineDirection.length() != 1) @@ -157,18 +160,20 @@ public class VecHelper { return origin.add(lineDirection.scale(t)); } - //https://forums.minecraftforge.net/topic/88562-116solved-3d-to-2d-conversion/?do=findComment&comment=413573 slightly modified + // https://forums.minecraftforge.net/topic/88562-116solved-3d-to-2d-conversion/?do=findComment&comment=413573 slightly modified public static Vector3d projectToPlayerView(Vector3d target, float partialTicks) { - /* The (centered) location on the screen of the given 3d point in the world. - * Result is (dist right of center screen, dist up from center screen, if < 0, then in front of view plane) */ + /* + * The (centered) location on the screen of the given 3d point in the world. + * Result is (dist right of center screen, dist up from center screen, if < 0, then in front of view plane) + */ ActiveRenderInfo ari = Minecraft.getInstance().gameRenderer.getActiveRenderInfo(); Vector3d camera_pos = ari.getProjectedView(); - Quaternion camera_rotation_conj = ari.getRotation().copy(); + Quaternion camera_rotation_conj = ari.getRotation() + .copy(); camera_rotation_conj.conjugate(); - Vector3f result3f = new Vector3f((float) (camera_pos.x - target.x), - (float) (camera_pos.y - target.y), - (float) (camera_pos.z - target.z)); + Vector3f result3f = new Vector3f((float) (camera_pos.x - target.x), (float) (camera_pos.y - target.y), + (float) (camera_pos.z - target.z)); result3f.func_214905_a(camera_rotation_conj); // ----- compensate for view bobbing (if active) ----- @@ -183,16 +188,19 @@ public class VecHelper { float f = distwalked_modified - playerentity.prevDistanceWalkedModified; float f1 = -(distwalked_modified + f * partialTicks); float f2 = MathHelper.lerp(partialTicks, playerentity.prevCameraYaw, playerentity.cameraYaw); - Quaternion q2 = new Quaternion(Vector3f.POSITIVE_X, Math.abs(MathHelper.cos(f1 * (float) Math.PI - 0.2F) * f2) * 5.0F, true); + Quaternion q2 = new Quaternion(Vector3f.POSITIVE_X, + Math.abs(MathHelper.cos(f1 * (float) Math.PI - 0.2F) * f2) * 5.0F, true); q2.conjugate(); result3f.func_214905_a(q2); - Quaternion q1 = new Quaternion(Vector3f.POSITIVE_Z, MathHelper.sin(f1 * (float) Math.PI) * f2 * 3.0F, true); + Quaternion q1 = + new Quaternion(Vector3f.POSITIVE_Z, MathHelper.sin(f1 * (float) Math.PI) * f2 * 3.0F, true); q1.conjugate(); result3f.func_214905_a(q1); - Vector3f bob_translation = new Vector3f((MathHelper.sin(f1 * (float) Math.PI) * f2 * 0.5F), (-Math.abs(MathHelper.cos(f1 * (float) Math.PI) * f2)), 0.0f); - bob_translation.setY(-bob_translation.getY()); // this is weird but hey, if it works + Vector3f bob_translation = new Vector3f((MathHelper.sin(f1 * (float) Math.PI) * f2 * 0.5F), + (-Math.abs(MathHelper.cos(f1 * (float) Math.PI) * f2)), 0.0f); + bob_translation.setY(-bob_translation.getY()); // this is weird but hey, if it works result3f.add(bob_translation); } } @@ -200,7 +208,8 @@ public class VecHelper { // ----- adjust for fov ----- float fov = (float) mc.gameRenderer.getFOVModifier(ari, partialTicks, true); - float half_height = (float) mc.getWindow().getScaledHeight() / 2; + float half_height = (float) mc.getWindow() + .getScaledHeight() / 2; float scale_factor = half_height / (result3f.getZ() * (float) Math.tan(Math.toRadians(fov / 2))); return new Vector3d(-result3f.getX() * scale_factor, result3f.getY() * scale_factor, result3f.getZ()); } diff --git a/src/main/java/com/simibubi/create/foundation/utility/VoxelShaper.java b/src/main/java/com/simibubi/create/foundation/utility/VoxelShaper.java index 7e7cccc06..31e9645ac 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/VoxelShaper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/VoxelShaper.java @@ -27,20 +27,22 @@ public class VoxelShaper { return shapes.get(axisAsFace(axis)); } - public static VoxelShaper forHorizontal(VoxelShape shape, Direction facing){ + public static VoxelShaper forHorizontal(VoxelShape shape, Direction facing) { return forDirectionsWithRotation(shape, facing, Direction.Plane.HORIZONTAL, new HorizontalRotationValues()); } public static VoxelShaper forHorizontalAxis(VoxelShape shape, Axis along) { - return forDirectionsWithRotation(shape, axisAsFace(along), Arrays.asList(Direction.SOUTH, Direction.EAST), new HorizontalRotationValues()); + return forDirectionsWithRotation(shape, axisAsFace(along), Arrays.asList(Direction.SOUTH, Direction.EAST), + new HorizontalRotationValues()); } - public static VoxelShaper forDirectional(VoxelShape shape, Direction facing){ + public static VoxelShaper forDirectional(VoxelShape shape, Direction facing) { return forDirectionsWithRotation(shape, facing, Arrays.asList(Iterate.directions), new DefaultRotationValues()); } - public static VoxelShaper forAxis(VoxelShape shape, Axis along){ - return forDirectionsWithRotation(shape, axisAsFace(along), Arrays.asList(Direction.SOUTH, Direction.EAST, Direction.UP), new DefaultRotationValues()); + public static VoxelShaper forAxis(VoxelShape shape, Axis along) { + return forDirectionsWithRotation(shape, axisAsFace(along), + Arrays.asList(Direction.SOUTH, Direction.EAST, Direction.UP), new DefaultRotationValues()); } public VoxelShaper withVerticalShapes(VoxelShape upShape) { @@ -49,7 +51,7 @@ public class VoxelShaper { return this; } - public VoxelShaper withShape(VoxelShape shape, Direction facing){ + public VoxelShaper withShape(VoxelShape shape, Direction facing) { shapes.put(facing, shape); return this; } @@ -58,11 +60,12 @@ public class VoxelShaper { return Direction.getFacingFromAxis(AxisDirection.POSITIVE, axis); } - protected static float horizontalAngleFromDirection(Direction direction){ - return (float)((Math.max(direction.getHorizontalIndex(), 0) & 3) * 90); + protected static float horizontalAngleFromDirection(Direction direction) { + return (float) ((Math.max(direction.getHorizontalIndex(), 0) & 3) * 90); } - protected static VoxelShaper forDirectionsWithRotation(VoxelShape shape, Direction facing, Iterable directions, Function rotationValues){ + protected static VoxelShaper forDirectionsWithRotation(VoxelShape shape, Direction facing, + Iterable directions, Function rotationValues) { VoxelShaper voxelShaper = new VoxelShaper(); for (Direction dir : directions) { voxelShaper.shapes.put(dir, rotate(shape, facing, dir, rotationValues)); @@ -70,14 +73,17 @@ public class VoxelShaper { return voxelShaper; } - protected static VoxelShape rotate(VoxelShape shape, Direction from, Direction to, Function usingValues){ + protected static VoxelShape rotate(VoxelShape shape, Direction from, Direction to, + Function usingValues) { if (from == to) return shape; - return rotatedCopy(shape, usingValues.apply(from).inverse().add(usingValues.apply(to))); + return rotatedCopy(shape, usingValues.apply(from) + .inverse() + .add(usingValues.apply(to))); } - protected static VoxelShape rotatedCopy(VoxelShape shape, Vector3d rotation){ + protected static VoxelShape rotatedCopy(VoxelShape shape, Vector3d rotation) { if (rotation.equals(Vector3d.ZERO)) return shape; @@ -85,16 +91,20 @@ public class VoxelShaper { Vector3d center = new Vector3d(8, 8, 8); shape.forEachBox((x1, y1, z1, x2, y2, z2) -> { - Vector3d v1 = new Vector3d(x1, y1, z1).scale(16).subtract(center); - Vector3d v2 = new Vector3d(x2, y2, z2).scale(16).subtract(center); + Vector3d v1 = new Vector3d(x1, y1, z1).scale(16) + .subtract(center); + Vector3d v2 = new Vector3d(x2, y2, z2).scale(16) + .subtract(center); v1 = VecHelper.rotate(v1, (float) rotation.x, Axis.X); v1 = VecHelper.rotate(v1, (float) rotation.y, Axis.Y); - v1 = VecHelper.rotate(v1, (float) rotation.z, Axis.Z).add(center); + v1 = VecHelper.rotate(v1, (float) rotation.z, Axis.Z) + .add(center); v2 = VecHelper.rotate(v2, (float) rotation.x, Axis.X); v2 = VecHelper.rotate(v2, (float) rotation.y, Axis.Y); - v2 = VecHelper.rotate(v2, (float) rotation.z, Axis.Z).add(center); + v2 = VecHelper.rotate(v2, (float) rotation.z, Axis.Z) + .add(center); VoxelShape rotated = Block.makeCuboidShape(v1.x, v1.y, v1.z, v2.x, v2.y, v2.z); result.setValue(VoxelShapes.or(result.getValue(), rotated)); @@ -104,25 +114,18 @@ public class VoxelShaper { } protected static class DefaultRotationValues implements Function { - //assume facing up as the default rotation + // assume facing up as the default rotation @Override public Vector3d apply(Direction direction) { - return new Vector3d( - direction == Direction.UP ? 0 : (Direction.Plane.VERTICAL.test(direction) ? 180 : 90), - -horizontalAngleFromDirection(direction), - 0 - ); + return new Vector3d(direction == Direction.UP ? 0 : (Direction.Plane.VERTICAL.test(direction) ? 180 : 90), + -horizontalAngleFromDirection(direction), 0); } } protected static class HorizontalRotationValues implements Function { @Override public Vector3d apply(Direction direction) { - return new Vector3d( - 0, - -horizontalAngleFromDirection(direction), - 0 - ); + return new Vector3d(0, -horizontalAngleFromDirection(direction), 0); } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/WeakHashSet.java b/src/main/java/com/simibubi/create/foundation/utility/WeakHashSet.java index e4c5c6688..61e4c7818 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/WeakHashSet.java +++ b/src/main/java/com/simibubi/create/foundation/utility/WeakHashSet.java @@ -1,8 +1,11 @@ package com.simibubi.create.foundation.utility; -import net.minecraft.util.Unit; +import java.util.AbstractSet; +import java.util.Collection; +import java.util.Iterator; +import java.util.WeakHashMap; -import java.util.*; +import net.minecraft.util.Unit; public class WeakHashSet extends AbstractSet { @@ -14,7 +17,7 @@ public class WeakHashSet extends AbstractSet { /** * Constructs a new set containing the elements in the specified - * collection. The HashMap is created with default load factor + * collection. The HashMap is created with default load factor * (0.75) and an initial capacity sufficient to contain the elements in * the specified collection. * @@ -22,7 +25,7 @@ public class WeakHashSet extends AbstractSet { * @throws NullPointerException if the specified collection is null */ public WeakHashSet(Collection c) { - map = new WeakHashMap<>(Math.max((int) (c.size()/.75f) + 1, 16)); + map = new WeakHashMap<>(Math.max((int) (c.size() / .75f) + 1, 16)); addAll(c); } @@ -30,10 +33,10 @@ public class WeakHashSet extends AbstractSet { * Constructs a new, empty set; the backing HashMap instance has * the specified initial capacity and the specified load factor. * - * @param initialCapacity the initial capacity of the hash map - * @param loadFactor the load factor of the hash map - * @throws IllegalArgumentException if the initial capacity is less - * than zero, or if the load factor is nonpositive + * @param initialCapacity the initial capacity of the hash map + * @param loadFactor the load factor of the hash map + * @throws IllegalArgumentException if the initial capacity is less + * than zero, or if the load factor is nonpositive */ public WeakHashSet(int initialCapacity, float loadFactor) { map = new WeakHashMap<>(initialCapacity, loadFactor); @@ -43,18 +46,18 @@ public class WeakHashSet extends AbstractSet { * Constructs a new, empty set; the backing HashMap instance has * the specified initial capacity and default load factor (0.75). * - * @param initialCapacity the initial capacity of the hash table - * @throws IllegalArgumentException if the initial capacity is less - * than zero + * @param initialCapacity the initial capacity of the hash table + * @throws IllegalArgumentException if the initial capacity is less + * than zero */ public WeakHashSet(int initialCapacity) { map = new WeakHashMap<>(initialCapacity); } - @Override public Iterator iterator() { - return map.keySet().iterator(); + return map.keySet() + .iterator(); } @Override @@ -84,12 +87,14 @@ public class WeakHashSet extends AbstractSet { @Override public Object[] toArray() { - return map.keySet().toArray(); + return map.keySet() + .toArray(); } @Override public boolean containsAll(Collection c) { - return c.stream().allMatch(map::containsKey); + return c.stream() + .allMatch(map::containsKey); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/utility/WorldAttached.java b/src/main/java/com/simibubi/create/foundation/utility/WorldAttached.java index c457bea5e..337ab826b 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/WorldAttached.java +++ b/src/main/java/com/simibubi/create/foundation/utility/WorldAttached.java @@ -22,11 +22,11 @@ public class WorldAttached { attached = new HashMap<>(); allMaps.add(attached); } - + public static void invalidateWorld(IWorld world) { allMaps.forEach(m -> m.remove(world)); } - + @Nullable public T get(IWorld world) { T t = attached.get(world); @@ -36,13 +36,14 @@ public class WorldAttached { put(world, entry); return entry; } - + public void put(IWorld world, T entry) { attached.put(world, entry); } public void forEach(Consumer consumer) { - attached.values().forEach(consumer); + attached.values() + .forEach(consumer); } - + } diff --git a/src/main/java/com/simibubi/create/foundation/utility/WorldHelper.java b/src/main/java/com/simibubi/create/foundation/utility/WorldHelper.java index 587c5b801..3cd375ea9 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/WorldHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/WorldHelper.java @@ -6,6 +6,8 @@ import net.minecraft.world.IWorld; public class WorldHelper { public static ResourceLocation getDimensionID(IWorld world) { - return world.getRegistryManager().get(Registry.DIMENSION_TYPE_KEY).getKey(world.getDimension()); + return world.getRegistryManager() + .get(Registry.DIMENSION_TYPE_KEY) + .getKey(world.getDimension()); } } diff --git a/src/main/java/com/simibubi/create/foundation/utility/animation/LerpedFloat.java b/src/main/java/com/simibubi/create/foundation/utility/animation/LerpedFloat.java index 8a7a8daeb..087929bb0 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/animation/LerpedFloat.java +++ b/src/main/java/com/simibubi/create/foundation/utility/animation/LerpedFloat.java @@ -1,10 +1,10 @@ package com.simibubi.create.foundation.utility.animation; +import com.simibubi.create.foundation.utility.AngleHelper; + import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.math.MathHelper; -import com.simibubi.create.foundation.utility.AngleHelper; - // Can replace all Interpolated value classes // InterpolatedChasingValue, InterpolatedValue, InterpolatedChasingAngle, InterpolatedAngle public class LerpedFloat { diff --git a/src/main/java/com/simibubi/create/foundation/utility/animation/PhysicalFloat.java b/src/main/java/com/simibubi/create/foundation/utility/animation/PhysicalFloat.java index a710d8525..d56f8e35f 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/animation/PhysicalFloat.java +++ b/src/main/java/com/simibubi/create/foundation/utility/animation/PhysicalFloat.java @@ -1,9 +1,9 @@ package com.simibubi.create.foundation.utility.animation; -import net.minecraft.util.math.MathHelper; - import java.util.ArrayList; +import net.minecraft.util.math.MathHelper; + public class PhysicalFloat { float previousValue; diff --git a/src/main/java/com/simibubi/create/foundation/utility/placement/IPlacementHelper.java b/src/main/java/com/simibubi/create/foundation/utility/placement/IPlacementHelper.java index a0b9ba213..0dcdb3e14 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/placement/IPlacementHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/placement/IPlacementHelper.java @@ -1,9 +1,17 @@ package com.simibubi.create.foundation.utility.placement; +import java.util.Arrays; +import java.util.Comparator; +import java.util.List; +import java.util.function.Function; +import java.util.function.Predicate; +import java.util.stream.Collectors; + import com.simibubi.create.CreateClient; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Pair; import com.simibubi.create.foundation.utility.VecHelper; + import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; @@ -17,13 +25,6 @@ import net.minecraft.util.math.vector.Vector3d; import net.minecraft.util.math.vector.Vector3i; import net.minecraft.world.World; -import java.util.Arrays; -import java.util.Comparator; -import java.util.List; -import java.util.function.Function; -import java.util.function.Predicate; -import java.util.stream.Collectors; - @MethodsReturnNonnullByDefault public interface IPlacementHelper { diff --git a/src/main/java/com/simibubi/create/foundation/utility/placement/PlacementHelpers.java b/src/main/java/com/simibubi/create/foundation/utility/placement/PlacementHelpers.java index 39b762cfc..b70ec6246 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/placement/PlacementHelpers.java +++ b/src/main/java/com/simibubi/create/foundation/utility/placement/PlacementHelpers.java @@ -1,5 +1,11 @@ package com.simibubi.create.foundation.utility.placement; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +import org.lwjgl.opengl.GL11; + import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.systems.RenderSystem; import com.simibubi.create.foundation.config.AllConfigs; @@ -9,6 +15,7 @@ import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingAngle; import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue; import com.simibubi.create.foundation.utility.AngleHelper; import com.simibubi.create.foundation.utility.VecHelper; + import net.minecraft.block.BlockState; import net.minecraft.client.MainWindow; import net.minecraft.client.Minecraft; @@ -30,19 +37,6 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; -import org.lwjgl.opengl.GL11; -import com.mojang.blaze3d.systems.RenderSystem; -import com.simibubi.create.foundation.config.AllConfigs; -import com.simibubi.create.foundation.config.CClient; -import com.simibubi.create.foundation.gui.AllGuiTextures; -import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingAngle; -import com.simibubi.create.foundation.gui.widgets.InterpolatedChasingValue; -import com.simibubi.create.foundation.utility.AngleHelper; -import com.simibubi.create.foundation.utility.VecHelper; - @Mod.EventBusSubscriber public class PlacementHelpers { diff --git a/src/main/java/com/simibubi/create/foundation/utility/placement/util/PoleHelper.java b/src/main/java/com/simibubi/create/foundation/utility/placement/util/PoleHelper.java index 4126f8cca..f362531d3 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/placement/util/PoleHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/placement/util/PoleHelper.java @@ -1,24 +1,25 @@ package com.simibubi.create.foundation.utility.placement.util; +import java.util.List; +import java.util.function.Function; +import java.util.function.Predicate; + import com.simibubi.create.content.curiosities.tools.ExtendoGripItem; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.utility.placement.IPlacementHelper; import com.simibubi.create.foundation.utility.placement.PlacementOffset; + import mcp.MethodsReturnNonnullByDefault; import net.minecraft.block.BlockState; import net.minecraft.entity.ai.attributes.ModifiableAttributeInstance; -import net.minecraft.state.Property; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.state.Property; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.world.World; import net.minecraftforge.common.ForgeMod; -import java.util.List; -import java.util.function.Function; -import java.util.function.Predicate; - @MethodsReturnNonnullByDefault public abstract class PoleHelper> implements IPlacementHelper { diff --git a/src/main/java/com/simibubi/create/foundation/utility/recipe/RecipeConditions.java b/src/main/java/com/simibubi/create/foundation/utility/recipe/RecipeConditions.java index cc96987e7..901ca5dc6 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/recipe/RecipeConditions.java +++ b/src/main/java/com/simibubi/create/foundation/utility/recipe/RecipeConditions.java @@ -1,13 +1,13 @@ package com.simibubi.create.foundation.utility.recipe; +import java.util.function.Predicate; + import com.simibubi.create.foundation.tileEntity.behaviour.filtering.FilteringBehaviour; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.IRecipeType; -import java.util.function.Predicate; - /** * Commonly used Predicates for searching through recipe collections. * diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorld.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorld.java index 1a8164a03..0ffde3ab4 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorld.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorld.java @@ -8,17 +8,12 @@ import java.util.function.Predicate; import com.simibubi.create.foundation.render.backend.instancing.IFlywheelWorld; import com.simibubi.create.foundation.utility.worldWrappers.chunk.WrappedChunk; -import ca.spottedleaf.starlight.common.light.VariableBlockLightHandler; -import ca.spottedleaf.starlight.common.light.VariableBlockLightHandlerImpl; -import ca.spottedleaf.starlight.common.world.ExtendedWorld; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.SectionPos; import net.minecraft.world.World; -import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.IChunk; import net.minecraft.world.lighting.WorldLightManager; public class PlacementSimulationWorld extends WrappedWorld implements IFlywheelWorld { diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorldStarlight.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorldStarlight.java index f4f66858e..1b2ba2ab7 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorldStarlight.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/PlacementSimulationWorldStarlight.java @@ -1,5 +1,8 @@ package com.simibubi.create.foundation.utility.worldWrappers; +import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; +import com.simibubi.create.foundation.utility.worldWrappers.chunk.WrappedChunkStarlight; + import ca.spottedleaf.starlight.common.light.VariableBlockLightHandler; import ca.spottedleaf.starlight.common.light.VariableBlockLightHandlerImpl; import ca.spottedleaf.starlight.common.world.ExtendedWorld; @@ -9,9 +12,6 @@ import net.minecraft.world.chunk.IChunk; import net.minecraft.world.gen.feature.template.Template; import net.minecraft.world.lighting.WorldLightManager; -import com.simibubi.create.content.contraptions.components.structureMovement.Contraption; -import com.simibubi.create.foundation.utility.worldWrappers.chunk.WrappedChunkStarlight; - public class PlacementSimulationWorldStarlight extends PlacementSimulationWorld implements ExtendedWorld { VariableBlockLightHandler variableBlockLightHandler = new VariableBlockLightHandlerImpl(); diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java index 89595dd19..ac0a8c9b3 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/WrappedClientWorld.java @@ -1,5 +1,12 @@ package com.simibubi.create.foundation.utility.worldWrappers; +import java.util.List; +import java.util.function.BiPredicate; +import java.util.stream.Stream; + +import javax.annotation.Nullable; +import javax.annotation.ParametersAreNonnullByDefault; + import mezz.jei.api.MethodsReturnNonnullByDefault; import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; @@ -22,12 +29,6 @@ import net.minecraft.world.level.ColorResolver; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import javax.annotation.Nullable; -import javax.annotation.ParametersAreNonnullByDefault; -import java.util.List; -import java.util.function.BiPredicate; -import java.util.stream.Stream; - @OnlyIn(Dist.CLIENT) @SuppressWarnings("deprecation") @ParametersAreNonnullByDefault diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java index a3ac8be0e..b8b06bd1d 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunk.java @@ -9,9 +9,6 @@ import javax.annotation.Nullable; import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld; -import ca.spottedleaf.starlight.common.chunk.ExtendedChunk; -import ca.spottedleaf.starlight.common.light.SWMRNibbleArray; -import ca.spottedleaf.starlight.common.light.StarLightEngine; import it.unimi.dsi.fastutil.longs.LongSet; import it.unimi.dsi.fastutil.shorts.ShortList; import net.minecraft.block.Block; diff --git a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunkStarlight.java b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunkStarlight.java index e3aed0267..839e8469c 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunkStarlight.java +++ b/src/main/java/com/simibubi/create/foundation/utility/worldWrappers/chunk/WrappedChunkStarlight.java @@ -1,13 +1,13 @@ package com.simibubi.create.foundation.utility.worldWrappers.chunk; +import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld; + import ca.spottedleaf.starlight.common.chunk.ExtendedChunk; import ca.spottedleaf.starlight.common.light.SWMRNibbleArray; import ca.spottedleaf.starlight.common.light.StarLightEngine; import net.minecraft.world.chunk.ChunkSection; import net.minecraft.world.chunk.IChunk; -import com.simibubi.create.foundation.utility.worldWrappers.PlacementSimulationWorld; - public class WrappedChunkStarlight extends WrappedChunk implements ExtendedChunk { private SWMRNibbleArray[] blockNibbles; diff --git a/src/main/java/com/simibubi/create/foundation/worldgen/AllWorldFeatures.java b/src/main/java/com/simibubi/create/foundation/worldgen/AllWorldFeatures.java index be79d1157..3eab6cd93 100644 --- a/src/main/java/com/simibubi/create/foundation/worldgen/AllWorldFeatures.java +++ b/src/main/java/com/simibubi/create/foundation/worldgen/AllWorldFeatures.java @@ -93,10 +93,12 @@ public class AllWorldFeatures { public static void register() {} public static void registerOreFeatures(RegistryEvent.Register> event) { - event.getRegistry().register(ConfigDrivenOreFeature.INSTANCE); + event.getRegistry() + .register(ConfigDrivenOreFeature.INSTANCE); } public static void registerDecoratorFeatures(RegistryEvent.Register> event) { - event.getRegistry().register(ConfigDrivenDecorator.INSTANCE); + event.getRegistry() + .register(ConfigDrivenDecorator.INSTANCE); } } diff --git a/src/main/java/com/simibubi/create/foundation/worldgen/ConfigDrivenDecorator.java b/src/main/java/com/simibubi/create/foundation/worldgen/ConfigDrivenDecorator.java index ff759d33e..b9c6509ad 100644 --- a/src/main/java/com/simibubi/create/foundation/worldgen/ConfigDrivenDecorator.java +++ b/src/main/java/com/simibubi/create/foundation/worldgen/ConfigDrivenDecorator.java @@ -11,7 +11,7 @@ import net.minecraft.world.gen.placement.SimplePlacement; public class ConfigDrivenDecorator extends SimplePlacement { public static final ConfigDrivenDecorator INSTANCE = new ConfigDrivenDecorator(); - + public ConfigDrivenDecorator() { super(ConfigDrivenOreFeatureConfig.CODEC); setRegistryName("create_config_driven_decorator"); diff --git a/src/main/java/com/simibubi/create/foundation/worldgen/OxidizingBlock.java b/src/main/java/com/simibubi/create/foundation/worldgen/OxidizingBlock.java index f6bf3f8b4..74345a8a3 100644 --- a/src/main/java/com/simibubi/create/foundation/worldgen/OxidizingBlock.java +++ b/src/main/java/com/simibubi/create/foundation/worldgen/OxidizingBlock.java @@ -44,7 +44,8 @@ public class OxidizingBlock extends Block { @Override public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { - if (worldIn.getRandom().nextFloat() <= chance) { + if (worldIn.getRandom() + .nextFloat() <= chance) { int currentState = state.get(OXIDIZATION); boolean canIncrease = false; LinkedList neighbors = new LinkedList<>(); @@ -64,7 +65,9 @@ public class OxidizingBlock extends Block { canIncrease = true; } if (canIncrease) { - OptionalDouble average = neighbors.stream().mapToInt(v -> v).average(); + OptionalDouble average = neighbors.stream() + .mapToInt(v -> v) + .average(); if (average.orElse(7d) >= currentState) worldIn.setBlockState(pos, state.with(OXIDIZATION, Math.min(currentState + 1, 7))); } @@ -72,11 +75,13 @@ public class OxidizingBlock extends Block { } @Override - public ActionResultType onUse(BlockState state, World world, BlockPos pos, - PlayerEntity player, Hand hand, BlockRayTraceResult blockRayTraceResult) { - if(state.get(OXIDIZATION) > 0 && player.getHeldItem(hand).getItem() instanceof SandPaperItem) { - if(!player.isCreative()) - player.getHeldItem(hand).damageItem(1, player, p -> p.sendBreakAnimation(p.getActiveHand())); + public ActionResultType onUse(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, + BlockRayTraceResult blockRayTraceResult) { + if (state.get(OXIDIZATION) > 0 && player.getHeldItem(hand) + .getItem() instanceof SandPaperItem) { + if (!player.isCreative()) + player.getHeldItem(hand) + .damageItem(1, player, p -> p.sendBreakAnimation(p.getActiveHand())); world.setBlockState(pos, state.with(OXIDIZATION, 0)); return ActionResultType.SUCCESS; }