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 503558349..533050cfe 100644 Binary files a/src/main/resources/assets/create/textures/gui/icons.png and b/src/main/resources/assets/create/textures/gui/icons.png differ