From 8737bc28f6e676e2e76c820700f623ca1fe6b1c9 Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Tue, 28 Jan 2020 18:08:56 +0100 Subject: [PATCH] part 1 --- build.gradle | 4 +- .../java/de/ellpeck/naturesaura/Helper.java | 37 +++++----- .../api/recipes/ing/NBTIngredient.java | 3 +- .../blocks/BlockAncientLeaves.java | 3 +- .../blocks/BlockAncientSapling.java | 5 +- .../blocks/BlockAnimalGenerator.java | 2 +- .../blocks/BlockContainerImpl.java | 3 +- .../blocks/BlockDecayedLeaves.java | 14 +--- .../blocks/BlockDimensionRail.java | 7 +- .../naturesaura/blocks/BlockEnderCrate.java | 14 ++-- .../naturesaura/blocks/BlockFieldCreator.java | 22 ++---- .../blocks/BlockFurnaceHeater.java | 5 -- .../blocks/BlockGeneratorLimitRemover.java | 10 ++- .../naturesaura/blocks/BlockGoldPowder.java | 17 ++--- .../naturesaura/blocks/BlockGoldenLeaves.java | 5 +- .../naturesaura/blocks/BlockGratedChute.java | 22 ++---- .../naturesaura/blocks/BlockNatureAltar.java | 16 +++-- .../blocks/BlockOfferingTable.java | 16 +++-- .../blocks/BlockPickupStopper.java | 6 +- .../blocks/BlockProjectileGenerator.java | 15 ++-- .../naturesaura/blocks/BlockSpawnLamp.java | 7 -- .../naturesaura/blocks/BlockWoodStand.java | 14 ++-- .../blocks/tiles/TileEntityAnimalSpawner.java | 2 +- .../blocks/tiles/TileEntityAutoCrafter.java | 4 +- .../blocks/tiles/TileEntityEndFlower.java | 2 +- .../tiles/TileEntityFireworkGenerator.java | 4 +- .../blocks/tiles/TileEntityHopperUpgrade.java | 2 +- .../blocks/tiles/TileEntityOfferingTable.java | 2 +- .../blocks/tiles/TileEntityWoodStand.java | 2 +- .../blocks/tiles/render/RenderEnderCrate.java | 21 ++++-- .../render/RenderGeneratorLimitRemover.java | 55 ++++++++------- .../tiles/render/RenderNatureAltar.java | 18 +++-- .../tiles/render/RenderOfferingTable.java | 42 ++++++----- .../render/RenderProjectileGenerator.java | 23 ++++--- .../blocks/tiles/render/RenderWoodStand.java | 21 ++++-- .../chunk/effect/AnimalEffect.java | 8 +-- .../chunk/effect/PlantBoostEffect.java | 3 +- .../compat/jei/AnimalSpawnerCategory.java | 14 ++-- .../compat/patchouli/PatchouliCompat.java | 7 +- .../entities/EntityEffectInhibitor.java | 8 +-- .../entities/EntityMoverMinecart.java | 4 +- .../render/RenderEffectInhibitor.java | 16 ++--- .../entities/render/RenderMoverMinecart.java | 16 +++-- .../naturesaura/events/ClientEvents.java | 69 +++++++++---------- .../naturesaura/events/CommonEvents.java | 2 +- .../naturesaura/items/ItemAuraBottle.java | 2 +- .../naturesaura/items/ItemBirthSpirit.java | 2 +- .../naturesaura/items/ItemColorChanger.java | 7 +- .../items/ItemRangeVisualizer.java | 2 +- .../items/ItemShockwaveCreator.java | 14 ++-- .../naturesaura/items/tools/ItemShovel.java | 2 +- .../naturesaura/misc/BlockLootProvider.java | 13 ++-- .../ellpeck/naturesaura/misc/WorldData.java | 7 +- .../naturesaura/packet/PacketParticles.java | 2 +- .../particles/ParticleHandler.java | 30 ++++---- .../naturesaura/particles/ParticleMagic.java | 53 +++++++------- .../naturesaura/proxy/ClientProxy.java | 11 ++- .../de/ellpeck/naturesaura/proxy/IProxy.java | 3 +- .../naturesaura/proxy/ServerProxy.java | 3 +- .../naturesaura/reg/ITESRProvider.java | 7 +- .../naturesaura/reg/ModArmorMaterial.java | 6 +- .../ellpeck/naturesaura/reg/ModItemTier.java | 6 +- .../ellpeck/naturesaura/reg/ModRegistry.java | 4 +- .../renderers/PlayerLayerTrinkets.java | 35 +++++----- .../renderers/SupporterFancyHandler.java | 8 +-- 65 files changed, 426 insertions(+), 383 deletions(-) diff --git a/build.gradle b/build.gradle index a5f786f0..28debfc7 100644 --- a/build.gradle +++ b/build.gradle @@ -20,7 +20,7 @@ archivesBaseName = 'NaturesAura' sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. minecraft { - mappings channel: 'snapshot', version: '20190719-1.14.3' + mappings channel: 'snapshot', version: '20200128-1.15.1' runs { client { @@ -97,7 +97,7 @@ dependencies { compileOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2:api") runtimeOnly fg.deobf("mezz.jei:jei-1.15.2:6.0.0.2") - //compile fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.14.4:5.0.1.162") + compile fg.deobf("com.blamejared.crafttweaker:CraftTweaker-1.15.1:6.0.0.4") compile fg.deobf("vazkii.patchouli:Patchouli:1.1-25.4") runtimeOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.15.2-2.0-beta2") diff --git a/src/main/java/de/ellpeck/naturesaura/Helper.java b/src/main/java/de/ellpeck/naturesaura/Helper.java index e2f9f419..71722177 100644 --- a/src/main/java/de/ellpeck/naturesaura/Helper.java +++ b/src/main/java/de/ellpeck/naturesaura/Helper.java @@ -1,6 +1,7 @@ package de.ellpeck.naturesaura; import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge; @@ -13,7 +14,6 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.model.ItemCameraTransforms; import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemFrameEntity; import net.minecraft.entity.player.PlayerEntity; @@ -127,34 +127,35 @@ public final class Helper { @OnlyIn(Dist.CLIENT) public static void renderItemInWorld(ItemStack stack) { - if (!stack.isEmpty()) { - GlStateManager.pushMatrix(); - GlStateManager.disableLighting(); + // TODO rendering items in world + /* if (!stack.isEmpty()) { + RenderSystem.pushMatrix(); + RenderSystem.disableLighting(); RenderHelper.enableStandardItemLighting(); Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.FIXED); RenderHelper.disableStandardItemLighting(); - GlStateManager.enableLighting(); - GlStateManager.popMatrix(); - } + RenderSystem.enableLighting(); + RenderSystem.popMatrix(); + }*/ } @OnlyIn(Dist.CLIENT) public static void renderItemInGui(ItemStack stack, int x, int y, float scale) { - GlStateManager.pushMatrix(); + RenderSystem.pushMatrix(); GlStateManager.enableBlend(); GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA); - RenderHelper.enableGUIStandardItemLighting(); + RenderHelper.setupGuiFlatDiffuseLighting(); GlStateManager.enableDepthTest(); - GlStateManager.enableRescaleNormal(); - GlStateManager.translatef(x, y, 0); - GlStateManager.scalef(scale, scale, scale); + RenderSystem.enableRescaleNormal(); + RenderSystem.translatef(x, y, 0); + RenderSystem.scalef(scale, scale, scale); Minecraft.getInstance().getItemRenderer().renderItemAndEffectIntoGUI(stack, 0, 0); Minecraft.getInstance().getItemRenderer().renderItemOverlayIntoGUI(Minecraft.getInstance().fontRenderer, stack, 0, 0, null); RenderHelper.disableStandardItemLighting(); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); } - public static boolean putStackOnTile(PlayerEntity player, Hand hand, BlockPos pos, int slot, boolean sound) { + public static ActionResultType putStackOnTile(PlayerEntity player, Hand hand, BlockPos pos, int slot, boolean sound) { TileEntity tile = player.world.getTileEntity(pos); if (tile instanceof TileEntityImpl) { IItemHandlerModifiable handler = ((TileEntityImpl) tile).getItemHandler(null); @@ -168,7 +169,7 @@ public final class Helper { SoundEvents.ENTITY_ITEM_FRAME_ADD_ITEM, SoundCategory.PLAYERS, 0.75F, 1F); if (!player.world.isRemote) player.setHeldItem(hand, remain); - return true; + return ActionResultType.SUCCESS; } } @@ -179,16 +180,16 @@ public final class Helper { if (!player.world.isRemote) { ItemStack stack = handler.getStackInSlot(slot); if (!player.addItemStackToInventory(stack)) { - ItemEntity item = new ItemEntity(player.world, player.posX, player.posY, player.posZ, stack); + ItemEntity item = new ItemEntity(player.world, player.getPosX(), player.getPosY(), player.getPosZ(), stack); player.world.addEntity(item); } handler.setStackInSlot(slot, ItemStack.EMPTY); } - return true; + return ActionResultType.SUCCESS; } } } - return false; + return ActionResultType.FAIL; } public static ICapabilityProvider makeRechargeProvider(ItemStack stack, boolean needsSelected) { diff --git a/src/main/java/de/ellpeck/naturesaura/api/recipes/ing/NBTIngredient.java b/src/main/java/de/ellpeck/naturesaura/api/recipes/ing/NBTIngredient.java index dff9cf4c..61152bde 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/recipes/ing/NBTIngredient.java +++ b/src/main/java/de/ellpeck/naturesaura/api/recipes/ing/NBTIngredient.java @@ -1,9 +1,8 @@ package de.ellpeck.naturesaura.api.recipes.ing; import net.minecraft.item.ItemStack; -import net.minecraftforge.common.crafting.IngredientNBT; -public class NBTIngredient extends IngredientNBT { +public class NBTIngredient extends net.minecraftforge.common.crafting.NBTIngredient { public NBTIngredient(ItemStack stack) { super(stack); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java index 4e9e7124..0cd04aee 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java @@ -14,6 +14,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; +import net.minecraft.world.server.ServerWorld; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -78,7 +79,7 @@ public class BlockAncientLeaves extends LeavesBlock implements } @Override - public void tick(BlockState state, World worldIn, BlockPos pos, Random random) { + public void tick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { super.tick(state, worldIn, pos, random); if (!worldIn.isRemote) { TileEntity tile = worldIn.getTileEntity(pos); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java index 55c02f5a..cd96a5de 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java @@ -13,6 +13,7 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; import net.minecraft.world.gen.feature.IFeatureConfig; +import net.minecraft.world.server.ServerWorld; import net.minecraftforge.event.ForgeEventFactory; import java.util.Random; @@ -31,7 +32,7 @@ public class BlockAncientSapling extends BushBlock implements IGrowable, IModIte } @Override - public void randomTick(BlockState state, World world, BlockPos pos, Random random) { + public void randomTick(BlockState state, ServerWorld world, BlockPos pos, Random random) { if (!world.isRemote) { super.randomTick(state, world, pos, random); @@ -62,7 +63,7 @@ public class BlockAncientSapling extends BushBlock implements IGrowable, IModIte } @Override - public void grow(World world, Random rand, BlockPos pos, BlockState state) { + public void grow(ServerWorld world, Random rand, BlockPos pos, BlockState state) { if (state.get(SaplingBlock.STAGE) == 0) { world.setBlockState(pos, state.cycle(SaplingBlock.STAGE), 4); } else if (ForgeEventFactory.saplingGrowTree(world, rand, pos)) { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalGenerator.java index bf638813..2d300cef 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalGenerator.java @@ -73,7 +73,7 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali BlockPos genPos = gen.getPos(); PacketHandler.sendToAllAround(entity.world, pos, 32, new PacketParticles( - (float) entity.posX, (float) entity.posY, (float) entity.posZ, PacketParticles.Type.ANIMAL_GEN_CONSUME, + (float) entity.getPosX(), (float) entity.getPosY(), (float) entity.getPosZ(), PacketParticles.Type.ANIMAL_GEN_CONSUME, child ? 1 : 0, (int) (entity.getEyeHeight() * 10F), genPos.getX(), genPos.getY(), genPos.getZ())); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java index 4f118ee9..42c43c93 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java @@ -15,6 +15,7 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; +import net.minecraft.world.server.ServerWorld; import net.minecraft.world.storage.loot.LootContext; import net.minecraft.world.storage.loot.LootParameters; @@ -126,7 +127,7 @@ public class BlockContainerImpl extends ContainerBlock implements IModItem, IMod } @Override - public void tick(BlockState state, World worldIn, BlockPos pos, Random random) { + public void tick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { if (!worldIn.isRemote) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityImpl) { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockDecayedLeaves.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockDecayedLeaves.java index 43fe0e18..9fd6feda 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockDecayedLeaves.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockDecayedLeaves.java @@ -4,11 +4,8 @@ import net.minecraft.block.BlockState; import net.minecraft.block.Blocks; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; +import net.minecraft.world.server.ServerWorld; import java.util.Random; @@ -19,15 +16,10 @@ public class BlockDecayedLeaves extends BlockImpl { } @Override - @OnlyIn(Dist.CLIENT) - public BlockRenderLayer getRenderLayer() { - return BlockRenderLayer.CUTOUT_MIPPED; - } - - @Override - public void tick(BlockState state, World world, BlockPos pos, Random random) { + public void tick(BlockState state, ServerWorld world, BlockPos pos, Random random) { if (!world.isRemote) { world.setBlockState(pos, Blocks.AIR.getDefaultState()); } } + } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java index 13b3506d..67dad3dd 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java @@ -22,6 +22,7 @@ import net.minecraft.state.IProperty; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.RailShape; +import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; @@ -66,16 +67,16 @@ public class BlockDimensionRail extends AbstractRailBlock implements IModItem, I } @Override - public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { + public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult hit) { ItemStack stack = player.getHeldItem(hand); if (stack.getItem() == ModItems.RANGE_VISUALIZER) { if (!worldIn.isRemote) { BlockPos goalPos = this.getGoalCoords(worldIn, pos); PacketHandler.sendTo(player, new PacketClient(0, this.goalDim, goalPos.getX(), goalPos.getY(), goalPos.getZ())); } - return true; + return ActionResultType.SUCCESS; } - return false; + return ActionResultType.FAIL; } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java index 5c0b387f..a3abbacb 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java @@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.misc.IWorldData; +import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate; import de.ellpeck.naturesaura.blocks.tiles.render.RenderEnderCrate; import de.ellpeck.naturesaura.items.ModItems; @@ -11,6 +12,7 @@ import net.minecraft.block.BlockState; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; import net.minecraft.entity.player.PlayerEntity; @@ -20,6 +22,8 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.Items; import net.minecraft.particles.ParticleTypes; import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.Tuple; import net.minecraft.util.math.BlockPos; @@ -41,6 +45,7 @@ import javax.annotation.Nullable; import java.lang.ref.WeakReference; import java.util.List; import java.util.Random; +import java.util.function.Function; public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider { @@ -103,7 +108,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider } @Override - public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { if (!worldIn.isRemote) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityEnderCrate) { @@ -114,7 +119,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider } } } - return true; + return ActionResultType.SUCCESS; } @Override @@ -140,8 +145,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider } @Override - @OnlyIn(Dist.CLIENT) - public Tuple getTESR() { - return new Tuple<>(TileEntityEnderCrate.class, new RenderEnderCrate()); + public Tuple>> getTESR() { + return new Tuple<>(ModTileEntities.ENDER_CRATE, RenderEnderCrate::new); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java index 13726585..a3b1a896 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java @@ -2,7 +2,6 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.NaturesAuraAPI; -import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.TileEntityFieldCreator; import net.minecraft.block.BlockState; import net.minecraft.block.SoundType; @@ -10,7 +9,7 @@ import net.minecraft.block.material.Material; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; @@ -28,13 +27,13 @@ public class BlockFieldCreator extends BlockContainerImpl { } @Override - public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult p_225533_6_) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityFieldCreator) { if (!worldIn.isRemote) { String key = NaturesAura.MOD_ID + ":field_creator_pos"; CompoundNBT compound = player.getPersistentData(); - if (!player.isSneaking() && compound.contains(key)) { + if (!player.isShiftKeyDown() && compound.contains(key)) { BlockPos stored = BlockPos.fromLong(compound.getLong(key)); TileEntityFieldCreator creator = (TileEntityFieldCreator) tile; if (!pos.equals(stored)) { @@ -63,9 +62,9 @@ public class BlockFieldCreator extends BlockContainerImpl { player.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".stored_pos"), true); } } - return true; + return ActionResultType.SUCCESS; } else - return false; + return ActionResultType.FAIL; } @Override @@ -90,19 +89,8 @@ public class BlockFieldCreator extends BlockContainerImpl { } } - @Override - @OnlyIn(Dist.CLIENT) - public BlockRenderLayer getRenderLayer() { - return BlockRenderLayer.CUTOUT; - } - @Override public boolean isNormalCube(BlockState state, IBlockReader worldIn, BlockPos pos) { return false; } - - @Override - public boolean isSolid(BlockState state) { - return false; - } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java index d2c263e6..8a67fed8 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java @@ -82,11 +82,6 @@ public class BlockFurnaceHeater extends BlockContainerImpl { return false; } - @Override - public boolean isSolid(BlockState state) { - return false; - } - @Override protected void fillStateContainer(StateContainer.Builder builder) { builder.add(FACING); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java index 345af0ed..ee1db6e2 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java @@ -1,15 +1,21 @@ package de.ellpeck.naturesaura.blocks; +import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.TileEntityGeneratorLimitRemover; import de.ellpeck.naturesaura.blocks.tiles.render.RenderGeneratorLimitRemover; import de.ellpeck.naturesaura.reg.ITESRProvider; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Tuple; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import java.util.function.Function; + public class BlockGeneratorLimitRemover extends BlockContainerImpl implements ITESRProvider { public BlockGeneratorLimitRemover() { @@ -18,7 +24,7 @@ public class BlockGeneratorLimitRemover extends BlockContainerImpl implements IT @Override @OnlyIn(Dist.CLIENT) - public Tuple getTESR() { - return new Tuple<>(TileEntityGeneratorLimitRemover.class, new RenderGeneratorLimitRemover()); + public Tuple>> getTESR() { + return new Tuple<>(ModTileEntities.GENERATOR_LIMIT_REMOVER, RenderGeneratorLimitRemover::new); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java index 163a2f6d..40b4f9fc 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java @@ -11,7 +11,6 @@ import net.minecraft.state.EnumProperty; import net.minecraft.state.StateContainer; import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.state.properties.RedstoneSide; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.shapes.ISelectionContext; @@ -21,8 +20,6 @@ import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.IWorldReader; import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock { @@ -96,9 +93,9 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock { BlockPos blockpos1 = pos.up(); BlockState blockstate1 = worldIn.getBlockState(blockpos1); if (!blockstate1.isNormalCube(worldIn, blockpos1)) { - boolean flag = blockstate.func_224755_d(worldIn, blockpos, Direction.UP) || blockstate.getBlock() == Blocks.HOPPER; + boolean flag = blockstate.isSolidSide(worldIn, blockpos, Direction.UP) || blockstate.getBlock() == Blocks.HOPPER; if (flag && this.canConnectTo(worldIn.getBlockState(blockpos.up()))) { - if (blockstate.func_224756_o(worldIn, blockpos)) { + if (blockstate.isCollisionShapeOpaque(worldIn, blockpos)) { return RedstoneSide.UP; } @@ -118,7 +115,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock { public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) { BlockPos blockpos = pos.down(); BlockState blockstate = worldIn.getBlockState(blockpos); - return blockstate.func_224755_d(worldIn, blockpos, Direction.UP) || blockstate.getBlock() == Blocks.HOPPER; + return blockstate.isSolidSide(worldIn, blockpos, Direction.UP) || blockstate.getBlock() == Blocks.HOPPER; } @Override @@ -183,7 +180,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock { @Override public void updateDiagonalNeighbors(BlockState state, IWorld worldIn, BlockPos pos, int flags) { - try (BlockPos.PooledMutableBlockPos pool = BlockPos.PooledMutableBlockPos.retain()) { + try (BlockPos.PooledMutable pool = BlockPos.PooledMutable.retain()) { for (Direction direction : Direction.Plane.HORIZONTAL) { RedstoneSide redstoneside = state.get(RedstoneWireBlock.FACING_PROPERTY_MAP.get(direction)); if (redstoneside != RedstoneSide.NONE && worldIn.getBlockState(pool.setPos(pos).move(direction)).getBlock() != this) { @@ -217,10 +214,4 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock { } } } - - @Override - @OnlyIn(Dist.CLIENT) - public BlockRenderLayer getRenderLayer() { - return BlockRenderLayer.CUTOUT; - } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java index 133c47c3..cd3c605c 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java @@ -17,6 +17,7 @@ import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeColors; +import net.minecraft.world.server.ServerWorld; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -62,7 +63,7 @@ public class BlockGoldenLeaves extends LeavesBlock implements return (state, worldIn, pos, tintIndex) -> { int color = 0xF2FF00; if (state != null && worldIn != null && pos != null) { - int foliage = BiomeColors.getFoliageColor(worldIn, pos); + int foliage = BiomeColors.func_228361_b_(worldIn, pos); return Helper.blendColors(color, foliage, state.get(STAGE) / (float) HIGHEST_STAGE); } else { return color; @@ -77,7 +78,7 @@ public class BlockGoldenLeaves extends LeavesBlock implements } @Override - public void randomTick(BlockState state, World worldIn, BlockPos pos, Random random) { + public void randomTick(BlockState state, ServerWorld worldIn, BlockPos pos, Random random) { super.randomTick(state, worldIn, pos, random); if (!worldIn.isRemote) { int stage = state.get(STAGE); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java index 2025988b..23f2e2aa 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java @@ -10,7 +10,7 @@ import net.minecraft.state.DirectionProperty; import net.minecraft.state.StateContainer; import net.minecraft.tileentity.IHopper; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockRenderLayer; +import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; @@ -22,8 +22,6 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.items.IItemHandler; import javax.annotation.Nullable; @@ -87,18 +85,18 @@ public class BlockGratedChute extends BlockContainerImpl { } @Override - public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { - if (!player.isSneaking()) - return false; + public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + if (!player.isShiftKeyDown()) + return ActionResultType.FAIL; TileEntity tile = worldIn.getTileEntity(pos); if (!(tile instanceof TileEntityGratedChute)) - return false; + return ActionResultType.FAIL; if (!worldIn.isRemote) { TileEntityGratedChute chute = (TileEntityGratedChute) tile; chute.isBlacklist = !chute.isBlacklist; chute.sendToClients(); } - return true; + return ActionResultType.SUCCESS; } @Nullable @@ -128,17 +126,11 @@ public class BlockGratedChute extends BlockContainerImpl { ItemStack stack = handler.getStackInSlot(0); if (stack.isEmpty()) return 0; - return MathHelper.ceil((stack.getCount() / (float) stack.getMaxStackSize()) * 15); + return MathHelper.ceil(stack.getCount() / (float) stack.getMaxStackSize() * 15); } else return 0; } - @Override - @OnlyIn(Dist.CLIENT) - public BlockRenderLayer getRenderLayer() { - return BlockRenderLayer.CUTOUT_MIPPED; - } - @Override protected void fillStateContainer(StateContainer.Builder builder) { builder.add(FACING); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java index 2bb1e512..1fb80c31 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java @@ -1,13 +1,18 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.Helper; +import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar; import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar; import de.ellpeck.naturesaura.reg.ITESRProvider; import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.Tuple; import net.minecraft.util.math.BlockPos; @@ -17,10 +22,10 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.ToolType; +import java.util.function.Function; + public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider { private static final VoxelShape SHAPE = VoxelShapes.create(0, 0, 0, 1, 12 / 16F, 1); @@ -35,13 +40,12 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide } @Override - public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { return Helper.putStackOnTile(player, handIn, pos, 0, true); } @Override - @OnlyIn(Dist.CLIENT) - public Tuple getTESR() { - return new Tuple<>(TileEntityNatureAltar.class, new RenderNatureAltar()); + public Tuple>> getTESR() { + return new Tuple<>(ModTileEntities.NATURE_ALTAR, RenderNatureAltar::new); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java index 7f128f2a..04cd27cf 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java @@ -1,6 +1,7 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.Helper; +import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.TileEntityOfferingTable; import de.ellpeck.naturesaura.blocks.tiles.render.RenderOfferingTable; import de.ellpeck.naturesaura.reg.ITESRProvider; @@ -8,7 +9,11 @@ import net.minecraft.block.BlockState; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.Tuple; import net.minecraft.util.math.BlockPos; @@ -18,8 +23,8 @@ import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; + +import java.util.function.Function; public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvider { @@ -30,7 +35,7 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi } @Override - public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { return Helper.putStackOnTile(player, handIn, pos, 0, true); } @@ -40,8 +45,7 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi } @Override - @OnlyIn(Dist.CLIENT) - public Tuple getTESR() { - return new Tuple<>(TileEntityOfferingTable.class, new RenderOfferingTable()); + public Tuple>> getTESR() { + return new Tuple<>(ModTileEntities.OFFERING_TABLE, RenderOfferingTable::new); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java index 7670a018..1c5003f7 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java @@ -28,8 +28,8 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza @SubscribeEvent public void onPickup(EntityItemPickupEvent event) { - PlayerEntity player = event.getEntityPlayer(); - if (player != null && !player.isSneaking()) { + PlayerEntity player = event.getPlayer(); + if (player != null && !player.isShiftKeyDown()) { ItemEntity item = event.getItem(); BlockPos pos = item.getPosition(); Helper.getTileEntitiesInArea(item.world, pos, 8, tile -> { @@ -47,7 +47,7 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza if (item.world.getGameTime() % 3 == 0) PacketHandler.sendToAllAround(item.world, pos, 32, - new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.PICKUP_STOPPER)); + new PacketParticles((float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.PICKUP_STOPPER)); return true; }); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java index 16dd0b02..68f71dee 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java @@ -2,6 +2,7 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; +import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.TileEntityProjectileGenerator; import de.ellpeck.naturesaura.blocks.tiles.render.RenderProjectileGenerator; import de.ellpeck.naturesaura.packet.PacketHandler; @@ -10,20 +11,22 @@ import de.ellpeck.naturesaura.reg.ITESRProvider; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.entity.Entity; import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundEvents; import net.minecraft.util.Tuple; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.RayTraceResult; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.ProjectileImpactEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; +import java.util.function.Function; + public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider { public BlockProjectileGenerator() { super("projectile_generator", TileEntityProjectileGenerator::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2.5F).sound(SoundType.STONE)); @@ -59,7 +62,7 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES IAuraChunk.getAuraChunk(entity.world, spot).storeAura(spot, amount); PacketHandler.sendToAllAround(entity.world, pos, 32, - new PacketParticles((float) entity.posX, (float) entity.posY, (float) entity.posZ, PacketParticles.Type.PROJECTILE_GEN, pos.getX(), pos.getY(), pos.getZ())); + new PacketParticles((float) entity.getPosX(), (float) entity.getPosY(), (float) entity.getPosZ(), PacketParticles.Type.PROJECTILE_GEN, pos.getX(), pos.getY(), pos.getZ())); entity.world.playSound(null, pos.getX(), pos.getY(), pos.getZ(), SoundEvents.ENTITY_ENDER_EYE_LAUNCH, SoundCategory.BLOCKS, 0.8F, 1F); generator.nextSide = generator.nextSide.rotateY(); @@ -70,8 +73,8 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES } @Override - @OnlyIn(Dist.CLIENT) - public Tuple getTESR() { - return new Tuple<>(TileEntityProjectileGenerator.class, new RenderProjectileGenerator()); + public Tuple>> getTESR() { + return new Tuple<>(ModTileEntities.PROJECTILE_GENERATOR, RenderProjectileGenerator::new); } + } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java index 6f04e726..42150cb2 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java @@ -11,7 +11,6 @@ import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.entity.MobEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; @@ -74,12 +73,6 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable return SHAPE; } - @Override - @OnlyIn(Dist.CLIENT) - public BlockRenderLayer getRenderLayer() { - return BlockRenderLayer.CUTOUT; - } - @Override @OnlyIn(Dist.CLIENT) public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java index 7935cdb4..d4137ed3 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java @@ -4,6 +4,7 @@ import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.recipes.TreeRitualRecipe; import de.ellpeck.naturesaura.blocks.multi.Multiblocks; +import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities; import de.ellpeck.naturesaura.blocks.tiles.TileEntityWoodStand; import de.ellpeck.naturesaura.blocks.tiles.render.RenderWoodStand; import de.ellpeck.naturesaura.reg.ITESRProvider; @@ -11,10 +12,13 @@ import net.minecraft.block.BlockState; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; +import net.minecraft.util.ActionResultType; import net.minecraft.util.Hand; import net.minecraft.util.Tuple; import net.minecraft.util.math.BlockPos; @@ -25,8 +29,6 @@ import net.minecraft.util.math.shapes.VoxelShapes; import net.minecraft.world.IBlockReader; import net.minecraft.world.IWorld; import net.minecraft.world.World; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.ToolType; import net.minecraftforge.event.world.SaplingGrowTreeEvent; @@ -36,6 +38,7 @@ import org.apache.commons.lang3.mutable.MutableObject; import java.util.ArrayList; import java.util.Arrays; import java.util.List; +import java.util.function.Function; public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider { @@ -100,13 +103,12 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider } @Override - public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { + public ActionResultType onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { return Helper.putStackOnTile(player, handIn, pos, 0, true); } @Override - @OnlyIn(Dist.CLIENT) - public Tuple getTESR() { - return new Tuple<>(TileEntityWoodStand.class, new RenderWoodStand()); + public Tuple>> getTESR() { + return new Tuple<>(ModTileEntities.WOOD_STAND, RenderWoodStand::new); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalSpawner.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalSpawner.java index d02fabef..3a35b59f 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalSpawner.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalSpawner.java @@ -90,7 +90,7 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable for (ItemEntity item : items) { item.remove(); PacketHandler.sendToAllAround(this.world, this.pos, 32, - new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.ANIMAL_SPAWNER)); + new PacketParticles((float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.ANIMAL_SPAWNER)); } this.currentRecipe = recipe; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAutoCrafter.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAutoCrafter.java index c5203615..b02b5cd1 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAutoCrafter.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAutoCrafter.java @@ -104,13 +104,13 @@ public class TileEntityAutoCrafter extends TileEntityImpl implements ITickableTi ItemStack remain = remainingItems.get(i); if (!remain.isEmpty()) { - ItemEntity remItem = new ItemEntity(this.world, item.posX, item.posY, item.posZ, remain.copy()); + ItemEntity remItem = new ItemEntity(this.world, item.getPosX(), item.getPosY(), item.getPosZ(), remain.copy()); remItem.setMotion(0, 0, 0); this.world.addEntity(remItem); } PacketHandler.sendToAllAround(this.world, this.pos, 32, - new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.ANIMAL_SPAWNER)); + new PacketParticles((float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.ANIMAL_SPAWNER)); } } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEndFlower.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEndFlower.java index b49d26b9..f66e299d 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEndFlower.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEndFlower.java @@ -73,7 +73,7 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickableTile item.remove(); PacketHandler.sendToAllAround(this.world, this.pos, 32, - new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.END_FLOWER_CONSUME, this.container.getAuraColor())); + new PacketParticles((float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.END_FLOWER_CONSUME, this.container.getAuraColor())); break; } } else { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java index 6c5bd272..10f2e845 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java @@ -46,7 +46,7 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick if (stack.isEmpty() || stack.getItem() != Items.FIREWORK_ROCKET) continue; if (this.trackedEntity == null && this.releaseTimer <= 0) { - FireworkRocketEntity entity = new FireworkRocketEntity(this.world, item.posX, item.posY, item.posZ, stack); + FireworkRocketEntity entity = new FireworkRocketEntity(this.world, item.getPosX(), item.getPosY(), item.getPosZ(), stack); this.trackedEntity = entity; this.trackedItem = stack.copy(); this.world.addEntity(entity); @@ -109,7 +109,7 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick data.add(this.pos.getZ()); data.addAll(usedColors); PacketHandler.sendToAllLoaded(this.world, this.pos, new PacketParticles( - (float) this.trackedEntity.posX, (float) this.trackedEntity.posY, (float) this.trackedEntity.posZ, + (float) this.trackedEntity.getPosX(), (float) this.trackedEntity.getPosY(), (float) this.trackedEntity.getPosZ(), PacketParticles.Type.FIREWORK_GEN, Ints.toArray(data))); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityHopperUpgrade.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityHopperUpgrade.java index 4c696c1b..4c593e59 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityHopperUpgrade.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityHopperUpgrade.java @@ -63,7 +63,7 @@ public class TileEntityHopperUpgrade extends TileEntityImpl implements ITickable IAuraChunk.getAuraChunk(this.world, spot).drainAura(spot, 500); PacketHandler.sendToAllAround(this.world, this.pos, 32, - new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.HOPPER_UPGRADE)); + new PacketParticles((float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.HOPPER_UPGRADE)); } } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java index a6f7f1c9..b0cd2465 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java @@ -77,7 +77,7 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable ((ServerWorld) this.world).addLightningBolt(new LightningBoltEntity(this.world, this.pos.getX(), this.pos.getY(), this.pos.getZ(), true)); PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles( - (float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.OFFERING_TABLE, + (float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.OFFERING_TABLE, this.pos.getX(), this.pos.getY(), this.pos.getZ())); break; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java index 8669a0ae..b81a4bbd 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java @@ -91,7 +91,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickableTile this.world.addEntity(item); PacketHandler.sendToAllAround(this.world, this.pos, 32, - new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, PacketParticles.Type.TR_SPAWN_RESULT)); + new PacketParticles((float) item.getPosX(), (float) item.getPosY(), (float) item.getPosZ(), PacketParticles.Type.TR_SPAWN_RESULT)); this.world.playSound(null, this.pos.getX() + 0.5, this.pos.getY() + 0.5, this.pos.getZ() + 0.5, SoundEvents.ENTITY_ENDERMAN_TELEPORT, SoundCategory.BLOCKS, 0.65F, 1F); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderEnderCrate.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderEnderCrate.java index 7060233c..d856809b 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderEnderCrate.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderEnderCrate.java @@ -1,14 +1,11 @@ package de.ellpeck.naturesaura.blocks.tiles.render; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.matrix.MatrixStack; import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.client.renderer.GLAllocation; -import net.minecraft.client.renderer.GameRenderer; -import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -25,7 +22,17 @@ public class RenderEnderCrate extends TileEntityRenderer { private static final FloatBuffer PROJECTION = GLAllocation.createDirectFloatBuffer(16); private final FloatBuffer buffer = GLAllocation.createDirectFloatBuffer(16); + public RenderEnderCrate(TileEntityRendererDispatcher rendererDispatcherIn) { + super(rendererDispatcherIn); + } + @Override + public void render(TileEntityEnderCrate tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { + + } + + // TODO TESR + /*@Override public void render(TileEntityEnderCrate tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) { GlStateManager.disableLighting(); RANDOM.setSeed(31100L); @@ -107,7 +114,7 @@ public class RenderEnderCrate extends TileEntityRenderer { if (flag) { gamerenderer.setupFogColor(false); } - } + }*/ protected int getPasses(double dist) { int i; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderGeneratorLimitRemover.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderGeneratorLimitRemover.java index cf151cb5..9aeff336 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderGeneratorLimitRemover.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderGeneratorLimitRemover.java @@ -1,15 +1,11 @@ package de.ellpeck.naturesaura.blocks.tiles.render; -import com.mojang.blaze3d.platform.GLX; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.matrix.MatrixStack; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.blocks.tiles.TileEntityGeneratorLimitRemover; -import de.ellpeck.naturesaura.blocks.tiles.TileEntityImpl; -import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.entity.model.RendererModel; -import net.minecraft.client.renderer.model.Model; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.tileentity.TileEntity; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.util.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -17,8 +13,19 @@ import net.minecraftforge.api.distmarker.OnlyIn; @OnlyIn(Dist.CLIENT) public class RenderGeneratorLimitRemover extends TileEntityRenderer { private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/generator_limit_remover_glint.png"); - private final ModelLimitRemoverGlint model = new ModelLimitRemoverGlint(); + //private final ModelLimitRemoverGlint model = new ModelLimitRemoverGlint(); + public RenderGeneratorLimitRemover(TileEntityRendererDispatcher disp) { + super(disp); + } + + @Override + public void render(TileEntityGeneratorLimitRemover tileEntityGeneratorLimitRemover, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int i, int i1) { + + } + + // TODO TESR + /* @Override public void render(TileEntityGeneratorLimitRemover te, double x, double y, double z, float partialTicks, int destroyStage) { TileEntity above = te.getWorld().getTileEntity(te.getPos().up()); @@ -29,42 +36,44 @@ public class RenderGeneratorLimitRemover extends TileEntityRenderer { + public RenderNatureAltar(TileEntityRendererDispatcher rendererDispatcherIn) { + super(rendererDispatcherIn); + } @Override + public void render(TileEntityNatureAltar tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { + + } + + // TODO TESR + /*@Override public void render(TileEntityNatureAltar tileEntityIn, double x, double y, double z, float partialTicks, int destroyStage) { ItemStack stack = tileEntityIn.items.getStackInSlot(0); if (!stack.isEmpty()) { @@ -23,5 +31,5 @@ public class RenderNatureAltar extends TileEntityRenderer Helper.renderItemInWorld(stack); GlStateManager.popMatrix(); } - } + }*/ } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderOfferingTable.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderOfferingTable.java index 42521f17..ff5fcfa1 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderOfferingTable.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderOfferingTable.java @@ -1,14 +1,10 @@ package de.ellpeck.naturesaura.blocks.tiles.render; -import com.mojang.blaze3d.platform.GlStateManager; -import de.ellpeck.naturesaura.Helper; +import com.mojang.blaze3d.matrix.MatrixStack; import de.ellpeck.naturesaura.blocks.tiles.TileEntityOfferingTable; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; -import net.minecraft.item.BlockItem; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.math.MathHelper; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import java.util.Random; @@ -16,9 +12,19 @@ public class RenderOfferingTable extends TileEntityRenderer { private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/projectile_generator_overlay.png"); - private final ModelOverlay model = new ModelOverlay(); + //private final ModelOverlay model = new ModelOverlay(); + + public RenderProjectileGenerator(TileEntityRendererDispatcher rendererDispatcherIn) { + super(rendererDispatcherIn); + } @Override + public void render(TileEntityProjectileGenerator tileEntityIn, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int combinedLightIn, int combinedOverlayIn) { + + } + + // TODO TESR + /*@Override public void render(TileEntityProjectileGenerator te, double x, double y, double z, float partialTicks, int destroyStage) { GlStateManager.pushMatrix(); GlStateManager.enableAlphaTest(); @@ -64,5 +71,5 @@ public class RenderProjectileGenerator extends TileEntityRenderer { + public RenderWoodStand(TileEntityRendererDispatcher disp) { + super(disp); + } + @Override + public void render(TileEntityWoodStand tileEntityWoodStand, float v, MatrixStack matrixStack, IRenderTypeBuffer iRenderTypeBuffer, int i, int i1) { + + } + + // TODO TESR + /*@Override public void render(TileEntityWoodStand tile, double x, double y, double z, float partialTicks, int destroyStage) { ItemStack stack = tile.items.getStackInSlot(0); if (!stack.isEmpty()) { @@ -30,5 +37,5 @@ public class RenderWoodStand extends TileEntityRenderer { Helper.renderItemInWorld(stack); GlStateManager.popMatrix(); } - } + }*/ } diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java index ab253d6e..4a4862cb 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java @@ -97,7 +97,7 @@ public class AnimalEffect implements IDrainSpotEffect { ChickenEntity chicken = new ChickenEntity(EntityType.CHICKEN, world); chicken.setGrowingAge(-24000); - chicken.setPosition(item.posX, item.posY, item.posZ); + chicken.setPosition(item.getPosX(), item.getPosY(), item.getPosZ()); world.addEntity(chicken); BlockPos closestSpot = IAuraChunk.getHighestSpot(world, item.getPosition(), 35, pos); @@ -135,9 +135,9 @@ public class AnimalEffect implements IDrainSpotEffect { animal.setInLove(null); for (int j = 0; j < 7; j++) animal.world.addParticle(ParticleTypes.HEART, - (animal.posX + (double) (animal.world.rand.nextFloat() * animal.getWidth() * 2.0F)) - animal.getWidth(), - animal.posY + 0.5D + (double) (animal.world.rand.nextFloat() * animal.getHeight()), - (animal.posZ + (double) (animal.world.rand.nextFloat() * animal.getWidth() * 2.0F)) - animal.getWidth(), + animal.getPosX() + (double) (animal.world.rand.nextFloat() * animal.getWidth() * 2.0F) - animal.getWidth(), + animal.getPosY() + 0.5D + (double) (animal.world.rand.nextFloat() * animal.getHeight()), + animal.getPosZ() + (double) (animal.world.rand.nextFloat() * animal.getWidth() * 2.0F) - animal.getWidth(), animal.world.rand.nextGaussian() * 0.02D, animal.world.rand.nextGaussian() * 0.02D, animal.world.rand.nextGaussian() * 0.02D); diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/PlantBoostEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/PlantBoostEffect.java index cf89cf06..5c2dee66 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/PlantBoostEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/PlantBoostEffect.java @@ -18,6 +18,7 @@ import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; import net.minecraft.world.gen.Heightmap; +import net.minecraft.world.server.ServerWorld; public class PlantBoostEffect implements IDrainSpotEffect { @@ -72,7 +73,7 @@ public class PlantBoostEffect implements IDrainSpotEffect { if (block instanceof IGrowable && !(block instanceof DoublePlantBlock) && !(block instanceof TallGrassBlock) && block != Blocks.GRASS) { IGrowable growable = (IGrowable) block; if (growable.canGrow(world, plantPos, state, false)) { - growable.grow(world, world.rand, plantPos, state); + growable.grow((ServerWorld) world, world.rand, plantPos, state); BlockPos closestSpot = IAuraChunk.getHighestSpot(world, plantPos, 25, pos); IAuraChunk.getAuraChunk(world, closestSpot).drainAura(closestSpot, 3500); diff --git a/src/main/java/de/ellpeck/naturesaura/compat/jei/AnimalSpawnerCategory.java b/src/main/java/de/ellpeck/naturesaura/compat/jei/AnimalSpawnerCategory.java index 6f8d7b3b..73b6cae2 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/jei/AnimalSpawnerCategory.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/jei/AnimalSpawnerCategory.java @@ -1,8 +1,6 @@ package de.ellpeck.naturesaura.compat.jei; import com.google.common.collect.ImmutableList; -import com.mojang.blaze3d.platform.GLX; -import com.mojang.blaze3d.platform.GlStateManager; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe; import mezz.jei.api.constants.VanillaTypes; @@ -13,7 +11,6 @@ import mezz.jei.api.helpers.IGuiHelper; import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.recipe.category.IRecipeCategory; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityType; @@ -82,9 +79,9 @@ public class AnimalSpawnerCategory implements IRecipeCategory> 16) & 255) / 255F; float g = ((info.color >> 8) & 255) / 255F; float b = (info.color & 255) / 255F; - GlStateManager.color3f(r, g, b); + RenderSystem.color3f(r, g, b); AbstractGui.blit(x, y, 496 - 32, 44, 16, 18, 512, 256); } diff --git a/src/main/java/de/ellpeck/naturesaura/entities/EntityEffectInhibitor.java b/src/main/java/de/ellpeck/naturesaura/entities/EntityEffectInhibitor.java index 30140771..4b72afec 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/EntityEffectInhibitor.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/EntityEffectInhibitor.java @@ -74,7 +74,7 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable { @Override public void setPosition(double x, double y, double z) { - boolean should = x != this.posX || y != this.posY || z != this.posZ; + boolean should = x != this.getPosX() || y != this.getPosY() || z != this.getPosZ(); if (should) this.removeFromPowderList(); super.setPosition(x, y, z); @@ -112,9 +112,9 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable { if (this.world.isRemote) { if (this.world.getGameTime() % 5 == 0) { NaturesAuraAPI.instance().spawnMagicParticle( - this.posX + this.world.rand.nextGaussian() * 0.1F, - this.posY, - this.posZ + this.world.rand.nextGaussian() * 0.1F, + this.getPosX() + this.world.rand.nextGaussian() * 0.1F, + this.getPosY(), + this.getPosZ() + this.world.rand.nextGaussian() * 0.1F, this.world.rand.nextGaussian() * 0.005F, this.world.rand.nextFloat() * 0.03F, this.world.rand.nextGaussian() * 0.005F, diff --git a/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java b/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java index 59d3e062..176efa67 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java @@ -53,7 +53,7 @@ public class EntityMoverMinecart extends AbstractMinecartEntity { if (!this.spotOffsets.isEmpty() && this.world.getGameTime() % 10 == 0) PacketHandler.sendToAllAround(this.world, pos, 32, new PacketParticles( - (float) this.posX, (float) this.posY, (float) this.posZ, PacketParticles.Type.MOVER_CART, + (float) this.getPosX(), (float) this.getPosY(), (float) this.getPosZ(), PacketParticles.Type.MOVER_CART, MathHelper.floor(this.getMotion().getX() * 100F), MathHelper.floor(this.getMotion().getY() * 100F), MathHelper.floor(this.getMotion().getZ() * 100F))); if (pos.distanceSq(this.lastPosition) < 8 * 8) @@ -115,7 +115,7 @@ public class EntityMoverMinecart extends AbstractMinecartEntity { ListNBT list = new ListNBT(); for (BlockPos offset : this.spotOffsets) - list.add(new LongNBT(offset.toLong())); + list.add(LongNBT.valueOf(offset.toLong())); compound.put("offsets", list); return compound; } diff --git a/src/main/java/de/ellpeck/naturesaura/entities/render/RenderEffectInhibitor.java b/src/main/java/de/ellpeck/naturesaura/entities/render/RenderEffectInhibitor.java index 58fbc9ce..96e8a95f 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/render/RenderEffectInhibitor.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/render/RenderEffectInhibitor.java @@ -1,19 +1,13 @@ package de.ellpeck.naturesaura.entities.render; -import com.mojang.blaze3d.platform.GlStateManager; -import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.entities.EntityEffectInhibitor; -import de.ellpeck.naturesaura.items.ItemEffectPowder; -import de.ellpeck.naturesaura.items.ModItems; import net.minecraft.client.renderer.entity.EntityRenderer; import net.minecraft.client.renderer.entity.EntityRendererManager; -import net.minecraft.client.renderer.texture.AtlasTexture; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import javax.annotation.Nullable; import java.util.HashMap; import java.util.Map; @@ -26,7 +20,13 @@ public class RenderEffectInhibitor extends EntityRenderer super(renderManager); } - @Nullable + @Override + public ResourceLocation getEntityTexture(EntityEffectInhibitor entity) { + return null; + } + + // TODO Render entities +/* @Nullable @Override protected ResourceLocation getEntityTexture(EntityEffectInhibitor entity) { return AtlasTexture.LOCATION_BLOCKS_TEXTURE; @@ -44,5 +44,5 @@ public class RenderEffectInhibitor extends EntityRenderer Helper.renderItemInWorld(this.items.computeIfAbsent(effect, res -> ItemEffectPowder.setEffect(new ItemStack(ModItems.EFFECT_POWDER), effect))); GlStateManager.popMatrix(); - } + }*/ } diff --git a/src/main/java/de/ellpeck/naturesaura/entities/render/RenderMoverMinecart.java b/src/main/java/de/ellpeck/naturesaura/entities/render/RenderMoverMinecart.java index 1e85292d..d4e4ec5b 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/render/RenderMoverMinecart.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/render/RenderMoverMinecart.java @@ -1,25 +1,29 @@ package de.ellpeck.naturesaura.entities.render; -import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.matrix.MatrixStack; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.entities.EntityMoverMinecart; -import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.entity.EntityRendererManager; import net.minecraft.client.renderer.entity.MinecartRenderer; -import net.minecraft.client.renderer.entity.model.RendererModel; -import net.minecraft.client.renderer.model.Model; import net.minecraft.util.ResourceLocation; public class RenderMoverMinecart extends MinecartRenderer { private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/mover_cart.png"); - private final ModelMoverMinecart model = new ModelMoverMinecart(); + //private final ModelMoverMinecart model = new ModelMoverMinecart(); public RenderMoverMinecart(EntityRendererManager renderManagerIn) { super(renderManagerIn); } @Override + public void render(EntityMoverMinecart entityIn, float entityYaw, float partialTicks, MatrixStack matrixStackIn, IRenderTypeBuffer bufferIn, int packedLightIn) { + super.render(entityIn, entityYaw, partialTicks, matrixStackIn, bufferIn, packedLightIn); + } + + // TODO Entity rendering + /*@Override protected void renderCartContents(EntityMoverMinecart cart, float partialTicks, BlockState state) { GlStateManager.pushMatrix(); GlStateManager.translatef(0, 22 / 16F, 0); @@ -42,5 +46,5 @@ public class RenderMoverMinecart extends MinecartRenderer { public void render() { this.box.render(1 / 16F); } - } + }*/ } diff --git a/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java b/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java index 56b4cf6b..b414efa4 100644 --- a/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java +++ b/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java @@ -1,6 +1,7 @@ package de.ellpeck.naturesaura.events; import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.ModConfig; import de.ellpeck.naturesaura.NaturesAura; @@ -124,7 +125,7 @@ public class ClientEvents { @SubscribeEvent public void onRenderLast(RenderWorldLastEvent event) { - ParticleHandler.renderParticles(event.getPartialTicks()); + ParticleHandler.renderParticles(event.getMatrixStack(), event.getPartialTicks()); } @SubscribeEvent @@ -151,8 +152,8 @@ public class ClientEvents { if (mc.world.getGameTime() % 20 == 0) { int amount = MathHelper.floor(190 * ModConfig.instance.excessParticleAmount.get()); for (int i = 0; i < amount; i++) { - int x = MathHelper.floor(mc.player.posX) + mc.world.rand.nextInt(64) - 32; - int z = MathHelper.floor(mc.player.posZ) + mc.world.rand.nextInt(64) - 32; + int x = MathHelper.floor(mc.player.getPosX()) + mc.world.rand.nextInt(64) - 32; + int z = MathHelper.floor(mc.player.getPosZ()) + mc.world.rand.nextInt(64) - 32; BlockPos pos = new BlockPos(x, mc.world.getHeight(Heightmap.Type.WORLD_SURFACE, x, z) - 1, z); BlockState state = mc.world.getBlockState(pos); Block block = state.getBlock(); @@ -168,7 +169,7 @@ public class ClientEvents { mc.world.rand.nextGaussian() * 0.01F, mc.world.rand.nextFloat() * 0.025F, mc.world.rand.nextGaussian() * 0.01F, - BiomeColors.getFoliageColor(mc.world, pos), + BiomeColors.func_228361_b_(mc.world, pos), Math.min(2F, 1F + mc.world.rand.nextFloat() * (excess / 30000F)), Math.min(300, 100 + mc.world.rand.nextInt(excess / 3000 + 1)), 0F, false, true); @@ -214,9 +215,9 @@ public class ClientEvents { GL11.glPushMatrix(); float partial = event.getPartialTicks(); GL11.glTranslated( - -mc.player.prevPosX - (mc.player.posX - mc.player.prevPosX) * partial, - -mc.player.prevPosY - (mc.player.posY - mc.player.prevPosY) * partial - (double) MathHelper.lerp(partial, this.previousHeight, this.height), - -mc.player.prevPosZ - (mc.player.posZ - mc.player.prevPosZ) * partial); + -mc.player.prevPosX - (mc.player.getPosX() - mc.player.prevPosX) * partial, + -mc.player.prevPosY - (mc.player.getPosY() - mc.player.prevPosY) * partial - (double) MathHelper.lerp(partial, this.previousHeight, this.height), + -mc.player.prevPosZ - (mc.player.getPosZ() - mc.player.prevPosZ) * partial); if (mc.gameSettings.showDebugInfo && mc.player.isCreative() && ModConfig.instance.debugWorld.get()) { Map spots = new HashMap<>(); @@ -229,7 +230,7 @@ public class ClientEvents { IAuraChunk.getSpotsInArea(mc.world, mc.player.getPosition(), 64, (pos, spot) -> { spots.put(pos, spot); - GlStateManager.color4f(spot > 0 ? 0F : 1F, spot > 0 ? 1F : 0F, 0F, 0.35F); + RenderSystem.color4f(spot > 0 ? 0F : 1F, spot > 0 ? 1F : 0F, 0F, 0.35F); Helper.renderWeirdBox(pos.getX(), pos.getY(), pos.getZ(), 1, 1, 1); }); GL11.glEnd(); @@ -237,15 +238,15 @@ public class ClientEvents { float scale = 0.03F; NumberFormat format = NumberFormat.getInstance(); - GlStateManager.scalef(scale, scale, scale); + RenderSystem.scalef(scale, scale, scale); for (Map.Entry spot : spots.entrySet()) { BlockPos pos = spot.getKey(); - GlStateManager.pushMatrix(); - GlStateManager.translated((pos.getX() + 0.1) / scale, (pos.getY() + 1) / scale, (pos.getZ() + 0.1) / scale); - GlStateManager.rotatef(90F, 1F, 0F, 0F); - GlStateManager.scalef(0.65F, 0.65F, 0.65F); + RenderSystem.pushMatrix(); + RenderSystem.translated((pos.getX() + 0.1) / scale, (pos.getY() + 1) / scale, (pos.getZ() + 0.1) / scale); + RenderSystem.rotatef(90F, 1F, 0F, 0F); + RenderSystem.scalef(0.65F, 0.65F, 0.65F); mc.fontRenderer.drawString(format.format(spot.getValue()), 0, 0, 0); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); } GL11.glEnable(GL11.GL_DEPTH_TEST); @@ -290,7 +291,7 @@ public class ClientEvents { return; box = box.grow(0.05F); int color = visualize.getVisualizationColor(world, pos); - GlStateManager.color4f(((color >> 16) & 255) / 255F, ((color >> 8) & 255) / 255F, (color & 255) / 255F, 0.5F); + RenderSystem.color4f(((color >> 16) & 255) / 255F, ((color >> 8) & 255) / 255F, (color & 255) / 255F, 0.5F); Helper.renderWeirdBox(box.minX, box.minY, box.minZ, box.maxX - box.minX, box.maxY - box.minY, box.maxZ - box.minZ); } @@ -306,10 +307,10 @@ public class ClientEvents { int x = res.getScaledWidth() / 2 - 173 - (mc.player.getHeldItemOffhand().isEmpty() ? 0 : 29); int y = res.getScaledHeight() - 8; - GlStateManager.pushMatrix(); + RenderSystem.pushMatrix(); int color = container.getAuraColor(); - GlStateManager.color3f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F); + RenderSystem.color4f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F, 1); mc.getTextureManager().bindTexture(OVERLAYS); if (width < 80) AbstractGui.blit(x + width, y, width, 0, 80 - width, 6, 256, 256); @@ -317,21 +318,21 @@ public class ClientEvents { AbstractGui.blit(x, y, 0, 6, width, 6, 256, 256); float scale = 0.75F; - GlStateManager.scalef(scale, scale, scale); + RenderSystem.scalef(scale, scale, scale); String s = heldCache.getDisplayName().getFormattedText(); mc.fontRenderer.drawStringWithShadow(s, (x + 80) / scale - mc.fontRenderer.getStringWidth(s), (y - 7) / scale, color); - GlStateManager.color3f(1F, 1F, 1F); - GlStateManager.popMatrix(); + RenderSystem.color4f(1F, 1F, 1F, 1); + RenderSystem.popMatrix(); } if (!heldEye.isEmpty() || !heldOcular.isEmpty()) { - GlStateManager.pushMatrix(); + RenderSystem.pushMatrix(); mc.getTextureManager().bindTexture(OVERLAYS); int conf = ModConfig.instance.auraBarLocation.get(); if (!mc.gameSettings.showDebugInfo && (conf != 2 || !(mc.currentScreen instanceof ChatScreen))) { - GlStateManager.color3f(83 / 255F, 160 / 255F, 8 / 255F); + RenderSystem.color4f(83 / 255F, 160 / 255F, 8 / 255F, 1); int totalAmount = IAuraChunk.triangulateAuraInArea(mc.world, mc.player.getPosition(), 35); float totalPercentage = totalAmount / (IAuraChunk.DEFAULT_AURA * 2F); @@ -352,7 +353,7 @@ public class ClientEvents { AbstractGui.blit(startX, y + 50 - tHeight, 0, 12 + 50 - tHeight, 6, tHeight, 256, 256); if (!heldOcular.isEmpty()) { - GlStateManager.color3f(160 / 255F, 83 / 255F, 8 / 255F); + RenderSystem.color4f(160 / 255F, 83 / 255F, 8 / 255F, 1); int topHeight = MathHelper.ceil(MathHelper.clamp((totalPercentage - 1F) * 2F, 0F, 1F) * 25); if (topHeight > 0) { @@ -374,15 +375,15 @@ public class ClientEvents { if (totalPercentage < (heldOcular.isEmpty() ? 0F : -0.5F)) mc.fontRenderer.drawStringWithShadow("-", startX + plusOffX, startY - 0.5F + (heldOcular.isEmpty() ? 44 : 70), color); - GlStateManager.pushMatrix(); - GlStateManager.scalef(textScale, textScale, textScale); + RenderSystem.pushMatrix(); + RenderSystem.scalef(textScale, textScale, textScale); mc.fontRenderer.drawStringWithShadow(text, textX / textScale, textY / textScale, 0x53a008); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); if (!heldOcular.isEmpty()) { float scale = 0.75F; - GlStateManager.pushMatrix(); - GlStateManager.scalef(scale, scale, scale); + RenderSystem.pushMatrix(); + RenderSystem.scalef(scale, scale, scale); int stackX = conf % 2 == 0 ? 10 : res.getScaledWidth() - 22; int stackY = conf < 2 ? 15 : res.getScaledHeight() - 55; for (Tuple effect : SHOWING_EFFECTS.values()) { @@ -398,7 +399,7 @@ public class ClientEvents { } stackY += 8; } - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); } } @@ -451,17 +452,15 @@ public class ClientEvents { } } - GlStateManager.color3f(1F, 1F, 1F); - GlStateManager.popMatrix(); + RenderSystem.color4f(1F, 1F, 1F, 1); + RenderSystem.popMatrix(); } } } } - private void drawContainerInfo(int stored, int max, - int color, Minecraft mc, MainWindow res, int yOffset, String name, String - textBelow) { - GlStateManager.color3f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F); + private void drawContainerInfo(int stored, int max, int color, Minecraft mc, MainWindow res, int yOffset, String name, String textBelow) { + RenderSystem.color3f((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F); int x = res.getScaledWidth() / 2 - 40; int y = res.getScaledHeight() / 2 + yOffset; diff --git a/src/main/java/de/ellpeck/naturesaura/events/CommonEvents.java b/src/main/java/de/ellpeck/naturesaura/events/CommonEvents.java index 0a61dab7..b35f26a8 100644 --- a/src/main/java/de/ellpeck/naturesaura/events/CommonEvents.java +++ b/src/main/java/de/ellpeck/naturesaura/events/CommonEvents.java @@ -47,7 +47,7 @@ public class CommonEvents { ChunkManager manager = ((ServerChunkProvider) event.world.getChunkProvider()).chunkManager; Iterable chunks = (Iterable) GET_LOADED_CHUNKS_METHOD.invoke(manager); for (ChunkHolder holder : chunks) { - Chunk chunk = holder.func_219298_c(); + Chunk chunk = holder.getChunkIfComplete(); if (chunk == null) continue; AuraChunk auraChunk = (AuraChunk) chunk.getCapability(NaturesAuraAPI.capAuraChunk, null).orElse(null); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemAuraBottle.java b/src/main/java/de/ellpeck/naturesaura/items/ItemAuraBottle.java index 1b68dcaa..5d84cb85 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemAuraBottle.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemAuraBottle.java @@ -115,7 +115,7 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem { BlockPos spot = IAuraChunk.getHighestSpot(player.world, pos, 30, pos); IAuraChunk.getAuraChunk(player.world, spot).drainAura(spot, 20000); - player.world.playSound(null, player.posX, player.posY, player.posZ, + player.world.playSound(null, player.getPosX(), player.getPosY(), player.getPosZ(), SoundEvents.ITEM_BOTTLE_FILL_DRAGONBREATH, SoundCategory.PLAYERS, 1F, 1F); } player.swingArm(event.getHand()); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemBirthSpirit.java b/src/main/java/de/ellpeck/naturesaura/items/ItemBirthSpirit.java index fa25ca6a..3c535f1e 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemBirthSpirit.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemBirthSpirit.java @@ -26,7 +26,7 @@ public class ItemBirthSpirit extends ItemGlowing { return; int amount = parent.world.rand.nextInt(3) + 1; - ItemEntity item = new ItemEntity(parent.world, parent.posX, parent.posY, parent.posZ, + ItemEntity item = new ItemEntity(parent.world, parent.getPosX(), parent.getPosY(), parent.getPosZ(), new ItemStack(ModItems.BIRTH_SPIRIT, amount)); parent.world.addEntity(item); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java b/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java index 987945cd..c6e2d463 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java @@ -44,7 +44,7 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem { DyeColor color = (DyeColor) state.get(prop); if (firstColor == null || color == firstColor) { DyeColor stored = getStoredColor(stack); - if (player.isSneaking()) { + if (player.isShiftKeyDown()) { if (stored != color) { world.playSound(player, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, SoundEvents.ITEM_BUCKET_FILL, SoundCategory.PLAYERS, 0.65F, 1F); @@ -81,8 +81,8 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem { @Override public ActionResult onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack stack = playerIn.getHeldItem(handIn); - if (playerIn.isSneaking() && getStoredColor(stack) != null) { - worldIn.playSound(playerIn, playerIn.posX, playerIn.posY, playerIn.posZ, SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.PLAYERS, 0.65F, 1F); + if (playerIn.isShiftKeyDown() && getStoredColor(stack) != null) { + worldIn.playSound(playerIn, playerIn.getPosX(), playerIn.getPosY(), playerIn.getPosZ(), SoundEvents.ITEM_BUCKET_FILL_LAVA, SoundCategory.PLAYERS, 0.65F, 1F); if (!worldIn.isRemote) { setFillMode(stack, !isFillMode(stack)); } @@ -92,7 +92,6 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem { } } - private static DyeColor getStoredColor(ItemStack stack) { if (!stack.hasTag()) { return null; diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemRangeVisualizer.java b/src/main/java/de/ellpeck/naturesaura/items/ItemRangeVisualizer.java index c0c2c73a..a9d1de3f 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemRangeVisualizer.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemRangeVisualizer.java @@ -35,7 +35,7 @@ public class ItemRangeVisualizer extends ItemImpl { @Override public ActionResult onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack stack = playerIn.getHeldItem(handIn); - if (playerIn.isSneaking()) { + if (playerIn.isShiftKeyDown()) { clear(); playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".range_visualizer.end_all"), true); return new ActionResult<>(ActionResultType.SUCCESS, stack); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java b/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java index 564a349f..d1a59ab9 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java @@ -51,9 +51,9 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { return; compound.putBoolean("air", true); - compound.putDouble("x", living.posX); - compound.putDouble("y", living.posY); - compound.putDouble("z", living.posZ); + compound.putDouble("x", living.getPosX()); + compound.putDouble("y", living.getPosY()); + compound.putDouble("z", living.getPosZ()); } else { if (!stack.hasTag()) return; @@ -63,7 +63,7 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { compound.putBoolean("air", false); - if (!living.isSneaking()) + if (!living.isShiftKeyDown()) return; if (living.getDistanceSq(compound.getDouble("x"), compound.getDouble("y"), compound.getDouble("z")) > 0.75F) return; @@ -79,8 +79,8 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { int range = 5; List mobs = worldIn.getEntitiesWithinAABB(LivingEntity.class, new AxisAlignedBB( - living.posX - range, living.posY - 0.5, living.posZ - range, - living.posX + range, living.posY + 0.5, living.posZ + range)); + living.getPosX() - range, living.getPosY() - 0.5, living.getPosZ() - range, + living.getPosX() + range, living.getPosY() + 0.5, living.getPosZ() + range)); for (LivingEntity mob : mobs) { if (!mob.isAlive() || mob == living) continue; @@ -103,7 +103,7 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { worldIn.playSound(null, pos, type.getBreakSound(), SoundCategory.BLOCKS, type.getVolume() * 0.5F, type.getPitch() * 0.8F); } - PacketHandler.sendToAllAround(worldIn, pos, 32, new PacketParticles((float) living.posX, (float) living.posY, (float) living.posZ, PacketParticles.Type.SHOCKWAVE_CREATOR)); + PacketHandler.sendToAllAround(worldIn, pos, 32, new PacketParticles((float) living.getPosX(), (float) living.getPosY(), (float) living.getPosZ(), PacketParticles.Type.SHOCKWAVE_CREATOR)); } } diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovel.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovel.java index 93eef749..eaaa28cf 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovel.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovel.java @@ -49,7 +49,7 @@ public class ItemShovel extends ShovelItem implements IModItem, IModelProvider { damage = 5; } } else { - int range = player.isSneaking() ? 0 : 1; + int range = player.isShiftKeyDown() ? 0 : 1; for (int x = -range; x <= range; x++) { for (int y = -range; y <= range; y++) { BlockPos actualPos = pos.add(x, 0, y); diff --git a/src/main/java/de/ellpeck/naturesaura/misc/BlockLootProvider.java b/src/main/java/de/ellpeck/naturesaura/misc/BlockLootProvider.java index b25b79b6..4a3251b3 100644 --- a/src/main/java/de/ellpeck/naturesaura/misc/BlockLootProvider.java +++ b/src/main/java/de/ellpeck/naturesaura/misc/BlockLootProvider.java @@ -8,6 +8,7 @@ import de.ellpeck.naturesaura.blocks.Slab; import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.ModRegistry; +import net.minecraft.advancements.criterion.StatePropertiesPredicate; import net.minecraft.block.Block; import net.minecraft.data.DataGenerator; import net.minecraft.data.DirectoryCache; @@ -46,7 +47,7 @@ public class BlockLootProvider implements IDataProvider { this.lootFunctions.put(ModBlocks.ANCIENT_LEAVES, b -> LootTableHooks.genLeaves(b, ModBlocks.ANCIENT_SAPLING)); this.lootFunctions.put(ModBlocks.DECAYED_LEAVES, LootTableHooks::genSilkOnly); - this.lootFunctions.put(ModBlocks.GOLDEN_LEAVES, b -> LootTable.builder().addLootPool(LootPool.builder().rolls(ConstantRange.of(1)).addEntry(LootTableHooks.survivesExplosion(b, ItemLootEntry.builder(ModItems.GOLD_LEAF)).acceptCondition(BlockStateProperty.builder(b).with(BlockGoldenLeaves.STAGE, BlockGoldenLeaves.HIGHEST_STAGE))).acceptCondition(RandomChance.builder(0.75F)))); + this.lootFunctions.put(ModBlocks.GOLDEN_LEAVES, b -> LootTable.builder().addLootPool(LootPool.builder().rolls(ConstantRange.of(1)).addEntry(LootTableHooks.survivesExplosion(b, ItemLootEntry.builder(ModItems.GOLD_LEAF)).acceptCondition(BlockStateProperty.builder(b).fromProperties(StatePropertiesPredicate.Builder.newBuilder().withIntProp(BlockGoldenLeaves.STAGE, BlockGoldenLeaves.HIGHEST_STAGE)))).acceptCondition(RandomChance.builder(0.75F)))); } @@ -74,23 +75,23 @@ public class BlockLootProvider implements IDataProvider { // What a mess private static class LootTableHooks extends BlockLootTables { public static LootTable.Builder genLeaves(Block block, Block drop) { - return func_218540_a(block, drop, 0.05F, 0.0625F, 0.083333336F, 0.1F); + return droppingWithChancesAndSticks(block, drop, 0.05F, 0.0625F, 0.083333336F, 0.1F); } public static LootTable.Builder genSlab(Block block) { - return func_218513_d(block); + return droppingSlab(block); } public static LootTable.Builder genRegular(Block block) { - return func_218546_a(block); + return dropping(block); } public static LootTable.Builder genSilkOnly(Block block) { - return func_218561_b(block); + return onlyWithSilkTouch(block); } public static T survivesExplosion(Block block, ILootConditionConsumer then) { - return func_218560_a(block, then); + return withSurvivesExplosion(block, then); } } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/naturesaura/misc/WorldData.java b/src/main/java/de/ellpeck/naturesaura/misc/WorldData.java index 04a8965e..24be01e4 100644 --- a/src/main/java/de/ellpeck/naturesaura/misc/WorldData.java +++ b/src/main/java/de/ellpeck/naturesaura/misc/WorldData.java @@ -23,7 +23,10 @@ import net.minecraftforge.common.util.LazyOptional; import javax.annotation.Nonnull; import javax.annotation.Nullable; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; public class WorldData implements IWorldData { private final Map enderStorages = new HashMap<>(); @@ -53,7 +56,7 @@ public class WorldData implements IWorldData { ListNBT moss = new ListNBT(); for (BlockPos pos : this.recentlyConvertedMossStones) - moss.add(new LongNBT(pos.toLong())); + moss.add(LongNBT.valueOf(pos.toLong())); compound.put("converted_moss", moss); return compound; diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java index 6ace5c63..a2a5484d 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java @@ -217,7 +217,7 @@ public class PacketParticles { message.posX + 0.5F, message.posY + 0.5F, message.posZ + 0.5F, - 0.6F, BiomeColors.getFoliageColor(world, new BlockPos(sapX, sapY, sapZ)), 1.5F); + 0.6F, BiomeColors.func_228361_b_(world, new BlockPos(sapX, sapY, sapZ)), 1.5F); if (releaseAura) for (int i = world.rand.nextInt(10) + 10; i >= 0; i--) NaturesAuraAPI.instance().spawnMagicParticle( diff --git a/src/main/java/de/ellpeck/naturesaura/particles/ParticleHandler.java b/src/main/java/de/ellpeck/naturesaura/particles/ParticleHandler.java index 5a2f0b28..69086e06 100644 --- a/src/main/java/de/ellpeck/naturesaura/particles/ParticleHandler.java +++ b/src/main/java/de/ellpeck/naturesaura/particles/ParticleHandler.java @@ -1,6 +1,8 @@ package de.ellpeck.naturesaura.particles; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import de.ellpeck.naturesaura.ModConfig; import net.minecraft.client.Minecraft; import net.minecraft.client.entity.player.ClientPlayerEntity; @@ -65,7 +67,7 @@ public final class ParticleHandler { } } - public static void renderParticles(float partialTicks) { + public static void renderParticles(MatrixStack stack, float partialTicks) { Minecraft mc = Minecraft.getInstance(); ClientPlayerEntity player = mc.player; @@ -76,17 +78,15 @@ public final class ParticleHandler { float f2 = -f1 * MathHelper.sin(info.getPitch() * ((float) Math.PI / 180F)); float f3 = f * MathHelper.sin(info.getPitch() * ((float) Math.PI / 180F)); float f4 = MathHelper.cos(info.getPitch() * ((float) Math.PI / 180F)); - Particle.interpPosX = info.getProjectedView().x; - Particle.interpPosY = info.getProjectedView().y; - Particle.interpPosZ = info.getProjectedView().z; - GlStateManager.pushMatrix(); + RenderSystem.pushMatrix(); + RenderSystem.multMatrix(stack.getLast().getPositionMatrix()); - GlStateManager.enableAlphaTest(); + RenderSystem.enableAlphaTest(); GlStateManager.enableBlend(); - GlStateManager.alphaFunc(516, 0.003921569F); + RenderSystem.alphaFunc(516, 0.003921569F); GlStateManager.disableCull(); - GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE); + GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE.param); GlStateManager.depthMask(false); @@ -94,25 +94,25 @@ public final class ParticleHandler { Tessellator tessy = Tessellator.getInstance(); BufferBuilder buffer = tessy.getBuffer(); - buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX); for (Particle particle : PARTICLES) - particle.renderParticle(buffer, info, partialTicks, f, f4, f1, f2, f3); + particle.renderParticle(buffer, info, partialTicks); tessy.draw(); GlStateManager.disableDepthTest(); - buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP); + buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR_TEX); for (Particle particle : PARTICLES_NO_DEPTH) - particle.renderParticle(buffer, info, partialTicks, f, f4, f1, f2, f3); + particle.renderParticle(buffer, info, partialTicks); tessy.draw(); GlStateManager.enableDepthTest(); GlStateManager.enableCull(); GlStateManager.depthMask(true); - GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA); + GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA.param, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.param); GlStateManager.disableBlend(); - GlStateManager.alphaFunc(516, 0.1F); + RenderSystem.alphaFunc(516, 0.1F); - GlStateManager.popMatrix(); + RenderSystem.popMatrix(); } } diff --git a/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java b/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java index bed90c80..834e318a 100644 --- a/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java +++ b/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java @@ -1,11 +1,15 @@ package de.ellpeck.naturesaura.particles; +import com.mojang.blaze3d.vertex.IVertexBuilder; import de.ellpeck.naturesaura.NaturesAura; import net.minecraft.client.particle.IParticleRenderType; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.ActiveRenderInfo; -import net.minecraft.client.renderer.BufferBuilder; +import net.minecraft.client.renderer.Quaternion; +import net.minecraft.client.renderer.Vector3f; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; @@ -31,9 +35,9 @@ public class ParticleMagic extends Particle { this.motionY = motionY; this.motionZ = motionZ; - float r = (((color >> 16) & 255) / 255F) * (1F - this.rand.nextFloat() * 0.25F); - float g = (((color >> 8) & 255) / 255F) * (1F - this.rand.nextFloat() * 0.25F); - float b = ((color & 255) / 255F) * (1F - this.rand.nextFloat() * 0.25F); + float r = (color >> 16 & 255) / 255F * (1F - this.rand.nextFloat() * 0.25F); + float g = (color >> 8 & 255) / 255F * (1F - this.rand.nextFloat() * 0.25F); + float b = (color & 255) / 255F * (1F - this.rand.nextFloat() * 0.25F); this.setColor(r, g, b); this.particleAlpha = 1F; @@ -64,28 +68,29 @@ public class ParticleMagic extends Particle { } @Override - public void renderParticle(BufferBuilder buffer, ActiveRenderInfo entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) { - double x = this.prevPosX + (this.posX - this.prevPosX) * partialTicks - interpPosX; - double y = this.prevPosY + (this.posY - this.prevPosY) * partialTicks - interpPosY; - double z = this.prevPosZ + (this.posZ - this.prevPosZ) * partialTicks - interpPosZ; - float sc = 0.1F * this.particleScale; + public void renderParticle(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) { + Vec3d vec3d = renderInfo.getProjectedView(); + float f = (float) (MathHelper.lerp(partialTicks, this.prevPosX, this.posX) - vec3d.getX()); + float f1 = (float) (MathHelper.lerp(partialTicks, this.prevPosY, this.posY) - vec3d.getY()); + float f2 = (float) (MathHelper.lerp(partialTicks, this.prevPosZ, this.posZ) - vec3d.getZ()); + Quaternion quaternion = renderInfo.getRotation(); + Vector3f vector3f1 = new Vector3f(-1.0F, -1.0F, 0.0F); + vector3f1.transform(quaternion); + Vector3f[] avector3f = new Vector3f[]{new Vector3f(-1.0F, -1.0F, 0.0F), new Vector3f(-1.0F, 1.0F, 0.0F), new Vector3f(1.0F, 1.0F, 0.0F), new Vector3f(1.0F, -1.0F, 0.0F)}; + float f4 = 0.1F * this.particleScale; - int brightness = this.getBrightnessForRender(partialTicks); - int sky = brightness >> 16 & 0xFFFF; - int block = brightness & 0xFFFF; + for (int i = 0; i < 4; ++i) { + Vector3f vector3f = avector3f[i]; + vector3f.transform(quaternion); + vector3f.mul(f4); + vector3f.add(f, f1, f2); + } - buffer.pos(x + (-rotationX * sc - rotationXY * sc), y + -rotationZ * sc, z + (-rotationYZ * sc - rotationXZ * sc)) - .tex(0, 1).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) - .lightmap(sky, block).endVertex(); - buffer.pos(x + (-rotationX * sc + rotationXY * sc), y + (rotationZ * sc), z + (-rotationYZ * sc + rotationXZ * sc)) - .tex(1, 1).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) - .lightmap(sky, block).endVertex(); - buffer.pos(x + (rotationX * sc + rotationXY * sc), y + (rotationZ * sc), z + (rotationYZ * sc + rotationXZ * sc)) - .tex(1, 0).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) - .lightmap(sky, block).endVertex(); - buffer.pos(x + (rotationX * sc - rotationXY * sc), y + (-rotationZ * sc), z + (rotationYZ * sc - rotationXZ * sc)) - .tex(0, 0).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha) - .lightmap(sky, block).endVertex(); + int j = this.getBrightnessForRender(partialTicks); + buffer.pos(avector3f[0].getX(), avector3f[0].getY(), avector3f[0].getZ()).tex(0, 1).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j).endVertex(); + buffer.pos(avector3f[1].getX(), avector3f[1].getY(), avector3f[1].getZ()).tex(1, 1).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j).endVertex(); + buffer.pos(avector3f[2].getX(), avector3f[2].getY(), avector3f[2].getZ()).tex(1, 0).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j).endVertex(); + buffer.pos(avector3f[3].getX(), avector3f[3].getY(), avector3f[3].getZ()).tex(0, 0).color(this.particleRed, this.particleGreen, this.particleBlue, this.particleAlpha).lightmap(j).endVertex(); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java b/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java index ada55b6b..f03540e7 100644 --- a/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java @@ -18,8 +18,12 @@ import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.ItemColors; import net.minecraft.client.renderer.entity.PlayerRenderer; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; import net.minecraft.item.Item; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Tuple; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.registry.ClientRegistry; @@ -28,6 +32,7 @@ import net.minecraftforge.fml.client.registry.RenderingRegistry; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; import java.util.Map; +import java.util.function.Function; import java.util.function.Supplier; public class ClientProxy implements IProxy { @@ -74,8 +79,8 @@ public class ClientProxy implements IProxy { @Override public void registerTESR(ITESRProvider provider) { - Tuple tesr = provider.getTESR(); - ClientRegistry.bindTileEntitySpecialRenderer(tesr.getA(), tesr.getB()); + Tuple>> tesr = provider.getTESR(); + ClientRegistry.bindTileEntityRenderer(tesr.getA(), tesr.getB()); } @Override @@ -97,7 +102,7 @@ public class ClientProxy implements IProxy { } @Override - public void registerEntityRenderer(Class entityClass, Supplier> renderFactory) { + public void registerEntityRenderer(EntityType entityClass, Supplier> renderFactory) { RenderingRegistry.registerEntityRenderingHandler(entityClass, renderFactory.get()); } diff --git a/src/main/java/de/ellpeck/naturesaura/proxy/IProxy.java b/src/main/java/de/ellpeck/naturesaura/proxy/IProxy.java index f4352fdd..a43ac04e 100644 --- a/src/main/java/de/ellpeck/naturesaura/proxy/IProxy.java +++ b/src/main/java/de/ellpeck/naturesaura/proxy/IProxy.java @@ -4,6 +4,7 @@ import de.ellpeck.naturesaura.reg.IColorProvidingBlock; import de.ellpeck.naturesaura.reg.IColorProvidingItem; import de.ellpeck.naturesaura.reg.ITESRProvider; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; @@ -28,6 +29,6 @@ public interface IProxy { void setParticleSpawnRange(int range); - void registerEntityRenderer(Class entityClass, Supplier> renderFactory); + void registerEntityRenderer(EntityType entityClass, Supplier> renderFactory); } diff --git a/src/main/java/de/ellpeck/naturesaura/proxy/ServerProxy.java b/src/main/java/de/ellpeck/naturesaura/proxy/ServerProxy.java index a710ccef..aea600f5 100644 --- a/src/main/java/de/ellpeck/naturesaura/proxy/ServerProxy.java +++ b/src/main/java/de/ellpeck/naturesaura/proxy/ServerProxy.java @@ -4,6 +4,7 @@ import de.ellpeck.naturesaura.reg.IColorProvidingBlock; import de.ellpeck.naturesaura.reg.IColorProvidingItem; import de.ellpeck.naturesaura.reg.ITESRProvider; import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityType; import net.minecraftforge.fml.client.registry.IRenderFactory; import net.minecraftforge.fml.event.lifecycle.FMLCommonSetupEvent; @@ -57,7 +58,7 @@ public class ServerProxy implements IProxy { } @Override - public void registerEntityRenderer(Class entityClass, Supplier> renderFactory) { + public void registerEntityRenderer(EntityType entityClass, Supplier> renderFactory) { } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ITESRProvider.java b/src/main/java/de/ellpeck/naturesaura/reg/ITESRProvider.java index 17a5959b..dcdde7f6 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ITESRProvider.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ITESRProvider.java @@ -1,13 +1,18 @@ package de.ellpeck.naturesaura.reg; import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.Tuple; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; +import java.util.function.Function; + public interface ITESRProvider { @OnlyIn(Dist.CLIENT) - Tuple getTESR(); + Tuple>> getTESR(); } diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ModArmorMaterial.java b/src/main/java/de/ellpeck/naturesaura/reg/ModArmorMaterial.java index 78e2c7da..b4f67688 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ModArmorMaterial.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ModArmorMaterial.java @@ -5,7 +5,7 @@ import de.ellpeck.naturesaura.items.ModItems; import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.IArmorMaterial; import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.LazyLoadBase; +import net.minecraft.util.LazyValue; import net.minecraft.util.SoundEvent; import net.minecraft.util.SoundEvents; import net.minecraftforge.api.distmarker.Dist; @@ -24,7 +24,7 @@ public enum ModArmorMaterial implements IArmorMaterial { private final int enchantability; private final SoundEvent soundEvent; private final float toughness; - private final LazyLoadBase repairMaterial; + private final LazyValue repairMaterial; ModArmorMaterial(String nameIn, int maxDamageFactorIn, int[] damageReductionAmountsIn, int enchantabilityIn, SoundEvent equipSoundIn, float toughness, Supplier repairMaterialSupplier) { this.name = nameIn; @@ -33,7 +33,7 @@ public enum ModArmorMaterial implements IArmorMaterial { this.enchantability = enchantabilityIn; this.soundEvent = equipSoundIn; this.toughness = toughness; - this.repairMaterial = new LazyLoadBase<>(repairMaterialSupplier); + this.repairMaterial = new LazyValue<>(repairMaterialSupplier); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ModItemTier.java b/src/main/java/de/ellpeck/naturesaura/reg/ModItemTier.java index 063fb336..df3d5aab 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ModItemTier.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ModItemTier.java @@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.reg; import de.ellpeck.naturesaura.items.ModItems; import net.minecraft.item.IItemTier; import net.minecraft.item.crafting.Ingredient; -import net.minecraft.util.LazyLoadBase; +import net.minecraft.util.LazyValue; import java.util.function.Supplier; @@ -15,7 +15,7 @@ public enum ModItemTier implements IItemTier { private final float efficiency; private final float attackDamage; private final int enchantability; - private final LazyLoadBase repairMaterial; + private final LazyValue repairMaterial; ModItemTier(int harvestLevelIn, int maxUsesIn, float efficiencyIn, float attackDamageIn, int enchantabilityIn, Supplier repairMaterialIn) { this.harvestLevel = harvestLevelIn; @@ -23,7 +23,7 @@ public enum ModItemTier implements IItemTier { this.efficiency = efficiencyIn; this.attackDamage = attackDamageIn; this.enchantability = enchantabilityIn; - this.repairMaterial = new LazyLoadBase<>(repairMaterialIn); + this.repairMaterial = new LazyValue<>(repairMaterialIn); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java index 6649293b..ed4a1218 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java @@ -233,8 +233,8 @@ public final class ModRegistry { ); Helper.populateObjectHolders(ModEntities.class, event.getRegistry()); - NaturesAura.proxy.registerEntityRenderer(EntityMoverMinecart.class, () -> RenderMoverMinecart::new); - NaturesAura.proxy.registerEntityRenderer(EntityEffectInhibitor.class, () -> RenderEffectInhibitor::new); + NaturesAura.proxy.registerEntityRenderer(ModEntities.MOVER_CART, () -> RenderMoverMinecart::new); + NaturesAura.proxy.registerEntityRenderer(ModEntities.EFFECT_INHIBITOR, () -> RenderEffectInhibitor::new); } @SubscribeEvent diff --git a/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java b/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java index ec24d6ca..95e0115d 100644 --- a/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java +++ b/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java @@ -1,10 +1,13 @@ package de.ellpeck.naturesaura.renderers; +import com.mojang.blaze3d.matrix.MatrixStack; import com.mojang.blaze3d.platform.GlStateManager; +import com.mojang.blaze3d.systems.RenderSystem; import de.ellpeck.naturesaura.api.render.ITrinketItem; import de.ellpeck.naturesaura.api.render.ITrinketItem.RenderType; import de.ellpeck.naturesaura.compat.Compat; import net.minecraft.client.entity.player.AbstractClientPlayerEntity; +import net.minecraft.client.renderer.IRenderTypeBuffer; import net.minecraft.client.renderer.entity.IEntityRenderer; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.minecraft.client.renderer.entity.model.PlayerModel; @@ -18,7 +21,6 @@ import net.minecraftforge.items.IItemHandler; import top.theillusivec4.curios.api.CuriosAPI; import top.theillusivec4.curios.api.capability.ICurioItemHandler; -import javax.annotation.Nonnull; import java.util.HashSet; import java.util.Set; @@ -31,30 +33,30 @@ public class PlayerLayerTrinkets extends LayerRenderer