From d35f5905ffb53071616bbf360b0a89733ac095d6 Mon Sep 17 00:00:00 2001 From: simibubi <31564874+simibubi@users.noreply.github.com> Date: Tue, 2 Nov 2021 23:17:26 +0100 Subject: [PATCH] Derailed Capabilities - more porting - port JEI plugin - use new capability lifecycle for minecarts --- src/main/java/com/simibubi/create/Create.java | 6 +- .../compat/jei/BlueprintTransferHandler.java | 14 ++-- .../create/compat/jei/DoubleItemIcon.java | 3 - .../jei/category/CreateRecipeCategory.java | 14 ++-- .../category/MechanicalCraftingCategory.java | 19 +++--- .../category/SequencedAssemblyCategory.java | 5 +- .../components/actors/SeatEntity.java | 4 +- .../IMovedDispenseItemBehaviour.java | 22 ++----- .../ControlledContraptionEntity.java | 2 +- .../structureMovement/MountedStorage.java | 4 +- .../sync/ClientMotionPacket.java | 3 +- .../sync/ContraptionInteractionPacket.java | 6 +- .../train/CouplingHandlerClient.java | 4 +- .../train/CouplingPhysics.java | 5 +- .../train/MinecartCouplingItem.java | 8 +-- .../CapabilityMinecartController.java | 29 ++------- .../fluids/potion/PotionFluid.java | 2 +- .../recipe/PotionMixingRecipeManager.java | 2 +- .../goggles/GoggleOverlayRenderer.java | 16 ++--- .../contraptions/particle/CubeParticle.java | 8 +-- .../contraptions/relays/belt/BeltBlock.java | 27 ++++---- .../contraptions/relays/gauge/GaugeBlock.java | 45 +++++-------- .../relays/gearbox/GearboxBlock.java | 20 ++++-- .../content/curiosities/CombustibleItem.java | 4 +- .../curiosities/toolbox/ToolboxContainer.java | 12 ++-- .../toolbox/ToolboxDyeingRecipe.java | 10 +-- .../curiosities/toolbox/ToolboxHandler.java | 4 +- .../tools/BlueprintOverlayRenderer.java | 11 ++-- .../tools/ExtendoGripInteractionPacket.java | 45 +++++++------ .../curiosities/tools/SandPaperItem.java | 6 +- .../weapons/PotatoProjectileEntity.java | 12 ++-- .../weapons/PotatoProjectileRenderMode.java | 4 +- .../curiosities/zapper/ZapperItem.java | 2 +- .../block/chute/AbstractChuteBlock.java | 19 +++--- .../block/funnel/AbstractFunnelBlock.java | 17 +++-- .../block/redstone/NixieTubeRenderer.java | 5 +- .../content/palettes/AllPaletteBlocks.java | 37 ++++++----- .../content/palettes/PaletteBlockPartial.java | 2 +- .../simibubi/create/events/CommonEvents.java | 1 + .../foundation/command/CloneCommand.java | 18 +++--- .../create/foundation/gui/AllIcons.java | 1 + .../foundation/gui/GhostItemContainer.java | 22 ++++--- .../ponder/content/BearingScenes.java | 2 +- .../foundation/ponder/content/BeltScenes.java | 6 +- .../ponder/content/CartAssemblerScenes.java | 2 +- .../ponder/content/ChassisScenes.java | 6 +- .../ponder/content/ChuteScenes.java | 6 +- .../ponder/content/CrafterScenes.java | 6 +- .../ponder/content/DebugScenes.java | 2 +- .../ponder/content/EjectorScenes.java | 8 +-- .../foundation/ponder/content/FanScenes.java | 4 +- .../ponder/content/FunnelScenes.java | 12 ++-- .../ponder/content/MechanicalDrillScenes.java | 4 +- .../ponder/content/MechanicalSawScenes.java | 14 ++-- .../ponder/content/MovementActorScenes.java | 12 ++-- .../ponder/content/ProcessingScenes.java | 8 +-- .../ponder/content/TunnelScenes.java | 12 ++-- .../foundation/utility/BlockHelper.java | 44 ------------- .../utility/ReducedDestroyEffects.java | 60 ++++++++++++++++++ .../assets/create/textures/gui/icons.png | Bin 4865 -> 4899 bytes 60 files changed, 349 insertions(+), 359 deletions(-) create mode 100644 src/main/java/com/simibubi/create/foundation/utility/ReducedDestroyEffects.java diff --git a/src/main/java/com/simibubi/create/Create.java b/src/main/java/com/simibubi/create/Create.java index 1b83685a8..89ef019e0 100644 --- a/src/main/java/com/simibubi/create/Create.java +++ b/src/main/java/com/simibubi/create/Create.java @@ -45,6 +45,7 @@ import net.minecraft.world.level.levelgen.placement.FeatureDecorator; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.MinecraftForge; +import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraftforge.eventbus.api.EventPriority; import net.minecraftforge.eventbus.api.IEventBus; @@ -128,7 +129,6 @@ public class Create { } public static void init(final FMLCommonSetupEvent event) { - CapabilityMinecartController.register(); AllPackets.registerPackets(); SchematicInstances.register(); BuiltinPotatoProjectileTypes.register(); @@ -153,6 +153,10 @@ public class Create { ProcessingRecipeGen.registerAll(gen); } + public static void registerCapabilities(RegisterCapabilitiesEvent event) { + event.register(CapabilityMinecartController.class); + } + public static void onBiomeLoad(BiomeLoadingEvent event) { AllWorldFeatures.reload(event); } diff --git a/src/main/java/com/simibubi/create/compat/jei/BlueprintTransferHandler.java b/src/main/java/com/simibubi/create/compat/jei/BlueprintTransferHandler.java index b2f77c19f..e96a0ea85 100644 --- a/src/main/java/com/simibubi/create/compat/jei/BlueprintTransferHandler.java +++ b/src/main/java/com/simibubi/create/compat/jei/BlueprintTransferHandler.java @@ -10,16 +10,22 @@ import mezz.jei.api.recipe.transfer.IRecipeTransferHandler; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.crafting.Recipe; -public class BlueprintTransferHandler implements IRecipeTransferHandler { +@SuppressWarnings("rawtypes") +public class BlueprintTransferHandler implements IRecipeTransferHandler { @Override public Class getContainerClass() { return BlueprintContainer.class; } - + @Override - public IRecipeTransferError transferRecipe(BlueprintContainer container, Object recipe, IRecipeLayout recipeLayout, - Player player, boolean maxTransfer, boolean doTransfer) { + public Class getRecipeClass() { + return Recipe.class; + } + + @Override + public IRecipeTransferError transferRecipe(BlueprintContainer container, Recipe recipe, + IRecipeLayout recipeLayout, Player player, boolean maxTransfer, boolean doTransfer) { if (!(recipe instanceof Recipe)) return null; if (!doTransfer) 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 607bd55f3..62ea7e696 100644 --- a/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java +++ b/src/main/java/com/simibubi/create/compat/jei/DoubleItemIcon.java @@ -2,7 +2,6 @@ package com.simibubi.create.compat.jei; import java.util.function.Supplier; -import com.mojang.blaze3d.platform.Lighting; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.foundation.gui.GuiGameElement; @@ -39,8 +38,6 @@ public class DoubleItemIcon implements IDrawable { secondaryStack = secondarySupplier.get(); } - Lighting.turnBackOn(); - RenderSystem.color4f(1, 1, 1, 1); RenderSystem.enableDepthTest(); matrixStack.pushPose(); matrixStack.translate(xOffset, yOffset, 0); 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 db646c87c..3e7a4afe1 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 @@ -32,7 +32,7 @@ import net.minecraftforge.fluids.FluidStack; public abstract class CreateRecipeCategory> implements IRecipeCategory { public final List>>> recipes = new ArrayList<>(); - public final List> recipeCatalysts = new ArrayList<>(); + public final List> recipeCatalysts = new ArrayList<>(); protected ResourceLocation uid; protected String name; @@ -55,9 +55,8 @@ public abstract class CreateRecipeCategory> implements IReci } @Override - public String getTitle() { - return Lang.translate("recipe." + name) - .getString(); + public Component getTitle() { + return Lang.translate("recipe." + name); } @Override @@ -100,8 +99,9 @@ public abstract class CreateRecipeCategory> implements IReci public static void addStochasticTooltip(IGuiItemStackGroup itemStacks, List results) { addStochasticTooltip(itemStacks, results, 1); } - - public static void addStochasticTooltip(IGuiItemStackGroup itemStacks, List results, int startIndex) { + + public static void addStochasticTooltip(IGuiItemStackGroup itemStacks, List results, + int startIndex) { itemStacks.addTooltipCallback((slotIndex, input, ingredient, tooltip) -> { if (input) return; @@ -142,7 +142,7 @@ public abstract class CreateRecipeCategory> implements IReci fluidStacks.addTooltipCallback((slotIndex, input, fluid, tooltip) -> { if (index != -1 && slotIndex != index) return; - + if (fluid.getFluid() .isSame(AllFluids.POTION.get())) { Component name = fluid.getDisplayName(); 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 76ebee03d..100a25eac 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 @@ -4,7 +4,6 @@ import java.util.ArrayList; import java.util.Arrays; import java.util.List; -import com.mojang.blaze3d.platform.Lighting; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.PoseStack; import com.simibubi.create.AllBlocks; @@ -50,8 +49,7 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory recipeIngredients = recipe.getIngredients(); itemStacks.init(0, false, 133, 80); - itemStacks.set(0, recipe.getResultItem() - .getStack()); + itemStacks.set(0, recipe.getResultItem()); int x = getXPadding(recipe); int y = getYPadding(recipe); @@ -122,7 +120,6 @@ public class MechanicalCraftingCategory extends CreateRecipeCategory 1) { matrixStack.pushPose(); matrixStack.translate(15, 9, 0); - RenderSystem.color4f(.65f, .65f, .65f, 1); - AllIcons.I_REFRESH.draw(matrixStack, 50 + xOffset, 75); - RenderSystem.color4f(1, 1, 1, 1); + AllIcons.I_SEQ_REPEAT.draw(matrixStack, 50 + xOffset, 75); Component repeat = new TextComponent("x" + recipe.getLoops()); font.draw(matrixStack, repeat, 66 + xOffset, 80, 0x888888); matrixStack.popPose(); 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 347c1fef3..d19846cba 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 @@ -37,8 +37,8 @@ public class SeatEntity extends Entity implements IEntityAdditionalSpawnData { } @Override - public void setPosRaw(double x, double y, double z) { - super.setPosRaw(x, y, z); + public void setPos(double x, double y, double z) { + super.setPos(x, y, z); AABB bb = getBoundingBox(); Vec3 diff = new Vec3(x, y, z).subtract(bb.getCenter()); setBoundingBox(bb.move(diff)); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/IMovedDispenseItemBehaviour.java b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/IMovedDispenseItemBehaviour.java index c60341fa5..f73fdee8e 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/IMovedDispenseItemBehaviour.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/actors/dispenser/IMovedDispenseItemBehaviour.java @@ -31,8 +31,6 @@ import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.BucketPickup; import net.minecraft.world.level.block.entity.BeehiveBlockEntity; import net.minecraft.world.level.block.state.BlockState; -import net.minecraft.world.level.material.FlowingFluid; -import net.minecraft.world.level.material.Fluid; import net.minecraft.world.phys.Vec3; public interface IMovedDispenseItemBehaviour { @@ -40,8 +38,7 @@ public interface IMovedDispenseItemBehaviour { static void initSpawneggs() { final IMovedDispenseItemBehaviour spawnEggDispenseBehaviour = new MovedDefaultDispenseItemBehaviour() { @Override - protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, - Vec3 facing) { + protected ItemStack dispenseStack(ItemStack itemStack, MovementContext context, BlockPos pos, Vec3 facing) { if (!(itemStack.getItem() instanceof SpawnEggItem)) return super.dispenseStack(itemStack, context, pos, facing); if (context.world instanceof ServerLevel) { @@ -64,8 +61,7 @@ public interface IMovedDispenseItemBehaviour { static void init() { MovedProjectileDispenserBehaviour movedPotionDispenseItemBehaviour = new MovedProjectileDispenserBehaviour() { @Override - protected Projectile getProjectileEntity(Level world, double x, double y, double z, - ItemStack itemStack) { + protected Projectile getProjectileEntity(Level world, double x, double y, double z, ItemStack itemStack) { return Util.make(new ThrownPotion(world, x, y, z), (p_218411_1_) -> p_218411_1_.setItem(itemStack)); } @@ -158,18 +154,16 @@ public interface IMovedDispenseItemBehaviour { BlockState state = context.world.getBlockState(interactAt); Block block = state.getBlock(); - if (state.is(BlockTags.BEEHIVES) && state.getValue(BeehiveBlock.HONEY_LEVEL) >= 5) { + if (state.is(BlockTags.BEEHIVES) && state.getValue(BeehiveBlock.HONEY_LEVEL) >= 5) { ((BeehiveBlock) block).releaseBeesAndResetHoneyLevel(context.world, state, interactAt, null, BeehiveBlockEntity.BeeReleaseStatus.BEE_RELEASED); this.successful = true; - return placeItemInInventory(itemStack, new ItemStack(Items.HONEY_BOTTLE), context, pos, - facing); + return placeItemInInventory(itemStack, new ItemStack(Items.HONEY_BOTTLE), context, pos, facing); } else if (context.world.getFluidState(interactAt) .is(FluidTags.WATER)) { this.successful = true; return placeItemInInventory(itemStack, - PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.WATER), context, pos, - facing); + PotionUtils.setPotion(new ItemStack(Items.POTION), Potions.WATER), context, pos, facing); } else { return super.dispenseStack(itemStack, context, pos, facing); } @@ -185,10 +179,8 @@ public interface IMovedDispenseItemBehaviour { BlockState state = context.world.getBlockState(interactAt); Block block = state.getBlock(); if (block instanceof BucketPickup) { - Fluid fluid = ((BucketPickup) block).takeLiquid(context.world, interactAt, state); - if (fluid instanceof FlowingFluid) - return placeItemInInventory(itemStack, new ItemStack(fluid.getBucket()), context, pos, - facing); + ItemStack bucket = ((BucketPickup) block).pickupBlock(context.world, interactAt, state); + return placeItemInInventory(itemStack, bucket, context, pos, facing); } return super.dispenseStack(itemStack, context, pos, facing); } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java index 13122f7d9..a2e6d43d2 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/ControlledContraptionEntity.java @@ -141,7 +141,7 @@ public class ControlledContraptionEntity extends AbstractContraptionEntity { return; IControlContraption controller = getController(); if (controller == null) { - remove(); + discard(); return; } if (!controller.isAttachedTo(this)) { diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedStorage.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedStorage.java index 5c0f98b71..37f7841a7 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedStorage.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/MountedStorage.java @@ -66,7 +66,7 @@ public class MountedStorage { te.getLevel() .setBlockAndUpdate(te.getBlockPos(), te.getBlockState() .setValue(ChestBlock.TYPE, ChestType.SINGLE)); - te.clearCache(); +// te.clearCache(); } // Split double flexcrates @@ -76,7 +76,7 @@ public class MountedStorage { te.getLevel() .setBlockAndUpdate(te.getBlockPos(), te.getBlockState() .setValue(AdjustableCrateBlock.DOUBLE, false)); - te.clearCache(); +// te.clearCache(); } IItemHandler teHandler = te.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ClientMotionPacket.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ClientMotionPacket.java index 1770dc1de..9ab41ad82 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ClientMotionPacket.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/sync/ClientMotionPacket.java @@ -7,6 +7,7 @@ import com.simibubi.create.foundation.networking.SimplePacketBase; import net.minecraft.network.FriendlyByteBuf; import net.minecraft.server.level.ServerPlayer; +import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.phys.Vec3; import net.minecraftforge.fmllegacy.network.NetworkEvent.Context; import net.minecraftforge.fmllegacy.network.PacketDistributor; @@ -49,7 +50,7 @@ public class ClientMotionPacket extends SimplePacketBase { sender.setDeltaMovement(motion); sender.setOnGround(onGround); if (onGround) { - sender.causeFallDamage(sender.fallDistance, 1); + sender.causeFallDamage(sender.fallDistance, 1, DamageSource.FALL); sender.fallDistance = 0; sender.connection.aboveGroundTickCount = 0; } 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 decd3b7d0..af88250cd 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 @@ -55,13 +55,11 @@ public class ContraptionInteractionPacket extends SimplePacketBase { return; AbstractContraptionEntity contraptionEntity = (AbstractContraptionEntity) entityByID; double d = sender.getAttribute(ForgeMod.REACH_DISTANCE.get()).getValue() + 10; - if (!sender.canSee(entityByID)) + if (!sender.hasLineOfSight(entityByID)) d -= 3; d *= d; - if (sender.distanceToSqr(entityByID) > d) { - // TODO log? + if (sender.distanceToSqr(entityByID) > d) return; - } if (contraptionEntity.handlePlayerInteraction(sender, localPos, face, interactionHand)) sender.swing(interactionHand, true); }); diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingHandlerClient.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingHandlerClient.java index 82a862a05..954241a47 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingHandlerClient.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/CouplingHandlerClient.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.contraptions.components.structureMovement.tr import java.util.Random; +import com.mojang.math.Vector3f; import com.simibubi.create.AllItems; import com.simibubi.create.foundation.networking.AllPackets; import com.simibubi.create.foundation.utility.VecHelper; @@ -56,7 +57,8 @@ public class CouplingHandlerClient { ClientLevel world = Minecraft.getInstance().level; Vec3 center = AABB.getCenter(); int amount = highlight ? 100 : 2; - ParticleOptions particleData = highlight ? ParticleTypes.END_ROD : new DustParticleOptions(1, 1, 1, 1); + ParticleOptions particleData = + highlight ? ParticleTypes.END_ROD : new DustParticleOptions(new Vector3f(1, 1, 1), 1); for (int i = 0; i < amount; i++) { Vec3 v = VecHelper.offsetRandomly(Vec3.ZERO, r, 1); double yOffset = v.y; 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 2c61a55dc..d4c02314a 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 @@ -99,8 +99,7 @@ public class CouplingPhysics { motions.replaceWithParams(VecHelper::clamp, Couple.create(1f, 1f)); Couple nextPositions = carts.map(MinecartSim2020::predictNextPositionOf); - Couple shapes = carts.mapWithContext((cart, current) -> { - AbstractMinecart minecart = cart.getMinecart(); + Couple shapes = carts.mapWithContext((minecart, current) -> { Vec3 vec = nextPositions.get(current); int x = Mth.floor(vec.x()); int y = Mth.floor(vec.y()); @@ -112,7 +111,7 @@ public class CouplingPhysics { if (!(railState.getBlock() instanceof BaseRailBlock)) return null; BaseRailBlock block = (BaseRailBlock) railState.getBlock(); - return block.getRailDirection(railState, world, railPosition, cart); + return block.getRailDirection(railState, world, railPosition, minecart); }); float futureStress = (float) (couplingLength - nextPositions.getFirst() diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartCouplingItem.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartCouplingItem.java index 1f7542432..0a5542e8b 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartCouplingItem.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/MinecartCouplingItem.java @@ -71,8 +71,8 @@ public class MinecartCouplingItem extends Item { return true; } - private static boolean onWrenchInteractOnMinecart(EntityInteract event, AbstractMinecart minecart, - Player player, MinecartController controller) { + private static boolean onWrenchInteractOnMinecart(EntityInteract event, AbstractMinecart minecart, Player player, + MinecartController controller) { int couplings = (controller.isConnectedToCoupling() ? 1 : 0) + (controller.isLeadingCoupling() ? 1 : 0); if (couplings == 0) return false; @@ -87,8 +87,8 @@ public class MinecartCouplingItem extends Item { CouplingHandler.status(player, "removed"); controller.decouple(); if (!player.isCreative()) - player.getInventory().placeItemBackInInventory(event.getWorld(), - new ItemStack(AllItems.MINECART_COUPLING.get(), couplings)); + player.getInventory() + .placeItemBackInInventory(new ItemStack(AllItems.MINECART_COUPLING.get(), couplings)); return true; } diff --git a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/capability/CapabilityMinecartController.java b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/capability/CapabilityMinecartController.java index b2c26862b..5433e0e85 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/capability/CapabilityMinecartController.java +++ b/src/main/java/com/simibubi/create/content/contraptions/components/structureMovement/train/capability/CapabilityMinecartController.java @@ -21,7 +21,6 @@ import it.unimi.dsi.fastutil.objects.ObjectArrayList; import it.unimi.dsi.fastutil.objects.ObjectLists; import net.minecraft.core.Direction; import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.Tag; import net.minecraft.resources.ResourceLocation; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.item.ItemEntity; @@ -30,8 +29,8 @@ import net.minecraft.world.level.ChunkPos; import net.minecraft.world.level.Level; import net.minecraft.world.phys.Vec3; import net.minecraftforge.common.capabilities.Capability; -import net.minecraftforge.common.capabilities.CapabilityInject; import net.minecraftforge.common.capabilities.CapabilityManager; +import net.minecraftforge.common.capabilities.CapabilityToken; import net.minecraftforge.common.capabilities.ICapabilitySerializable; import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.NonNullConsumer; @@ -152,7 +151,8 @@ public class CapabilityMinecartController implements ICapabilitySerializable MINECART_CONTROLLER_CAPABILITY = null; + public static Capability MINECART_CONTROLLER_CAPABILITY = + CapabilityManager.get(new CapabilityToken<>() { + }); public static void attach(AttachCapabilitiesEvent event) { Entity entity = event.getObject(); @@ -233,24 +234,6 @@ public class CapabilityMinecartController implements ICapabilitySerializable() { - - @Override - public Tag writeNBT(Capability capability, MinecartController instance, - Direction side) { - return instance.serializeNBT(); - } - - @Override - public void readNBT(Capability capability, MinecartController instance, Direction side, - Tag base) { - instance.deserializeNBT((CompoundTag) base); - } - - }, MinecartController::empty); - } - /* Capability provider */ private final LazyOptional cap; 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 50cf67eaf..9bd88bd66 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 @@ -64,7 +64,7 @@ public class PotionFluid extends VirtualFluid { } public static FluidStack addPotionToFluidStack(FluidStack fs, Potion potion) { - ResourceLocation resourcelocation = ForgeRegistries.POTION_TYPES.getKey(potion); + ResourceLocation resourcelocation = ForgeRegistries.POTIONS.getKey(potion); if (potion == Potions.EMPTY) { fs.removeChildTag("Potion"); return fs; diff --git a/src/main/java/com/simibubi/create/content/contraptions/fluids/recipe/PotionMixingRecipeManager.java b/src/main/java/com/simibubi/create/content/contraptions/fluids/recipe/PotionMixingRecipeManager.java index c30409282..2226bc576 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/fluids/recipe/PotionMixingRecipeManager.java +++ b/src/main/java/com/simibubi/create/content/contraptions/fluids/recipe/PotionMixingRecipeManager.java @@ -51,7 +51,7 @@ public class PotionMixingRecipeManager { Collection reagents = getAllReagents(iBrewingRecipe); Set basicPotions = new HashSet<>(); - for (Potion potion : ForgeRegistries.POTION_TYPES.getValues()) { + for (Potion potion : ForgeRegistries.POTIONS.getValues()) { if (potion == Potions.EMPTY) continue; for (ItemStack stack : bottles) diff --git a/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java b/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java index b3a39cc45..48c34e8cc 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java +++ b/src/main/java/com/simibubi/create/content/contraptions/goggles/GoggleOverlayRenderer.java @@ -219,14 +219,14 @@ public class GoggleOverlayRenderer { super(p_i51108_1_); } - @Override - public void init(Minecraft mc, int width, int height) { - this.minecraft = mc; - this.itemRenderer = mc.getItemRenderer(); - this.font = mc.font; - this.width = width; - this.height = height; - } +// @Override +// public void init(Minecraft mc, int width, int height) { +// this.minecraft = mc; +// this.itemRenderer = mc.getItemRenderer(); +// this.font = mc.font; +// this.width = width; +// this.height = height; +// } } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticle.java b/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticle.java index 81ed689e0..34d24cdf0 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticle.java +++ b/src/main/java/com/simibubi/create/content/contraptions/particle/CubeParticle.java @@ -1,13 +1,12 @@ package com.simibubi.create.content.contraptions.particle; -import org.lwjgl.opengl.GL11; - import com.mojang.blaze3d.platform.GlStateManager; import com.mojang.blaze3d.systems.RenderSystem; import com.mojang.blaze3d.vertex.BufferBuilder; import com.mojang.blaze3d.vertex.DefaultVertexFormat; import com.mojang.blaze3d.vertex.Tesselator; import com.mojang.blaze3d.vertex.VertexConsumer; +import com.mojang.blaze3d.vertex.VertexFormat; import net.minecraft.client.Camera; import net.minecraft.client.multiplayer.ClientLevel; @@ -60,15 +59,13 @@ public class CubeParticle extends Particle { RenderSystem.depthMask(false); RenderSystem.enableBlend(); RenderSystem.blendFunc(GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ONE); - RenderSystem.enableLighting(); - RenderSystem.enableColorMaterial(); // opaque // RenderSystem.depthMask(true); // RenderSystem.disableBlend(); // RenderSystem.enableLighting(); - builder.begin(GL11.GL_QUADS, DefaultVertexFormat.BLOCK); + builder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.BLOCK); } @Override @@ -76,7 +73,6 @@ public class CubeParticle extends Particle { tessellator.end(); RenderSystem.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); - RenderSystem.disableLighting(); RenderSystem.enableTexture(); } }; diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java index 400fe6f36..cad96b01a 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/belt/BeltBlock.java @@ -3,6 +3,7 @@ package com.simibubi.create.content.contraptions.relays.belt; import java.util.ArrayList; import java.util.LinkedList; import java.util.List; +import java.util.function.Consumer; import org.apache.commons.lang3.mutable.MutableBoolean; @@ -24,10 +25,9 @@ import com.simibubi.create.content.schematics.ItemRequirement.ItemUseType; import com.simibubi.create.foundation.advancement.AllTriggers; import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.tileEntity.behaviour.belt.TransportedItemStackHandlerBehaviour.TransportedResult; -import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Iterate; +import com.simibubi.create.foundation.utility.ReducedDestroyEffects; -import net.minecraft.client.particle.ParticleEngine; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Direction.Axis; @@ -75,6 +75,7 @@ import net.minecraft.world.phys.shapes.Shapes; import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.IBlockRenderProperties; import net.minecraftforge.common.Tags; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; @@ -92,6 +93,11 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE consumer) { + consumer.accept(new ReducedDestroyEffects()); + } + @Override public void fillItemCategory(CreativeModeTab p_149666_1_, NonNullList p_149666_2_) { p_149666_2_.add(AllItems.BELT_CONNECTOR.asStack()); @@ -348,13 +354,6 @@ public class BeltBlock extends HorizontalKineticBlock implements ITE getTileEntityClass() { return BeltTileEntity.class; } - + @Override public BlockEntityType getTileEntityType() { - return AllTileEntities.BELT.get(); + return AllTileEntities.BELT.get(); } @Override diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeBlock.java index c5df459b3..19c980762 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gauge/GaugeBlock.java @@ -2,9 +2,11 @@ package com.simibubi.create.content.contraptions.relays.gauge; import java.util.Random; +import com.mojang.math.Vector3f; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.DirectionalAxisKineticBlock; import com.simibubi.create.content.contraptions.base.IRotate; +import com.simibubi.create.foundation.block.ITE; import com.simibubi.create.foundation.utility.Color; import com.simibubi.create.foundation.utility.Iterate; import com.simibubi.create.foundation.utility.Lang; @@ -23,13 +25,14 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraft.world.phys.Vec3; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; -public class GaugeBlock extends DirectionalAxisKineticBlock { +public class GaugeBlock extends DirectionalAxisKineticBlock implements ITE { public static final GaugeShaper GAUGE = GaugeShaper.make(); protected Type type; @@ -56,29 +59,6 @@ public class GaugeBlock extends DirectionalAxisKineticBlock { this.type = type; } - @Override - public BlockEntity createTileEntity(BlockState state, BlockGetter world) { - switch (type) { - case SPEED: - return AllTileEntities.SPEEDOMETER.create(); - case STRESS: - return AllTileEntities.STRESSOMETER.create(); - default: - return null; - } - } - - /* - * FIXME: Is there a new way of doing this in 1.16? Or cn we just delete it? - * - * @SuppressWarnings("deprecation") - * - * @Override - * public MaterialColor getMaterialColor(BlockState state, IBlockReader worldIn, BlockPos pos) { - * return Blocks.SPRUCE_PLANKS.getMaterialColor(state, worldIn, pos); - * } - */ - @Override public BlockState getStateForPlacement(BlockPlaceContext context) { Level world = context.getLevel(); @@ -133,7 +113,7 @@ public class GaugeBlock extends DirectionalAxisKineticBlock { return false; if (getRotationAxis(state) == Axis.Y && face != state.getValue(FACING)) return false; - if (!Block.shouldRenderFace(state, world, pos, face) && !(world instanceof WrappedWorld)) + if (!Block.shouldRenderFace(state, world, pos, face, pos.relative(face)) && !(world instanceof WrappedWorld)) return false; return true; } @@ -152,7 +132,7 @@ public class GaugeBlock extends DirectionalAxisKineticBlock { if (!shouldRenderHeadOnFace(worldIn, pos, stateIn, face)) continue; - Vec3 rgb = Color.vectorFromRGB(color); + Vector3f rgb = new Vector3f(Color.vectorFromRGB(color)); Vec3 faceVec = Vec3.atLowerCornerOf(face.getNormal()); Direction positiveFacing = Direction.get(AxisDirection.POSITIVE, face.getAxis()); Vec3 positiveFaceVec = Vec3.atLowerCornerOf(positiveFacing.getNormal()); @@ -169,8 +149,7 @@ public class GaugeBlock extends DirectionalAxisKineticBlock { Vec3 offset = VecHelper.getCenterOf(pos) .add(faceVec.scale(.55)) .add(mul); - worldIn.addParticle(new DustParticleOptions((float) rgb.x, (float) rgb.y, (float) rgb.z, 1), offset.x, - offset.y, offset.z, mul.x, mul.y, mul.z); + worldIn.addParticle(new DustParticleOptions(rgb, 1), offset.x, offset.y, offset.z, mul.x, mul.y, mul.z); } } @@ -201,4 +180,14 @@ public class GaugeBlock extends DirectionalAxisKineticBlock { public boolean isPathfindable(BlockState state, BlockGetter reader, BlockPos pos, PathComputationType type) { return false; } + + @Override + public Class getTileEntityClass() { + return GaugeTileEntity.class; + } + + @Override + public BlockEntityType getTileEntityType() { + return type == Type.SPEED ? AllTileEntities.SPEEDOMETER.get() : AllTileEntities.STRESSOMETER.get(); + } } diff --git a/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxBlock.java b/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxBlock.java index d8a8f7703..8c2d04a52 100644 --- a/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxBlock.java +++ b/src/main/java/com/simibubi/create/content/contraptions/relays/gearbox/GearboxBlock.java @@ -6,6 +6,7 @@ import java.util.List; import com.simibubi.create.AllItems; import com.simibubi.create.AllTileEntities; import com.simibubi.create.content.contraptions.base.RotatedPillarKineticBlock; +import com.simibubi.create.foundation.block.ITE; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; @@ -17,23 +18,18 @@ import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.BlockPlaceContext; import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.LevelReader; -import net.minecraft.world.level.block.entity.BlockEntity; +import net.minecraft.world.level.block.entity.BlockEntityType; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.PushReaction; import net.minecraft.world.level.storage.loot.LootContext.Builder; import net.minecraft.world.phys.HitResult; -public class GearboxBlock extends RotatedPillarKineticBlock { +public class GearboxBlock extends RotatedPillarKineticBlock implements ITE { public GearboxBlock(Properties properties) { super(properties); } - @Override - public BlockEntity createTileEntity(BlockState state, BlockGetter world) { - return AllTileEntities.GEARBOX.create(); - } - @Override public PushReaction getPistonPushReaction(BlockState state) { return PushReaction.PUSH_ONLY; @@ -77,4 +73,14 @@ public class GearboxBlock extends RotatedPillarKineticBlock { public Axis getRotationAxis(BlockState state) { return state.getValue(AXIS); } + + @Override + public Class getTileEntityClass() { + return GearboxTileEntity.class; + } + + @Override + public BlockEntityType getTileEntityType() { + return AllTileEntities.GEARBOX.get(); + } } diff --git a/src/main/java/com/simibubi/create/content/curiosities/CombustibleItem.java b/src/main/java/com/simibubi/create/content/curiosities/CombustibleItem.java index 73942560d..0ec268443 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/CombustibleItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/CombustibleItem.java @@ -2,6 +2,7 @@ package com.simibubi.create.content.curiosities; import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.crafting.RecipeType; public class CombustibleItem extends Item { private int burnTime = -1; @@ -15,7 +16,8 @@ public class CombustibleItem extends Item { } @Override - public int getBurnTime(ItemStack itemStack) { + public int getBurnTime(ItemStack itemStack, RecipeType recipeType) { return this.burnTime; } + } \ No newline at end of file diff --git a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxContainer.java b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxContainer.java index 8facf481e..fd2bbe54a 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxContainer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxContainer.java @@ -43,7 +43,7 @@ public class ToolboxContainer extends ContainerBase { BlockEntity tileEntity = world.getBlockEntity(readBlockPos); if (tileEntity instanceof ToolboxTileEntity) { ToolboxTileEntity toolbox = (ToolboxTileEntity) tileEntity; - toolbox.handleUpdateTag(toolbox.getBlockState(), readNbt); + toolbox.handleUpdateTag(readNbt); return toolbox; } @@ -73,20 +73,18 @@ public class ToolboxContainer extends ContainerBase { } @Override - public ItemStack clicked(int index, int flags, ClickType type, Player player) { + public void clicked(int index, int flags, ClickType type, Player player) { int size = contentHolder.inventory.getSlots(); if (index >= 0 && index < size) { - ItemStack itemInClickedSlot = getSlot(index).getItem(); - Inventory playerInv = player.getInventory(); - ItemStack carried = playerInv.getCarried(); + ItemStack carried = getCarried(); if (type == ClickType.PICKUP && !carried.isEmpty() && !itemInClickedSlot.isEmpty() && ToolboxInventory.canItemsShareCompartment(itemInClickedSlot, carried)) { int subIndex = index % STACKS_PER_COMPARTMENT; if (subIndex != STACKS_PER_COMPARTMENT - 1) - return clicked(index - subIndex + STACKS_PER_COMPARTMENT - 1, flags, type, player); + clicked(index - subIndex + STACKS_PER_COMPARTMENT - 1, flags, type, player); } if (type == ClickType.PICKUP && carried.isEmpty() && itemInClickedSlot.isEmpty()) @@ -96,7 +94,7 @@ public class ToolboxContainer extends ContainerBase { } } - return super.clicked(index, flags, type, player); + super.clicked(index, flags, type, player); } @Override diff --git a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxDyeingRecipe.java b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxDyeingRecipe.java index a6ba3ebfc..df2498433 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxDyeingRecipe.java +++ b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxDyeingRecipe.java @@ -30,10 +30,8 @@ public class ToolboxDyeingRecipe extends CustomRecipe { if (Block.byItem(stack.getItem()) instanceof ToolboxBlock) { ++toolboxes; } else { - if (!stack.getItem().is(Tags.Items.DYES)) { + if (!stack.is(Tags.Items.DYES)) return false; - } - ++dyes; } @@ -65,9 +63,11 @@ public class ToolboxDyeingRecipe extends CustomRecipe { } } - ItemStack dyedToolbox = AllBlocks.TOOLBOXES.get(color).asStack(); + ItemStack dyedToolbox = AllBlocks.TOOLBOXES.get(color) + .asStack(); if (toolbox.hasTag()) { - dyedToolbox.setTag(toolbox.getTag().copy()); + dyedToolbox.setTag(toolbox.getTag() + .copy()); } return dyedToolbox; diff --git a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxHandler.java b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxHandler.java index dd3e2a430..bf0c03728 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxHandler.java +++ b/src/main/java/com/simibubi/create/content/curiosities/toolbox/ToolboxHandler.java @@ -6,7 +6,7 @@ import java.util.stream.Collectors; import com.simibubi.create.foundation.config.AllConfigs; import com.simibubi.create.foundation.networking.AllPackets; -import com.simibubi.create.foundation.networking.ISyncPersistentData; +import com.simibubi.create.foundation.networking.ISyncPersistentData.PersistentDataPacket; import com.simibubi.create.foundation.utility.WorldAttached; import net.minecraft.core.BlockPos; @@ -98,7 +98,7 @@ public class ToolboxHandler { public static void syncData(Player player) { AllPackets.channel.send(PacketDistributor.PLAYER.with(() -> (ServerPlayer) player), - new ISyncPersistentData.Packet(player)); + new PersistentDataPacket(player)); } public static List getNearest(LevelAccessor world, Player player, int maxAmount) { diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintOverlayRenderer.java b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintOverlayRenderer.java index 335a2f4b9..e3a626c12 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintOverlayRenderer.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/BlueprintOverlayRenderer.java @@ -25,7 +25,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.MultiBufferSource; import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.ListTag; -import net.minecraft.tags.SerializationTags; +import net.minecraft.tags.ItemTags; import net.minecraft.tags.Tag; import net.minecraft.world.inventory.CraftingContainer; import net.minecraft.world.item.Item; @@ -104,9 +104,11 @@ public class BlueprintOverlayRenderer { boolean firstPass = true; boolean success = true; Minecraft mc = Minecraft.getInstance(); - ItemStackHandler playerInv = new ItemStackHandler(mc.player.getInventory().getContainerSize()); + ItemStackHandler playerInv = new ItemStackHandler(mc.player.getInventory() + .getContainerSize()); for (int i = 0; i < playerInv.getSlots(); i++) - playerInv.setStackInSlot(i, mc.player.getInventory().getItem(i) + playerInv.setStackInSlot(i, mc.player.getInventory() + .getItem(i) .copy()); int amountCrafted = 0; @@ -278,8 +280,7 @@ public class BlueprintOverlayRenderer { ItemAttribute fromNBT = ItemAttribute.fromNBT((CompoundTag) attributes.get(0)); if (fromNBT instanceof ItemAttribute.InTag) { ItemAttribute.InTag inTag = (ItemAttribute.InTag) fromNBT; - Tag itag = SerializationTags.getInstance() - .getItems() + Tag itag = ItemTags.getAllTags() .getTag(inTag.tagName); if (itag != null) return Ingredient.of(itag) 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 f15d74bfc..f4f18d330 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 @@ -54,29 +54,32 @@ public class ExtendoGripInteractionPacket extends SimplePacketBase { @Override public void handle(Supplier context) { - context.get().enqueueWork(() -> { - ServerPlayer sender = context.get().getSender(); - if (sender == null) - return; - Entity entityByID = sender.getLevel().getEntity(target); - if (entityByID != null && ExtendoGripItem.isHoldingExtendoGrip(sender)) { - double d = sender.getAttribute(ForgeMod.REACH_DISTANCE.get()).getValue(); - if (!sender.canSee(entityByID)) - d -= 3; - d *= d; - if (sender.distanceToSqr(entityByID) > d) { - // TODO log? + context.get() + .enqueueWork(() -> { + ServerPlayer sender = context.get() + .getSender(); + if (sender == null) return; + Entity entityByID = sender.getLevel() + .getEntity(target); + if (entityByID != null && ExtendoGripItem.isHoldingExtendoGrip(sender)) { + double d = sender.getAttribute(ForgeMod.REACH_DISTANCE.get()) + .getValue(); + if (!sender.hasLineOfSight(entityByID)) + d -= 3; + d *= d; + if (sender.distanceToSqr(entityByID) > d) + return; + if (interactionHand == null) + sender.attack(entityByID); + else if (specificPoint == null) + sender.interactOn(entityByID, interactionHand); + else + entityByID.interactAt(sender, specificPoint, interactionHand); } - if (interactionHand == null) - sender.attack(entityByID); - else if (specificPoint == null) - sender.interactOn(entityByID, interactionHand); - else - entityByID.interactAt(sender, specificPoint, interactionHand); - } - }); - context.get().setPacketHandled(true); + }); + context.get() + .setPacketHandled(true); } } diff --git a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java index 3a98b8499..3ba1ab6be 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/tools/SandPaperItem.java @@ -102,7 +102,7 @@ public class SandPaperItem extends Item { itemstack.getOrCreateTag() .put("Polishing", toPolish.serializeNBT()); if (item.isEmpty()) - pickUp.remove(); + pickUp.discard(); else pickUp.setItem(item); } @@ -143,7 +143,7 @@ public class SandPaperItem extends Item { if (player instanceof FakePlayer) { player.drop(polished, false, false); } else { - player.getInventory().placeItemBackInInventory(worldIn, polished); + player.getInventory().placeItemBackInInventory(polished); } } tag.remove("Polishing"); @@ -169,7 +169,7 @@ public class SandPaperItem extends Item { CompoundTag tag = stack.getOrCreateTag(); if (tag.contains("Polishing")) { ItemStack toPolish = ItemStack.of(tag.getCompound("Polishing")); - player.getInventory().placeItemBackInInventory(worldIn, toPolish); + player.getInventory().placeItemBackInInventory(toPolish); tag.remove("Polishing"); } } diff --git a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java index b892f0f37..7ccf9f66a 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java +++ b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileEntity.java @@ -134,7 +134,7 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements if (stuckEntity != null) { if (getY() < stuckEntity.getY() - 0.1) { pop(position()); - remove(); + kill(); } else { stuckFallSpeed += 0.007 * projectileType.getGravityMultiplier(); stuckOffset = stuckOffset.add(0, -stuckFallSpeed, 0); @@ -201,7 +201,7 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements boolean onServer = !level.isClientSide; if (onServer && !target.hurt(causePotatoDamage(), damage)) { target.setRemainingFireTicks(k); - remove(); + kill(); return; } @@ -214,7 +214,7 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements if (!(target instanceof LivingEntity)) { playHitSound(level, position()); - remove(); + kill(); return; } @@ -254,7 +254,7 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements if (type.isSticky() && target.isAlive()) { setStuckEntity(target); } else { - remove(); + kill(); } } @@ -280,7 +280,7 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements if (random.nextDouble() <= recoveryChance) recoverItem(); super.onHitBlock(ray); - remove(); + kill(); } @Override @@ -290,7 +290,7 @@ public class PotatoProjectileEntity extends AbstractHurtingProjectile implements if (this.isInvulnerableTo(source)) return false; pop(position()); - remove(); + kill(); return true; } diff --git a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileRenderMode.java b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileRenderMode.java index 774df3be8..46332dcd0 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileRenderMode.java +++ b/src/main/java/com/simibubi/create/content/curiosities/weapons/PotatoProjectileRenderMode.java @@ -34,7 +34,7 @@ public interface PotatoProjectileRenderMode { MatrixTransformStack.of(ms) .rotateY(AngleHelper.deg(Mth.atan2(diff.x, diff.z)) + 180) - .rotateX(AngleHelper.deg(Mth.atan2(diff.y, Mth.sqrt(diff.x * diff.x + diff.z * diff.z)))); + .rotateX(AngleHelper.deg(Mth.atan2(diff.y, Mth.sqrt((float) (diff.x * diff.x + diff.z * diff.z))))); } } @@ -71,7 +71,7 @@ public interface PotatoProjectileRenderMode { MatrixTransformStack.of(ms) .rotateY(AngleHelper.deg(Mth.atan2(diff.x, diff.z))) .rotateX(270 - + AngleHelper.deg(Mth.atan2(diff.y, -Mth.sqrt(diff.x * diff.x + diff.z * diff.z)))); + + AngleHelper.deg(Mth.atan2(diff.y, -Mth.sqrt((float) (diff.x * diff.x + diff.z * diff.z))))); MatrixTransformStack.of(ms) .rotateY((entity.tickCount + pt) * 20 * spin + entityRandom(entity, 360)) .rotateZ(-spriteAngleOffset); diff --git a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperItem.java b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperItem.java index aff88dbb1..0dbcbdf8d 100644 --- a/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperItem.java +++ b/src/main/java/com/simibubi/create/content/curiosities/zapper/ZapperItem.java @@ -228,7 +228,7 @@ public abstract class ZapperItem extends Item { data.putInt("x", pos.getX()); data.putInt("y", pos.getY()); data.putInt("z", pos.getZ()); - tile.load(state, data); + tile.load(data); } } } 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 2f2989830..203eac6bb 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,5 +1,7 @@ package com.simibubi.create.content.logistics.block.chute; +import java.util.function.Consumer; + import javax.annotation.Nullable; import com.simibubi.create.content.contraptions.wrench.IWrenchable; @@ -7,10 +9,9 @@ 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.tileEntity.behaviour.filtering.FilteringBehaviour; -import com.simibubi.create.foundation.utility.BlockHelper; import com.simibubi.create.foundation.utility.Iterate; +import com.simibubi.create.foundation.utility.ReducedDestroyEffects; -import net.minecraft.client.particle.ParticleEngine; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.world.InteractionHand; @@ -23,13 +24,13 @@ import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.Block; -import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.shapes.CollisionContext; import net.minecraft.world.phys.shapes.VoxelShape; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.IBlockRenderProperties; import net.minecraftforge.common.util.LazyOptional; public abstract class AbstractChuteBlock extends Block implements IWrenchable, ITE { @@ -37,6 +38,11 @@ public abstract class AbstractChuteBlock extends Block implements IWrenchable, I public AbstractChuteBlock(Properties p_i48440_1_) { super(p_i48440_1_); } + + @OnlyIn(Dist.CLIENT) + public void initializeClient(Consumer consumer) { + consumer.accept(new ReducedDestroyEffects()); + } public static boolean isChute(BlockState state) { return state.getBlock() instanceof AbstractChuteBlock; @@ -164,13 +170,6 @@ public abstract class AbstractChuteBlock extends Block implements IWrenchable, I public abstract BlockState updateChuteState(BlockState state, BlockState above, BlockGetter world, BlockPos pos); - @Override - @OnlyIn(Dist.CLIENT) - public boolean addDestroyEffects(BlockState state, Level world, BlockPos pos, ParticleEngine manager) { - BlockHelper.addReducedDestroyEffects(state, world, pos, manager); - return true; - } - @Override public VoxelShape getShape(BlockState p_220053_1_, BlockGetter p_220053_2_, BlockPos p_220053_3_, CollisionContext p_220053_4_) { 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 3bee92134..3e7d3cdb9 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,6 +1,7 @@ package com.simibubi.create.content.logistics.block.funnel; import java.util.Random; +import java.util.function.Consumer; import javax.annotation.Nullable; @@ -10,9 +11,8 @@ import com.simibubi.create.foundation.block.ITE; 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 com.simibubi.create.foundation.utility.ReducedDestroyEffects; -import net.minecraft.client.particle.ParticleEngine; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.server.level.ServerLevel; @@ -31,6 +31,7 @@ import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.pathfinder.PathComputationType; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraftforge.client.IBlockRenderProperties; public abstract class AbstractFunnelBlock extends Block implements ITE, IWrenchable { @@ -41,6 +42,11 @@ public abstract class AbstractFunnelBlock extends Block implements ITE consumer) { + consumer.accept(new ReducedDestroyEffects()); + } + @Override public BlockState getStateForPlacement(BlockPlaceContext context) { return defaultBlockState().setValue(POWERED, context.getLevel() @@ -57,13 +63,6 @@ public abstract class AbstractFunnelBlock extends Block implements ITE Create.PALETTES_CREATIVE_TAB) + .itemGroup(() -> Create.PALETTES_CREATIVE_TAB) .startSection(AllSections.PALETTES); // Windows and Glass @@ -102,8 +103,8 @@ public class AllPaletteBlocks { public static final PalettesVariantEntry DIORITE_VARIANTS = new PalettesVariantEntry(PaletteStoneVariants.DIORITE, PaletteBlockPattern.VANILLA_RANGE); - public static final PalettesVariantEntry ANDESITE_VARIANTS = new PalettesVariantEntry(PaletteStoneVariants.ANDESITE, - PaletteBlockPattern.VANILLA_RANGE); + public static final PalettesVariantEntry ANDESITE_VARIANTS = + new PalettesVariantEntry(PaletteStoneVariants.ANDESITE, PaletteBlockPattern.VANILLA_RANGE); // Create stone variants @@ -126,8 +127,8 @@ public class AllPaletteBlocks { .loot(cobblestoneLoot(PaletteStoneVariants.WEATHERED_LIMESTONE)) .register(); - public static final PalettesVariantEntry WEATHERED_LIMESTONE_VARIANTS = new PalettesVariantEntry( - PaletteStoneVariants.WEATHERED_LIMESTONE, PaletteBlockPattern.STANDARD_RANGE); + public static final PalettesVariantEntry WEATHERED_LIMESTONE_VARIANTS = + new PalettesVariantEntry(PaletteStoneVariants.WEATHERED_LIMESTONE, PaletteBlockPattern.STANDARD_RANGE); public static final BlockEntry DOLOMITE = REGISTRATE.paletteStoneBlock("dolomite", () -> Blocks.QUARTZ_BLOCK, true) @@ -137,24 +138,23 @@ public class AllPaletteBlocks { public static final PalettesVariantEntry DOLOMITE_VARIANTS = new PalettesVariantEntry(PaletteStoneVariants.DOLOMITE, PaletteBlockPattern.STANDARD_RANGE); - public static final BlockEntry GABBRO = - REGISTRATE.paletteStoneBlock("gabbro", () -> Blocks.ANDESITE, true) - .loot(cobblestoneLoot(PaletteStoneVariants.GABBRO)) - .register(); + public static final BlockEntry GABBRO = REGISTRATE.paletteStoneBlock("gabbro", () -> Blocks.ANDESITE, true) + .loot(cobblestoneLoot(PaletteStoneVariants.GABBRO)) + .register(); public static final PalettesVariantEntry GABBRO_VARIANTS = new PalettesVariantEntry(PaletteStoneVariants.GABBRO, PaletteBlockPattern.STANDARD_RANGE); - public static final BlockEntry SCORIA = - REGISTRATE.paletteStoneBlock("scoria", () -> Blocks.ANDESITE, false) - .loot(cobblestoneLoot(PaletteStoneVariants.SCORIA)) - .register(); + public static final BlockEntry SCORIA = REGISTRATE.paletteStoneBlock("scoria", () -> Blocks.ANDESITE, false) + .loot(cobblestoneLoot(PaletteStoneVariants.SCORIA)) + .register(); public static final BlockEntry NATURAL_SCORIA = REGISTRATE.block("natural_scoria", Block::new) .initialProperties(() -> Blocks.ANDESITE) .tag(BlockTags.BASE_STONE_OVERWORLD, AllTags.AllBlockTags.WG_STONE.tag) .onRegister(CreateRegistrate.blockVertexColors(ScoriaVertexColor.INSTANCE)) - .loot((p, g) -> p.add(g, RegistrateBlockLootTables.droppingWithSilkTouch(g, SCORIA.get()))) + .loot((p, g) -> p.add(g, + RegistrateBlockLootTables.createSilkTouchDispatchTable(g, LootItem.lootTableItem(SCORIA.get())))) .blockstate(palettesCubeAll()) .simpleItem() .register(); @@ -170,9 +170,12 @@ public class AllPaletteBlocks { public static final PalettesVariantEntry DARK_SCORIA_VARIANTS = new PalettesVariantEntry(PaletteStoneVariants.DARK_SCORIA, PaletteBlockPattern.STANDARD_RANGE); - private static NonNullBiConsumer cobblestoneLoot(PaletteStoneVariants variant) { - return (loot, block) -> loot.add(block, RegistrateBlockLootTables.droppingWithSilkTouch(block, - variant.getVariants().registeredBlocks.get(0).get())); + private static NonNullBiConsumer cobblestoneLoot( + PaletteStoneVariants variant) { + return (loot, block) -> loot.add(block, + RegistrateBlockLootTables.createSilkTouchDispatchTable(block, + LootItem.lootTableItem(variant.getVariants().registeredBlocks.get(0) + .get()))); } private static NonNullBiConsumer, RegistrateBlockstateProvider> palettesCubeAll() { diff --git a/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPartial.java b/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPartial.java index 0334d669a..703463976 100644 --- a/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPartial.java +++ b/src/main/java/com/simibubi/create/content/palettes/PaletteBlockPartial.java @@ -186,7 +186,7 @@ public abstract class PaletteBlockPartial { protected BlockBuilder transformBlock( BlockBuilder builder, String variantName, PaletteBlockPattern pattern) { - builder.loot((lt, block) -> lt.add(block, RegistrateBlockLootTables.droppingSlab(block))); + builder.loot((lt, block) -> lt.add(block, RegistrateBlockLootTables.createSlabItemTable(block))); return super.transformBlock(builder, variantName, pattern); } diff --git a/src/main/java/com/simibubi/create/events/CommonEvents.java b/src/main/java/com/simibubi/create/events/CommonEvents.java index ea306dfa5..aab8f0dc3 100644 --- a/src/main/java/com/simibubi/create/events/CommonEvents.java +++ b/src/main/java/com/simibubi/create/events/CommonEvents.java @@ -32,6 +32,7 @@ import net.minecraft.world.level.Level; import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.material.FluidState; +import net.minecraftforge.common.capabilities.RegisterCapabilitiesEvent; import net.minecraftforge.event.AddReloadListenerEvent; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.RegisterCommandsEvent; 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 506af7678..c9d00ffae 100644 --- a/src/main/java/com/simibubi/create/foundation/command/CloneCommand.java +++ b/src/main/java/com/simibubi/create/foundation/command/CloneCommand.java @@ -72,8 +72,8 @@ public class CloneCommand { if (!world.hasChunksAt(begin, end) || !world.hasChunksAt(destination, destinationEnd)) throw BlockPosArgument.ERROR_NOT_LOADED.create(); - BlockPos diffToTarget = new BlockPos(destinationArea.x0 - sourceArea.x0, - destinationArea.y0 - sourceArea.y0, destinationArea.z0 - sourceArea.z0); + 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); @@ -89,8 +89,7 @@ public class CloneCommand { private static int cloneGlue(BoundingBox sourceArea, ServerLevel world, BlockPos diffToTarget) { int gluePastes = 0; - List glue = - world.getEntitiesOfClass(SuperGlueEntity.class, AABB.of(sourceArea)); + List glue = world.getEntitiesOfClass(SuperGlueEntity.class, AABB.of(sourceArea)); List> newGlue = Lists.newArrayList(); for (SuperGlueEntity g : glue) { @@ -115,9 +114,9 @@ public class CloneCommand { List blocks = Lists.newArrayList(); List tileBlocks = Lists.newArrayList(); - for (int z = sourceArea.z0; z <= sourceArea.z1; ++z) { - for (int y = sourceArea.y0; y <= sourceArea.y1; ++y) { - for (int x = sourceArea.x0; x <= sourceArea.x1; ++x) { + for (int z = sourceArea.minZ(); z <= sourceArea.maxZ(); ++z) { + for (int y = sourceArea.minY(); y <= sourceArea.maxY(); ++y) { + for (int x = sourceArea.minX(); x <= sourceArea.maxX(); ++x) { BlockPos currentPos = new BlockPos(x, y, z); BlockPos newPos = currentPos.offset(diffToTarget); BlockInWorld cached = new BlockInWorld(world, currentPos, false); @@ -156,11 +155,12 @@ public class CloneCommand { info.nbt.putInt("x", info.pos.getX()); info.nbt.putInt("y", info.pos.getY()); info.nbt.putInt("z", info.pos.getZ()); - te.load(info.state, info.nbt); + te.load(info.nbt); te.setChanged(); } - // 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.setBlock(info.pos, info.state, 2); } 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 cb5755296..7be7124bb 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AllIcons.java @@ -119,6 +119,7 @@ public class AllIcons implements IScreenRenderable { I_FOLLOW_MATERIAL = next(), I_SCHEMATIC = newRow(), + I_SEQ_REPEAT = next(), I_MTD_LEFT = newRow(), I_MTD_CLOSE = next(), diff --git a/src/main/java/com/simibubi/create/foundation/gui/GhostItemContainer.java b/src/main/java/com/simibubi/create/foundation/gui/GhostItemContainer.java index ed19b738e..07c258105 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/GhostItemContainer.java +++ b/src/main/java/com/simibubi/create/foundation/gui/GhostItemContainer.java @@ -50,12 +50,14 @@ public abstract class GhostItemContainer extends ContainerBase implements } @Override - public ItemStack clicked(int slotId, int dragType, ClickType clickTypeIn, Player player) { - ItemStack held = playerInventory.getCarried(); - if (slotId < 36) - return super.clicked(slotId, dragType, clickTypeIn, player); + public void clicked(int slotId, int dragType, ClickType clickTypeIn, Player player) { + ItemStack held = getCarried(); + if (slotId < 36) { + super.clicked(slotId, dragType, clickTypeIn, player); + return; + } if (clickTypeIn == ClickType.THROW) - return ItemStack.EMPTY; + return; int slot = slotId - 36; if (clickTypeIn == ClickType.CLONE) { @@ -63,23 +65,23 @@ public abstract class GhostItemContainer extends ContainerBase implements ItemStack stackInSlot = ghostInventory.getStackInSlot(slot) .copy(); stackInSlot.setCount(stackInSlot.getMaxStackSize()); - playerInventory.setCarried(stackInSlot); - return ItemStack.EMPTY; + setCarried(stackInSlot); + return; } - return ItemStack.EMPTY; + return; } if (held.isEmpty()) { ghostInventory.setStackInSlot(slot, ItemStack.EMPTY); getSlot(slotId).setChanged(); - return ItemStack.EMPTY; + return; } ItemStack insert = held.copy(); insert.setCount(1); ghostInventory.setStackInSlot(slot, insert); getSlot(slotId).setChanged(); - return held; + setCarried(held); } @Override diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/BearingScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/BearingScenes.java index 497562031..7e027644e 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/BearingScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/BearingScenes.java @@ -158,7 +158,7 @@ public class BearingScenes { scene.title("windmill_structure", "Windmill Contraptions"); scene.configureBasePlate(1, 1, 5); scene.setSceneOffsetY(-1); - scene.world.modifyEntities(SuperGlueEntity.class, Entity::remove); + scene.world.modifyEntities(SuperGlueEntity.class, Entity::discard); scene.world.showSection(util.select.layer(0), Direction.UP); scene.idle(5); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/BeltScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/BeltScenes.java index 0e02338e0..3966fb4f9 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/BeltScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/BeltScenes.java @@ -336,7 +336,7 @@ public class BeltScenes { ElementLink item = scene.world.createItemEntity(util.vector.centerOf(0, 4, 2), util.vector.of(0, 0, 0), stack); scene.idle(13); - scene.world.modifyEntity(item, Entity::remove); + scene.world.modifyEntity(item, Entity::discard); BlockPos beltEnd = util.grid.at(0, 1, 2); scene.world.createItemOnBelt(beltEnd, Direction.DOWN, stack); @@ -358,7 +358,7 @@ public class BeltScenes { scene.idle(10); scene.special.movePointOfInterest(beltEnd); scene.idle(3); - scene.world.modifyEntity(item, Entity::remove); + scene.world.modifyEntity(item, Entity::discard); scene.world.createItemOnBelt(beltEnd, Direction.DOWN, stack); scene.idle(8); @@ -373,7 +373,7 @@ public class BeltScenes { scene.idle(5); scene.world.setKineticSpeed(util.select.everywhere(), 0f); scene.idle(10); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.special.movePointOfInterest(util.grid.at(2, 5, 4)); Vec3 topOf = util.vector.topOf(util.grid.at(3, 2, 2)) diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/CartAssemblerScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/CartAssemblerScenes.java index 11451f0a3..1e2656d0c 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/CartAssemblerScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/CartAssemblerScenes.java @@ -155,7 +155,7 @@ public class CartAssemblerScenes { .pointAt(cartCenter) .placeNearTarget(); scene.idle(80); - scene.world.modifyEntity(itemEntity, Entity::remove); + scene.world.modifyEntity(itemEntity, Entity::discard); scene.overlay.showControls(new InputWindowElement(cartCenter.add(0, 0, 4), Pointing.DOWN).rightClick() .withItem(asStack), 20); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/ChassisScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/ChassisScenes.java index 783206664..0698aa79b 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/ChassisScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/ChassisScenes.java @@ -261,7 +261,7 @@ public class ChassisScenes { scene.effects.superGlue(chassisPos.west(), Direction.NORTH, true); scene.idle(20); - scene.world.modifyEntity(glueEntity, Entity::remove); + scene.world.modifyEntity(glueEntity, Entity::discard); scene.world.hideIndependentSection(glassSection, Direction.UP); scene.world.hideIndependentSection(gluedPlank, Direction.UP); scene.world.hideIndependentSection(topGlassSection, Direction.UP); @@ -509,7 +509,7 @@ public class ChassisScenes { scene.world.glueBlockOnto(central.north(), Direction.SOUTH, plank); scene.idle(20); - scene.world.modifyEntity(glueEntity, Entity::remove); + scene.world.modifyEntity(glueEntity, Entity::discard); BlockPos bearingPos = util.grid.at(2, 1, 2); scene.world.configureCenterOfRotation(plank, util.vector.centerOf(bearingPos)); @@ -558,7 +558,7 @@ public class ChassisScenes { scene.addKeyframe(); scene.overlay.showControls(new InputWindowElement(util.vector.topOf(central), Pointing.DOWN).leftClick(), 40); scene.idle(7); - scene.world.modifyEntity(glueEntity, Entity::remove); + scene.world.modifyEntity(glueEntity, Entity::discard); scene.effects.superGlue(central, Direction.UP, false); scene.idle(10); scene.overlay.showText(60) diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/ChuteScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/ChuteScenes.java index a65d47f95..9e44828ae 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/ChuteScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/ChuteScenes.java @@ -47,7 +47,7 @@ public class ChuteScenes { ElementLink remove = scene.world.createItemEntity(util.vector.centerOf(util.grid.at(1, 5, 2)), util.vector.of(0, 0.1, 0), stack); scene.idle(15); - scene.world.modifyEntity(remove, Entity::remove); + scene.world.modifyEntity(remove, Entity::discard); scene.overlay.showText(60) .attachKeyFrame() @@ -55,7 +55,7 @@ public class ChuteScenes { .placeNearTarget() .text("Chutes can transport items vertically from and to inventories"); scene.idle(70); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.world.moveSection(bottom, util.vector.of(1, 0, 0), 10); scene.world.moveSection(top, util.vector.of(-1, 0, 0), 10); scene.idle(20); @@ -125,7 +125,7 @@ public class ChuteScenes { stack); scene.idle(12); scene.world.createItemOnBeltLike(util.grid.at(2, 4, 3), Direction.UP, stack); - scene.world.modifyEntity(remove, Entity::remove); + scene.world.modifyEntity(remove, Entity::discard); scene.idle(3); offset = offset.getClockWise(); } diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/CrafterScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/CrafterScenes.java index 269e16279..1b883c3a4 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/CrafterScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/CrafterScenes.java @@ -434,17 +434,17 @@ public class CrafterScenes { ElementLink ingot = scene.world.createItemEntity(util.vector.centerOf(4, 4, 2), util.vector.of(0, 0.2, 0), iron); scene.idle(17); - scene.world.modifyEntity(ingot, Entity::remove); + scene.world.modifyEntity(ingot, Entity::discard); scene.world.modifyTileEntity(util.grid.at(3, 2, 2), type, mct -> mct.getInventory() .insertItem(0, iron.copy(), false)); ingot = scene.world.createItemEntity(util.vector.centerOf(4, 4, 2), util.vector.of(0, 0.2, 0), iron); scene.idle(17); - scene.world.modifyEntity(ingot, Entity::remove); + scene.world.modifyEntity(ingot, Entity::discard); scene.world.modifyTileEntity(util.grid.at(2, 1, 2), type, mct -> mct.getInventory() .insertItem(0, iron.copy(), false)); ingot = scene.world.createItemEntity(util.vector.centerOf(4, 4, 2), util.vector.of(0, 0.2, 0), iron); scene.idle(17); - scene.world.modifyEntity(ingot, Entity::remove); + scene.world.modifyEntity(ingot, Entity::discard); scene.world.modifyTileEntity(util.grid.at(1, 2, 2), type, mct -> mct.getInventory() .insertItem(0, iron.copy(), false)); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/DebugScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/DebugScenes.java index 383d8a42c..5125b2b6b 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/DebugScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/DebugScenes.java @@ -431,7 +431,7 @@ public class DebugScenes { scene.idle(27); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); } public static void pipeScene(SceneBuilder scene, SceneBuildingUtil util) { diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/EjectorScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/EjectorScenes.java index 7aefba9d2..8b27f6d6b 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/EjectorScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/EjectorScenes.java @@ -127,7 +127,7 @@ public class EjectorScenes { .placeNearTarget(); scene.idle(60); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.world.hideSection(targetS, Direction.SOUTH); scene.idle(15); scene.world.restoreBlocks(targetS); @@ -187,7 +187,7 @@ public class EjectorScenes { scene.world.hideSection(util.select.fromTo(5, 1, 0, 4, 1, 1), Direction.UP); scene.world.hideSection(util.select.position(5, 0, 1), Direction.DOWN); scene.idle(30); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.addKeyframe(); ElementLink birb = scene.special.createBirb(util.vector.topOf(ejectorPos) @@ -309,7 +309,7 @@ public class EjectorScenes { for (int i = 0; i < 3; i++) { scene.world.createItemEntity(topOf, util.vector.of(0, 0.1, 0), copper); scene.idle(12); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.world.createItemOnBeltLike(ejectorPos, Direction.UP, copper); scene.idle(20); if (i == 1) { @@ -349,7 +349,7 @@ public class EjectorScenes { for (int i = 0; i < 6; i++) { scene.world.createItemEntity(topOf, util.vector.of(0, 0.1, 0), copper); scene.idle(12); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.world.createItemOnBeltLike(ejectorPos, Direction.UP, copper); scene.idle(1); scene.world.toggleRedstonePower(observerRedstone); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/FanScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/FanScenes.java index b6cc2270a..aae951c5f 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/FanScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/FanScenes.java @@ -137,7 +137,7 @@ public class FanScenes { scene.idle(40); scene.overlay.showControls(new InputWindowElement(itemVec, Pointing.DOWN).withItem(smelted), 20); scene.idle(20); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.idle(20); scene.overlay.showText(80) @@ -202,7 +202,7 @@ public class FanScenes { scene.world.modifyEntities(ItemEntity.class, ie -> ie.setItem(washed)); scene.overlay.showControls(new InputWindowElement(itemVec, Pointing.DOWN).withItem(washed), 20); scene.idle(20); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.idle(20); scene.overlay.showText(100) diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/FunnelScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/FunnelScenes.java index c633bf71f..c471c2411 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/FunnelScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/FunnelScenes.java @@ -79,7 +79,7 @@ public class FunnelScenes { for (int i = 0; i < 4; i++) { if (lastItemEntity != null) - scene.world.modifyEntity(lastItemEntity, Entity::remove); + scene.world.modifyEntity(lastItemEntity, Entity::discard); if (i < 3) lastItemEntity = scene.world.createItemEntity(topItemSpawn, util.vector.of(0, -0.4, 0), itemStack); scene.idle(8); @@ -139,7 +139,7 @@ public class FunnelScenes { scene.world.createItemEntity(topCenter, util.vector.of(0, 4 / 16f, 0), itemStack); scene.idle(40); - scene.world.modifyEntity(itemLink, Entity::remove); + scene.world.modifyEntity(itemLink, Entity::discard); scene.world.hideSection(topFunnelSelection, Direction.UP); scene.idle(20); @@ -159,7 +159,7 @@ public class FunnelScenes { itemLink = scene.world.createItemEntity(topCenter.add(0, 3, 0), util.vector.of(0, -0.2, 0), itemStack); scene.idle(10); - scene.world.modifyEntity(itemLink, Entity::remove); + scene.world.modifyEntity(itemLink, Entity::discard); scene.idle(45); // Wrench interaction @@ -182,7 +182,7 @@ public class FunnelScenes { scene.idle(10); scene.world.modifyBlock(topFunnel, s -> s.cycle(FunnelBlock.EXTRACTING), true); scene.idle(10); - scene.world.modifyEntity(itemLink, Entity::remove); + scene.world.modifyEntity(itemLink, Entity::discard); scene.idle(20); @@ -205,7 +205,7 @@ public class FunnelScenes { scene.idle(60); scene.world.hideSection(sideFunnelSelection, Direction.UP); scene.world.hideSection(topFunnelSelection, Direction.UP); - scene.world.modifyEntity(itemLink, Entity::remove); + scene.world.modifyEntity(itemLink, Entity::discard); scene.idle(20); // Belt funnel @@ -324,7 +324,7 @@ public class FunnelScenes { for (int i = 0; i < 4; i++) { if (lastItemEntity != null) - scene.world.modifyEntity(lastItemEntity, Entity::remove); + scene.world.modifyEntity(lastItemEntity, Entity::discard); lastItemEntity = scene.world.createItemEntity(topItemSpawn, util.vector.of(0, -0.2, 0), itemStack); scene.idle(8); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalDrillScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalDrillScenes.java index 8f920fb0a..494a840fe 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalDrillScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalDrillScenes.java @@ -56,7 +56,7 @@ public class MechanicalDrillScenes { scene.idle(20); scene.idle(15); - scene.world.modifyEntity(plankEntity, Entity::remove); + scene.world.modifyEntity(plankEntity, Entity::discard); scene.world.modifyKineticSpeed(util.select.everywhere(), f -> 4 * f); scene.effects.rotationSpeedIndicator(breakingPos.east(3)); scene.idle(5); @@ -162,7 +162,7 @@ public class MechanicalDrillScenes { scene.idle(40); scene.world.setBlocks(planks, Blocks.OAK_PLANKS.defaultBlockState(), false); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.world.glueBlockOnto(util.grid.at(4, 3, 2), Direction.DOWN, contraption); scene.overlay.showText(60) diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalSawScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalSawScenes.java index 2c78d2a02..3b40e7fb4 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalSawScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/MechanicalSawScenes.java @@ -65,7 +65,7 @@ public class MechanicalSawScenes { scene.world.modifyEntity(logItem, e -> e.setDeltaMovement(util.vector.of(0.05, 0.2, 0))); scene.idle(12); - scene.world.modifyEntity(logItem, Entity::remove); + scene.world.modifyEntity(logItem, Entity::discard); scene.world.createItemOnBeltLike(sawPos, Direction.WEST, log); scene.idle(50); @@ -88,7 +88,7 @@ public class MechanicalSawScenes { scene.world.modifyEntity(logItem, e -> e.setDeltaMovement(util.vector.of(-0.05, 0.2, 0))); scene.idle(12); - scene.world.modifyEntity(logItem, Entity::remove); + scene.world.modifyEntity(logItem, Entity::discard); scene.world.createItemOnBeltLike(sawPos, Direction.EAST, strippedLog); scene.idle(25); @@ -102,7 +102,7 @@ public class MechanicalSawScenes { scene.world.setKineticSpeed(otherBelt, 0); scene.world.setKineticSpeed(belt, 0); scene.world.modifyKineticSpeed(util.select.everywhere(), f -> -f); - scene.world.modifyEntity(logItem, Entity::remove); + scene.world.modifyEntity(logItem, Entity::discard); scene.world.setBlock(shaftPos, AllBlocks.COGWHEEL.getDefaultState() .setValue(ShaftBlock.AXIS, Axis.Z), true); scene.idle(3); @@ -144,7 +144,7 @@ public class MechanicalSawScenes { scene.overlay.showFilterSlotInput(filter, 80); ItemStack bricks = new ItemStack(Blocks.STONE_BRICKS); scene.overlay.showControls(new InputWindowElement(filter, Pointing.DOWN).withItem(bricks), 80); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.idle(7); scene.world.setFilterData(util.select.position(sawPos), SawTileEntity.class, bricks); scene.idle(10); @@ -167,7 +167,7 @@ public class MechanicalSawScenes { .pointAt(filter) .placeNearTarget(); scene.idle(65); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); } public static void treeCutting(SceneBuilder scene, SceneBuildingUtil util) { @@ -227,7 +227,7 @@ public class MechanicalSawScenes { scene.world.destroyBlock(util.grid.at(1, 1, 2)); scene.world.hideSection(util.select.layersFrom(2) .add(util.select.fromTo(2, 1, 2, 1, 1, 3)), Direction.UP); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.idle(15); scene.world.setBlocks(util.select.fromTo(2, 1, 2, 1, 20, 3), Blocks.JUNGLE_LOG.defaultBlockState(), false); scene.world.showSection(util.select.layersFrom(2) @@ -350,7 +350,7 @@ public class MechanicalSawScenes { scene.idle(40); scene.world.restoreBlocks(tree); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.world.glueBlockOnto(util.grid.at(5, 2, 2), Direction.DOWN, contraption); scene.overlay.showText(60) diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/MovementActorScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/MovementActorScenes.java index b0c7129b1..0242b39a9 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/MovementActorScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/MovementActorScenes.java @@ -123,9 +123,9 @@ public class MovementActorScenes { ElementLink entity2 = scene.world.createItemEntity(entitySpawn, util.vector.of(0, 0.2, 0), itemStack); scene.idle(10); - scene.world.modifyEntity(entity1, Entity::remove); + scene.world.modifyEntity(entity1, Entity::discard); scene.idle(10); - scene.world.modifyEntity(entity2, Entity::remove); + scene.world.modifyEntity(entity2, Entity::discard); scene.overlay .showControls(new InputWindowElement(util.vector.topOf(5, 3, 2), Pointing.DOWN).withItem(itemStack), 40); @@ -146,9 +146,9 @@ public class MovementActorScenes { scene.world.createItemOnBelt(beltPos, Direction.EAST, itemStack); scene.idle(20); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.idle(15); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.overlay.showText(120) .placeNearTarget() @@ -282,7 +282,7 @@ public class MovementActorScenes { scene.idle(101); scene.world.hideSection(crops, Direction.DOWN); scene.idle(15); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.world.setBlocks(crops, Blocks.WHEAT.defaultBlockState() .setValue(CropBlock.AGE, 7), false); scene.world.showSection(crops, Direction.UP); @@ -400,7 +400,7 @@ public class MovementActorScenes { scene.world.hideSection(garbage, Direction.UP); scene.idle(40); scene.world.setBlocks(garbage, Blocks.SNOW.defaultBlockState(), false); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); ElementLink chest = scene.world.showIndependentSection(util.select.position(4, 2, 2), Direction.DOWN); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/ProcessingScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/ProcessingScenes.java index c8459c492..a4f2572e3 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/ProcessingScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/ProcessingScenes.java @@ -92,7 +92,7 @@ public class ProcessingScenes { ElementLink entity1 = scene.world.createItemEntity(entitySpawn, util.vector.of(0, 0.2, 0), itemStack); scene.idle(18); - scene.world.modifyEntity(entity1, Entity::remove); + scene.world.modifyEntity(entity1, Entity::discard); scene.world.modifyTileEntity(millstone, MillstoneTileEntity.class, ms -> ms.inputInv.setStackInSlot(0, itemStack)); scene.idle(10); @@ -208,7 +208,7 @@ public class ProcessingScenes { ElementLink entity1 = scene.world.createItemEntity(entitySpawn, util.vector.of(0, 0.2, 0), input); scene.idle(18); - scene.world.modifyEntity(entity1, Entity::remove); + scene.world.modifyEntity(entity1, Entity::discard); Emitter blockSpace = Emitter.withinBlockSpace(new ItemParticleOption(ParticleTypes.ITEM, input), util.vector.of(0, 0, 0)); scene.effects.emitParticles(util.vector.centerOf(center) @@ -235,7 +235,7 @@ public class ProcessingScenes { scene.idle(5); scene.world.showSection(beltCog, Direction.UP); scene.idle(5); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.world.showSection(bottomBelt, Direction.SOUTH); scene.idle(5); @@ -581,7 +581,7 @@ public class ProcessingScenes { .placeNearTarget(); scene.idle(50); - scene.world.modifyEntities(Blaze.class, Entity::remove); + scene.world.modifyEntities(Blaze.class, Entity::discard); scene.idle(20); scene.world.showSection(util.select.position(2, 1, 2), Direction.DOWN); diff --git a/src/main/java/com/simibubi/create/foundation/ponder/content/TunnelScenes.java b/src/main/java/com/simibubi/create/foundation/ponder/content/TunnelScenes.java index 22041d51a..f273f4344 100644 --- a/src/main/java/com/simibubi/create/foundation/ponder/content/TunnelScenes.java +++ b/src/main/java/com/simibubi/create/foundation/ponder/content/TunnelScenes.java @@ -299,15 +299,15 @@ public class TunnelScenes { scene.world.createItemEntity(spawn, m, item1); scene.idle(12); scene.world.createItemOnBelt(beltPos, Direction.UP, item1); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.world.createItemEntity(spawn, m, item2); scene.idle(12); scene.world.createItemOnBelt(beltPos, Direction.UP, item2); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.world.createItemEntity(spawn, m, item3); scene.idle(12); scene.world.createItemOnBelt(beltPos, Direction.UP, item3); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.idle(50); scene.world.showSectionAndMerge(util.select.position(3, 5, 2), Direction.DOWN, newBelt); @@ -324,15 +324,15 @@ public class TunnelScenes { scene.world.createItemEntity(spawn, m, item1); scene.idle(12); scene.world.createItemOnBelt(beltPos, Direction.EAST, item1); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.world.createItemEntity(spawn, m, item2); scene.idle(12); scene.world.createItemOnBelt(beltPos, Direction.EAST, item2); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.world.createItemEntity(spawn, m, item3); scene.idle(12); scene.world.createItemOnBelt(beltPos, Direction.EAST, item3); - scene.world.modifyEntities(ItemEntity.class, Entity::remove); + scene.world.modifyEntities(ItemEntity.class, Entity::discard); scene.idle(30); } 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 3c84ff944..84e6c9fc6 100644 --- a/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java +++ b/src/main/java/com/simibubi/create/foundation/utility/BlockHelper.java @@ -54,50 +54,6 @@ import net.minecraftforge.event.world.BlockEvent; public class BlockHelper { - @OnlyIn(Dist.CLIENT) - public static void addReducedDestroyEffects(BlockState state, Level worldIn, BlockPos pos, ParticleEngine manager) { - if (!(worldIn instanceof ClientLevel)) - return; - ClientLevel world = (ClientLevel) worldIn; - VoxelShape voxelshape = state.getShape(world, pos); - MutableInt amtBoxes = new MutableInt(0); - voxelshape.forAllBoxes((x1, y1, z1, x2, y2, z2) -> amtBoxes.increment()); - double chance = 1d / amtBoxes.getValue(); - - if (state.isAir()) - return; - if (RenderProperties.get(state) - .addDestroyEffects(state, worldIn, pos, manager)) - return; - - voxelshape.forAllBoxes((p_172273_, p_172274_, p_172275_, p_172276_, p_172277_, p_172278_) -> { - double d1 = Math.min(1.0D, p_172276_ - p_172273_); - double d2 = Math.min(1.0D, p_172277_ - p_172274_); - double d3 = Math.min(1.0D, p_172278_ - p_172275_); - int i = Math.max(2, Mth.ceil(d1 / 0.25D)); - int j = Math.max(2, Mth.ceil(d2 / 0.25D)); - int k = Math.max(2, Mth.ceil(d3 / 0.25D)); - - for (int l = 0; l < i; ++l) { - for (int i1 = 0; i1 < j; ++i1) { - for (int j1 = 0; j1 < k; ++j1) { - if (world.random.nextDouble() > chance) - continue; - - double d4 = ((double) l + 0.5D) / (double) i; - double d5 = ((double) i1 + 0.5D) / (double) j; - double d6 = ((double) j1 + 0.5D) / (double) k; - double d7 = d4 * d1 + p_172273_; - double d8 = d5 * d2 + p_172274_; - double d9 = d6 * d3 + p_172275_; - manager.add(new TerrainParticle(world, pos.getX() + d7, pos.getY() + d8, pos.getZ() + d9, - d4 - 0.5D, d5 - 0.5D, d6 - 0.5D, state, pos).updateSprite(state, pos)); - } - } - } - }); - } - public static BlockState setZeroAge(BlockState blockState) { if (blockState.hasProperty(BlockStateProperties.AGE_1)) return blockState.setValue(BlockStateProperties.AGE_1, 0); diff --git a/src/main/java/com/simibubi/create/foundation/utility/ReducedDestroyEffects.java b/src/main/java/com/simibubi/create/foundation/utility/ReducedDestroyEffects.java new file mode 100644 index 000000000..d1f0ecc0d --- /dev/null +++ b/src/main/java/com/simibubi/create/foundation/utility/ReducedDestroyEffects.java @@ -0,0 +1,60 @@ +package com.simibubi.create.foundation.utility; + +import org.apache.commons.lang3.mutable.MutableInt; + +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.client.particle.ParticleEngine; +import net.minecraft.client.particle.TerrainParticle; +import net.minecraft.core.BlockPos; +import net.minecraft.util.Mth; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.state.BlockState; +import net.minecraft.world.phys.shapes.VoxelShape; +import net.minecraftforge.client.IBlockRenderProperties; + +public class ReducedDestroyEffects implements IBlockRenderProperties { + + @Override + public boolean addDestroyEffects(BlockState state, Level worldIn, BlockPos pos, ParticleEngine manager) { + if (!(worldIn instanceof ClientLevel)) + return true; + ClientLevel world = (ClientLevel) worldIn; + VoxelShape voxelshape = state.getShape(world, pos); + MutableInt amtBoxes = new MutableInt(0); + voxelshape.forAllBoxes((x1, y1, z1, x2, y2, z2) -> amtBoxes.increment()); + double chance = 1d / amtBoxes.getValue(); + + if (state.isAir()) + return true; + + voxelshape.forAllBoxes((p_172273_, p_172274_, p_172275_, p_172276_, p_172277_, p_172278_) -> { + double d1 = Math.min(1.0D, p_172276_ - p_172273_); + double d2 = Math.min(1.0D, p_172277_ - p_172274_); + double d3 = Math.min(1.0D, p_172278_ - p_172275_); + int i = Math.max(2, Mth.ceil(d1 / 0.25D)); + int j = Math.max(2, Mth.ceil(d2 / 0.25D)); + int k = Math.max(2, Mth.ceil(d3 / 0.25D)); + + for (int l = 0; l < i; ++l) { + for (int i1 = 0; i1 < j; ++i1) { + for (int j1 = 0; j1 < k; ++j1) { + if (world.random.nextDouble() > chance) + continue; + + double d4 = ((double) l + 0.5D) / (double) i; + double d5 = ((double) i1 + 0.5D) / (double) j; + double d6 = ((double) j1 + 0.5D) / (double) k; + double d7 = d4 * d1 + p_172273_; + double d8 = d5 * d2 + p_172274_; + double d9 = d6 * d3 + p_172275_; + manager.add(new TerrainParticle(world, pos.getX() + d7, pos.getY() + d8, pos.getZ() + d9, + d4 - 0.5D, d5 - 0.5D, d6 - 0.5D, state, pos).updateSprite(state, pos)); + } + } + } + }); + + return true; + } + +} diff --git a/src/main/resources/assets/create/textures/gui/icons.png b/src/main/resources/assets/create/textures/gui/icons.png index 503558349f5ba7de42a0f2f2e849e7f344c36455..533050cfeef7a1c3912b4ac777408c95d23df817 100644 GIT binary patch delta 3389 zcmb_ec|6oz`yR#`V@qUB7-dgUwz12;X5Z(L3<@ckgfC4<9!oOz7<=|@W+H30?CT7b zT|CyYGbFs8p5OEP@BQyRf1Pum`+V+m&gZ(W`wA1u6{)170U*?RTIv=^CsIn7#)KlH zHoUTG`|xZtc!Y?SP|zEt%=aMG+#W;Uw`ViO!-5$HctPW_*TVi%RGK^fd|ZpoPVkw} z5%R1au+Mf_h8TAy*IN%hac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