From 21cdea67f6369e3845f391ab13713d185d61e182 Mon Sep 17 00:00:00 2001 From: Snownee <1850986885@qq.com> Date: Mon, 18 May 2020 22:13:07 +0800 Subject: [PATCH 1/7] Fix AirCurrent damage handling --- .../contraptions/components/fan/AirCurrent.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/fan/AirCurrent.java b/src/main/java/com/simibubi/create/modules/contraptions/components/fan/AirCurrent.java index 7d472a462..982b5740f 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/fan/AirCurrent.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/fan/AirCurrent.java @@ -17,7 +17,9 @@ import com.simibubi.create.modules.logistics.InWorldProcessing.Type; import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; import net.minecraft.entity.item.ItemEntity; +import net.minecraft.entity.monster.EndermanEntity; import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.nbt.CompoundNBT; import net.minecraft.state.properties.BlockStateProperties; @@ -113,14 +115,21 @@ public class AirCurrent { } else { switch (processingType) { case BLASTING: - entity.setFire(10); - entity.attackEntityFrom(damageSourceLava, 4); + if (!entity.isImmuneToFire()) { + entity.setFire(10); + entity.attackEntityFrom(damageSourceLava, 4); + } break; case SMOKING: - entity.setFire(2); - entity.attackEntityFrom(damageSourceFire, 2); + if (!entity.isImmuneToFire()) { + entity.setFire(2); + entity.attackEntityFrom(damageSourceFire, 2); + } break; case SPLASHING: + if (entity instanceof EndermanEntity || entity.getType() == EntityType.SNOW_GOLEM || entity.getType() == EntityType.BLAZE) { + entity.attackEntityFrom(DamageSource.DROWN, 2); + } if (!entity.isBurning()) break; entity.extinguish(); From 4a7ad75cd0a1125c4156c5df94ea0bae65f98498 Mon Sep 17 00:00:00 2001 From: Snownee <1850986885@qq.com> Date: Mon, 18 May 2020 22:29:25 +0800 Subject: [PATCH 2/7] Fix sand paper is sometimes stackable --- .../curiosities/tools/SandPaperItem.java | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) diff --git a/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItem.java b/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItem.java index 6747f1f5a..542affa6c 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItem.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/tools/SandPaperItem.java @@ -33,7 +33,7 @@ import net.minecraftforge.common.util.FakePlayer; public class SandPaperItem extends Item implements IHaveCustomItemModel { public SandPaperItem(Properties properties) { - super(properties); + super(properties.maxDamage(8)); } @Override @@ -173,21 +173,6 @@ public class SandPaperItem extends Item implements IHaveCustomItemModel { return 32; } - @Override - public int getItemStackLimit(ItemStack stack) { - return 1; - } - - @Override - public boolean isDamageable() { - return true; - } - - @Override - public int getMaxDamage(ItemStack stack) { - return 8; - } - @Override public int getItemEnchantability() { return 5; From 137841859360b5385cddcece9a8c2589e6cebfe9 Mon Sep 17 00:00:00 2001 From: Snownee <1850986885@qq.com> Date: Mon, 18 May 2020 22:35:11 +0800 Subject: [PATCH 3/7] Fix deployer can eat --- .../contraptions/components/deployer/DeployerFakePlayer.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerFakePlayer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerFakePlayer.java index f5f71dc1a..ec3768403 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerFakePlayer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerFakePlayer.java @@ -82,6 +82,11 @@ public class DeployerFakePlayer extends FakePlayer { return 1 / 64f; } + @Override + public boolean canEat(boolean ignoreHunger) { + return false; + } + @SubscribeEvent public static void deployerHasEyesOnHisFeet(EntityEvent.EyeHeight event) { if (event.getEntity() instanceof DeployerFakePlayer) From 485e6c529dec7e98982c70638559b5236bf20b14 Mon Sep 17 00:00:00 2001 From: Snownee <1850986885@qq.com> Date: Mon, 18 May 2020 23:57:49 +0800 Subject: [PATCH 4/7] Implement IHaveColorHandler on WindowInABlockBlock https://discordapp.com/channels/620934202875183104/689866656914210897/700713829407129620 --- .../partialWindows/WindowInABlockBlock.java | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java b/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java index f913a6bb1..a38ffafbd 100644 --- a/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java +++ b/src/main/java/com/simibubi/create/modules/curiosities/partialWindows/WindowInABlockBlock.java @@ -4,6 +4,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.List; +import com.simibubi.create.foundation.block.IHaveColorHandler; import com.simibubi.create.foundation.block.IHaveCustomBlockModel; import com.simibubi.create.foundation.block.IHaveNoBlockItem; import com.simibubi.create.foundation.block.ITE; @@ -15,6 +16,8 @@ import net.minecraft.block.FourWayBlock; import net.minecraft.block.PaneBlock; import net.minecraft.block.material.Material; import net.minecraft.block.material.MaterialColor; +import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.entity.Entity; import net.minecraft.entity.player.PlayerEntity; @@ -47,7 +50,7 @@ import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; public class WindowInABlockBlock extends PaneBlock - implements ITE, IHaveNoBlockItem, IHaveCustomBlockModel { + implements ITE, IHaveNoBlockItem, IHaveCustomBlockModel, IHaveColorHandler { public WindowInABlockBlock() { super(Properties.create(Material.ROCK)); @@ -210,6 +213,7 @@ public class WindowInABlockBlock extends PaneBlock return Blocks.AIR.getDefaultState(); } + @Override @OnlyIn(Dist.CLIENT) public boolean isSideInvisible(BlockState state, BlockState adjacentBlockState, Direction side) { return false; @@ -226,4 +230,16 @@ public class WindowInABlockBlock extends PaneBlock return WindowInABlockTileEntity.class; } + @Override + @OnlyIn(Dist.CLIENT) + public IBlockColor getColorHandler() { + return (state, world, pos, index) -> { + try { + BlockState surrounding = getSurroundingBlockState(world, pos); + return Minecraft.getInstance().getBlockColors().getColor(surrounding, world, pos, index); + } catch (Exception e) {} + return -1; + }; + } + } From 282445d2ac12ccd6c4d3d4a34b6cb891779941ce Mon Sep 17 00:00:00 2001 From: Snownee <1850986885@qq.com> Date: Tue, 19 May 2020 01:43:59 +0800 Subject: [PATCH 5/7] Fix deployer can eat, part 2 --- .../contraptions/components/deployer/DeployerHandler.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerHandler.java b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerHandler.java index 14400a1ac..5c6b9a069 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerHandler.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerHandler.java @@ -266,8 +266,6 @@ public class DeployerHandler { CompoundNBT tag = stack.getOrCreateTag(); if (stack.getItem() instanceof SandPaperItem && tag.contains("Polishing")) player.spawnedItemEffects = ItemStack.read(tag.getCompound("Polishing")); - if (stack.isFood()) - player.spawnedItemEffects = stack.copy(); if (!player.getActiveItemStack().isEmpty()) player.setHeldItem(hand, stack.onItemUseFinish(world, player)); From f08a5746534a810dac22d1aa7fb4b53723d613ab Mon Sep 17 00:00:00 2001 From: Snownee <1850986885@qq.com> Date: Tue, 19 May 2020 02:06:22 +0800 Subject: [PATCH 6/7] Add deployer feeding --- .../components/deployer/DeployerFakePlayer.java | 6 ++++++ .../components/deployer/DeployerHandler.java | 9 +++++++++ 2 files changed, 15 insertions(+) diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerFakePlayer.java b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerFakePlayer.java index ec3768403..bd8fd3288 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerFakePlayer.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerFakePlayer.java @@ -30,6 +30,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.StringTextComponent; +import net.minecraft.world.World; import net.minecraft.world.server.ServerWorld; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -87,6 +88,11 @@ public class DeployerFakePlayer extends FakePlayer { return false; } + @Override + public ItemStack onFoodEaten(World world, ItemStack stack) { + return stack; + } + @SubscribeEvent public static void deployerHasEyesOnHisFeet(EntityEvent.EyeHeight event) { if (event.getEntity() instanceof DeployerFakePlayer) diff --git a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerHandler.java b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerHandler.java index 5c6b9a069..d19f330a0 100644 --- a/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerHandler.java +++ b/src/main/java/com/simibubi/create/modules/contraptions/components/deployer/DeployerHandler.java @@ -20,6 +20,7 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.LivingEntity; import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.item.ItemEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.fluid.Fluid; import net.minecraft.fluid.Fluids; import net.minecraft.inventory.EquipmentSlotType; @@ -137,6 +138,14 @@ public class DeployerHandler { && stack.interactWithEntity(player, (LivingEntity) entity, hand)) success = true; } + if (!success && stack.isFood() && entity instanceof PlayerEntity) { + PlayerEntity playerEntity = (PlayerEntity) entity; + if (playerEntity.canEat(item.getFood().canEatWhenFull())) { + playerEntity.onFoodEaten(world, stack); + player.spawnedItemEffects = stack.copy(); + success = true; + } + } } // Punch entity From 3890698a4b26b9a3564331df8177f732026a904d Mon Sep 17 00:00:00 2001 From: Snownee <1850986885@qq.com> Date: Tue, 19 May 2020 13:29:11 +0800 Subject: [PATCH 7/7] Fix GUI rendering order --- .../create/foundation/gui/AbstractSimiContainerScreen.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java index 1a1f5e3d1..917c16f9a 100644 --- a/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java +++ b/src/main/java/com/simibubi/create/foundation/gui/AbstractSimiContainerScreen.java @@ -44,6 +44,9 @@ public abstract class AbstractSimiContainerScreen extends C renderBackground(); renderWindow(mouseX, mouseY, partialTicks); + for (Widget widget : widgets) + widget.render(mouseX, mouseY, partialTicks); + super.render(mouseX, mouseY, partialTicks); GlStateManager.enableAlphaTest(); @@ -52,9 +55,6 @@ public abstract class AbstractSimiContainerScreen extends C RenderHelper.disableStandardItemLighting(); GlStateManager.disableLighting(); GlStateManager.disableDepthTest(); - - for (Widget widget : widgets) - widget.render(mouseX, mouseY, partialTicks); renderWindowForeground(mouseX, mouseY, partialTicks); for (Widget widget : widgets) widget.renderToolTip(mouseX, mouseY);