From e48235656332672409869a46440fab897c5badea Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Sun, 20 Oct 2019 22:30:49 +0200 Subject: [PATCH] automatic vazkii thing --- .../java/de/ellpeck/naturesaura/Helper.java | 76 +++++++++---------- .../de/ellpeck/naturesaura/InternalHooks.java | 8 +- .../de/ellpeck/naturesaura/ModConfig.java | 2 +- .../de/ellpeck/naturesaura/NaturesAura.java | 6 +- .../naturesaura/api/NaturesAuraAPI.java | 20 ++--- .../api/aura/chunk/IAuraChunk.java | 4 +- .../api/aura/chunk/IDrainSpotEffect.java | 4 +- .../aura/container/BasicAuraContainer.java | 6 +- .../api/aura/container/ItemAuraContainer.java | 4 +- .../api/aura/type/BasicAuraType.java | 2 +- .../naturesaura/api/internal/StubHooks.java | 6 +- .../naturesaura/api/misc/IWorldData.java | 6 +- .../naturesaura/api/multiblock/Matcher.java | 16 ++-- .../api/recipes/AnimalSpawnerRecipe.java | 6 +- .../naturesaura/api/render/ITrinketItem.java | 10 +-- .../naturesaura/api/render/IVisualizable.java | 8 +- .../blocks/BlockAncientLeaves.java | 36 ++++----- .../naturesaura/blocks/BlockAncientLog.java | 10 +-- .../blocks/BlockAncientSapling.java | 32 ++++---- .../blocks/BlockAnimalGenerator.java | 34 ++++----- .../naturesaura/blocks/BlockAuraDetector.java | 6 +- .../naturesaura/blocks/BlockAutoCrafter.java | 18 ++--- .../naturesaura/blocks/BlockChunkLoader.java | 30 ++++---- .../blocks/BlockContainerImpl.java | 32 ++++---- .../blocks/BlockDecayedLeaves.java | 16 ++-- .../blocks/BlockDimensionRail.java | 30 ++++---- .../naturesaura/blocks/BlockEndFlower.java | 34 ++++----- .../naturesaura/blocks/BlockEnderCrate.java | 44 +++++------ .../naturesaura/blocks/BlockFieldCreator.java | 46 +++++------ .../blocks/BlockFireworkGenerator.java | 8 +- .../blocks/BlockFlowerGenerator.java | 8 +- .../blocks/BlockFurnaceHeater.java | 42 +++++----- .../blocks/BlockGeneratorLimitRemover.java | 10 +-- .../naturesaura/blocks/BlockGoldPowder.java | 60 +++++++-------- .../naturesaura/blocks/BlockGoldenLeaves.java | 48 ++++++------ .../naturesaura/blocks/BlockGratedChute.java | 50 ++++++------ .../blocks/BlockHopperUpgrade.java | 8 +- .../blocks/BlockMossGenerator.java | 8 +- .../naturesaura/blocks/BlockNatureAltar.java | 34 ++++----- .../naturesaura/blocks/BlockOakGenerator.java | 14 ++-- .../blocks/BlockOfferingTable.java | 32 ++++---- .../blocks/BlockPickupStopper.java | 18 ++--- .../naturesaura/blocks/BlockPlacer.java | 8 +- .../naturesaura/blocks/BlockPowderPlacer.java | 18 ++--- .../blocks/BlockProjectileGenerator.java | 20 ++--- .../naturesaura/blocks/BlockSlabsNA.java | 48 ++++++------ .../naturesaura/blocks/BlockSpawnLamp.java | 34 ++++----- .../naturesaura/blocks/BlockStairsNA.java | 16 ++-- .../naturesaura/blocks/BlockWoodStand.java | 36 ++++----- .../ellpeck/naturesaura/blocks/ModBlocks.java | 2 +- .../naturesaura/blocks/multi/Multiblock.java | 6 +- .../naturesaura/blocks/multi/Multiblocks.java | 8 +- .../blocks/tiles/TileEntityAncientLeaves.java | 10 +-- .../blocks/tiles/TileEntityAnimalSpawner.java | 14 ++-- .../blocks/tiles/TileEntityAutoCrafter.java | 36 ++++----- .../blocks/tiles/TileEntityChunkLoader.java | 2 +- .../blocks/tiles/TileEntityEndFlower.java | 24 +++--- .../blocks/tiles/TileEntityEnderCrate.java | 16 ++-- .../blocks/tiles/TileEntityFieldCreator.java | 24 +++--- .../tiles/TileEntityFireworkGenerator.java | 30 ++++---- .../tiles/TileEntityFlowerGenerator.java | 32 ++++---- .../blocks/tiles/TileEntityFurnaceHeater.java | 22 +++--- .../TileEntityGeneratorLimitRemover.java | 6 +- .../blocks/tiles/TileEntityGratedChute.java | 32 ++++---- .../blocks/tiles/TileEntityHopperUpgrade.java | 20 ++--- .../blocks/tiles/TileEntityImpl.java | 58 +++++++------- .../blocks/tiles/TileEntityMossGenerator.java | 8 +- .../blocks/tiles/TileEntityNatureAltar.java | 24 +++--- .../blocks/tiles/TileEntityOakGenerator.java | 4 +- .../blocks/tiles/TileEntityOfferingTable.java | 30 ++++---- .../blocks/tiles/TileEntityPlacer.java | 38 +++++----- .../tiles/TileEntityPotionGenerator.java | 16 ++-- .../blocks/tiles/TileEntityPowderPlacer.java | 8 +- .../tiles/TileEntityProjectileGenerator.java | 12 +-- .../blocks/tiles/TileEntityRFConverter.java | 14 ++-- .../blocks/tiles/TileEntityTimeChanger.java | 32 ++++---- .../blocks/tiles/TileEntityWoodStand.java | 30 ++++---- .../blocks/tiles/render/RenderEnderCrate.java | 12 +-- .../render/RenderGeneratorLimitRemover.java | 12 +-- .../tiles/render/RenderNatureAltar.java | 10 +-- .../tiles/render/RenderOfferingTable.java | 10 +-- .../render/RenderProjectileGenerator.java | 20 ++--- .../blocks/tiles/render/RenderWoodStand.java | 10 +-- .../ellpeck/naturesaura/chunk/AuraChunk.java | 22 +++--- .../naturesaura/chunk/AuraChunkProvider.java | 14 ++-- .../chunk/effect/AnimalEffect.java | 34 ++++----- .../chunk/effect/BreathlessEffect.java | 16 ++-- .../chunk/effect/CacheRechargeEffect.java | 8 +- .../chunk/effect/ExplosionEffect.java | 6 +- .../chunk/effect/GrassDieEffect.java | 12 +-- .../chunk/effect/OreSpawnEffect.java | 18 ++--- .../chunk/effect/PlantBoostEffect.java | 12 +-- .../chunk/effect/SpreadEffect.java | 4 +- .../naturesaura/commands/CommandAura.java | 8 +- .../naturesaura/compat/BaublesCompat.java | 14 ++-- .../jei/animal/AnimalSpawnerWrapper.java | 4 +- .../compat/patchouli/PatchouliCompat.java | 20 ++--- .../patchouli/ProcessorAnimalSpawner.java | 2 +- .../entities/EntityEffectInhibitor.java | 16 ++-- .../entities/EntityMoverMinecart.java | 28 +++---- .../render/RenderEffectInhibitor.java | 20 ++--- .../entities/render/RenderMoverMinecart.java | 14 ++-- .../naturesaura/events/ClientEvents.java | 56 +++++++------- .../naturesaura/events/CommonEvents.java | 6 +- .../naturesaura/gen/WorldGenAncientTree.java | 26 +++---- .../naturesaura/gui/ContainerEnderCrate.java | 12 +-- .../naturesaura/gui/GuiEnderCrate.java | 18 ++--- .../ellpeck/naturesaura/gui/GuiHandler.java | 6 +- .../naturesaura/items/ItemAuraBottle.java | 42 +++++----- .../naturesaura/items/ItemAuraCache.java | 36 ++++----- .../naturesaura/items/ItemBirthSpirit.java | 10 +-- .../naturesaura/items/ItemCaveFinder.java | 28 +++---- .../naturesaura/items/ItemColorChanger.java | 42 +++++----- .../naturesaura/items/ItemEffectPowder.java | 20 ++--- .../naturesaura/items/ItemEnderAccess.java | 22 +++--- .../de/ellpeck/naturesaura/items/ItemEye.java | 16 ++-- .../naturesaura/items/ItemGlowing.java | 6 +- .../naturesaura/items/ItemGoldFiber.java | 14 ++-- .../ellpeck/naturesaura/items/ItemImpl.java | 3 - .../naturesaura/items/ItemMoverMinecart.java | 22 +++--- .../items/ItemMultiblockMaker.java | 24 +++--- .../items/ItemRangeVisualizer.java | 38 +++++----- .../items/ItemShockwaveCreator.java | 62 +++++++-------- .../ellpeck/naturesaura/items/ItemSlabNA.java | 50 ++++++------ .../ellpeck/naturesaura/items/ModItems.java | 12 +-- .../naturesaura/items/tools/ItemArmorNA.java | 30 ++++---- .../naturesaura/items/tools/ItemAxeNA.java | 12 +-- .../naturesaura/items/tools/ItemHoeNA.java | 28 +++---- .../items/tools/ItemPickaxeNA.java | 30 ++++---- .../naturesaura/items/tools/ItemShovelNA.java | 32 ++++---- .../naturesaura/items/tools/ItemSwordNA.java | 18 ++--- .../ellpeck/naturesaura/misc/WorldData.java | 24 +++--- .../naturesaura/packet/PacketAuraChunk.java | 6 +- .../naturesaura/packet/PacketClient.java | 6 +- .../naturesaura/packet/PacketHandler.java | 18 ++--- .../packet/PacketParticleStream.java | 6 +- .../naturesaura/packet/PacketParticles.java | 14 ++-- .../particles/ParticleHandler.java | 12 +-- .../naturesaura/particles/ParticleMagic.java | 6 +- .../naturesaura/potion/ModPotions.java | 4 +- .../naturesaura/potion/PotionBreathless.java | 10 +-- .../naturesaura/potion/PotionImpl.java | 12 +-- .../naturesaura/proxy/ClientProxy.java | 12 +-- .../de/ellpeck/naturesaura/proxy/IProxy.java | 2 +- .../naturesaura/proxy/ServerProxy.java | 2 +- .../naturesaura/recipes/ModRecipes.java | 30 ++++---- .../naturesaura/reg/IColorProvidingBlock.java | 6 +- .../naturesaura/reg/IColorProvidingItem.java | 6 +- .../naturesaura/reg/ICreativeItem.java | 4 +- .../reg/ICustomItemBlockProvider.java | 4 +- .../naturesaura/reg/IModelProvider.java | 2 +- .../naturesaura/reg/ITESRProvider.java | 10 +-- .../ellpeck/naturesaura/reg/ModRegistry.java | 24 +++--- .../renderers/PlayerLayerTrinkets.java | 22 +++--- .../renderers/SupporterFancyHandler.java | 20 ++--- 155 files changed, 1478 insertions(+), 1481 deletions(-) diff --git a/src/main/java/de/ellpeck/naturesaura/Helper.java b/src/main/java/de/ellpeck/naturesaura/Helper.java index 62ab703b..05c5e651 100644 --- a/src/main/java/de/ellpeck/naturesaura/Helper.java +++ b/src/main/java/de/ellpeck/naturesaura/Helper.java @@ -7,23 +7,23 @@ import de.ellpeck.naturesaura.chunk.AuraChunk; import net.minecraft.advancements.Advancement; import net.minecraft.block.Block; import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; +import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.block.model.ItemCameraTransforms; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.item.EntityItemFrame; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.init.SoundEvents; +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; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.util.SoundEvents; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.nbt.NBTBase; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; @@ -31,13 +31,13 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; -import net.minecraft.world.chunk.IChunkProvider; -import net.minecraft.world.gen.ChunkProviderServer; +import net.minecraft.world.chunk.AbstractChunkProvider; +import net.minecraft.world.chunk.ServerChunkProvider; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityManager; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandlerModifiable; import org.lwjgl.opengl.GL11; @@ -85,10 +85,10 @@ public final class Helper { world.profiler.endSection(); } - public static List getAttachedItemFrames(World world, BlockPos pos) { - List frames = world.getEntitiesWithinAABB(EntityItemFrame.class, new AxisAlignedBB(pos).grow(0.25)); + public static List getAttachedItemFrames(World world, BlockPos pos) { + List frames = world.getEntitiesWithinAABB(ItemFrameEntity.class, new AxisAlignedBB(pos).grow(0.25)); for (int i = frames.size() - 1; i >= 0; i--) { - EntityItemFrame frame = frames.get(i); + ItemFrameEntity frame = frames.get(i); BlockPos framePos = frame.getHangingPosition().offset(frame.facingDirection.getOpposite()); if (!pos.equals(framePos)) frames.remove(i); @@ -99,9 +99,9 @@ public final class Helper { // For some reason this method isn't public in World, but I also don't want to have to make a new BlockPos // or use the messy MutableBlockPos system just to see if a chunk is loaded, so this will have to do I guess public static boolean isChunkLoaded(World world, int x, int z) { - IChunkProvider provider = world.getChunkProvider(); - if (provider instanceof ChunkProviderServer) - return ((ChunkProviderServer) provider).chunkExists(x, z); + AbstractChunkProvider provider = world.getChunkProvider(); + if (provider instanceof ServerChunkProvider) + return ((ServerChunkProvider) provider).chunkExists(x, z); else return !provider.provideChunk(x, z).isEmpty(); } @@ -120,7 +120,7 @@ public final class Helper { return !nbt || ItemStack.areItemStackShareTagsEqual(first, second); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void renderItemInWorld(ItemStack stack) { if (!stack.isEmpty()) { GlStateManager.pushMatrix(); @@ -135,7 +135,7 @@ public final class Helper { } } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void renderItemInGui(ItemStack stack, int x, int y, float scale) { GlStateManager.pushMatrix(); GlStateManager.enableBlend(); @@ -151,7 +151,7 @@ public final class Helper { GlStateManager.popMatrix(); } - public static boolean putStackOnTile(EntityPlayer player, EnumHand hand, BlockPos pos, int slot, boolean sound) { + public static boolean 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); @@ -176,7 +176,7 @@ public final class Helper { if (!player.world.isRemote) { ItemStack stack = handler.getStackInSlot(slot); if (!player.addItemStackToInventory(stack)) { - EntityItem item = new EntityItem(player.world, player.posX, player.posY, player.posZ, stack); + ItemEntity item = new ItemEntity(player.world, player.posX, player.posY, player.posZ, stack); player.world.spawnEntity(item); } handler.setStackInSlot(slot, ItemStack.EMPTY); @@ -203,28 +203,28 @@ public final class Helper { }; @Override - public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public boolean hasCapability(@Nonnull Capability capability, @Nullable Direction facing) { return capability == NaturesAuraAPI.capAuraRecharge; } @Nullable @Override - public T getCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public T getCapability(@Nonnull Capability capability, @Nullable Direction facing) { return capability == NaturesAuraAPI.capAuraRecharge ? (T) this.recharge : null; } }; } - public static IBlockState getStateFromString(String raw) { + public static BlockState getStateFromString(String raw) { String[] split = raw.split("\\["); Block block = Block.REGISTRY.getObject(new ResourceLocation(split[0])); if (block != null) { - IBlockState state = block.getDefaultState(); + BlockState state = block.getDefaultState(); if (split.length > 1) { for (String part : split[1].replace("]", "").split(",")) { String[] keyValue = part.split("="); for (IProperty prop : state.getProperties().keySet()) { - IBlockState changed = findProperty(state, prop, keyValue[0], keyValue[1]); + BlockState changed = findProperty(state, prop, keyValue[0], keyValue[1]); if (changed != null) { state = changed; break; @@ -237,7 +237,7 @@ public final class Helper { return null; } - private static > IBlockState findProperty(IBlockState state, IProperty prop, String key, String newValue) { + private static > BlockState findProperty(BlockState state, IProperty prop, String key, String newValue) { if (key.equals(prop.getName())) for (T value : prop.getAllowedValues()) if (prop.getName(value).equals(newValue)) @@ -249,21 +249,21 @@ public final class Helper { CapabilityManager.INSTANCE.register(type, new Capability.IStorage() { @Nullable @Override - public NBTBase writeNBT(Capability capability, Object instance, EnumFacing side) { + public NBTBase writeNBT(Capability capability, Object instance, Direction side) { return null; } @Override - public void readNBT(Capability capability, Object instance, EnumFacing side, NBTBase nbt) { + public void readNBT(Capability capability, Object instance, Direction side, NBTBase nbt) { } }, () -> null); } - public static void addAdvancement(EntityPlayer player, ResourceLocation advancement, String criterion) { - if (!(player instanceof EntityPlayerMP)) + public static void addAdvancement(PlayerEntity player, ResourceLocation advancement, String criterion) { + if (!(player instanceof ServerPlayerEntity)) return; - EntityPlayerMP playerMp = (EntityPlayerMP) player; + ServerPlayerEntity playerMp = (ServerPlayerEntity) player; Advancement adv = playerMp.getServerWorld().getAdvancementManager().getAdvancement(advancement); if (adv != null) playerMp.getAdvancements().grantCriterion(adv, criterion); @@ -277,7 +277,7 @@ public final class Helper { return highestAmount; } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void renderWeirdBox(double x, double y, double z, double width, double height, double depth) { GL11.glVertex3d(x, y + height, z); GL11.glVertex3d(x + width, y + height, z); @@ -305,8 +305,8 @@ public final class Helper { GL11.glVertex3d(x, y, z); } - public static boolean isHoldingItem(EntityPlayer player, Item item) { - for (EnumHand hand : EnumHand.values()) { + public static boolean isHoldingItem(PlayerEntity player, Item item) { + for (Hand hand : Hand.values()) { ItemStack stack = player.getHeldItem(hand); if (!stack.isEmpty() && stack.getItem() == item) return true; diff --git a/src/main/java/de/ellpeck/naturesaura/InternalHooks.java b/src/main/java/de/ellpeck/naturesaura/InternalHooks.java index cdfb4a2e..044f2057 100644 --- a/src/main/java/de/ellpeck/naturesaura/InternalHooks.java +++ b/src/main/java/de/ellpeck/naturesaura/InternalHooks.java @@ -9,7 +9,7 @@ import de.ellpeck.naturesaura.api.multiblock.IMultiblock; import de.ellpeck.naturesaura.blocks.multi.Multiblock; import de.ellpeck.naturesaura.compat.Compat; import de.ellpeck.naturesaura.misc.WorldData; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Tuple; @@ -29,16 +29,16 @@ import java.util.function.BiConsumer; public class InternalHooks implements NaturesAuraAPI.IInternalHooks { @Override - public boolean extractAuraFromPlayer(EntityPlayer player, int amount, boolean simulate) { + public boolean extractAuraFromPlayer(PlayerEntity player, int amount, boolean simulate) { return this.auraPlayerInteraction(player, amount, true, simulate); } @Override - public boolean insertAuraIntoPlayer(EntityPlayer player, int amount, boolean simulate) { + public boolean insertAuraIntoPlayer(PlayerEntity player, int amount, boolean simulate) { return this.auraPlayerInteraction(player, amount, false, simulate); } - private boolean auraPlayerInteraction(EntityPlayer player, int amount, boolean extract, boolean simulate) { + private boolean auraPlayerInteraction(PlayerEntity player, int amount, boolean extract, boolean simulate) { if (extract && player.capabilities.isCreativeMode) return true; diff --git a/src/main/java/de/ellpeck/naturesaura/ModConfig.java b/src/main/java/de/ellpeck/naturesaura/ModConfig.java index 76a71ef1..d72e788c 100644 --- a/src/main/java/de/ellpeck/naturesaura/ModConfig.java +++ b/src/main/java/de/ellpeck/naturesaura/ModConfig.java @@ -6,7 +6,7 @@ import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.api.recipes.WeightedOre; import de.ellpeck.naturesaura.chunk.effect.OreSpawnEffect; import net.minecraft.util.ResourceLocation; -import net.minecraft.world.DimensionType; +import net.minecraft.world.dimension.DimensionType; import net.minecraftforge.common.config.Config; import net.minecraftforge.common.config.Config.Comment; import net.minecraftforge.common.config.Config.RangeDouble; diff --git a/src/main/java/de/ellpeck/naturesaura/NaturesAura.java b/src/main/java/de/ellpeck/naturesaura/NaturesAura.java index 9d405bb4..5f3fa714 100644 --- a/src/main/java/de/ellpeck/naturesaura/NaturesAura.java +++ b/src/main/java/de/ellpeck/naturesaura/NaturesAura.java @@ -20,8 +20,8 @@ import de.ellpeck.naturesaura.potion.ModPotions; import de.ellpeck.naturesaura.proxy.IProxy; import de.ellpeck.naturesaura.recipes.ModRecipes; import de.ellpeck.naturesaura.reg.ModRegistry; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.init.Items; +import net.minecraft.item.ItemGroup; +import net.minecraft.item.Items; import net.minecraft.item.ItemStack; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.common.Mod; @@ -55,7 +55,7 @@ public final class NaturesAura { @SidedProxy(modId = MOD_ID, clientSide = PROXY_LOCATION + "ClientProxy", serverSide = PROXY_LOCATION + "ServerProxy") public static IProxy proxy; - public static final CreativeTabs CREATIVE_TAB = new CreativeTabs(MOD_ID) { + public static final ItemGroup CREATIVE_TAB = new ItemGroup(MOD_ID) { @Override public ItemStack createIcon() { return new ItemStack(ModItems.GOLD_LEAF); diff --git a/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java b/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java index 43c9017e..e08a4ee5 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java +++ b/src/main/java/de/ellpeck/naturesaura/api/NaturesAuraAPI.java @@ -13,15 +13,15 @@ import de.ellpeck.naturesaura.api.misc.IWorldData; import de.ellpeck.naturesaura.api.multiblock.IMultiblock; import de.ellpeck.naturesaura.api.multiblock.Matcher; import de.ellpeck.naturesaura.api.recipes.*; -import net.minecraft.block.BlockFlower; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.FlowerBlock; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Tuple; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.DimensionType; +import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.CapabilityInject; @@ -66,16 +66,16 @@ public final class NaturesAuraAPI { /** * The list of all types of blocks that several mechanics in the mod use as * flowers. Right now, this includes the Herbivorous Absorber and the - * Offering Table. By default, all {@link BlockFlower} instances and all + * Offering Table. By default, all {@link FlowerBlock} instances and all * blocks specified in the config file are added */ - public static final List FLOWERS = new ArrayList<>(); + public static final List FLOWERS = new ArrayList<>(); /** * A map of all of the block states that the Botanist's Pickaxe can convert * into their mossy variations. Contains mossy brick and mossy cobblestone * by default, along with all blocks specified in the config file */ - public static final BiMap BOTANIST_PICKAXE_CONVERSIONS = HashBiMap.create(); + public static final BiMap BOTANIST_PICKAXE_CONVERSIONS = HashBiMap.create(); /** * A map of all {@link IAuraType} instances which are types of Aura present * in different types of worlds. {@link BasicAuraType} instances can be @@ -201,7 +201,7 @@ public final class NaturesAuraAPI { * @param simulate If the extraction should be simulated * @return If the extraction was successful */ - boolean extractAuraFromPlayer(EntityPlayer player, int amount, boolean simulate); + boolean extractAuraFromPlayer(PlayerEntity player, int amount, boolean simulate); /** * Helper method to insert aura into an {@link IAuraContainer} in the @@ -213,7 +213,7 @@ public final class NaturesAuraAPI { * @param simulate If the insertion should be simulated * @return If the insertion was successful */ - boolean insertAuraIntoPlayer(EntityPlayer player, int amount, boolean simulate); + boolean insertAuraIntoPlayer(PlayerEntity player, int amount, boolean simulate); /** * This method can be used to spawn the magic particle effect used by @@ -285,7 +285,7 @@ public final class NaturesAuraAPI { * each character is mapped to a raw matcher * @param rawMatchers Each char matcher in the form of the char followed * by a matcher, either in the form of a Block, an - * IBlockState or a {@link Matcher}, similar to the + * BlockState or a {@link Matcher}, similar to the * old way that crafting recipes work. * @return the multiblock instance */ diff --git a/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IAuraChunk.java b/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IAuraChunk.java index 29918515..edf34ce1 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IAuraChunk.java +++ b/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IAuraChunk.java @@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.api.aura.chunk; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.type.IAuraType; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraft.world.chunk.Chunk; @@ -18,7 +18,7 @@ import java.util.function.BiConsumer; * It is not intended for API users to create custom implementation of this * class. */ -public interface IAuraChunk extends INBTSerializable { +public interface IAuraChunk extends INBTSerializable { /** * The default amount of Aura that a chunk has stored */ diff --git a/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IDrainSpotEffect.java b/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IDrainSpotEffect.java index 7262e5e6..38f79b62 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IDrainSpotEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/api/aura/chunk/IDrainSpotEffect.java @@ -1,7 +1,7 @@ package de.ellpeck.naturesaura.api.aura.chunk; import de.ellpeck.naturesaura.api.aura.type.IAuraType; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; @@ -16,7 +16,7 @@ public interface IDrainSpotEffect { ResourceLocation getName(); - default int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { + default int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { return -1; } diff --git a/src/main/java/de/ellpeck/naturesaura/api/aura/container/BasicAuraContainer.java b/src/main/java/de/ellpeck/naturesaura/api/aura/container/BasicAuraContainer.java index c0fb713b..e7ff0acd 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/aura/container/BasicAuraContainer.java +++ b/src/main/java/de/ellpeck/naturesaura/api/aura/container/BasicAuraContainer.java @@ -1,7 +1,7 @@ package de.ellpeck.naturesaura.api.aura.container; import de.ellpeck.naturesaura.api.aura.type.IAuraType; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; public class BasicAuraContainer implements IAuraContainer { @@ -52,11 +52,11 @@ public class BasicAuraContainer implements IAuraContainer { return this.type == null || type.isSimilar(this.type); } - public void writeNBT(NBTTagCompound compound) { + public void writeNBT(CompoundNBT compound) { compound.setInteger("aura", this.aura); } - public void readNBT(NBTTagCompound compound) { + public void readNBT(CompoundNBT compound) { this.aura = compound.getInteger("aura"); } } diff --git a/src/main/java/de/ellpeck/naturesaura/api/aura/container/ItemAuraContainer.java b/src/main/java/de/ellpeck/naturesaura/api/aura/container/ItemAuraContainer.java index ec23b0ba..e71f08aa 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/aura/container/ItemAuraContainer.java +++ b/src/main/java/de/ellpeck/naturesaura/api/aura/container/ItemAuraContainer.java @@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.api.aura.container; import de.ellpeck.naturesaura.api.aura.type.IAuraType; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; public class ItemAuraContainer implements IAuraContainer { @@ -38,7 +38,7 @@ public class ItemAuraContainer implements IAuraContainer { private void setAura(int amount) { if (!this.stack.hasTagCompound()) { - this.stack.setTagCompound(new NBTTagCompound()); + this.stack.setTagCompound(new CompoundNBT()); } this.stack.getTagCompound().setInteger("aura", amount); } diff --git a/src/main/java/de/ellpeck/naturesaura/api/aura/type/BasicAuraType.java b/src/main/java/de/ellpeck/naturesaura/api/aura/type/BasicAuraType.java index e7ed5e02..7cdc54bb 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/aura/type/BasicAuraType.java +++ b/src/main/java/de/ellpeck/naturesaura/api/aura/type/BasicAuraType.java @@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.api.aura.type; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import net.minecraft.util.ResourceLocation; -import net.minecraft.world.DimensionType; +import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.World; import java.util.HashSet; diff --git a/src/main/java/de/ellpeck/naturesaura/api/internal/StubHooks.java b/src/main/java/de/ellpeck/naturesaura/api/internal/StubHooks.java index 45a933ac..2e361839 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/internal/StubHooks.java +++ b/src/main/java/de/ellpeck/naturesaura/api/internal/StubHooks.java @@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.api.internal; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.multiblock.IMultiblock; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Tuple; import net.minecraft.util.math.AxisAlignedBB; @@ -17,12 +17,12 @@ import java.util.function.BiConsumer; public class StubHooks implements NaturesAuraAPI.IInternalHooks { @Override - public boolean extractAuraFromPlayer(EntityPlayer player, int amount, boolean simulate) { + public boolean extractAuraFromPlayer(PlayerEntity player, int amount, boolean simulate) { return false; } @Override - public boolean insertAuraIntoPlayer(EntityPlayer player, int amount, boolean simulate) { + public boolean insertAuraIntoPlayer(PlayerEntity player, int amount, boolean simulate) { return false; } diff --git a/src/main/java/de/ellpeck/naturesaura/api/misc/IWorldData.java b/src/main/java/de/ellpeck/naturesaura/api/misc/IWorldData.java index dbe07bfd..cdf84e13 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/misc/IWorldData.java +++ b/src/main/java/de/ellpeck/naturesaura/api/misc/IWorldData.java @@ -1,14 +1,14 @@ package de.ellpeck.naturesaura.api.misc; import de.ellpeck.naturesaura.api.NaturesAuraAPI; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.world.DimensionType; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.common.util.INBTSerializable; import net.minecraftforge.items.IItemHandlerModifiable; -public interface IWorldData extends ICapabilityProvider, INBTSerializable { +public interface IWorldData extends ICapabilityProvider, INBTSerializable { static IWorldData getWorldData(World world) { if (world.hasCapability(NaturesAuraAPI.capWorldData, null)) diff --git a/src/main/java/de/ellpeck/naturesaura/api/multiblock/Matcher.java b/src/main/java/de/ellpeck/naturesaura/api/multiblock/Matcher.java index f14007b9..df03536d 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/multiblock/Matcher.java +++ b/src/main/java/de/ellpeck/naturesaura/api/multiblock/Matcher.java @@ -1,8 +1,8 @@ package de.ellpeck.naturesaura.api.multiblock; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -13,15 +13,15 @@ import java.util.List; public class Matcher { - private final IBlockState defaultState; + private final BlockState defaultState; private final ICheck check; - public Matcher(IBlockState defaultState, ICheck check) { + public Matcher(BlockState defaultState, ICheck check) { this.defaultState = defaultState; this.check = check; } - public IBlockState getDefaultState() { + public BlockState getDefaultState() { return this.defaultState; } @@ -35,10 +35,10 @@ public class Matcher { public static Matcher oreDict(Block defaultBlock, String name) { return new Matcher(defaultBlock.getDefaultState(), new ICheck() { - private List states; + private List states; @Override - public boolean matches(World world, BlockPos start, BlockPos offset, BlockPos pos, IBlockState state, char c) { + public boolean matches(World world, BlockPos start, BlockPos offset, BlockPos pos, BlockState state, char c) { if (this.states == null) { this.states = new ArrayList<>(); for (ItemStack stack : OreDictionary.getOres(name)) { @@ -59,6 +59,6 @@ public class Matcher { } public interface ICheck { - boolean matches(World world, BlockPos start, BlockPos offset, BlockPos pos, IBlockState state, char c); + boolean matches(World world, BlockPos start, BlockPos offset, BlockPos pos, BlockState state, char c); } } diff --git a/src/main/java/de/ellpeck/naturesaura/api/recipes/AnimalSpawnerRecipe.java b/src/main/java/de/ellpeck/naturesaura/api/recipes/AnimalSpawnerRecipe.java index c7aa956e..11ed1ace 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/recipes/AnimalSpawnerRecipe.java +++ b/src/main/java/de/ellpeck/naturesaura/api/recipes/AnimalSpawnerRecipe.java @@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.api.recipes; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.MobEntity; import net.minecraft.item.crafting.Ingredient; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.MathHelper; @@ -34,8 +34,8 @@ public class AnimalSpawnerRecipe { if (x == 0 && y == 0 && z == 0) return entity; entity.setLocationAndAngles(x, y, z, MathHelper.wrapDegrees(world.rand.nextFloat() * 360F), 0F); - if (entity instanceof EntityLiving) { - EntityLiving living = (EntityLiving) entity; + if (entity instanceof MobEntity) { + MobEntity living = (MobEntity) entity; living.rotationYawHead = entity.rotationYaw; living.renderYawOffset = entity.rotationYaw; living.onInitialSpawn(world.getDifficultyForLocation(living.getPosition()), null); diff --git a/src/main/java/de/ellpeck/naturesaura/api/render/ITrinketItem.java b/src/main/java/de/ellpeck/naturesaura/api/render/ITrinketItem.java index 88d6635a..fbf6d81a 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/render/ITrinketItem.java +++ b/src/main/java/de/ellpeck/naturesaura/api/render/ITrinketItem.java @@ -1,16 +1,16 @@ package de.ellpeck.naturesaura.api.render; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public interface ITrinketItem { enum RenderType { HEAD, BODY } - @SideOnly(Side.CLIENT) - void render(ItemStack stack, EntityPlayer player, RenderType type, boolean isHolding); + @OnlyIn(Dist.CLIENT) + void render(ItemStack stack, PlayerEntity player, RenderType type, boolean isHolding); } diff --git a/src/main/java/de/ellpeck/naturesaura/api/render/IVisualizable.java b/src/main/java/de/ellpeck/naturesaura/api/render/IVisualizable.java index 10f9a093..c0b2416b 100644 --- a/src/main/java/de/ellpeck/naturesaura/api/render/IVisualizable.java +++ b/src/main/java/de/ellpeck/naturesaura/api/render/IVisualizable.java @@ -3,14 +3,14 @@ package de.ellpeck.naturesaura.api.render; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public interface IVisualizable { - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) AxisAlignedBB getVisualizationBounds(World world, BlockPos pos); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) int getVisualizationColor(World world, BlockPos pos); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java index 63780a53..9c991af0 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLeaves.java @@ -4,12 +4,12 @@ import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.blocks.tiles.TileEntityAncientLeaves; import de.ellpeck.naturesaura.reg.*; -import net.minecraft.block.BlockLeaves; +import net.minecraft.block.LeavesBlock; import net.minecraft.block.BlockPlanks; import net.minecraft.block.ITileEntityProvider; -import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.MaterialColor; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.item.Item; @@ -23,15 +23,15 @@ import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import net.minecraftforge.fml.common.registry.GameRegistry; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import javax.annotation.Nullable; import java.util.Collections; import java.util.List; import java.util.Random; -public class BlockAncientLeaves extends BlockLeaves implements +public class BlockAncientLeaves extends LeavesBlock implements IModItem, ICreativeItem, IModelProvider, IColorProvidingBlock, IColorProvidingItem, ITileEntityProvider { public BlockAncientLeaves() { @@ -40,8 +40,8 @@ public class BlockAncientLeaves extends BlockLeaves implements } @Override - public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos) { - return MapColor.PINK; + public MaterialColor getMapColor(BlockState state, IBlockAccess worldIn, BlockPos pos) { + return MaterialColor.PINK; } @Override @@ -75,7 +75,7 @@ public class BlockAncientLeaves extends BlockLeaves implements } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { boolean check = (meta & 1) != 0; boolean decay = (meta & 2) != 0; @@ -83,7 +83,7 @@ public class BlockAncientLeaves extends BlockLeaves implements } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { boolean check = state.getValue(CHECK_DECAY); boolean decay = state.getValue(DECAYABLE); @@ -91,14 +91,14 @@ public class BlockAncientLeaves extends BlockLeaves implements } @Override - public void beginLeavesDecay(IBlockState state, World world, BlockPos pos) { + public void beginLeavesDecay(BlockState state, World world, BlockPos pos) { if (!state.getValue(CHECK_DECAY) && state.getValue(DECAYABLE)) { world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4); } } @Override - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { + public void breakBlock(World worldIn, BlockPos pos, BlockState state) { super.breakBlock(worldIn, pos, state); worldIn.removeTileEntity(pos); } @@ -115,20 +115,20 @@ public class BlockAncientLeaves extends BlockLeaves implements } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IBlockColor getBlockColor() { return (state, worldIn, pos, tintIndex) -> 0xE55B97; } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IItemColor getItemColor() { return (stack, tintIndex) -> 0xE55B97; } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { + @OnlyIn(Dist.CLIENT) + public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { super.randomDisplayTick(stateIn, worldIn, pos, rand); if (rand.nextFloat() >= 0.95F && !worldIn.getBlockState(pos.down()).isFullBlock()) { TileEntity tile = worldIn.getTileEntity(pos); @@ -147,12 +147,12 @@ public class BlockAncientLeaves extends BlockLeaves implements } @Override - public Item getItemDropped(IBlockState state, Random rand, int fortune) { + public Item getItemDropped(BlockState state, Random rand, int fortune) { return Item.getItemFromBlock(ModBlocks.ANCIENT_SAPLING); } @Override - public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { + public void updateTick(World worldIn, BlockPos pos, BlockState state, Random rand) { super.updateTick(worldIn, pos, state, rand); if (!worldIn.isRemote) { TileEntity tile = worldIn.getTileEntity(pos); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java index 80431035..2d096588 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientLog.java @@ -4,14 +4,14 @@ import de.ellpeck.naturesaura.reg.ICreativeItem; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; -import net.minecraft.block.BlockLog; +import net.minecraft.block.LogBlock; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -public class BlockAncientLog extends BlockLog implements IModItem, ICreativeItem, IModelProvider { +public class BlockAncientLog extends LogBlock implements IModItem, ICreativeItem, IModelProvider { private final String baseName; @@ -46,12 +46,12 @@ public class BlockAncientLog extends BlockLog implements IModItem, ICreativeItem } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(LOG_AXIS).ordinal(); } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(LOG_AXIS, EnumAxis.values()[meta]); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java index 71ff0ebd..b981df21 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAncientSapling.java @@ -5,12 +5,12 @@ import de.ellpeck.naturesaura.reg.ICreativeItem; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; -import net.minecraft.block.BlockBush; -import net.minecraft.block.BlockSapling; +import net.minecraft.block.BushBlock; +import net.minecraft.block.SaplingBlock; import net.minecraft.block.IGrowable; import net.minecraft.block.SoundType; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; @@ -22,7 +22,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import java.util.Random; -public class BlockAncientSapling extends BlockBush implements IGrowable, IModItem, ICreativeItem, IModelProvider { +public class BlockAncientSapling extends BushBlock implements IGrowable, IModItem, ICreativeItem, IModelProvider { private static final AxisAlignedBB AABB = new AxisAlignedBB( 0.09999999403953552D, 0.0D, 0.09999999403953552D, @@ -36,12 +36,12 @@ public class BlockAncientSapling extends BlockBush implements IGrowable, IModIte } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return AABB; } @Override - public void updateTick(World world, BlockPos pos, IBlockState state, Random rand) { + public void updateTick(World world, BlockPos pos, BlockState state, Random rand) { if (!world.isRemote) { super.updateTick(world, pos, state, rand); @@ -72,34 +72,34 @@ public class BlockAncientSapling extends BlockBush implements IGrowable, IModIte } @Override - public IBlockState getStateFromMeta(int meta) { - return this.getDefaultState().withProperty(BlockSapling.STAGE, meta); + public BlockState getStateFromMeta(int meta) { + return this.getDefaultState().withProperty(SaplingBlock.STAGE, meta); } @Override - public int getMetaFromState(IBlockState state) { - return state.getValue(BlockSapling.STAGE); + public int getMetaFromState(BlockState state) { + return state.getValue(SaplingBlock.STAGE); } @Override protected BlockStateContainer createBlockState() { - return new BlockStateContainer(this, BlockSapling.STAGE); + return new BlockStateContainer(this, SaplingBlock.STAGE); } @Override - public boolean canGrow(World world, BlockPos pos, IBlockState state, boolean isClient) { + public boolean canGrow(World world, BlockPos pos, BlockState state, boolean isClient) { return true; } @Override - public boolean canUseBonemeal(World world, Random rand, BlockPos pos, IBlockState state) { + public boolean canUseBonemeal(World world, Random rand, BlockPos pos, BlockState state) { return world.rand.nextFloat() < 0.45F; } @Override - public void grow(World world, Random rand, BlockPos pos, IBlockState state) { - if (state.getValue(BlockSapling.STAGE) == 0) { - world.setBlockState(pos, state.cycleProperty(BlockSapling.STAGE), 4); + public void grow(World world, Random rand, BlockPos pos, BlockState state) { + if (state.getValue(SaplingBlock.STAGE) == 0) { + world.setBlockState(pos, state.cycleProperty(SaplingBlock.STAGE), 4); } else if (TerrainGen.saplingGrowTree(world, rand, pos)) { new WorldGenAncientTree(true).generate(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 c0cabb27..9e6aa9f3 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAnimalGenerator.java @@ -8,11 +8,11 @@ import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.INpc; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.INPC; import net.minecraft.entity.monster.IMob; -import net.minecraft.entity.passive.IAnimals; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.entity.passive.IAnimal; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -22,9 +22,9 @@ import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.living.LivingExperienceDropEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class BlockAnimalGenerator extends BlockContainerImpl implements IVisualizable { public BlockAnimalGenerator() { @@ -37,18 +37,18 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali @SubscribeEvent public void onLivingUpdate(LivingEvent.LivingUpdateEvent event) { - EntityLivingBase entity = event.getEntityLiving(); - if (entity.world.isRemote || !(entity instanceof IAnimals) || entity instanceof IMob || entity instanceof INpc) + LivingEntity entity = event.getEntityLiving(); + if (entity.world.isRemote || !(entity instanceof IAnimal) || entity instanceof IMob || entity instanceof INPC) return; - NBTTagCompound data = entity.getEntityData(); + CompoundNBT data = entity.getEntityData(); int timeAlive = data.getInteger(NaturesAura.MOD_ID + ":time_alive"); data.setInteger(NaturesAura.MOD_ID + ":time_alive", timeAlive + 1); } @SubscribeEvent public void onEntityDeath(LivingDeathEvent event) { - EntityLivingBase entity = event.getEntityLiving(); - if (entity.world.isRemote || !(entity instanceof IAnimals) || entity instanceof IMob || entity instanceof INpc) + LivingEntity entity = event.getEntityLiving(); + if (entity.world.isRemote || !(entity instanceof IAnimal) || entity instanceof IMob || entity instanceof INPC) return; BlockPos pos = entity.getPosition(); Helper.getTileEntitiesInArea(entity.world, pos, 5, tile -> { @@ -56,7 +56,7 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali return false; TileEntityAnimalGenerator gen = (TileEntityAnimalGenerator) tile; - NBTTagCompound data = entity.getEntityData(); + CompoundNBT data = entity.getEntityData(); data.setBoolean(NaturesAura.MOD_ID + ":no_drops", true); if (gen.isBusy()) @@ -85,26 +85,26 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali @SubscribeEvent public void onEntityDrops(LivingDropsEvent event) { - EntityLivingBase entity = event.getEntityLiving(); + LivingEntity entity = event.getEntityLiving(); if (entity.getEntityData().getBoolean(NaturesAura.MOD_ID + ":no_drops")) event.setCanceled(true); } @SubscribeEvent public void onEntityExp(LivingExperienceDropEvent event) { - EntityLivingBase entity = event.getEntityLiving(); + LivingEntity entity = event.getEntityLiving(); if (entity.getEntityData().getBoolean(NaturesAura.MOD_ID + ":no_drops")) event.setCanceled(true); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { return new AxisAlignedBB(pos).grow(5); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getVisualizationColor(World world, BlockPos pos) { return 0x11377a; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraDetector.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraDetector.java index 20551d2a..5dd7c721 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraDetector.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAuraDetector.java @@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.blocks.tiles.TileEntityAuraDetector; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -17,12 +17,12 @@ public class BlockAuraDetector extends BlockContainerImpl { } @Override - public boolean hasComparatorInputOverride(IBlockState state) { + public boolean hasComparatorInputOverride(BlockState state) { return true; } @Override - public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos) { + public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityAuraDetector) return ((TileEntityAuraDetector) tile).redstonePower; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAutoCrafter.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAutoCrafter.java index 1053cc99..c57a5b36 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockAutoCrafter.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockAutoCrafter.java @@ -1,19 +1,19 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.blocks.tiles.TileEntityAutoCrafter; -import net.minecraft.block.BlockHorizontal; +import net.minecraft.block.HorizontalBlock; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.EnumFacing; +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockAutoCrafter extends BlockContainerImpl { - public static final PropertyDirection FACING = BlockHorizontal.FACING; + public static final PropertyDirection FACING = HorizontalBlock.FACING; public BlockAutoCrafter() { super(Material.WOOD, "auto_crafter", TileEntityAutoCrafter.class, "auto_crafter"); @@ -27,17 +27,17 @@ public class BlockAutoCrafter extends BlockContainerImpl { } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(FACING).getHorizontalIndex(); } @Override - public IBlockState getStateFromMeta(int meta) { - return this.getDefaultState().withProperty(FACING, EnumFacing.byHorizontalIndex(meta)); + public BlockState getStateFromMeta(int meta) { + return this.getDefaultState().withProperty(FACING, Direction.byHorizontalIndex(meta)); } @Override - public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { + public BlockState getStateForPlacement(World worldIn, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, LivingEntity placer) { return this.getDefaultState().withProperty(FACING, placer.getHorizontalFacing()); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockChunkLoader.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockChunkLoader.java index 4dee5a6f..41f9132a 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockChunkLoader.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockChunkLoader.java @@ -7,10 +7,10 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityChunkLoader; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.state.IBlockState; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.block.BlockState; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -19,8 +19,8 @@ import net.minecraft.world.World; import net.minecraftforge.common.ForgeChunkManager; import net.minecraftforge.common.ForgeChunkManager.Ticket; import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import java.util.List; import java.util.Random; @@ -42,7 +42,7 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityChunkLoader) { @@ -61,8 +61,8 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { + @OnlyIn(Dist.CLIENT) + public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityChunkLoader) { int range = ((TileEntityChunkLoader) tile).range(); @@ -75,33 +75,33 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getVisualizationColor(World world, BlockPos pos) { return 0xc159f9; } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return BOUND_BOX; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { + public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) { return false; } @Override - public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) { return BlockFaceShape.UNDEFINED; } @@ -110,7 +110,7 @@ public class BlockChunkLoader extends BlockContainerImpl implements IVisualizabl @Override public void ticketsLoaded(List tickets, World world) { for (Ticket ticket : tickets) { - NBTTagCompound data = ticket.getModData(); + CompoundNBT data = ticket.getModData(); BlockPos pos = BlockPos.fromLong(data.getLong("pos")); TileEntity tile = world.getTileEntity(pos); if (!(tile instanceof TileEntityChunkLoader)) diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java index d71cf73a..f7289a49 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockContainerImpl.java @@ -7,14 +7,14 @@ import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.block.Block; -import net.minecraft.block.BlockContainer; +import net.minecraft.block.ContainerBlock; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.block.BlockRenderType; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; @@ -28,7 +28,7 @@ import net.minecraftforge.fml.common.registry.GameRegistry; import javax.annotation.Nullable; import java.util.Random; -public class BlockContainerImpl extends BlockContainer implements IModItem, ICreativeItem, IModelProvider { +public class BlockContainerImpl extends ContainerBlock implements IModItem, ICreativeItem, IModelProvider { private final String baseName; @@ -75,12 +75,12 @@ public class BlockContainerImpl extends BlockContainer implements IModItem, ICre } @Override - public EnumBlockRenderType getRenderType(IBlockState state) { - return EnumBlockRenderType.MODEL; + public BlockRenderType getRenderType(BlockState state) { + return BlockRenderType.MODEL; } @Override - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { + public void breakBlock(World worldIn, BlockPos pos, BlockState state) { if (!worldIn.isRemote) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityImpl) @@ -90,7 +90,7 @@ public class BlockContainerImpl extends BlockContainer implements IModItem, ICre } @Override - public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { + public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityImpl) drops.add(((TileEntityImpl) tile).getDrop(state, fortune)); @@ -99,30 +99,30 @@ public class BlockContainerImpl extends BlockContainer implements IModItem, ICre } @Override - public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { + public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest) { return willHarvest || super.removedByPlayer(state, world, pos, player, false); } @Override - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) { + public void harvestBlock(World worldIn, PlayerEntity player, BlockPos pos, BlockState state, @Nullable TileEntity te, ItemStack stack) { super.harvestBlock(worldIn, player, pos, state, te, stack); worldIn.setBlockToAir(pos); } @Override - public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) { + public void onBlockPlacedBy(World worldIn, BlockPos pos, BlockState state, LivingEntity placer, ItemStack stack) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityImpl) ((TileEntityImpl) tile).loadDataOnPlace(stack); } @Override - public void onBlockAdded(World worldIn, BlockPos pos, IBlockState state) { + public void onBlockAdded(World worldIn, BlockPos pos, BlockState state) { this.updateRedstoneState(worldIn, pos); } @Override - public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { + public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { this.updateRedstoneState(worldIn, pos); } @@ -144,7 +144,7 @@ public class BlockContainerImpl extends BlockContainer implements IModItem, ICre } @Override - public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { + public void updateTick(World worldIn, BlockPos pos, BlockState state, Random rand) { 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 88e7d4cc..fcdf42d0 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockDecayedLeaves.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockDecayedLeaves.java @@ -2,14 +2,14 @@ package de.ellpeck.naturesaura.blocks; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Items; +import net.minecraft.block.BlockState; +import net.minecraft.item.Items; import net.minecraft.item.Item; import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import java.util.Random; @@ -24,25 +24,25 @@ public class BlockDecayedLeaves extends BlockImpl { } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public BlockRenderLayer getRenderLayer() { return BlockRenderLayer.CUTOUT_MIPPED; } @Override - public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random random) { + public void updateTick(World worldIn, BlockPos pos, BlockState state, Random random) { if (!worldIn.isRemote) { worldIn.setBlockToAir(pos); } } @Override - public Item getItemDropped(IBlockState state, Random rand, int fortune) { + public Item getItemDropped(BlockState state, Random rand, int fortune) { return Items.AIR; } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java index d1460156..c4b72286 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockDimensionRail.java @@ -9,31 +9,31 @@ import de.ellpeck.naturesaura.reg.ICreativeItem; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; -import net.minecraft.block.BlockRailBase; +import net.minecraft.block.AbstractRailBlock; import net.minecraft.block.SoundType; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.item.EntityMinecart; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.SoundEvents; +import net.minecraft.block.BlockState; +import net.minecraft.entity.item.minecart.AbstractMinecartEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.server.MinecraftServer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.DimensionType; +import net.minecraft.world.dimension.DimensionType; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraft.world.WorldServer; +import net.minecraft.world.ServerWorld; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -public class BlockDimensionRail extends BlockRailBase implements IModItem, ICreativeItem, IModelProvider { +public class BlockDimensionRail extends AbstractRailBlock implements IModItem, ICreativeItem, IModelProvider { public static final PropertyEnum SHAPE = PropertyEnum.create("shape", EnumRailDirection.class, EnumRailDirection.NORTH_SOUTH, EnumRailDirection.EAST_WEST); @@ -60,7 +60,7 @@ public class BlockDimensionRail extends BlockRailBase implements IModItem, ICrea } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { ItemStack stack = playerIn.getHeldItem(hand); if (stack.getItem() == ModItems.RANGE_VISUALIZER) { if (!worldIn.isRemote) { @@ -74,7 +74,7 @@ public class BlockDimensionRail extends BlockRailBase implements IModItem, ICrea } @Override - public void onMinecartPass(World world, EntityMinecart cart, BlockPos pos) { + public void onMinecartPass(World world, AbstractMinecartEntity cart, BlockPos pos) { if (world.isRemote) return; if (cart.isBeingRidden()) @@ -103,7 +103,7 @@ public class BlockDimensionRail extends BlockRailBase implements IModItem, ICrea return new BlockPos(pos.getX() / 8, pos.getY() / 2, pos.getZ() / 8); } else if (this == ModBlocks.DIMENSION_RAIL_END) { // travel to the end from the overworld - WorldServer end = server.getWorld(this.goalDim); + ServerWorld end = server.getWorld(this.goalDim); return end.getSpawnCoordinate().up(8); } else { if (world.provider.getDimensionType() == DimensionType.NETHER) { @@ -138,12 +138,12 @@ public class BlockDimensionRail extends BlockRailBase implements IModItem, ICrea } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(SHAPE).getMetadata(); } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(SHAPE, EnumRailDirection.byMetadata(meta)); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java index 83df6bed..647d167e 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEndFlower.java @@ -6,14 +6,14 @@ import de.ellpeck.naturesaura.reg.ICreativeItem; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; -import net.minecraft.block.BlockBush; +import net.minecraft.block.BushBlock; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.SoundType; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.boss.EntityDragon; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.boss.dragon.EnderDragonEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.block.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.NonNullList; @@ -26,12 +26,12 @@ import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.registry.GameRegistry; import javax.annotation.Nullable; -public class BlockEndFlower extends BlockBush implements IModItem, ICreativeItem, IModelProvider, ITileEntityProvider { +public class BlockEndFlower extends BushBlock implements IModItem, ICreativeItem, IModelProvider, ITileEntityProvider { public BlockEndFlower() { this.setHardness(0.5F); @@ -44,10 +44,10 @@ public class BlockEndFlower extends BlockBush implements IModItem, ICreativeItem @SubscribeEvent public void onDraonTick(LivingUpdateEvent event) { - EntityLivingBase living = event.getEntityLiving(); - if (living.world.isRemote || !(living instanceof EntityDragon)) + LivingEntity living = event.getEntityLiving(); + if (living.world.isRemote || !(living instanceof EnderDragonEntity)) return; - EntityDragon dragon = (EntityDragon) living; + EnderDragonEntity dragon = (EnderDragonEntity) living; if (dragon.deathTicks < 150 || dragon.deathTicks % 10 != 0) return; @@ -64,7 +64,7 @@ public class BlockEndFlower extends BlockBush implements IModItem, ICreativeItem } @Override - protected boolean canSustainBush(IBlockState state) { + protected boolean canSustainBush(BlockState state) { return state.getBlock() == Blocks.END_STONE; } @@ -74,7 +74,7 @@ public class BlockEndFlower extends BlockBush implements IModItem, ICreativeItem } @Override - public boolean canBlockStay(World worldIn, BlockPos pos, IBlockState state) { + public boolean canBlockStay(World worldIn, BlockPos pos, BlockState state) { return this.canSustainBush(worldIn.getBlockState(pos.down())); } @@ -105,13 +105,13 @@ public class BlockEndFlower extends BlockBush implements IModItem, ICreativeItem } @Override - public void breakBlock(World worldIn, BlockPos pos, IBlockState state) { + public void breakBlock(World worldIn, BlockPos pos, BlockState state) { super.breakBlock(worldIn, pos, state); worldIn.removeTileEntity(pos); } @Override - public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { + public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityEndFlower && ((TileEntityEndFlower) tile).isDrainMode) return; @@ -120,12 +120,12 @@ public class BlockEndFlower extends BlockBush implements IModItem, ICreativeItem } @Override - public boolean removedByPlayer(IBlockState state, World world, BlockPos pos, EntityPlayer player, boolean willHarvest) { + public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest) { return willHarvest || super.removedByPlayer(state, world, pos, player, false); } @Override - public void harvestBlock(World worldIn, EntityPlayer player, BlockPos pos, IBlockState state, @Nullable TileEntity te, ItemStack stack) { + public void harvestBlock(World worldIn, PlayerEntity player, BlockPos pos, BlockState state, @Nullable TileEntity te, ItemStack stack) { super.harvestBlock(worldIn, player, pos, state, te, stack); worldIn.setBlockToAir(pos); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java index 44d8df9a..7d38fb11 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockEnderCrate.java @@ -6,21 +6,21 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate; import de.ellpeck.naturesaura.blocks.tiles.render.RenderEnderCrate; import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.reg.ITESRProvider; -import net.minecraft.block.BlockAnvil; +import net.minecraft.block.AnvilBlock; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.resources.I18n; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.Tuple; import net.minecraft.util.math.BlockPos; @@ -29,9 +29,9 @@ import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.AnvilUpdateEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import javax.annotation.Nullable; import java.lang.ref.WeakReference; @@ -55,11 +55,11 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider public static String getEnderName(ItemStack stack) { if (!stack.hasTagCompound()) return ""; - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); return compound.getString(NaturesAura.MOD_ID + ":ender_name"); } - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public static void addEnderNameInfo(ItemStack stack, List tooltip) { String name = getEnderName(stack); if (name != null && !name.isEmpty()) @@ -73,8 +73,8 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider public void onRightClick(PlayerInteractEvent.RightClickBlock event) { World world = event.getWorld(); BlockPos pos = event.getPos(); - IBlockState state = world.getBlockState(pos); - if (state.getBlock() instanceof BlockAnvil) { + BlockState state = world.getBlockState(pos); + if (state.getBlock() instanceof AnvilBlock) { CACHED_WORLD.set(new WeakReference<>(world)); } } @@ -97,7 +97,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider return; ItemStack output = stack.copy(); if (!output.hasTagCompound()) - output.setTagCompound(new NBTTagCompound()); + output.setTagCompound(new CompoundNBT()); output.getTagCompound().setString(NaturesAura.MOD_ID + ":ender_name", name); event.setOutput(output); event.setMaterialCost(stack.getCount()); @@ -105,7 +105,7 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { if (!worldIn.isRemote) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityEnderCrate) { @@ -120,14 +120,14 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { addEnderNameInfo(stack, tooltip); } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { + @OnlyIn(Dist.CLIENT) + public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { for (int i = 0; i < 3; ++i) { int j = rand.nextInt(2) * 2 - 1; int k = rand.nextInt(2) * 2 - 1; @@ -142,8 +142,8 @@ public class BlockEnderCrate extends BlockContainerImpl implements ITESRProvider } @Override - @SideOnly(Side.CLIENT) - public Tuple getTESR() { + @OnlyIn(Dist.CLIENT) + public Tuple getTESR() { return new Tuple<>(TileEntityEnderCrate.class, new RenderEnderCrate()); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java index fdedc518..a1270ee4 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFieldCreator.java @@ -6,19 +6,19 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityFieldCreator; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.block.BlockState; +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.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import java.util.Random; @@ -30,12 +30,12 @@ public class BlockFieldCreator extends BlockContainerImpl { } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityFieldCreator) { if (!worldIn.isRemote) { String key = NaturesAura.MOD_ID + ":field_creator_pos"; - NBTTagCompound compound = playerIn.getEntityData(); + CompoundNBT compound = playerIn.getEntityData(); if (!playerIn.isSneaking() && compound.hasKey(key)) { BlockPos stored = BlockPos.fromLong(compound.getLong(key)); TileEntityFieldCreator creator = (TileEntityFieldCreator) tile; @@ -53,16 +53,16 @@ public class BlockFieldCreator extends BlockContainerImpl { otherCreator.sendToClients(); compound.removeTag(key); - playerIn.sendStatusMessage(new TextComponentTranslation("info." + NaturesAura.MOD_ID + ".connected"), true); + playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".connected"), true); } else - playerIn.sendStatusMessage(new TextComponentTranslation("info." + NaturesAura.MOD_ID + ".stored_pos_gone"), true); + playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".stored_pos_gone"), true); } else - playerIn.sendStatusMessage(new TextComponentTranslation("info." + NaturesAura.MOD_ID + ".too_far"), true); + playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".too_far"), true); } else - playerIn.sendStatusMessage(new TextComponentTranslation("info." + NaturesAura.MOD_ID + ".same_position"), true); + playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".same_position"), true); } else { compound.setLong(key, pos.toLong()); - playerIn.sendStatusMessage(new TextComponentTranslation("info." + NaturesAura.MOD_ID + ".stored_pos"), true); + playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".stored_pos"), true); } } return true; @@ -71,8 +71,8 @@ public class BlockFieldCreator extends BlockContainerImpl { } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { + @OnlyIn(Dist.CLIENT) + public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityFieldCreator) { TileEntityFieldCreator creator = (TileEntityFieldCreator) tile; @@ -93,33 +93,33 @@ public class BlockFieldCreator extends BlockContainerImpl { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public BlockRenderLayer getRenderLayer() { return BlockRenderLayer.CUTOUT; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { + public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) { return false; } @Override - public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) { + public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) { return false; } @Override - public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) { return BlockFaceShape.UNDEFINED; } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFireworkGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFireworkGenerator.java index 892ad932..a13fac77 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFireworkGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFireworkGenerator.java @@ -7,8 +7,8 @@ import net.minecraft.block.material.Material; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class BlockFireworkGenerator extends BlockContainerImpl implements IVisualizable { public BlockFireworkGenerator() { @@ -18,13 +18,13 @@ public class BlockFireworkGenerator extends BlockContainerImpl implements IVisua } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { return new AxisAlignedBB(pos).grow(4); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getVisualizationColor(World world, BlockPos pos) { return 0xa442f4; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerGenerator.java index 3d5b30e0..0fa77acc 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFlowerGenerator.java @@ -7,8 +7,8 @@ import net.minecraft.block.material.Material; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class BlockFlowerGenerator extends BlockContainerImpl implements IVisualizable { @@ -19,13 +19,13 @@ public class BlockFlowerGenerator extends BlockContainerImpl implements IVisuali } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { return new AxisAlignedBB(pos).grow(3); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getVisualizationColor(World world, BlockPos pos) { return 0xffed2b; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java index 72240e99..aa06a257 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockFurnaceHeater.java @@ -6,17 +6,17 @@ import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.block.BlockState; +import net.minecraft.entity.LivingEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import java.util.Random; @@ -37,20 +37,20 @@ public class BlockFurnaceHeater extends BlockContainerImpl { } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { + @OnlyIn(Dist.CLIENT) + public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityFurnaceHeater && ((TileEntityFurnaceHeater) tile).isActive) { - EnumFacing facing = stateIn.getValue(FACING); + Direction facing = stateIn.getValue(FACING); float x; float y; float z; - if (facing == EnumFacing.UP) { + if (facing == Direction.UP) { x = 0.35F + rand.nextFloat() * 0.3F; y = 0F; z = 0.35F + rand.nextFloat() * 0.3F; - } else if (facing == EnumFacing.DOWN) { + } else if (facing == Direction.DOWN) { x = 0.35F + rand.nextFloat() * 0.3F; y = 1F; z = 0.35F + rand.nextFloat() * 0.3F; @@ -70,7 +70,7 @@ public class BlockFurnaceHeater extends BlockContainerImpl { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { switch (state.getValue(FACING)) { case DOWN: return AABB_DOWN; @@ -88,27 +88,27 @@ public class BlockFurnaceHeater extends BlockContainerImpl { } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { + public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) { return false; } @Override - public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) { + public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) { return false; } @Override - public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) { return BlockFaceShape.UNDEFINED; } @@ -118,17 +118,17 @@ public class BlockFurnaceHeater extends BlockContainerImpl { } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(FACING).getIndex(); } @Override - public IBlockState getStateFromMeta(int meta) { - return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta)); + public BlockState getStateFromMeta(int meta) { + return this.getDefaultState().withProperty(FACING, Direction.byIndex(meta)); } @Override - public IBlockState getStateForPlacement(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer, EnumHand hand) { + public BlockState getStateForPlacement(World world, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, LivingEntity placer, Hand hand) { return this.getDefaultState().withProperty(FACING, facing); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java index a0b75064..6beebfc1 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGeneratorLimitRemover.java @@ -5,10 +5,10 @@ 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.TileEntitySpecialRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.util.Tuple; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class BlockGeneratorLimitRemover extends BlockContainerImpl implements ITESRProvider { @@ -19,8 +19,8 @@ public class BlockGeneratorLimitRemover extends BlockContainerImpl implements IT } @Override - @SideOnly(Side.CLIENT) - public Tuple getTESR() { + @OnlyIn(Dist.CLIENT) + public Tuple getTESR() { return new Tuple<>(TileEntityGeneratorLimitRemover.class, new RenderGeneratorLimitRemover()); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java index cea93448..d0562a5a 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldPowder.java @@ -7,18 +7,18 @@ import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.renderer.color.IBlockColor; -import net.minecraft.init.Blocks; +import net.minecraft.block.Blocks; import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.IStringSerializable; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import javax.annotation.Nullable; @@ -64,7 +64,7 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock { } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return 0; } @@ -74,11 +74,11 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return AABBS[getAABBIndex(state.getActualState(source, pos))]; } - private static int getAABBIndex(IBlockState state) { + private static int getAABBIndex(BlockState state) { int i = 0; boolean n = state.getValue(NORTH) != AttachPos.NONE; boolean e = state.getValue(EAST) != AttachPos.NONE; @@ -86,38 +86,38 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock { boolean w = state.getValue(WEST) != AttachPos.NONE; if (n || s && !n && !e && !w) { - i |= 1 << EnumFacing.NORTH.getHorizontalIndex(); + i |= 1 << Direction.NORTH.getHorizontalIndex(); } if (e || w && !n && !e && !s) { - i |= 1 << EnumFacing.EAST.getHorizontalIndex(); + i |= 1 << Direction.EAST.getHorizontalIndex(); } if (s || n && !e && !s && !w) { - i |= 1 << EnumFacing.SOUTH.getHorizontalIndex(); + i |= 1 << Direction.SOUTH.getHorizontalIndex(); } if (w || e && !n && !s && !w) { - i |= 1 << EnumFacing.WEST.getHorizontalIndex(); + i |= 1 << Direction.WEST.getHorizontalIndex(); } return i; } @Override - public IBlockState getActualState(IBlockState state, IBlockAccess worldIn, BlockPos pos) { - state = state.withProperty(WEST, this.getAttachPosition(worldIn, pos, EnumFacing.WEST)); - state = state.withProperty(EAST, this.getAttachPosition(worldIn, pos, EnumFacing.EAST)); - state = state.withProperty(NORTH, this.getAttachPosition(worldIn, pos, EnumFacing.NORTH)); - state = state.withProperty(SOUTH, this.getAttachPosition(worldIn, pos, EnumFacing.SOUTH)); + public BlockState getActualState(BlockState state, IBlockAccess worldIn, BlockPos pos) { + state = state.withProperty(WEST, this.getAttachPosition(worldIn, pos, Direction.WEST)); + state = state.withProperty(EAST, this.getAttachPosition(worldIn, pos, Direction.EAST)); + state = state.withProperty(NORTH, this.getAttachPosition(worldIn, pos, Direction.NORTH)); + state = state.withProperty(SOUTH, this.getAttachPosition(worldIn, pos, Direction.SOUTH)); return state; } - private AttachPos getAttachPosition(IBlockAccess worldIn, BlockPos pos, EnumFacing direction) { + private AttachPos getAttachPosition(IBlockAccess worldIn, BlockPos pos, Direction direction) { BlockPos dirPos = pos.offset(direction); - IBlockState state = worldIn.getBlockState(pos.offset(direction)); + BlockState state = worldIn.getBlockState(pos.offset(direction)); if (!this.canConnectTo(worldIn.getBlockState(dirPos), direction, worldIn, dirPos) && (state.isNormalCube() || !this.canConnectUpwardsTo(worldIn, dirPos.down()))) { - IBlockState iblockstate1 = worldIn.getBlockState(pos.up()); + BlockState iblockstate1 = worldIn.getBlockState(pos.up()); if (!iblockstate1.isNormalCube()) { - boolean flag = worldIn.getBlockState(dirPos).isSideSolid(worldIn, dirPos, EnumFacing.UP) + boolean flag = worldIn.getBlockState(dirPos).isSideSolid(worldIn, dirPos, Direction.UP) || worldIn.getBlockState(dirPos).getBlock() == Blocks.GLOWSTONE; if (flag && this.canConnectUpwardsTo(worldIn, dirPos.up())) { if (state.isBlockNormalCube()) { @@ -133,30 +133,30 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock { } @Override - public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, IBlockAccess worldIn, BlockPos pos) { + public AxisAlignedBB getCollisionBoundingBox(BlockState blockState, IBlockAccess worldIn, BlockPos pos) { return NULL_AABB; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override public boolean canPlaceBlockAt(World worldIn, BlockPos pos) { - IBlockState downState = worldIn.getBlockState(pos.down()); + BlockState downState = worldIn.getBlockState(pos.down()); return downState.isTopSolid() - || downState.getBlockFaceShape(worldIn, pos.down(), EnumFacing.UP) == BlockFaceShape.SOLID + || downState.getBlockFaceShape(worldIn, pos.down(), Direction.UP) == BlockFaceShape.SOLID || worldIn.getBlockState(pos.down()).getBlock() == Blocks.GLOWSTONE; } @Override - public void neighborChanged(IBlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { + public void neighborChanged(BlockState state, World worldIn, BlockPos pos, Block blockIn, BlockPos fromPos) { if (!worldIn.isRemote) { if (!this.canPlaceBlockAt(worldIn, pos)) { this.dropBlockAsItem(worldIn, pos, state, 0); @@ -169,19 +169,19 @@ public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock { return this.canConnectTo(worldIn.getBlockState(pos), null, worldIn, pos); } - private boolean canConnectTo(IBlockState blockState, @Nullable EnumFacing side, IBlockAccess world, BlockPos pos) { + private boolean canConnectTo(BlockState blockState, @Nullable Direction side, IBlockAccess world, BlockPos pos) { Block block = blockState.getBlock(); return block == this; } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public BlockRenderLayer getRenderLayer() { return BlockRenderLayer.CUTOUT; } @Override - public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) { return BlockFaceShape.UNDEFINED; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java index 422d3f06..1b844b0d 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGoldenLeaves.java @@ -4,32 +4,32 @@ import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.reg.*; -import net.minecraft.block.BlockLeaves; +import net.minecraft.block.LeavesBlock; import net.minecraft.block.BlockPlanks; -import net.minecraft.block.material.MapColor; +import net.minecraft.block.material.MaterialColor; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IItemColor; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeColorHelper; +import net.minecraft.world.biome.BiomeColors; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import java.util.List; import java.util.Random; -public class BlockGoldenLeaves extends BlockLeaves implements +public class BlockGoldenLeaves extends LeavesBlock implements IModItem, IModelProvider, IColorProvidingBlock, IColorProvidingItem { private static final int HIGHEST_STAGE = 3; @@ -41,8 +41,8 @@ public class BlockGoldenLeaves extends BlockLeaves implements } @Override - public MapColor getMapColor(IBlockState state, IBlockAccess worldIn, BlockPos pos) { - return MapColor.GOLD; + public MaterialColor getMapColor(BlockState state, IBlockAccess worldIn, BlockPos pos) { + return MaterialColor.GOLD; } @Override @@ -66,8 +66,8 @@ public class BlockGoldenLeaves extends BlockLeaves implements } @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(IBlockState stateIn, World worldIn, BlockPos pos, Random rand) { + @OnlyIn(Dist.CLIENT) + public void randomDisplayTick(BlockState stateIn, World worldIn, BlockPos pos, Random rand) { if (stateIn.getValue(STAGE) == HIGHEST_STAGE && rand.nextFloat() >= 0.75F) NaturesAuraAPI.instance().spawnMagicParticle( pos.getX() + rand.nextFloat(), @@ -90,7 +90,7 @@ public class BlockGoldenLeaves extends BlockLeaves implements } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { boolean check = (meta & 4) != 0; // 4th bit boolean decay = (meta & 8) != 0; // 3rd bit int stage = meta & HIGHEST_STAGE; // 1st and 2nd bit @@ -99,7 +99,7 @@ public class BlockGoldenLeaves extends BlockLeaves implements } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { boolean check = state.getValue(CHECK_DECAY); boolean decay = state.getValue(DECAYABLE); @@ -107,7 +107,7 @@ public class BlockGoldenLeaves extends BlockLeaves implements } @Override - public void beginLeavesDecay(IBlockState state, World world, BlockPos pos) { + public void beginLeavesDecay(BlockState state, World world, BlockPos pos) { if (!state.getValue(CHECK_DECAY) && state.getValue(DECAYABLE)) { world.setBlockState(pos, state.withProperty(CHECK_DECAY, true), 4); } @@ -119,12 +119,12 @@ public class BlockGoldenLeaves extends BlockLeaves implements } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IBlockColor getBlockColor() { return (state, worldIn, pos, tintIndex) -> { int color = 0xF2FF00; if (state != null && worldIn != null && pos != null) { - int foliage = BiomeColorHelper.getFoliageColorAtPos(worldIn, pos); + int foliage = BiomeColors.getFoliageColorAtPos(worldIn, pos); return Helper.blendColors(color, foliage, state.getValue(STAGE) / (float) HIGHEST_STAGE); } else { return color; @@ -133,13 +133,13 @@ public class BlockGoldenLeaves extends BlockLeaves implements } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IItemColor getItemColor() { return (stack, tintIndex) -> 0xF2FF00; } @Override - public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, IBlockState state, int fortune) { + public void getDrops(NonNullList drops, IBlockAccess world, BlockPos pos, BlockState state, int fortune) { Random rand = world instanceof World ? ((World) world).rand : RANDOM; if (state.getValue(STAGE) < HIGHEST_STAGE) { if (rand.nextFloat() >= 0.75F) { @@ -151,7 +151,7 @@ public class BlockGoldenLeaves extends BlockLeaves implements } @Override - public void updateTick(World worldIn, BlockPos pos, IBlockState state, Random rand) { + public void updateTick(World worldIn, BlockPos pos, BlockState state, Random rand) { super.updateTick(worldIn, pos, state, rand); if (!worldIn.isRemote) { int stage = state.getValue(STAGE); @@ -160,7 +160,7 @@ public class BlockGoldenLeaves extends BlockLeaves implements } if (stage > 1) { - BlockPos offset = pos.offset(EnumFacing.random(rand)); + BlockPos offset = pos.offset(Direction.random(rand)); if (worldIn.isBlockLoaded(offset)) convert(worldIn, offset); } @@ -168,12 +168,12 @@ public class BlockGoldenLeaves extends BlockLeaves implements } @Override - public boolean canSilkHarvest(World world, BlockPos pos, IBlockState state, EntityPlayer player) { + public boolean canSilkHarvest(World world, BlockPos pos, BlockState state, PlayerEntity player) { return false; } public static boolean convert(World world, BlockPos pos) { - IBlockState state = world.getBlockState(pos); + BlockState state = world.getBlockState(pos); if (state.getBlock().isLeaves(state, world, pos) && !(state.getBlock() instanceof BlockAncientLeaves || state.getBlock() instanceof BlockGoldenLeaves)) { if (!world.isRemote) { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java index baca7707..cda591c1 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockGratedChute.java @@ -1,16 +1,16 @@ package de.ellpeck.naturesaura.blocks; import de.ellpeck.naturesaura.blocks.tiles.TileEntityGratedChute; -import net.minecraft.block.BlockHopper; +import net.minecraft.block.HopperBlock; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyDirection; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; @@ -19,8 +19,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.items.IItemHandler; import javax.annotation.Nullable; @@ -28,7 +28,7 @@ import java.util.List; public class BlockGratedChute extends BlockContainerImpl { - public static final PropertyDirection FACING = BlockHopper.FACING; + public static final PropertyDirection FACING = HopperBlock.FACING; private static final AxisAlignedBB BASE_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.625D, 1.0D); private static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D); private static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D); @@ -43,7 +43,7 @@ public class BlockGratedChute extends BlockContainerImpl { } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (!playerIn.isSneaking()) return false; TileEntity tile = worldIn.getTileEntity(pos); @@ -58,12 +58,12 @@ public class BlockGratedChute extends BlockContainerImpl { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return FULL_BLOCK_AABB; } @Override - public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List collidingBoxes, @Nullable Entity entityIn, boolean isActualState) { + public void addCollisionBoxToList(BlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List collidingBoxes, @Nullable Entity entityIn, boolean isActualState) { addCollisionBoxToList(pos, entityBox, collidingBoxes, BASE_AABB); addCollisionBoxToList(pos, entityBox, collidingBoxes, EAST_AABB); addCollisionBoxToList(pos, entityBox, collidingBoxes, WEST_AABB); @@ -72,7 +72,7 @@ public class BlockGratedChute extends BlockContainerImpl { } @Override - public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { + public BlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, LivingEntity placer) { EnumFacing newFacing = facing.getOpposite(); if (newFacing == EnumFacing.UP) newFacing = EnumFacing.DOWN; @@ -80,38 +80,38 @@ public class BlockGratedChute extends BlockContainerImpl { } @Override - public boolean isTopSolid(IBlockState state) { + public boolean isTopSolid(BlockState state) { return true; } @Override - public EnumBlockRenderType getRenderType(IBlockState state) { + public EnumBlockRenderType getRenderType(BlockState state) { return EnumBlockRenderType.MODEL; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { + @OnlyIn(Dist.CLIENT) + public boolean shouldSideBeRendered(BlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side) { return true; } @Override - public boolean hasComparatorInputOverride(IBlockState state) { + public boolean hasComparatorInputOverride(BlockState state) { return true; } @Override - public int getComparatorInputOverride(IBlockState blockState, World worldIn, BlockPos pos) { + public int getComparatorInputOverride(BlockState blockState, World worldIn, BlockPos pos) { TileEntity tile = worldIn.getTileEntity(pos); if (tile instanceof TileEntityGratedChute) { IItemHandler handler = ((TileEntityGratedChute) tile).getItemHandler(null); @@ -124,28 +124,28 @@ public class BlockGratedChute extends BlockContainerImpl { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public BlockRenderLayer getRenderLayer() { return BlockRenderLayer.CUTOUT_MIPPED; } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.getDefaultState().withProperty(FACING, EnumFacing.byIndex(meta)); } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return state.getValue(FACING).getIndex(); } @Override - public IBlockState withRotation(IBlockState state, Rotation rot) { + public BlockState withRotation(BlockState state, Rotation rot) { return state.withProperty(FACING, rot.rotate(state.getValue(FACING))); } @Override - public IBlockState withMirror(IBlockState state, Mirror mirrorIn) { + public BlockState withMirror(BlockState state, Mirror mirrorIn) { return state.withRotation(mirrorIn.toRotation(state.getValue(FACING))); } @@ -155,7 +155,7 @@ public class BlockGratedChute extends BlockContainerImpl { } @Override - public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, EnumFacing face) { return face == EnumFacing.UP ? BlockFaceShape.BOWL : BlockFaceShape.UNDEFINED; } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockHopperUpgrade.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockHopperUpgrade.java index 06c89cc1..92b43a6b 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockHopperUpgrade.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockHopperUpgrade.java @@ -7,8 +7,8 @@ import net.minecraft.block.material.Material; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class BlockHopperUpgrade extends BlockContainerImpl implements IVisualizable { public BlockHopperUpgrade() { @@ -18,13 +18,13 @@ public class BlockHopperUpgrade extends BlockContainerImpl implements IVisualiza } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { return new AxisAlignedBB(pos).grow(7); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getVisualizationColor(World world, BlockPos pos) { return 0x434f3f; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockMossGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockMossGenerator.java index e199fb16..d18f5e0d 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockMossGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockMossGenerator.java @@ -7,8 +7,8 @@ import net.minecraft.block.material.Material; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class BlockMossGenerator extends BlockContainerImpl implements IVisualizable { public BlockMossGenerator() { @@ -18,13 +18,13 @@ public class BlockMossGenerator extends BlockContainerImpl implements IVisualiza } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { return new AxisAlignedBB(pos).grow(2); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getVisualizationColor(World world, BlockPos pos) { return 0x15702d; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java index 584d28cf..43d19cd4 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockNatureAltar.java @@ -6,18 +6,18 @@ import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar; import de.ellpeck.naturesaura.reg.ITESRProvider; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.Tuple; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider { @@ -30,43 +30,43 @@ public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvide } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { return Helper.putStackOnTile(playerIn, hand, pos, 0, true); } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return BOUND_BOX; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { + public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) { return false; } @Override - public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) { - return side == EnumFacing.DOWN; + public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) { + return side == Direction.DOWN; } @Override - public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) { return BlockFaceShape.UNDEFINED; } @Override - @SideOnly(Side.CLIENT) - public Tuple getTESR() { + @OnlyIn(Dist.CLIENT) + public Tuple getTESR() { return new Tuple<>(TileEntityNatureAltar.class, new RenderNatureAltar()); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockOakGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockOakGenerator.java index 065d8324..be79e686 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockOakGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockOakGenerator.java @@ -5,7 +5,7 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.blocks.tiles.TileEntityOakGenerator; -import net.minecraft.block.BlockSapling; +import net.minecraft.block.SaplingBlock; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.util.math.AxisAlignedBB; @@ -13,9 +13,9 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.terraingen.SaplingGrowTreeEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import java.util.Random; @@ -34,7 +34,7 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab World world = event.getWorld(); BlockPos pos = event.getPos(); if (!world.isRemote && IAuraType.forWorld(world).isSimilar(NaturesAuraAPI.TYPE_OVERWORLD) - && world.getBlockState(pos).getBlock() instanceof BlockSapling) { + && world.getBlockState(pos).getBlock() instanceof SaplingBlock) { Helper.getTileEntitiesInArea(world, pos, 10, tile -> { if (!(tile instanceof TileEntityOakGenerator)) return false; @@ -57,13 +57,13 @@ public class BlockOakGenerator extends BlockContainerImpl implements IVisualizab } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { return new AxisAlignedBB(pos).grow(10); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getVisualizationColor(World world, BlockPos pos) { return 0x2e7a11; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java index e74b64cd..7f5eda01 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockOfferingTable.java @@ -7,18 +7,18 @@ import de.ellpeck.naturesaura.reg.ITESRProvider; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.Tuple; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvider { @@ -31,43 +31,43 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { return Helper.putStackOnTile(playerIn, hand, pos, 0, true); } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return BOUND_BOX; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { + public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) { return false; } @Override - public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) { + public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) { return false; } @Override - public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) { return BlockFaceShape.UNDEFINED; } @Override - @SideOnly(Side.CLIENT) - public Tuple getTESR() { + @OnlyIn(Dist.CLIENT) + public Tuple getTESR() { return new Tuple<>(TileEntityOfferingTable.class, new RenderOfferingTable()); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java index a11a36fe..536ecb05 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPickupStopper.java @@ -7,17 +7,17 @@ import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.EntityItemPickupEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class BlockPickupStopper extends BlockContainerImpl implements IVisualizable { public BlockPickupStopper() { @@ -30,9 +30,9 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza @SubscribeEvent public void onPickup(EntityItemPickupEvent event) { - EntityPlayer player = event.getEntityPlayer(); + PlayerEntity player = event.getEntityPlayer(); if (player != null && !player.isSneaking()) { - EntityItem item = event.getItem(); + ItemEntity item = event.getItem(); BlockPos pos = item.getPosition(); Helper.getTileEntitiesInArea(item.world, pos, 8, tile -> { if (!(tile instanceof TileEntityPickupStopper)) @@ -56,7 +56,7 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntityPickupStopper) { @@ -68,7 +68,7 @@ public class BlockPickupStopper extends BlockContainerImpl implements IVisualiza } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getVisualizationColor(World world, BlockPos pos) { return 0xf4aa42; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPlacer.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPlacer.java index a29fe091..fec2e418 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPlacer.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPlacer.java @@ -7,8 +7,8 @@ import net.minecraft.block.material.Material; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class BlockPlacer extends BlockContainerImpl implements IVisualizable { @@ -19,13 +19,13 @@ public class BlockPlacer extends BlockContainerImpl implements IVisualizable { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { return new AxisAlignedBB(pos).grow(5); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getVisualizationColor(World world, BlockPos pos) { return 0x078a93; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPowderPlacer.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPowderPlacer.java index a7986712..43187d10 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockPowderPlacer.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockPowderPlacer.java @@ -4,8 +4,8 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityPowderPlacer; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.state.IBlockState; -import net.minecraft.util.EnumFacing; +import net.minecraft.block.BlockState; +import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; @@ -20,32 +20,32 @@ public class BlockPowderPlacer extends BlockContainerImpl { } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return BOUND_BOX; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { + public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) { return false; } @Override - public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) { - return side == EnumFacing.DOWN; + public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) { + return side == Direction.DOWN; } @Override - public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) { return BlockFaceShape.UNDEFINED; } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java index 96b6d9b0..efb10d57 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockProjectileGenerator.java @@ -9,11 +9,11 @@ import de.ellpeck.naturesaura.packet.PacketParticles; import de.ellpeck.naturesaura.reg.ITESRProvider; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityList; -import net.minecraft.init.SoundEvents; +import net.minecraft.util.SoundEvents; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; @@ -22,9 +22,9 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.ProjectileImpactEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class BlockProjectileGenerator extends BlockContainerImpl implements ITESRProvider { public BlockProjectileGenerator() { @@ -70,18 +70,18 @@ public class BlockProjectileGenerator extends BlockContainerImpl implements ITES } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - @SideOnly(Side.CLIENT) - public Tuple getTESR() { + @OnlyIn(Dist.CLIENT) + public Tuple getTESR() { return new Tuple<>(TileEntityProjectileGenerator.class, new RenderProjectileGenerator()); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockSlabsNA.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockSlabsNA.java index 01703b3f..735cd05a 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockSlabsNA.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockSlabsNA.java @@ -8,12 +8,12 @@ import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyEnum; import net.minecraft.block.state.BlockFaceShape; import net.minecraft.block.state.BlockStateContainer; -import net.minecraft.block.state.IBlockState; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.block.BlockState; +import net.minecraft.item.ItemGroup; +import net.minecraft.entity.LivingEntity; import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; -import net.minecraft.util.EnumFacing; +import net.minecraft.item.BlockItem; +import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; @@ -40,7 +40,7 @@ public abstract class BlockSlabsNA extends BlockImpl implements ICustomItemBlock } @Override - public CreativeTabs getTabToAdd() { + public ItemGroup getTabToAdd() { return this.isDouble() ? null : super.getTabToAdd(); } @@ -50,7 +50,7 @@ public abstract class BlockSlabsNA extends BlockImpl implements ICustomItemBlock } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { if (this.isDouble()) return FULL_BLOCK_AABB; else @@ -58,42 +58,42 @@ public abstract class BlockSlabsNA extends BlockImpl implements ICustomItemBlock } @Override - public boolean isTopSolid(IBlockState state) { + public boolean isTopSolid(BlockState state) { return this.isDouble() || state.getValue(HALF) == EnumBlockHalf.TOP; } @Override - public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) { if (this.isDouble()) return BlockFaceShape.SOLID; - else if (face == EnumFacing.UP && state.getValue(HALF) == EnumBlockHalf.TOP) + else if (face == Direction.UP && state.getValue(HALF) == EnumBlockHalf.TOP) return BlockFaceShape.SOLID; else - return face == EnumFacing.DOWN && state.getValue(HALF) == EnumBlockHalf.BOTTOM ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED; + return face == Direction.DOWN && state.getValue(HALF) == EnumBlockHalf.BOTTOM ? BlockFaceShape.SOLID : BlockFaceShape.UNDEFINED; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return this.isDouble(); } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return this.isDouble(); } @Override - public boolean isFullBlock(IBlockState state) { + public boolean isFullBlock(BlockState state) { return this.isDouble(); } @Override - public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { + public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) { return this.isDouble(); } @Override - public boolean doesSideBlockRendering(IBlockState state, IBlockAccess world, BlockPos pos, EnumFacing face) { + public boolean doesSideBlockRendering(BlockState state, IBlockAccess world, BlockPos pos, Direction face) { if (ForgeModContainer.disableStairSlabCulling) return super.doesSideBlockRendering(state, world, pos, face); @@ -101,16 +101,16 @@ public abstract class BlockSlabsNA extends BlockImpl implements ICustomItemBlock return true; EnumBlockHalf side = state.getValue(HALF); - return (side == EnumBlockHalf.TOP && face == EnumFacing.UP) || (side == EnumBlockHalf.BOTTOM && face == EnumFacing.DOWN); + return (side == EnumBlockHalf.TOP && face == Direction.UP) || (side == EnumBlockHalf.BOTTOM && face == Direction.DOWN); } @Override - public IBlockState getStateForPlacement(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer) { + public BlockState getStateForPlacement(World worldIn, BlockPos pos, Direction facing, float hitX, float hitY, float hitZ, int meta, LivingEntity placer) { if (this.isDouble()) return this.getDefaultState(); else { - IBlockState state = this.getStateFromMeta(meta); - return facing != EnumFacing.DOWN && (facing == EnumFacing.UP || (double) hitY <= 0.5D) ? + BlockState state = this.getStateFromMeta(meta); + return facing != Direction.DOWN && (facing == Direction.UP || (double) hitY <= 0.5D) ? state.withProperty(HALF, EnumBlockHalf.BOTTOM) : state.withProperty(HALF, EnumBlockHalf.TOP); } } @@ -121,12 +121,12 @@ public abstract class BlockSlabsNA extends BlockImpl implements ICustomItemBlock } @Override - public Item getItemDropped(IBlockState state, Random rand, int fortune) { + public Item getItemDropped(BlockState state, Random rand, int fortune) { return Item.getItemFromBlock(this.singleSlab.get()); } @Override - public ItemBlock getItemBlock() { + public BlockItem getItemBlock() { return new ItemSlabNA(this, this.singleSlab, this.doubleSlab); } @@ -136,12 +136,12 @@ public abstract class BlockSlabsNA extends BlockImpl implements ICustomItemBlock } @Override - public int getMetaFromState(IBlockState state) { + public int getMetaFromState(BlockState state) { return this.isDouble() ? 0 : (state.getValue(HALF) == EnumBlockHalf.TOP ? 1 : 0); } @Override - public IBlockState getStateFromMeta(int meta) { + public BlockState getStateFromMeta(int meta) { return this.isDouble() ? this.getDefaultState() : this.getDefaultState().withProperty(HALF, meta == 1 ? EnumBlockHalf.TOP : EnumBlockHalf.BOTTOM); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java index 63f90aaf..54e6be95 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockSpawnLamp.java @@ -9,11 +9,11 @@ import de.ellpeck.naturesaura.packet.PacketParticles; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.EntityLiving; +import net.minecraft.block.BlockState; +import net.minecraft.entity.MobEntity; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.BlockRenderLayer; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; @@ -21,10 +21,10 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingSpawnEvent; -import net.minecraftforge.fml.common.eventhandler.Event; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.eventbus.api.Event; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable { @@ -56,7 +56,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable if (!new AxisAlignedBB(lampPos).grow(range).contains(new Vec3d(pos))) return false; - EntityLiving entity = (EntityLiving) event.getEntityLiving(); + MobEntity entity = (MobEntity) event.getEntityLiving(); if (entity.getCanSpawnHere() && entity.isNotColliding()) { BlockPos spot = IAuraChunk.getHighestSpot(world, lampPos, 32, lampPos); IAuraChunk.getAuraChunk(world, spot).drainAura(spot, 200); @@ -71,43 +71,43 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return AABB; } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public BlockRenderLayer getRenderLayer() { return BlockRenderLayer.CUTOUT; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { + public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) { return false; } @Override - public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) { + public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) { return false; } @Override - public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) { return BlockFaceShape.UNDEFINED; } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { TileEntity tile = world.getTileEntity(pos); if (tile instanceof TileEntitySpawnLamp) { @@ -119,7 +119,7 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getVisualizationColor(World world, BlockPos pos) { return 0x825ee5; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockStairsNA.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockStairsNA.java index 72cb4441..5cf25ab2 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockStairsNA.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockStairsNA.java @@ -4,19 +4,19 @@ import de.ellpeck.naturesaura.reg.ICreativeItem; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; -import net.minecraft.block.BlockStairs; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.StairsBlock; +import net.minecraft.block.BlockState; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -public class BlockStairsNA extends BlockStairs implements IModItem, ICreativeItem, IModelProvider { +public class BlockStairsNA extends StairsBlock implements IModItem, ICreativeItem, IModelProvider { private final String baseName; - protected BlockStairsNA(String baseName, IBlockState modelState) { + protected BlockStairsNA(String baseName, BlockState modelState) { super(modelState); this.baseName = baseName; ModRegistry.add(this); @@ -45,22 +45,22 @@ public class BlockStairsNA extends BlockStairs implements IModItem, ICreativeIte } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isFullBlock(IBlockState state) { + public boolean isFullBlock(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { + public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) { return false; } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java b/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java index 718b25af..041d7d38 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/BlockWoodStand.java @@ -10,14 +10,14 @@ import de.ellpeck.naturesaura.reg.ITESRProvider; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.BlockFaceShape; -import net.minecraft.block.state.IBlockState; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +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.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.Tuple; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -25,9 +25,9 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.terraingen.SaplingGrowTreeEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import org.apache.commons.lang3.mutable.MutableObject; import java.util.ArrayList; @@ -53,7 +53,7 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider BlockPos pos = event.getPos(); if (!world.isRemote) { if (Multiblocks.TREE_RITUAL.isComplete(world, pos)) { - IBlockState sapling = world.getBlockState(pos); + BlockState sapling = world.getBlockState(pos); ItemStack saplingStack = sapling.getBlock().getItem(world, pos, sapling); if (!saplingStack.isEmpty()) { for (TreeRitualRecipe recipe : NaturesAuraAPI.TREE_RITUAL_RECIPES.values()) { @@ -96,43 +96,43 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider } @Override - public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public boolean onBlockActivated(World worldIn, BlockPos pos, BlockState state, PlayerEntity playerIn, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { return Helper.putStackOnTile(playerIn, hand, pos, 0, true); } @Override - public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos) { + public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) { return BOUND_BOX; } @Override - public boolean isFullCube(IBlockState state) { + public boolean isFullCube(BlockState state) { return false; } @Override - public boolean isOpaqueCube(IBlockState state) { + public boolean isOpaqueCube(BlockState state) { return false; } @Override - public boolean isNormalCube(IBlockState state, IBlockAccess world, BlockPos pos) { + public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) { return false; } @Override - public boolean isSideSolid(IBlockState baseState, IBlockAccess world, BlockPos pos, EnumFacing side) { + public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) { return false; } @Override - public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, IBlockState state, BlockPos pos, EnumFacing face) { + public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) { return BlockFaceShape.UNDEFINED; } @Override - @SideOnly(Side.CLIENT) - public Tuple getTESR() { + @OnlyIn(Dist.CLIENT) + public Tuple getTESR() { return new Tuple<>(TileEntityWoodStand.class, new RenderWoodStand()); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java b/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java index d0da723e..8f0036ea 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/ModBlocks.java @@ -4,7 +4,7 @@ import de.ellpeck.naturesaura.ModConfig; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.world.DimensionType; +import net.minecraft.world.dimension.DimensionType; public final class ModBlocks { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblock.java b/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblock.java index bf70af20..85cc75e7 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblock.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblock.java @@ -5,7 +5,7 @@ import de.ellpeck.naturesaura.api.multiblock.IMultiblock; import de.ellpeck.naturesaura.api.multiblock.Matcher; import de.ellpeck.naturesaura.compat.patchouli.PatchouliCompat; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -80,8 +80,8 @@ public class Multiblock implements IMultiblock { continue; Object value = rawMatchers[i + 1]; - if (value instanceof IBlockState) { - IBlockState state = (IBlockState) value; + if (value instanceof BlockState) { + BlockState state = (BlockState) value; matchers.put(c, new Matcher(state, (world, start, offset, pos, other, otherC) -> other == state)); } else if (value instanceof Block) { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java b/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java index 794e0b3c..4fed03d3 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/multi/Multiblocks.java @@ -6,11 +6,11 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.multiblock.IMultiblock; import de.ellpeck.naturesaura.api.multiblock.Matcher; import de.ellpeck.naturesaura.blocks.ModBlocks; -import net.minecraft.block.BlockLog; -import net.minecraft.block.BlockSapling; +import net.minecraft.block.LogBlock; +import net.minecraft.block.SaplingBlock; import net.minecraft.block.BlockStoneBrick; import net.minecraft.block.BlockStoneBrick.EnumType; -import net.minecraft.init.Blocks; +import net.minecraft.block.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; @@ -38,7 +38,7 @@ public final class Multiblocks { 'G', ModBlocks.GOLD_POWDER, '0', new Matcher(Blocks.SAPLING.getDefaultState(), (world, start, offset, pos, state, c) -> { - if (state.getBlock() instanceof BlockSapling || state.getBlock() instanceof BlockLog) + if (state.getBlock() instanceof SaplingBlock || state.getBlock() instanceof LogBlock) return true; // try-catch to prevent blocks that need to have been placed crashing here try { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java index 3caf3a32..66e74de7 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAncientLeaves.java @@ -3,8 +3,8 @@ package de.ellpeck.naturesaura.blocks.tiles; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; import de.ellpeck.naturesaura.api.aura.container.NaturalAuraContainer; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.Direction; public class TileEntityAncientLeaves extends TileEntityImpl { @@ -25,19 +25,19 @@ public class TileEntityAncientLeaves extends TileEntityImpl { }; @Override - public IAuraContainer getAuraContainer(EnumFacing facing) { + public IAuraContainer getAuraContainer(Direction facing) { return this.container; } @Override - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { super.writeNBT(compound, type); if (type != SaveType.BLOCK) this.container.writeNBT(compound); } @Override - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { super.readNBT(compound, type); if (type != SaveType.BLOCK) this.container.readNBT(compound); 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 3b4a58cb..f6ddfd1f 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalSpawner.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAnimalSpawner.java @@ -9,10 +9,10 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ITickable; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; @@ -60,14 +60,14 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable this.sendToClients(); } } else { - List items = this.world.getEntitiesWithinAABB(EntityItem.class, + List items = this.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(this.pos).grow(2)); for (AnimalSpawnerRecipe recipe : NaturesAuraAPI.ANIMAL_SPAWNER_RECIPES.values()) { if (recipe.ingredients.length != items.size()) continue; List required = new ArrayList<>(Arrays.asList(recipe.ingredients)); - for (EntityItem item : items) { + for (ItemEntity item : items) { if (item.isDead || item.cannotPickup()) break; ItemStack stack = item.getItem(); @@ -83,7 +83,7 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable if (!required.isEmpty()) continue; - for (EntityItem item : items) { + for (ItemEntity item : items) { item.setDead(); PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles((float) item.posX, (float) item.posY, (float) item.posZ, 19)); @@ -129,7 +129,7 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable } @Override - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { super.writeNBT(compound, type); if (type != SaveType.BLOCK) { if (this.currentRecipe != null) { @@ -142,7 +142,7 @@ public class TileEntityAnimalSpawner extends TileEntityImpl implements ITickable } @Override - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { super.readNBT(compound, type); if (type != SaveType.BLOCK) { if (compound.hasKey("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 7bcbe113..6de4355c 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAutoCrafter.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityAutoCrafter.java @@ -4,16 +4,16 @@ import de.ellpeck.naturesaura.blocks.BlockAutoCrafter; import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.InventoryCrafting; +import net.minecraft.block.BlockState; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.container.Container; +import net.minecraft.inventory.CraftingInventory; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.CraftingManager; import net.minecraft.item.crafting.IRecipe; -import net.minecraft.util.EntitySelectors; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.EntityPredicates; +import net.minecraft.util.Direction; import net.minecraft.util.ITickable; import net.minecraft.util.NonNullList; import net.minecraft.util.math.AxisAlignedBB; @@ -22,9 +22,9 @@ import net.minecraft.util.math.BlockPos; import java.util.List; public class TileEntityAutoCrafter extends TileEntityImpl implements ITickable { - public final InventoryCrafting crafting = new InventoryCrafting(new Container() { + public final CraftingInventory crafting = new CraftingInventory(new Container() { @Override - public boolean canInteractWith(EntityPlayer playerIn) { + public boolean canInteractWith(PlayerEntity playerIn) { return false; } }, 3, 3); @@ -39,8 +39,8 @@ public class TileEntityAutoCrafter extends TileEntityImpl implements ITickable { return; this.crafting.clear(); - IBlockState state = this.world.getBlockState(this.pos); - EnumFacing facing = state.getValue(BlockAutoCrafter.FACING); + BlockState state = this.world.getBlockState(this.pos); + Direction facing = state.getValue(BlockAutoCrafter.FACING); BlockPos middlePos = this.pos.up(); BlockPos topPos = middlePos.offset(facing, 2); BlockPos bottomPos = middlePos.offset(facing.getOpposite(), 2); @@ -56,15 +56,15 @@ public class TileEntityAutoCrafter extends TileEntityImpl implements ITickable { bottomPos.offset(facing.rotateY(), 2) }; - EntityItem[] items = new EntityItem[9]; + ItemEntity[] items = new ItemEntity[9]; for (int i = 0; i < poses.length; i++) { - List entities = this.world.getEntitiesWithinAABB( - EntityItem.class, new AxisAlignedBB(poses[i]).grow(0.25), EntitySelectors.IS_ALIVE); + List entities = this.world.getEntitiesWithinAABB( + ItemEntity.class, new AxisAlignedBB(poses[i]).grow(0.25), EntityPredicates.IS_ALIVE); if (entities.size() > 1) return; if (entities.isEmpty()) continue; - EntityItem entity = entities.get(0); + ItemEntity entity = entities.get(0); if (entity.cannotPickup()) return; ItemStack stack = entity.getItem(); @@ -81,14 +81,14 @@ public class TileEntityAutoCrafter extends TileEntityImpl implements ITickable { ItemStack result = recipe.getCraftingResult(this.crafting); if (result.isEmpty()) return; - EntityItem resultItem = new EntityItem(this.world, + ItemEntity resultItem = new ItemEntity(this.world, this.pos.getX() + 0.5F, this.pos.getY() - 0.35F, this.pos.getZ() + 0.5F, result.copy()); resultItem.motionX = resultItem.motionY = resultItem.motionZ = 0; this.world.spawnEntity(resultItem); NonNullList remainingItems = recipe.getRemainingItems(this.crafting); for (int i = 0; i < items.length; i++) { - EntityItem item = items[i]; + ItemEntity item = items[i]; if (item == null) continue; ItemStack stack = item.getItem(); @@ -101,7 +101,7 @@ public class TileEntityAutoCrafter extends TileEntityImpl implements ITickable { ItemStack remain = remainingItems.get(i); if (!remain.isEmpty()) { - EntityItem remItem = new EntityItem(this.world, item.posX, item.posY, item.posZ, remain.copy()); + ItemEntity remItem = new ItemEntity(this.world, item.posX, item.posY, item.posZ, remain.copy()); remItem.motionX = remItem.motionY = remItem.motionZ = 0; this.world.spawnEntity(remItem); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityChunkLoader.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityChunkLoader.java index f62e02fd..721764e5 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityChunkLoader.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityChunkLoader.java @@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.blocks.tiles; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.ChunkPos; 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 19ef6dff..7e5d600a 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEndFlower.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEndFlower.java @@ -6,13 +6,13 @@ import de.ellpeck.naturesaura.api.aura.container.BasicAuraContainer; import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.block.Blocks; +import net.minecraft.item.Items; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EntitySelectors; -import net.minecraft.util.EnumFacing; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.EntityPredicates; +import net.minecraft.util.Direction; import net.minecraft.util.ITickable; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -54,9 +54,9 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickable { return; if (!this.isDrainMode) { - List items = this.world.getEntitiesWithinAABB(EntityItem.class, - new AxisAlignedBB(this.pos).grow(1), EntitySelectors.IS_ALIVE); - for (EntityItem item : items) { + List items = this.world.getEntitiesWithinAABB(ItemEntity.class, + new AxisAlignedBB(this.pos).grow(1), EntityPredicates.IS_ALIVE); + for (ItemEntity item : items) { if (item.cannotPickup()) continue; ItemStack stack = item.getItem(); @@ -101,12 +101,12 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickable { } @Override - public IAuraContainer getAuraContainer(EnumFacing facing) { + public IAuraContainer getAuraContainer(Direction facing) { return this.container; } @Override - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { super.writeNBT(compound, type); if (type != SaveType.BLOCK) { this.container.writeNBT(compound); @@ -115,7 +115,7 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickable { } @Override - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { super.readNBT(compound, type); if (type != SaveType.BLOCK) { this.container.readNBT(compound); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEnderCrate.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEnderCrate.java index 2257087f..9b6aba81 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEnderCrate.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityEnderCrate.java @@ -4,10 +4,10 @@ import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.misc.IWorldData; import de.ellpeck.naturesaura.blocks.BlockEnderCrate; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraftforge.items.IItemHandlerModifiable; @@ -62,7 +62,7 @@ public class TileEntityEnderCrate extends TileEntityImpl { public String name; @Override - public IItemHandlerModifiable getItemHandler(EnumFacing facing) { + public IItemHandlerModifiable getItemHandler(Direction facing) { if (this.canOpen()) return this.wrappedEnderStorage; return null; @@ -77,11 +77,11 @@ public class TileEntityEnderCrate extends TileEntityImpl { } @Override - public ItemStack getDrop(IBlockState state, int fortune) { + public ItemStack getDrop(BlockState state, int fortune) { ItemStack drop = super.getDrop(state, fortune); if (this.name != null) { if (!drop.hasTagCompound()) - drop.setTagCompound(new NBTTagCompound()); + drop.setTagCompound(new CompoundNBT()); drop.getTagCompound().setString(NaturesAura.MOD_ID + ":ender_name", this.name); } return drop; @@ -98,7 +98,7 @@ public class TileEntityEnderCrate extends TileEntityImpl { } @Override - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { super.writeNBT(compound, type); if (type != SaveType.BLOCK) { if (this.name != null) @@ -107,7 +107,7 @@ public class TileEntityEnderCrate extends TileEntityImpl { } @Override - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { super.readNBT(compound, type); if (type != SaveType.BLOCK) { if (compound.hasKey("name")) diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java index e0a9d26e..eaeec1d2 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFieldCreator.java @@ -8,18 +8,18 @@ import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticleStream; import net.minecraft.block.Block; import net.minecraft.block.BlockLiquid; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.item.EntityItemFrame; -import net.minecraft.item.ItemShears; +import net.minecraft.block.BlockState; +import net.minecraft.entity.item.ItemFrameEntity; +import net.minecraft.item.ShearsItem; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ITickable; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; -import net.minecraft.world.WorldServer; +import net.minecraft.world.ServerWorld; import net.minecraftforge.common.IShearable; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.FakePlayer; @@ -111,13 +111,13 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickable if (pos.equals(this.pos) || pos.equals(connectedPos)) continue; - IBlockState state = this.world.getBlockState(pos); + BlockState state = this.world.getBlockState(pos); Block block = state.getBlock(); if (!block.isAir(state, this.world, pos) && !(block instanceof BlockLiquid) && !(block instanceof IFluidBlock) && state.getBlockHardness(this.world, pos) >= 0F) { - FakePlayer fake = FakePlayerFactory.getMinecraft((WorldServer) this.world); + FakePlayer fake = FakePlayerFactory.getMinecraft((ServerWorld) this.world); if (!MinecraftForge.EVENT_BUS.post(new BlockEvent.BreakEvent(this.world, pos, state, fake))) { boolean shearBlock = shears && block instanceof IShearable; List drops; @@ -143,10 +143,10 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickable } public boolean shears() { - List frames = Helper.getAttachedItemFrames(this.world, this.pos); - for (EntityItemFrame frame : frames) { + List frames = Helper.getAttachedItemFrames(this.world, this.pos); + for (ItemFrameEntity frame : frames) { ItemStack stack = frame.getDisplayedItem(); - if (!stack.isEmpty() && stack.getItem() instanceof ItemShears) + if (!stack.isEmpty() && stack.getItem() instanceof ShearsItem) return true; } return false; @@ -179,7 +179,7 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickable } @Override - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { super.writeNBT(compound, type); if (type != SaveType.BLOCK) { if (this.connectionOffset != null) @@ -193,7 +193,7 @@ public class TileEntityFieldCreator extends TileEntityImpl implements ITickable } @Override - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { super.readNBT(compound, type); if (type != SaveType.BLOCK) { if (compound.hasKey("connection")) 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 33319324..f50cb604 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFireworkGenerator.java @@ -4,14 +4,14 @@ import com.google.common.primitives.Ints; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; -import net.minecraft.entity.item.EntityFireworkRocket; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.init.Items; +import net.minecraft.entity.item.FireworkRocketEntity; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.item.Items; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.EntitySelectors; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; +import net.minecraft.util.EntityPredicates; import net.minecraft.util.ITickable; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -24,7 +24,7 @@ import java.util.Set; public class TileEntityFireworkGenerator extends TileEntityImpl implements ITickable { - private EntityFireworkRocket trackedEntity; + private FireworkRocketEntity trackedEntity; private ItemStack trackedItem; private int toRelease; private int releaseTimer; @@ -33,16 +33,16 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick public void update() { if (!this.world.isRemote) { if (this.world.getTotalWorldTime() % 10 == 0) { - List items = this.world.getEntitiesWithinAABB(EntityItem.class, - new AxisAlignedBB(this.pos).grow(4), EntitySelectors.IS_ALIVE); - for (EntityItem item : items) { + List items = this.world.getEntitiesWithinAABB(ItemEntity.class, + new AxisAlignedBB(this.pos).grow(4), EntityPredicates.IS_ALIVE); + for (ItemEntity item : items) { if (item.cannotPickup()) continue; ItemStack stack = item.getItem(); if (stack.isEmpty() || stack.getItem() != Items.FIREWORKS) continue; if (this.trackedEntity == null && this.releaseTimer <= 0) { - EntityFireworkRocket entity = new EntityFireworkRocket(this.world, item.posX, item.posY, item.posZ, stack); + FireworkRocketEntity entity = new FireworkRocketEntity(this.world, item.posX, item.posY, item.posZ, stack); this.trackedEntity = entity; this.trackedItem = stack.copy(); this.world.spawnEntity(entity); @@ -60,16 +60,16 @@ public class TileEntityFireworkGenerator extends TileEntityImpl implements ITick float generateFactor = 0; Set usedColors = new HashSet<>(); - NBTTagCompound compound = this.trackedItem.getTagCompound(); - NBTTagCompound fireworks = compound.getCompoundTag("Fireworks"); + CompoundNBT compound = this.trackedItem.getTagCompound(); + CompoundNBT fireworks = compound.getCompoundTag("Fireworks"); int flightTime = fireworks.getInteger("Flight"); - NBTTagList explosions = fireworks.getTagList("Explosions", 10); + ListNBT explosions = fireworks.getTagList("Explosions", 10); if (!explosions.isEmpty()) { generateFactor += flightTime; for (NBTBase base : explosions) { - NBTTagCompound explosion = (NBTTagCompound) base; + CompoundNBT explosion = (CompoundNBT) base; generateFactor += 1.5F; boolean flicker = explosion.getBoolean("Flicker"); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java index 22d24919..577839b2 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFlowerGenerator.java @@ -8,10 +8,10 @@ import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticleStream; import de.ellpeck.naturesaura.packet.PacketParticles; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.util.ITickable; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; @@ -25,7 +25,7 @@ import java.util.Map; public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickable { - private final Map consumedRecently = new HashMap<>(); + private final Map consumedRecently = new HashMap<>(); @Override public void update() { @@ -36,7 +36,7 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab for (int y = -1; y <= 1; y++) { for (int z = -range; z <= range; z++) { BlockPos offset = this.pos.add(x, y, z); - IBlockState state = this.world.getBlockState(offset); + BlockState state = this.world.getBlockState(offset); if (NaturesAuraAPI.FLOWERS.contains(state)) { possible.add(offset); } @@ -48,7 +48,7 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab return; BlockPos pos = possible.get(this.world.rand.nextInt(possible.size())); - IBlockState state = this.world.getBlockState(pos); + BlockState state = this.world.getBlockState(pos); MutableInt curr = this.consumedRecently.computeIfAbsent(state, s -> new MutableInt()); int addAmount = 25000; @@ -64,7 +64,7 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab toAdd = 0; } - for (Map.Entry entry : this.consumedRecently.entrySet()) { + for (Map.Entry entry : this.consumedRecently.entrySet()) { if (entry.getKey() != state) { MutableInt val = entry.getValue(); if (val.getValue() > 0) @@ -99,16 +99,16 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab } @Override - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { super.writeNBT(compound, type); if (type != SaveType.SYNC && !this.consumedRecently.isEmpty()) { - NBTTagList list = new NBTTagList(); - for (Map.Entry entry : this.consumedRecently.entrySet()) { - IBlockState state = entry.getKey(); + ListNBT list = new ListNBT(); + for (Map.Entry entry : this.consumedRecently.entrySet()) { + BlockState state = entry.getKey(); Block block = state.getBlock(); - NBTTagCompound tag = new NBTTagCompound(); + CompoundNBT tag = new CompoundNBT(); tag.setString("block", block.getRegistryName().toString()); tag.setInteger("meta", block.getMetaFromState(state)); tag.setInteger("amount", entry.getValue().intValue()); @@ -119,19 +119,19 @@ public class TileEntityFlowerGenerator extends TileEntityImpl implements ITickab } @Override - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { super.readNBT(compound, type); if (type != SaveType.SYNC) { this.consumedRecently.clear(); - NBTTagList list = compound.getTagList("consumed_recently", 10); + ListNBT list = compound.getTagList("consumed_recently", 10); for (NBTBase base : list) { - NBTTagCompound tag = (NBTTagCompound) base; + CompoundNBT tag = (CompoundNBT) base; Block block = ForgeRegistries.BLOCKS.getValue(new ResourceLocation(tag.getString("block"))); if (block != null) { - IBlockState state = block.getStateFromMeta(tag.getInteger("meta")); + BlockState state = block.getStateFromMeta(tag.getInteger("meta")); this.consumedRecently.put(state, new MutableInt(tag.getInteger("amount"))); } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java index e00ff89a..6f355edd 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityFurnaceHeater.java @@ -6,13 +6,13 @@ import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.blocks.BlockFurnaceHeater; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticleStream; -import net.minecraft.block.BlockFurnace; +import net.minecraft.block.FurnaceBlock; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityFurnace; -import net.minecraft.util.EnumFacing; +import net.minecraft.tileentity.FurnaceTileEntity; +import net.minecraft.util.Direction; import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -26,15 +26,15 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable if (!this.world.isRemote && this.world.getTotalWorldTime() % 5 == 0) { boolean did = false; - EnumFacing facing = this.world.getBlockState(this.pos).getValue(BlockFurnaceHeater.FACING); + Direction facing = this.world.getBlockState(this.pos).getValue(BlockFurnaceHeater.FACING); BlockPos tilePos = this.pos.offset(facing.getOpposite()); TileEntity tile = this.world.getTileEntity(tilePos); - if (tile instanceof TileEntityFurnace) { - TileEntityFurnace furnace = (TileEntityFurnace) tile; + if (tile instanceof FurnaceTileEntity) { + FurnaceTileEntity furnace = (FurnaceTileEntity) tile; if (isReady(furnace)) { int time = furnace.getField(0); if (time <= 0) - BlockFurnace.setState(true, this.world, furnace.getPos()); + FurnaceBlock.setState(true, this.world, furnace.getPos()); furnace.setField(0, 200); //if set higher than 199, it'll never finish because the furnace does ++ and then == furnace.setField(2, Math.min(199, furnace.getField(2) + 5)); @@ -65,7 +65,7 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable } } - private static boolean isReady(TileEntityFurnace furnace) { + private static boolean isReady(FurnaceTileEntity furnace) { if (!furnace.getStackInSlot(1).isEmpty()) return false; @@ -83,7 +83,7 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable } @Override - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { super.writeNBT(compound, type); if (type == SaveType.SYNC) @@ -91,7 +91,7 @@ public class TileEntityFurnaceHeater extends TileEntityImpl implements ITickable } @Override - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { super.readNBT(compound, type); if (type == SaveType.SYNC) diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGeneratorLimitRemover.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGeneratorLimitRemover.java index 2fcc836b..bea3ef89 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGeneratorLimitRemover.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGeneratorLimitRemover.java @@ -1,13 +1,13 @@ package de.ellpeck.naturesaura.blocks.tiles; import net.minecraft.util.math.AxisAlignedBB; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class TileEntityGeneratorLimitRemover extends TileEntityImpl { @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public AxisAlignedBB getRenderBoundingBox() { return new AxisAlignedBB(this.pos, this.pos.add(1, 2, 1)); } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGratedChute.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGratedChute.java index 062eb748..2062f618 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGratedChute.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityGratedChute.java @@ -2,13 +2,13 @@ package de.ellpeck.naturesaura.blocks.tiles; import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.blocks.BlockGratedChute; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.item.EntityItemFrame; +import net.minecraft.block.BlockState; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.entity.item.ItemFrameEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.ITickable; import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.items.CapabilityItemHandler; @@ -44,8 +44,8 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickable { ItemStack curr = this.items.getStackInSlot(0); push: if (!curr.isEmpty()) { - IBlockState state = this.world.getBlockState(this.pos); - EnumFacing facing = state.getValue(BlockGratedChute.FACING); + BlockState state = this.world.getBlockState(this.pos); + Direction facing = state.getValue(BlockGratedChute.FACING); TileEntity tile = this.world.getTileEntity(this.pos.offset(facing)); if (tile == null || !tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite())) @@ -67,10 +67,10 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickable { } pull: if (curr.isEmpty() || curr.getCount() < curr.getMaxStackSize()) { - List items = this.world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB( + List items = this.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB( this.pos.getX(), this.pos.getY() + 0.5, this.pos.getZ(), this.pos.getX() + 1, this.pos.getY() + 2, this.pos.getZ() + 1)); - for (EntityItem item : items) { + for (ItemEntity item : items) { if (item.isDead) continue; ItemStack stack = item.getItem(); @@ -87,9 +87,9 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickable { } TileEntity tileUp = this.world.getTileEntity(this.pos.up()); - if (tileUp == null || !tileUp.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)) + if (tileUp == null || !tileUp.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN)) break pull; - IItemHandler handlerUp = tileUp.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN); + IItemHandler handlerUp = tileUp.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN); if (handlerUp == null) break pull; for (int i = 0; i < handlerUp.getSlots(); i++) { @@ -109,10 +109,10 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickable { } private boolean isItemInFrame(ItemStack stack) { - List frames = Helper.getAttachedItemFrames(this.world, this.pos); + List frames = Helper.getAttachedItemFrames(this.world, this.pos); if (frames.isEmpty()) return false; - for (EntityItemFrame frame : frames) { + for (ItemFrameEntity frame : frames) { ItemStack frameStack = frame.getDisplayedItem(); if (Helper.areItemsEqual(stack, frameStack, true)) { return true; @@ -122,7 +122,7 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickable { } @Override - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { super.writeNBT(compound, type); if (type != SaveType.BLOCK) { compound.setInteger("cooldown", this.cooldown); @@ -132,7 +132,7 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickable { } @Override - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { super.readNBT(compound, type); if (type != SaveType.BLOCK) { this.cooldown = compound.getInteger("cooldown"); @@ -142,7 +142,7 @@ public class TileEntityGratedChute extends TileEntityImpl implements ITickable { } @Override - public IItemHandlerModifiable getItemHandler(EnumFacing facing) { + public IItemHandlerModifiable getItemHandler(Direction facing) { return this.items; } } 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 61fb86b6..73f041e0 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityHopperUpgrade.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityHopperUpgrade.java @@ -3,12 +3,12 @@ package de.ellpeck.naturesaura.blocks.tiles; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; -import net.minecraft.block.BlockHopper; -import net.minecraft.entity.item.EntityItem; +import net.minecraft.block.HopperBlock; +import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.tileentity.TileEntityHopper; -import net.minecraft.util.EnumFacing; +import net.minecraft.tileentity.HopperTileEntity; +import net.minecraft.util.Direction; import net.minecraft.util.ITickable; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -26,18 +26,18 @@ public class TileEntityHopperUpgrade extends TileEntityImpl implements ITickable TileEntity tile = this.world.getTileEntity(this.pos.down()); if (!isValidHopper(tile)) return; - if (!tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP)) + if (!tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.UP)) return; - IItemHandler handler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.UP); + IItemHandler handler = tile.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.UP); if (handler == null) return; - List items = this.world.getEntitiesWithinAABB(EntityItem.class, + List items = this.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(this.pos).grow(7)); if (items.isEmpty()) return; - for (EntityItem item : items) { + for (ItemEntity item : items) { if (item.isDead || item.cannotPickup()) continue; ItemStack stack = item.getItem(); @@ -68,8 +68,8 @@ public class TileEntityHopperUpgrade extends TileEntityImpl implements ITickable } private static boolean isValidHopper(TileEntity tile) { - if (tile instanceof TileEntityHopper) - return BlockHopper.isEnabled(tile.getBlockMetadata()); + if (tile instanceof HopperTileEntity) + return HopperBlock.isEnabled(tile.getBlockMetadata()); if (tile instanceof TileEntityGratedChute) return ((TileEntityGratedChute) tile).redstonePower <= 0; return false; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java index a050d9bb..3928103a 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityImpl.java @@ -5,18 +5,18 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; import de.ellpeck.naturesaura.blocks.ModBlocks; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.item.EntityItem; +import net.minecraft.block.BlockState; +import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.NetworkManager; -import net.minecraft.network.play.server.SPacketUpdateTileEntity; +import net.minecraft.network.play.server.SUpdateTileEntityPacket; import net.minecraft.server.management.PlayerChunkMapEntry; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraft.world.WorldServer; +import net.minecraft.world.ServerWorld; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; @@ -29,29 +29,29 @@ public class TileEntityImpl extends TileEntity { public int redstonePower; @Override - public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) { + public boolean shouldRefresh(World world, BlockPos pos, BlockState oldState, BlockState newState) { return oldState.getBlock() != newState.getBlock(); } @Override - public NBTTagCompound writeToNBT(NBTTagCompound compound) { + public CompoundNBT writeToNBT(CompoundNBT compound) { this.writeNBT(compound, SaveType.TILE); return compound; } @Override - public void readFromNBT(NBTTagCompound compound) { + public void readFromNBT(CompoundNBT compound) { this.readNBT(compound, SaveType.TILE); } - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { if (type != SaveType.BLOCK) { super.writeToNBT(compound); compound.setInteger("redstone", this.redstonePower); } } - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { if (type != SaveType.BLOCK) { super.readFromNBT(compound); this.redstonePower = compound.getInteger("redstone"); @@ -63,48 +63,48 @@ public class TileEntityImpl extends TileEntity { } @Override - public final SPacketUpdateTileEntity getUpdatePacket() { - NBTTagCompound compound = new NBTTagCompound(); + public final SUpdateTileEntityPacket getUpdatePacket() { + CompoundNBT compound = new CompoundNBT(); this.writeNBT(compound, SaveType.SYNC); - return new SPacketUpdateTileEntity(this.pos, 0, compound); + return new SUpdateTileEntityPacket(this.pos, 0, compound); } @Override - public final NBTTagCompound getUpdateTag() { - NBTTagCompound compound = new NBTTagCompound(); + public final CompoundNBT getUpdateTag() { + CompoundNBT compound = new CompoundNBT(); this.writeNBT(compound, SaveType.SYNC); return compound; } @Override - public void handleUpdateTag(NBTTagCompound tag) { + public void handleUpdateTag(CompoundNBT tag) { this.readNBT(tag, SaveType.SYNC); } @Override - public void onDataPacket(NetworkManager net, SPacketUpdateTileEntity packet) { + public void onDataPacket(NetworkManager net, SUpdateTileEntityPacket packet) { super.onDataPacket(net, packet); this.readNBT(packet.getNbtCompound(), SaveType.SYNC); } public void sendToClients() { - WorldServer world = (WorldServer) this.getWorld(); + ServerWorld world = (ServerWorld) this.getWorld(); PlayerChunkMapEntry entry = world.getPlayerChunkMap().getEntry(this.getPos().getX() >> 4, this.getPos().getZ() >> 4); if (entry != null) { entry.sendPacket(this.getUpdatePacket()); } } - public IItemHandlerModifiable getItemHandler(EnumFacing facing) { + public IItemHandlerModifiable getItemHandler(Direction facing) { return null; } - public IAuraContainer getAuraContainer(EnumFacing facing) { + public IAuraContainer getAuraContainer(Direction facing) { return null; } @Override - public boolean hasCapability(Capability capability, @Nullable EnumFacing facing) { + public boolean hasCapability(Capability capability, @Nullable Direction facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return this.getItemHandler(facing) != null; } else if (capability == NaturesAuraAPI.capAuraContainer) { @@ -116,7 +116,7 @@ public class TileEntityImpl extends TileEntity { @Nullable @Override - public T getCapability(Capability capability, @Nullable EnumFacing facing) { + public T getCapability(Capability capability, @Nullable Direction facing) { if (capability == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) { return (T) this.getItemHandler(facing); } else if (capability == NaturesAuraAPI.capAuraContainer) { @@ -132,7 +132,7 @@ public class TileEntityImpl extends TileEntity { for (int i = 0; i < handler.getSlots(); i++) { ItemStack stack = handler.getStackInSlot(i); if (!stack.isEmpty()) { - EntityItem item = new EntityItem(this.world, + ItemEntity item = new ItemEntity(this.world, this.pos.getX() + 0.5, this.pos.getY() + 0.5, this.pos.getZ() + 0.5, stack); this.world.spawnEntity(item); @@ -141,18 +141,18 @@ public class TileEntityImpl extends TileEntity { } } - public ItemStack getDrop(IBlockState state, int fortune) { + public ItemStack getDrop(BlockState state, int fortune) { Block block = state.getBlock(); ItemStack stack = new ItemStack( block.getItemDropped(state, this.world.rand, fortune), block.quantityDropped(state, fortune, this.world.rand), block.damageDropped(state)); - NBTTagCompound compound = new NBTTagCompound(); + CompoundNBT compound = new CompoundNBT(); this.writeNBT(compound, SaveType.BLOCK); if (!compound.isEmpty()) { - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); stack.getTagCompound().setTag("data", compound); } @@ -161,7 +161,7 @@ public class TileEntityImpl extends TileEntity { public void loadDataOnPlace(ItemStack stack) { if (stack.hasTagCompound()) { - NBTTagCompound compound = stack.getTagCompound().getCompoundTag("data"); + CompoundNBT compound = stack.getTagCompound().getCompoundTag("data"); if (compound != null) this.readNBT(compound, SaveType.BLOCK); } @@ -169,7 +169,7 @@ public class TileEntityImpl extends TileEntity { public boolean canGenerateRightNow(int range, int toAdd) { if (this.wantsLimitRemover()) { - IBlockState below = this.world.getBlockState(this.pos.down()); + BlockState below = this.world.getBlockState(this.pos.down()); if (below.getBlock() == ModBlocks.GENERATOR_LIMIT_REMOVER) return true; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityMossGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityMossGenerator.java index 1a1acd80..5f3e3cfc 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityMossGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityMossGenerator.java @@ -5,7 +5,7 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; @@ -26,7 +26,7 @@ public class TileEntityMossGenerator extends TileEntityImpl implements ITickable for (int y = -range; y <= range; y++) for (int z = -range; z <= range; z++) { BlockPos offset = this.pos.add(x, y, z); - IBlockState state = this.world.getBlockState(offset); + BlockState state = this.world.getBlockState(offset); if (NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.inverse().containsKey(state)) possibleOffsets.add(offset); } @@ -34,8 +34,8 @@ public class TileEntityMossGenerator extends TileEntityImpl implements ITickable if (possibleOffsets.isEmpty()) return; BlockPos offset = possibleOffsets.get(this.world.rand.nextInt(possibleOffsets.size())); - IBlockState state = this.world.getBlockState(offset); - IBlockState result = NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.inverse().get(state); + BlockState state = this.world.getBlockState(offset); + BlockState result = NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.inverse().get(state); int toAdd = 7500; if (this.canGenerateRightNow(35, toAdd)) { diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java index 1bee9453..cfc2fe80 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityNatureAltar.java @@ -10,19 +10,19 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticleStream; import de.ellpeck.naturesaura.packet.PacketParticles; -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.SoundEvents; +import net.minecraft.block.BlockState; +import net.minecraft.util.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.Direction; import net.minecraft.util.ITickable; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.ItemStackHandler; @@ -50,7 +50,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable { } }; - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int bobTimer; private final BasicAuraContainer container = new BasicAuraContainer(NaturesAuraAPI.TYPE_OVERWORLD, 500000); @@ -71,7 +71,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable { for (int x = -2; x <= 2; x += 4) { for (int z = -2; z <= 2; z += 4) { BlockPos offset = this.pos.add(x, 1, z); - IBlockState state = this.world.getBlockState(offset); + BlockState state = this.world.getBlockState(offset); this.catalysts[index] = state.getBlock().getItem(this.world, offset, state); index++; } @@ -206,7 +206,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable { } @Override - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { super.writeNBT(compound, type); if (type != SaveType.BLOCK) { compound.setTag("items", this.items.serializeNBT()); @@ -222,7 +222,7 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable { } @Override - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { super.readNBT(compound, type); if (type != SaveType.BLOCK) { this.items.deserializeNBT(compound.getCompoundTag("items")); @@ -238,12 +238,12 @@ public class TileEntityNatureAltar extends TileEntityImpl implements ITickable { } @Override - public IAuraContainer getAuraContainer(EnumFacing facing) { + public IAuraContainer getAuraContainer(Direction facing) { return this.container; } @Override - public IItemHandlerModifiable getItemHandler(EnumFacing facing) { + public IItemHandlerModifiable getItemHandler(Direction facing) { return this.items; } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java index afd315fc..ee02eb7c 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOakGenerator.java @@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.blocks.tiles; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; -import net.minecraft.block.BlockLog; +import net.minecraft.block.LogBlock; import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; @@ -19,7 +19,7 @@ public class TileEntityOakGenerator extends TileEntityImpl implements ITickable if (!this.world.isRemote) while (!this.scheduledBigTrees.isEmpty()) { BlockPos pos = this.scheduledBigTrees.remove(); - if (this.world.getBlockState(pos).getBlock() instanceof BlockLog) { + if (this.world.getBlockState(pos).getBlock() instanceof LogBlock) { int toAdd = 100000; boolean canGen = this.canGenerateRightNow(25, toAdd); if (canGen) 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 2034055d..6421bb6d 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityOfferingTable.java @@ -6,13 +6,13 @@ import de.ellpeck.naturesaura.api.recipes.OfferingRecipe; import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; -import net.minecraft.entity.effect.EntityLightningBolt; -import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.effect.LightningBoltEntity; +import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.EnumFacing; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; +import net.minecraft.util.Direction; import net.minecraft.util.ITickable; import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.items.IItemHandlerModifiable; @@ -42,7 +42,7 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable if (stack.isEmpty()) return; - List items = this.world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(this.pos).grow(1)); + List items = this.world.getEntitiesWithinAABB(ItemEntity.class, new AxisAlignedBB(this.pos).grow(1)); if (items.isEmpty()) return; @@ -50,7 +50,7 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable if (recipe == null) return; - for (EntityItem item : items) { + for (ItemEntity item : items) { if (item.isDead || item.cannotPickup()) continue; @@ -70,7 +70,7 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable for (int i = 0; i < recipeCount; i++) this.itemsToSpawn.add(recipe.output.copy()); - this.world.addWeatherEffect(new EntityLightningBolt(this.world, this.pos.getX(), this.pos.getY(), this.pos.getZ(), true)); + this.world.addWeatherEffect(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, 13, this.pos.getX(), this.pos.getY(), this.pos.getZ())); @@ -79,7 +79,7 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable } } else if (this.world.getTotalWorldTime() % 3 == 0) { if (!this.itemsToSpawn.isEmpty()) - this.world.spawnEntity(new EntityItem( + this.world.spawnEntity(new ItemEntity( this.world, this.pos.getX() + 0.5F, 256, this.pos.getZ() + 0.5F, this.itemsToSpawn.remove())); @@ -95,13 +95,13 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable } @Override - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { super.writeNBT(compound, type); if (type != SaveType.BLOCK) { compound.setTag("items", this.items.serializeNBT()); if (type != SaveType.SYNC) { - NBTTagList list = new NBTTagList(); + ListNBT list = new ListNBT(); for (ItemStack stack : this.itemsToSpawn) { list.appendTag(stack.serializeNBT()); } @@ -111,23 +111,23 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable } @Override - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { super.readNBT(compound, type); if (type != SaveType.BLOCK) { this.items.deserializeNBT(compound.getCompoundTag("items")); if (type != SaveType.SYNC) { this.itemsToSpawn.clear(); - NBTTagList list = compound.getTagList("items_to_spawn", 10); + ListNBT list = compound.getTagList("items_to_spawn", 10); for (NBTBase base : list) { - this.itemsToSpawn.add(new ItemStack((NBTTagCompound) base)); + this.itemsToSpawn.add(new ItemStack((CompoundNBT) base)); } } } } @Override - public IItemHandlerModifiable getItemHandler(EnumFacing facing) { + public IItemHandlerModifiable getItemHandler(Direction facing) { return this.items; } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java index 7b2f5d79..7e81f7a5 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPlacer.java @@ -6,18 +6,18 @@ import de.ellpeck.naturesaura.blocks.ModBlocks; import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.item.EntityItemFrame; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; +import net.minecraft.block.BlockState; +import net.minecraft.entity.item.ItemFrameEntity; +import net.minecraft.block.Blocks; +import net.minecraft.item.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.WorldServer; +import net.minecraft.world.ServerWorld; import net.minecraftforge.common.IPlantable; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayerFactory; @@ -35,12 +35,12 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickable { if (this.redstonePower > 0) return; TileEntity tileUp = this.world.getTileEntity(this.pos.up()); - if (tileUp == null || !tileUp.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN)) + if (tileUp == null || !tileUp.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN)) return; - IItemHandler handler = tileUp.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, EnumFacing.DOWN); + IItemHandler handler = tileUp.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN); if (handler == null) return; - List frames = Helper.getAttachedItemFrames(this.world, this.pos); + List frames = Helper.getAttachedItemFrames(this.world, this.pos); if (frames.isEmpty()) return; @@ -54,7 +54,7 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickable { continue; BlockPos up = pos.up(); - IBlockState state = this.world.getBlockState(up); + BlockState state = this.world.getBlockState(up); if (state.getBlock().isReplaceable(this.world, up)) validPositions.add(up); } @@ -82,12 +82,12 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickable { } } - private boolean framesContain(List frames, BlockPos pos, IBlockState state) { + private boolean framesContain(List frames, BlockPos pos, BlockState state) { ItemStack stack = state.getBlock().getItem(this.world, pos, state); if (stack.isEmpty()) return false; - for (EntityItemFrame frame : frames) { + for (ItemFrameEntity frame : frames) { ItemStack frameStack = frame.getDisplayedItem(); if (frameStack.isEmpty()) continue; @@ -104,13 +104,13 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickable { if (this.handleSpecialCases(stack, pos)) return stack; - if (!(this.world instanceof WorldServer)) + if (!(this.world instanceof ServerWorld)) return stack; - FakePlayer fake = FakePlayerFactory.getMinecraft((WorldServer) this.world); + FakePlayer fake = FakePlayerFactory.getMinecraft((ServerWorld) this.world); fake.inventory.mainInventory.set(fake.inventory.currentItem, stack); - fake.interactionManager.processRightClickBlock(fake, this.world, fake.getHeldItemMainhand(), EnumHand.MAIN_HAND, - pos, EnumFacing.DOWN, 0.5F, 0.5F, 0.5F); + fake.interactionManager.processRightClickBlock(fake, this.world, fake.getHeldItemMainhand(), Hand.MAIN_HAND, + pos, Direction.DOWN, 0.5F, 0.5F, 0.5F); return fake.getHeldItemMainhand().copy(); } @@ -127,10 +127,10 @@ public class TileEntityPlacer extends TileEntityImpl implements ITickable { return false; else if (stack.getItem() instanceof IPlantable) { IPlantable plantable = (IPlantable) stack.getItem(); - IBlockState plant = plantable.getPlant(this.world, pos); + BlockState plant = plantable.getPlant(this.world, pos); if (!plant.getBlock().canPlaceBlockAt(this.world, pos)) return false; - IBlockState state = this.world.getBlockState(pos); + BlockState state = this.world.getBlockState(pos); if (!state.getBlock().isAir(state, this.world, pos)) return false; this.world.setBlockState(pos, plant); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java index a5d7c2c6..98b6272c 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPotionGenerator.java @@ -4,10 +4,10 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; -import net.minecraft.entity.EntityAreaEffectCloud; +import net.minecraft.entity.AreaEffectCloudEntity; +import net.minecraft.potion.Effect; +import net.minecraft.potion.EffectInstance; import net.minecraft.potion.Potion; -import net.minecraft.potion.PotionEffect; -import net.minecraft.potion.PotionType; import net.minecraft.potion.PotionUtils; import net.minecraft.util.ITickable; import net.minecraft.util.math.AxisAlignedBB; @@ -24,18 +24,18 @@ public class TileEntityPotionGenerator extends TileEntityImpl implements ITickab if (Multiblocks.POTION_GENERATOR.isComplete(this.world, this.pos)) { boolean addedOne = false; - List clouds = this.world.getEntitiesWithinAABB(EntityAreaEffectCloud.class, new AxisAlignedBB(this.pos).grow(2)); - for (EntityAreaEffectCloud cloud : clouds) { + List clouds = this.world.getEntitiesWithinAABB(AreaEffectCloudEntity.class, new AxisAlignedBB(this.pos).grow(2)); + for (AreaEffectCloudEntity cloud : clouds) { if (cloud.isDead) continue; if (!addedOne) { - PotionType type = ReflectionHelper.getPrivateValue(EntityAreaEffectCloud.class, cloud, "field_184502_e", "potion"); + Potion type = ReflectionHelper.getPrivateValue(AreaEffectCloudEntity.class, cloud, "field_184502_e", "potion"); if (type == null) continue; - for (PotionEffect effect : type.getEffects()) { - Potion potion = effect.getPotion(); + for (EffectInstance effect : type.getEffects()) { + Effect potion = effect.getPotion(); if (potion.isBadEffect() || potion.isInstant()) { continue; } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPowderPlacer.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPowderPlacer.java index 20c08e19..59b582cf 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPowderPlacer.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityPowderPlacer.java @@ -4,8 +4,8 @@ import de.ellpeck.naturesaura.entities.EntityEffectInhibitor; import de.ellpeck.naturesaura.items.ModItems; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EntitySelectors; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.EntityPredicates; +import net.minecraft.util.Direction; import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.items.IItemHandler; @@ -18,8 +18,8 @@ public class TileEntityPowderPlacer extends TileEntityImpl { public void onRedstonePowerChange(int newPower) { if (this.redstonePower <= 0 && newPower > 0) { List powders = this.world.getEntitiesWithinAABB(EntityEffectInhibitor.class, - new AxisAlignedBB(this.pos, this.pos.add(1, 2, 1)), EntitySelectors.IS_ALIVE); - for (EnumFacing facing : EnumFacing.HORIZONTALS) { + new AxisAlignedBB(this.pos, this.pos.add(1, 2, 1)), EntityPredicates.IS_ALIVE); + for (Direction facing : Direction.HORIZONTALS) { TileEntity tile = this.world.getTileEntity(this.pos.offset(facing)); if (tile == null || !tile.hasCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, facing.getOpposite())) continue; diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityProjectileGenerator.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityProjectileGenerator.java index 72068c54..1eb6e253 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityProjectileGenerator.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityProjectileGenerator.java @@ -1,15 +1,15 @@ package de.ellpeck.naturesaura.blocks.tiles; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.Direction; import net.minecraft.util.ITickable; public class TileEntityProjectileGenerator extends TileEntityImpl { - public EnumFacing nextSide = EnumFacing.NORTH; + public Direction nextSide = Direction.NORTH; @Override - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { super.writeNBT(compound, type); if (type != SaveType.BLOCK) { compound.setInteger("next_side", this.nextSide.getHorizontalIndex()); @@ -17,10 +17,10 @@ public class TileEntityProjectileGenerator extends TileEntityImpl { } @Override - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { super.readNBT(compound, type); if (type != SaveType.BLOCK) { - this.nextSide = EnumFacing.byHorizontalIndex(compound.getInteger("next_side")); + this.nextSide = Direction.byHorizontalIndex(compound.getInteger("next_side")); } } } diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityRFConverter.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityRFConverter.java index f11076c1..fee14ec2 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityRFConverter.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityRFConverter.java @@ -5,9 +5,9 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.ITickable; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -24,13 +24,13 @@ public class TileEntityRFConverter extends TileEntityImpl implements ITickable { private int lastEnergy; @Override - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { super.writeNBT(compound, type); compound.setInteger("energy", this.storage.getEnergyStored()); } @Override - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { super.readNBT(compound, type); this.storage.setEnergy(compound.getInteger("energy")); } @@ -43,7 +43,7 @@ public class TileEntityRFConverter extends TileEntityImpl implements ITickable { this.lastEnergy = this.storage.getEnergyStored(); } - for (EnumFacing facing : EnumFacing.VALUES) { + for (Direction facing : Direction.VALUES) { TileEntity tile = this.world.getTileEntity(this.pos.offset(facing)); if (tile == null || !tile.hasCapability(CapabilityEnergy.ENERGY, facing.getOpposite())) continue; @@ -84,13 +84,13 @@ public class TileEntityRFConverter extends TileEntityImpl implements ITickable { } @Override - public boolean hasCapability(Capability capability, @Nullable EnumFacing facing) { + public boolean hasCapability(Capability capability, @Nullable Direction facing) { return capability == CapabilityEnergy.ENERGY || super.hasCapability(capability, facing); } @Nullable @Override - public T getCapability(Capability capability, @Nullable EnumFacing facing) { + public T getCapability(Capability capability, @Nullable Direction facing) { if (capability == CapabilityEnergy.ENERGY) return (T) this.storage; else diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityTimeChanger.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityTimeChanger.java index 42942d4e..8fd08a04 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityTimeChanger.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityTimeChanger.java @@ -5,19 +5,19 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.items.ModItems; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.item.EntityItemFrame; -import net.minecraft.init.Items; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.entity.item.ItemFrameEntity; +import net.minecraft.item.Items; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.network.play.server.SPacketTimeUpdate; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.network.play.server.SUpdateTimePacket; import net.minecraft.server.management.PlayerList; -import net.minecraft.util.EntitySelectors; +import net.minecraft.util.EntityPredicates; import net.minecraft.util.ITickable; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; -import net.minecraft.world.WorldServer; +import net.minecraft.world.ServerWorld; import java.util.List; @@ -28,8 +28,8 @@ public class TileEntityTimeChanger extends TileEntityImpl implements ITickable { @Override public void update() { if (!this.world.isRemote) { - List frames = Helper.getAttachedItemFrames(this.world, this.pos); - for (EntityItemFrame frame : frames) { + List frames = Helper.getAttachedItemFrames(this.world, this.pos); + for (ItemFrameEntity frame : frames) { ItemStack frameStack = frame.getDisplayedItem(); if (frameStack.isEmpty() || frameStack.getItem() != ModItems.CLOCK_HAND) continue; @@ -47,9 +47,9 @@ public class TileEntityTimeChanger extends TileEntityImpl implements ITickable { BlockPos spot = IAuraChunk.getHighestSpot(this.world, this.pos, 35, this.pos); IAuraChunk.getAuraChunk(this.world, spot).drainAura(spot, (int) toAdd * 20); - if (this.world instanceof WorldServer) { + if (this.world instanceof ServerWorld) { PlayerList list = this.world.getMinecraftServer().getPlayerList(); - list.sendPacketToAllPlayersInDimension(new SPacketTimeUpdate( + list.sendPacketToAllPlayersInDimension(new SUpdateTimePacket( this.world.getTotalWorldTime(), this.world.getWorldTime(), this.world.getGameRules().getBoolean("doDaylightCycle")), this.world.provider.getDimension()); } @@ -59,9 +59,9 @@ public class TileEntityTimeChanger extends TileEntityImpl implements ITickable { if (this.world.getTotalWorldTime() % 20 != 0) return; - List items = this.world.getEntitiesWithinAABB(EntityItem.class, - new AxisAlignedBB(this.pos).grow(1), EntitySelectors.IS_ALIVE); - for (EntityItem item : items) { + List items = this.world.getEntitiesWithinAABB(ItemEntity.class, + new AxisAlignedBB(this.pos).grow(1), EntityPredicates.IS_ALIVE); + for (ItemEntity item : items) { if (item.cannotPickup()) continue; ItemStack stack = item.getItem(); @@ -106,14 +106,14 @@ public class TileEntityTimeChanger extends TileEntityImpl implements ITickable { } @Override - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { super.writeNBT(compound, type); if (type != SaveType.BLOCK) compound.setLong("goal", this.goalTime); } @Override - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { super.readNBT(compound, type); if (type != SaveType.BLOCK) this.goalTime = compound.getLong("goal"); 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 d1dbf620..6c98f21b 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/TileEntityWoodStand.java @@ -6,16 +6,16 @@ import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticleStream; import de.ellpeck.naturesaura.packet.PacketParticles; -import net.minecraft.block.BlockLeaves; -import net.minecraft.block.BlockLog; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.init.SoundEvents; +import net.minecraft.block.LeavesBlock; +import net.minecraft.block.LogBlock; +import net.minecraft.block.BlockState; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.util.SoundEvents; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.ITickable; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; @@ -80,7 +80,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable { return true; }); - EntityItem item = new EntityItem(this.world, + ItemEntity item = new ItemEntity(this.world, this.ritualPos.getX() + 0.5, this.ritualPos.getY() + 4.5, this.ritualPos.getZ() + 0.5, this.recipe.result.copy()); this.world.spawnEntity(item); @@ -133,8 +133,8 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable { for (int y = -1; y <= 1; y++) { for (int z = -1; z <= 1; z++) { BlockPos offset = pos.add(x, y, z); - IBlockState state = this.world.getBlockState(offset); - if (state.getBlock() instanceof BlockLog || state.getBlock() instanceof BlockLeaves) { + BlockState state = this.world.getBlockState(offset); + if (state.getBlock() instanceof LogBlock || state.getBlock() instanceof LeavesBlock) { this.world.setBlockToAir(offset); PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(offset.getX(), offset.getY(), offset.getZ(), 2)); @@ -150,8 +150,8 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable { return false; } for (int i = 0; i < 2; i++) { - IBlockState state = this.world.getBlockState(this.ritualPos.up(i)); - if(!(state.getBlock() instanceof BlockLog)) + BlockState state = this.world.getBlockState(this.ritualPos.up(i)); + if(!(state.getBlock() instanceof LogBlock)) return false; } if (this.timer < this.recipe.time / 2) { @@ -179,7 +179,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable { } @Override - public void writeNBT(NBTTagCompound compound, SaveType type) { + public void writeNBT(CompoundNBT compound, SaveType type) { super.writeNBT(compound, type); if (type != SaveType.BLOCK) compound.setTag("items", this.items.serializeNBT()); @@ -194,7 +194,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable { } @Override - public void readNBT(NBTTagCompound compound, SaveType type) { + public void readNBT(CompoundNBT compound, SaveType type) { super.readNBT(compound, type); if (type != SaveType.BLOCK) this.items.deserializeNBT(compound.getCompoundTag("items")); @@ -209,7 +209,7 @@ public class TileEntityWoodStand extends TileEntityImpl implements ITickable { } @Override - public IItemHandlerModifiable getItemHandler(EnumFacing facing) { + public IItemHandlerModifiable getItemHandler(Direction facing) { return this.items; } } 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 3c7e3381..2933f356 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 @@ -4,19 +4,19 @@ 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.GlStateManager; +import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import java.nio.FloatBuffer; import java.util.Random; -@SideOnly(Side.CLIENT) -public class RenderEnderCrate extends TileEntitySpecialRenderer { +@OnlyIn(Dist.CLIENT) +public class RenderEnderCrate extends TileEntityRenderer { private static final ResourceLocation END_SKY_TEXTURE = new ResourceLocation("textures/environment/end_sky.png"); private static final ResourceLocation END_PORTAL_TEXTURE = new ResourceLocation("textures/entity/end_portal.png"); private static final Random RANDOM = new Random(31100L); 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 7ebc6bff..a46e62ea 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 @@ -6,17 +6,17 @@ import de.ellpeck.naturesaura.blocks.tiles.TileEntityImpl; import net.minecraft.client.Minecraft; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; -import net.minecraft.client.renderer.GlStateManager; +import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -@SideOnly(Side.CLIENT) -public class RenderGeneratorLimitRemover extends TileEntitySpecialRenderer { +@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(); diff --git a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderNatureAltar.java b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderNatureAltar.java index 3ecf4e77..5b33a5db 100644 --- a/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderNatureAltar.java +++ b/src/main/java/de/ellpeck/naturesaura/blocks/tiles/render/RenderNatureAltar.java @@ -2,12 +2,12 @@ package de.ellpeck.naturesaura.blocks.tiles.render; import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; -import net.minecraft.item.ItemBlock; +import com.mojang.blaze3d.platform.GlStateManager; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; +import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; -public class RenderNatureAltar extends TileEntitySpecialRenderer { +public class RenderNatureAltar extends TileEntityRenderer { @Override public void render(TileEntityNatureAltar tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { ItemStack stack = tile.items.getStackInSlot(0); @@ -17,7 +17,7 @@ public class RenderNatureAltar extends TileEntitySpecialRenderer { +public class RenderOfferingTable extends TileEntityRenderer { private final Random rand = new Random(); @@ -29,7 +29,7 @@ public class RenderOfferingTable extends TileEntitySpecialRenderer { +@OnlyIn(Dist.CLIENT) +public class RenderProjectileGenerator extends TileEntityRenderer { private static final ResourceLocation RES = new ResourceLocation(NaturesAura.MOD_ID, "textures/models/projectile_generator_overlay.png"); private final ModelOverlay model = new ModelOverlay(); @@ -21,13 +21,13 @@ public class RenderProjectileGenerator extends TileEntitySpecialRenderer { +public class RenderWoodStand extends TileEntityRenderer { @Override public void render(TileEntityWoodStand tile, double x, double y, double z, float partialTicks, int destroyStage, float alpha) { ItemStack stack = tile.items.getStackInSlot(0); if (!stack.isEmpty()) { GlStateManager.pushMatrix(); Item item = stack.getItem(); - if (item instanceof ItemBlock && ((ItemBlock) item).getBlock().getRenderLayer() == BlockRenderLayer.SOLID) { + if (item instanceof BlockItem && ((BlockItem) item).getBlock().getRenderLayer() == BlockRenderLayer.SOLID) { GlStateManager.translate(x + 0.5F, y + 0.9735F, z + 0.5F); float scale = 0.65F; GlStateManager.scale(scale, scale, scale); diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunk.java b/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunk.java index 6b722be3..59483763 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunk.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunk.java @@ -6,11 +6,11 @@ import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect; import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.packet.PacketAuraChunk; import de.ellpeck.naturesaura.packet.PacketHandler; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Tuple; import net.minecraft.util.math.BlockPos; @@ -173,7 +173,7 @@ public class AuraChunk implements IAuraChunk { } } - public void getActiveEffectIcons(EntityPlayer player, Map> icons) { + public void getActiveEffectIcons(PlayerEntity player, Map> icons) { for (IDrainSpotEffect effect : this.effects) { Tuple alreadyThere = icons.get(effect.getName()); if (alreadyThere != null && alreadyThere.getSecond()) @@ -193,26 +193,26 @@ public class AuraChunk implements IAuraChunk { } @Override - public NBTTagCompound serializeNBT() { - NBTTagList list = new NBTTagList(); + public CompoundNBT serializeNBT() { + ListNBT list = new ListNBT(); for (Map.Entry entry : this.drainSpots.entrySet()) { - NBTTagCompound tag = new NBTTagCompound(); + CompoundNBT tag = new CompoundNBT(); tag.setLong("pos", entry.getKey().toLong()); tag.setInteger("amount", entry.getValue().intValue()); list.appendTag(tag); } - NBTTagCompound compound = new NBTTagCompound(); + CompoundNBT compound = new CompoundNBT(); compound.setTag("drain_spots", list); return compound; } @Override - public void deserializeNBT(NBTTagCompound compound) { + public void deserializeNBT(CompoundNBT compound) { this.drainSpots.clear(); - NBTTagList list = compound.getTagList("drain_spots", 10); + ListNBT list = compound.getTagList("drain_spots", 10); for (NBTBase base : list) { - NBTTagCompound tag = (NBTTagCompound) base; + CompoundNBT tag = (CompoundNBT) base; this.addDrainSpot( BlockPos.fromLong(tag.getLong("pos")), new MutableInt(tag.getInteger("amount"))); diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunkProvider.java b/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunkProvider.java index 48a6b6c6..cb8bf76b 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunkProvider.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/AuraChunkProvider.java @@ -3,8 +3,8 @@ package de.ellpeck.naturesaura.chunk; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.type.IAuraType; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.Direction; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; @@ -13,7 +13,7 @@ import net.minecraftforge.common.util.INBTSerializable; import javax.annotation.Nonnull; import javax.annotation.Nullable; -public class AuraChunkProvider implements ICapabilityProvider, INBTSerializable { +public class AuraChunkProvider implements ICapabilityProvider, INBTSerializable { private final Chunk chunk; private IAuraChunk auraChunk; @@ -29,23 +29,23 @@ public class AuraChunkProvider implements ICapabilityProvider, INBTSerializable< } @Override - public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public boolean hasCapability(@Nonnull Capability capability, @Nullable Direction facing) { return capability == NaturesAuraAPI.capAuraChunk; } @Nullable @Override - public T getCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public T getCapability(@Nonnull Capability capability, @Nullable Direction facing) { return capability == NaturesAuraAPI.capAuraChunk ? (T) this.getAuraChunk() : null; } @Override - public NBTTagCompound serializeNBT() { + public CompoundNBT serializeNBT() { return this.getAuraChunk().serializeNBT(); } @Override - public void deserializeNBT(NBTTagCompound nbt) { + public void deserializeNBT(CompoundNBT nbt) { this.getAuraChunk().deserializeNBT(nbt); } } 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 e682cd54..54a9554d 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/AnimalEffect.java @@ -6,12 +6,12 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect; import de.ellpeck.naturesaura.api.aura.type.IAuraType; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.passive.EntityAnimal; -import net.minecraft.entity.passive.EntityChicken; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.ItemEgg; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.entity.passive.AnimalEntity; +import net.minecraft.entity.passive.ChickenEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Items; +import net.minecraft.item.EggItem; import net.minecraft.item.ItemStack; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; @@ -48,7 +48,7 @@ public class AnimalEffect implements IDrainSpotEffect { } @Override - public int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { + public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { if (!this.calcValues(player.world, pos, spot)) return -1; if (!this.bb.contains(player.getPositionVector())) @@ -68,23 +68,23 @@ public class AnimalEffect implements IDrainSpotEffect { if (!this.calcValues(world, pos, spot)) return; - List animals = world.getEntitiesWithinAABB(EntityAnimal.class, this.bb); + List animals = world.getEntitiesWithinAABB(AnimalEntity.class, this.bb); if (animals.size() >= 200) return; if (world.getTotalWorldTime() % 200 == 0) { - List items = world.getEntitiesWithinAABB(EntityItem.class, this.bb); - for (EntityItem item : items) { + List items = world.getEntitiesWithinAABB(ItemEntity.class, this.bb); + for (ItemEntity item : items) { if (item.isDead) continue; if (!NaturesAuraAPI.instance().isEffectPowderActive(world, item.getPosition(), NAME)) continue; ItemStack stack = item.getItem(); - if (!(stack.getItem() instanceof ItemEgg)) + if (!(stack.getItem() instanceof EggItem)) continue; // The getAge() method is private for absolutely no reason but I want it so I don't care - int age = ReflectionHelper.getPrivateValue(EntityItem.class, item, "field_70292_b", "age"); + int age = ReflectionHelper.getPrivateValue(ItemEntity.class, item, "field_70292_b", "age"); if (age < item.lifespan / 2) continue; @@ -95,7 +95,7 @@ public class AnimalEffect implements IDrainSpotEffect { item.setItem(stack); } - EntityChicken chicken = new EntityChicken(world); + ChickenEntity chicken = new ChickenEntity(world); chicken.setGrowingAge(-24000); chicken.setPosition(item.posX, item.posY, item.posZ); world.spawnEntity(chicken); @@ -108,18 +108,18 @@ public class AnimalEffect implements IDrainSpotEffect { if (world.rand.nextInt(200) <= this.chance) { if (animals.size() < 2) return; - EntityAnimal first = animals.get(world.rand.nextInt(animals.size())); + AnimalEntity first = animals.get(world.rand.nextInt(animals.size())); if (first.isChild() || first.isInLove()) return; if (!NaturesAuraAPI.instance().isEffectPowderActive(world, first.getPosition(), NAME)) return; - Optional secondOptional = animals.stream() + Optional secondOptional = animals.stream() .filter(e -> e != first && !e.isInLove() && !e.isChild()) .min(Comparator.comparingDouble(e -> e.getDistanceSq(first))); if (!secondOptional.isPresent()) return; - EntityAnimal second = secondOptional.get(); + AnimalEntity second = secondOptional.get(); if (second.getDistanceSq(first) > 5 * 5) return; @@ -131,7 +131,7 @@ public class AnimalEffect implements IDrainSpotEffect { } } - private void setInLove(EntityAnimal animal) { + private void setInLove(AnimalEntity animal) { animal.setInLove(null); for (int j = 0; j < 7; j++) animal.world.spawnParticle(EnumParticleTypes.HEART, diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/BreathlessEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/BreathlessEffect.java index 0236b4ec..6ea565e5 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/BreathlessEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/BreathlessEffect.java @@ -7,11 +7,11 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect; import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.potion.ModPotions; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.block.Blocks; import net.minecraft.item.ItemStack; -import net.minecraft.potion.PotionEffect; +import net.minecraft.potion.EffectInstance; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; @@ -43,7 +43,7 @@ public class BreathlessEffect implements IDrainSpotEffect { } @Override - public int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { + public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { if (!this.calcValues(player.world, pos, spot)) return -1; if (!this.bb.contains(player.getPositionVector())) @@ -62,9 +62,9 @@ public class BreathlessEffect implements IDrainSpotEffect { return; if (!this.calcValues(world, pos, spot)) return; - List entities = world.getEntitiesWithinAABB(EntityLivingBase.class, this.bb); - for (EntityLivingBase entity : entities) - entity.addPotionEffect(new PotionEffect(ModPotions.BREATHLESS, 300, this.amp)); + List entities = world.getEntitiesWithinAABB(LivingEntity.class, this.bb); + for (LivingEntity entity : entities) + entity.addPotionEffect(new EffectInstance(ModPotions.BREATHLESS, 300, this.amp)); } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/CacheRechargeEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/CacheRechargeEffect.java index ad96e784..fb49b572 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/CacheRechargeEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/CacheRechargeEffect.java @@ -7,7 +7,7 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect; import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.items.ModItems; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.AxisAlignedBB; @@ -38,7 +38,7 @@ public class CacheRechargeEffect implements IDrainSpotEffect { } @Override - public int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { + public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { if (!this.calcValues(player.world, pos, spot)) return -1; if (!this.bb.contains(player.getPositionVector())) @@ -57,8 +57,8 @@ public class CacheRechargeEffect implements IDrainSpotEffect { public void update(World world, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { if (!this.calcValues(world, pos, spot)) return; - List players = world.getEntitiesWithinAABB(EntityPlayer.class, this.bb); - for (EntityPlayer player : players) { + List players = world.getEntitiesWithinAABB(PlayerEntity.class, this.bb); + for (PlayerEntity player : players) { if (NaturesAuraAPI.instance().isEffectPowderActive(world, player.getPosition(), NAME)) continue; if (NaturesAuraAPI.instance().insertAuraIntoPlayer(player, this.amount, true)) { diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/ExplosionEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/ExplosionEffect.java index f18db4b7..a4b525c7 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/ExplosionEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/ExplosionEffect.java @@ -5,8 +5,8 @@ import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect; import de.ellpeck.naturesaura.api.aura.type.IAuraType; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.block.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; @@ -38,7 +38,7 @@ public class ExplosionEffect implements IDrainSpotEffect { } @Override - public int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { + public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { if (!this.calcValues(player.world, pos, spot)) return -1; if (player.getDistanceSq(pos) > this.dist * this.dist) diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/GrassDieEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/GrassDieEffect.java index b20caf8a..04d2db2d 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/GrassDieEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/GrassDieEffect.java @@ -8,9 +8,9 @@ import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect; import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.blocks.ModBlocks; import net.minecraft.block.*; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.block.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; @@ -40,7 +40,7 @@ public class GrassDieEffect implements IDrainSpotEffect { } @Override - public int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { + public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { if (!this.calcValues(player.world, pos, spot)) return -1; if (player.getDistanceSq(pos) > this.dist * this.dist) @@ -64,10 +64,10 @@ public class GrassDieEffect implements IDrainSpotEffect { pos.getZ() + world.rand.nextGaussian() * this.dist ); if (grassPos.distanceSq(pos) <= this.dist * this.dist && world.isBlockLoaded(grassPos)) { - IBlockState state = world.getBlockState(grassPos); + BlockState state = world.getBlockState(grassPos); Block block = state.getBlock(); - IBlockState newState = null; + BlockState newState = null; if (block instanceof BlockLeaves) { newState = ModBlocks.DECAYED_LEAVES.getDefaultState(); } else if (block instanceof BlockGrass) { diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/OreSpawnEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/OreSpawnEffect.java index c712a880..24f25da9 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/OreSpawnEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/OreSpawnEffect.java @@ -8,9 +8,9 @@ import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect; import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.api.recipes.WeightedOre; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.block.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.util.*; import net.minecraft.util.math.AxisAlignedBB; @@ -18,7 +18,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; -import net.minecraft.world.WorldServer; +import net.minecraft.world.ServerWorld; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.common.util.FakePlayer; import net.minecraftforge.common.util.FakePlayerFactory; @@ -30,7 +30,7 @@ import java.util.Set; public class OreSpawnEffect implements IDrainSpotEffect { - public static final Set SPAWN_EXCEPTIONS = new HashSet<>(); + public static final Set SPAWN_EXCEPTIONS = new HashSet<>(); public static final ResourceLocation NAME = new ResourceLocation(NaturesAura.MOD_ID, "ore_spawn"); private int amount; @@ -50,7 +50,7 @@ public class OreSpawnEffect implements IDrainSpotEffect { } @Override - public int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { + public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { if (!this.calcValues(player.world, pos, spot)) return -1; if (player.getDistanceSq(pos) > this.dist * this.dist) @@ -97,7 +97,7 @@ public class OreSpawnEffect implements IDrainSpotEffect { BlockPos orePos = new BlockPos(x, y, z); if (orePos.distanceSq(powderPos.x, powderPos.y, powderPos.z) <= range * range && orePos.distanceSq(pos) <= this.dist * this.dist && world.isBlockLoaded(orePos)) { - IBlockState state = world.getBlockState(orePos); + BlockState state = world.getBlockState(orePos); Block block = state.getBlock(); if (block != requiredBlock) continue; @@ -113,8 +113,8 @@ public class OreSpawnEffect implements IDrainSpotEffect { if (toPlace == Blocks.AIR) continue; - FakePlayer player = FakePlayerFactory.getMinecraft((WorldServer) world); - IBlockState stateToPlace = toPlace.getStateForPlacement(world, pos, EnumFacing.UP, 0, 0, 0, stack.getMetadata(), player, EnumHand.MAIN_HAND); + FakePlayer player = FakePlayerFactory.getMinecraft((ServerWorld) world); + BlockState stateToPlace = toPlace.getStateForPlacement(world, pos, EnumFacing.UP, 0, 0, 0, stack.getMetadata(), player, EnumHand.MAIN_HAND); if (SPAWN_EXCEPTIONS.contains(stateToPlace)) continue; 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 7dc190c5..ea5b3f82 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/PlantBoostEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/PlantBoostEffect.java @@ -10,10 +10,10 @@ import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; import net.minecraft.block.Block; import net.minecraft.block.IGrowable; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.block.Blocks; +import net.minecraft.item.Items; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; @@ -42,7 +42,7 @@ public class PlantBoostEffect implements IDrainSpotEffect { } @Override - public int isActiveHere(EntityPlayer player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { + public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { if (!this.calcValues(player.world, pos, spot)) return -1; if (player.getDistanceSq(pos) > this.dist * this.dist) @@ -69,7 +69,7 @@ public class PlantBoostEffect implements IDrainSpotEffect { if (NaturesAuraAPI.instance().isEffectPowderActive(world, plantPos, NAME)) continue; - IBlockState state = world.getBlockState(plantPos); + BlockState state = world.getBlockState(plantPos); Block block = state.getBlock(); if (block instanceof IGrowable && block != Blocks.TALLGRASS && block != Blocks.GRASS && block != Blocks.DOUBLE_PLANT) { diff --git a/src/main/java/de/ellpeck/naturesaura/chunk/effect/SpreadEffect.java b/src/main/java/de/ellpeck/naturesaura/chunk/effect/SpreadEffect.java index 28cce373..591562fc 100644 --- a/src/main/java/de/ellpeck/naturesaura/chunk/effect/SpreadEffect.java +++ b/src/main/java/de/ellpeck/naturesaura/chunk/effect/SpreadEffect.java @@ -4,7 +4,7 @@ import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect; import de.ellpeck.naturesaura.api.aura.type.IAuraType; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -23,7 +23,7 @@ public class SpreadEffect implements IDrainSpotEffect { while (toMove > 0) { BlockPos bestOffset = null; int bestAmount = drain ? Integer.MAX_VALUE : Integer.MIN_VALUE; - for (EnumFacing facing : EnumFacing.VALUES) { + for (Direction facing : Direction.VALUES) { BlockPos offset = pos.offset(facing, 15); if (world.isBlockLoaded(offset) && offset.getY() >= 0 && offset.getY() <= world.getHeight()) { int amount = IAuraChunk.getAuraInArea(world, offset, 14); diff --git a/src/main/java/de/ellpeck/naturesaura/commands/CommandAura.java b/src/main/java/de/ellpeck/naturesaura/commands/CommandAura.java index c9433af6..fd1be78e 100644 --- a/src/main/java/de/ellpeck/naturesaura/commands/CommandAura.java +++ b/src/main/java/de/ellpeck/naturesaura/commands/CommandAura.java @@ -5,7 +5,7 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import net.minecraft.command.*; import net.minecraft.server.MinecraftServer; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.StringTextComponent; import net.minecraft.world.World; import javax.annotation.Nullable; @@ -38,7 +38,7 @@ public class CommandAura extends CommandBase { BlockPos spot = IAuraChunk.getLowestSpot(world, pos, range, pos); amount -= IAuraChunk.getAuraChunk(world, spot).storeAura(spot, amount); } - sender.sendMessage(new TextComponentString("Stored Aura successfully")); + sender.sendMessage(new StringTextComponent("Stored Aura successfully")); } else if ("drain".equals(action)) { int amount = parse(args, 1, -1); int range = parse(args, 2, 35); @@ -46,7 +46,7 @@ public class CommandAura extends CommandBase { BlockPos spot = IAuraChunk.getHighestSpot(world, pos, range, pos); amount -= IAuraChunk.getAuraChunk(world, spot).drainAura(spot, amount); } - sender.sendMessage(new TextComponentString("Drained Aura successfully")); + sender.sendMessage(new StringTextComponent("Drained Aura successfully")); } else if ("reset".equals(action)) { int range = parse(args, 1, -1); IAuraChunk.getSpotsInArea(world, pos, range, (spot, amount) -> { @@ -56,7 +56,7 @@ public class CommandAura extends CommandBase { else chunk.storeAura(spot, -amount); }); - sender.sendMessage(new TextComponentString("Reset Aura successfully")); + sender.sendMessage(new StringTextComponent("Reset Aura successfully")); } else { throw new SyntaxErrorException("Invalid action " + action); } diff --git a/src/main/java/de/ellpeck/naturesaura/compat/BaublesCompat.java b/src/main/java/de/ellpeck/naturesaura/compat/BaublesCompat.java index 101f6ff4..654a02fd 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/BaublesCompat.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/BaublesCompat.java @@ -5,15 +5,15 @@ import baubles.api.IBauble; import baubles.api.cap.BaublesCapabilities; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.items.ModItems; -import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.LivingEntity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumFacing; +import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.event.AttachCapabilitiesEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -37,13 +37,13 @@ public class BaublesCompat { private void addCap(AttachCapabilitiesEvent event, IBauble type) { event.addCapability(new ResourceLocation(NaturesAura.MOD_ID, "bauble"), new ICapabilityProvider() { @Override - public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public boolean hasCapability(@Nonnull Capability capability, @Nullable Direction facing) { return capability == BaublesCapabilities.CAPABILITY_ITEM_BAUBLE; } @Nullable @Override - public T getCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public T getCapability(@Nonnull Capability capability, @Nullable Direction facing) { return capability == BaublesCapabilities.CAPABILITY_ITEM_BAUBLE ? (T) type : null; } }); @@ -65,12 +65,12 @@ public class BaublesCompat { } @Override - public boolean willAutoSync(ItemStack itemstack, EntityLivingBase player) { + public boolean willAutoSync(ItemStack itemstack, LivingEntity player) { return this.sync; } @Override - public void onWornTick(ItemStack stack, EntityLivingBase player) { + public void onWornTick(ItemStack stack, LivingEntity player) { stack.getItem().onUpdate(stack, player.world, player, -1, false); } } diff --git a/src/main/java/de/ellpeck/naturesaura/compat/jei/animal/AnimalSpawnerWrapper.java b/src/main/java/de/ellpeck/naturesaura/compat/jei/animal/AnimalSpawnerWrapper.java index 1df30ecc..51fb25e7 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/jei/animal/AnimalSpawnerWrapper.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/jei/animal/AnimalSpawnerWrapper.java @@ -6,11 +6,11 @@ import mezz.jei.api.ingredients.IIngredients; import mezz.jei.api.ingredients.VanillaTypes; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.GlStateManager; +import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.Entity; -import net.minecraft.init.Items; +import net.minecraft.item.Items; import net.minecraft.item.ItemMonsterPlacer; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; diff --git a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/PatchouliCompat.java b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/PatchouliCompat.java index 6e139b81..d236ad24 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/PatchouliCompat.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/PatchouliCompat.java @@ -7,16 +7,16 @@ import de.ellpeck.naturesaura.compat.Compat; import de.ellpeck.naturesaura.events.ClientEvents; import de.ellpeck.naturesaura.renderers.SupporterFancyHandler; import de.ellpeck.naturesaura.renderers.SupporterFancyHandler.FancyInfo; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.gui.AbstractGui; +import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import vazkii.patchouli.api.BookDrawScreenEvent; import vazkii.patchouli.api.PatchouliAPI; @@ -39,7 +39,7 @@ public final class PatchouliCompat { } @SubscribeEvent - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void onBookDraw(BookDrawScreenEvent event) { if (event.book == null || !event.book.equals(BOOK)) return; @@ -51,7 +51,7 @@ public final class PatchouliCompat { RenderHelper.disableStandardItemLighting(); GlStateManager.color(1, 1, 1, 1); event.gui.mc.getTextureManager().bindTexture(ClientEvents.BOOK_GUI); - Gui.drawModalRectWithCustomSizedTexture(x, y, 469, 0, 43, 42, 512, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(x, y, 469, 0, 43, 42, 512, 256); if (event.mouseX >= x && event.mouseY >= y && event.mouseX < x + 43 && event.mouseY < y + 42) GuiUtils.drawHoveringText( @@ -69,15 +69,15 @@ public final class PatchouliCompat { GlStateManager.color(1, 1, 1, 1); event.gui.mc.getTextureManager().bindTexture(ClientEvents.BOOK_GUI); - Gui.drawModalRectWithCustomSizedTexture(x, y, 496, 44, 16, 18, 512, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(x, y, 496, 44, 16, 18, 512, 256); if (info.tier == 1) { - Gui.drawModalRectWithCustomSizedTexture(x, y, 496 - 16, 44, 16, 18, 512, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(x, y, 496 - 16, 44, 16, 18, 512, 256); } else { float r = ((info.color >> 16) & 255) / 255F; float g = ((info.color >> 8) & 255) / 255F; float b = (info.color & 255) / 255F; GlStateManager.color(r, g, b); - Gui.drawModalRectWithCustomSizedTexture(x, y, 496 - 32, 44, 16, 18, 512, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(x, y, 496 - 32, 44, 16, 18, 512, 256); } if (event.mouseX >= x && event.mouseY >= y && event.mouseX < x + 16 && event.mouseY < y + 18) diff --git a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAnimalSpawner.java b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAnimalSpawner.java index ebac89ae..10188f25 100644 --- a/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAnimalSpawner.java +++ b/src/main/java/de/ellpeck/naturesaura/compat/patchouli/ProcessorAnimalSpawner.java @@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.compat.patchouli; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.recipes.AnimalSpawnerRecipe; import net.minecraft.client.resources.I18n; -import net.minecraft.init.Items; +import net.minecraft.item.Items; import net.minecraft.item.ItemMonsterPlacer; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.common.registry.EntityEntry; diff --git a/src/main/java/de/ellpeck/naturesaura/entities/EntityEffectInhibitor.java b/src/main/java/de/ellpeck/naturesaura/entities/EntityEffectInhibitor.java index d3641926..944c0b17 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/EntityEffectInhibitor.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/EntityEffectInhibitor.java @@ -11,7 +11,7 @@ import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.misc.WorldData; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.network.datasync.DataParameter; import net.minecraft.network.datasync.DataSerializers; import net.minecraft.network.datasync.EntityDataManager; @@ -23,8 +23,8 @@ import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import java.util.List; @@ -34,7 +34,7 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable { private static final DataParameter COLOR = EntityDataManager.createKey(EntityEffectInhibitor.class, DataSerializers.VARINT); private static final DataParameter AMOUNT = EntityDataManager.createKey(EntityEffectInhibitor.class, DataSerializers.VARINT); - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int renderTicks; public EntityEffectInhibitor(World worldIn) { @@ -106,14 +106,14 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable { } @Override - protected void readEntityFromNBT(NBTTagCompound compound) { + protected void readEntityFromNBT(CompoundNBT compound) { this.setInhibitedEffect(new ResourceLocation(compound.getString("effect"))); this.setColor(compound.getInteger("color")); this.setAmount(compound.hasKey("amount") ? compound.getInteger("amount") : 24); } @Override - protected void writeEntityToNBT(NBTTagCompound compound) { + protected void writeEntityToNBT(CompoundNBT compound) { compound.setString("effect", this.getInhibitedEffect().toString()); compound.setInteger("color", this.getColor()); compound.setInteger("amount", this.getAmount()); @@ -184,13 +184,13 @@ public class EntityEffectInhibitor extends Entity implements IVisualizable { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { return Helper.aabb(this.getPositionVector()).grow(this.getAmount()); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getVisualizationColor(World world, BlockPos pos) { return this.getColor(); } diff --git a/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java b/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java index 967c9e2e..e92d882e 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/EntityMoverMinecart.java @@ -4,15 +4,15 @@ import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketParticles; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; -import net.minecraft.entity.item.EntityMinecart; -import net.minecraft.init.Blocks; +import net.minecraft.entity.item.minecart.AbstractMinecartEntity; +import net.minecraft.block.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.nbt.NBTTagLong; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; +import net.minecraft.nbt.LongNBT; import net.minecraft.util.DamageSource; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; @@ -25,7 +25,7 @@ import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; -public class EntityMoverMinecart extends EntityMinecart { +public class EntityMoverMinecart extends AbstractMinecartEntity { private final List spotOffsets = new ArrayList<>(); private BlockPos lastPosition = BlockPos.ORIGIN; @@ -103,27 +103,27 @@ public class EntityMoverMinecart extends EntityMinecart { } @Override - protected void writeEntityToNBT(NBTTagCompound compound) { + protected void writeEntityToNBT(CompoundNBT compound) { super.writeEntityToNBT(compound); compound.setBoolean("active", this.isActive); compound.setLong("last_pos", this.lastPosition.toLong()); - NBTTagList list = new NBTTagList(); + ListNBT list = new ListNBT(); for (BlockPos offset : this.spotOffsets) - list.appendTag(new NBTTagLong(offset.toLong())); + list.appendTag(new LongNBT(offset.toLong())); compound.setTag("offsets", list); } @Override - protected void readEntityFromNBT(NBTTagCompound compound) { + protected void readEntityFromNBT(CompoundNBT compound) { super.readEntityFromNBT(compound); this.isActive = compound.getBoolean("active"); this.lastPosition = BlockPos.fromLong(compound.getLong("last_pos")); this.spotOffsets.clear(); - NBTTagList list = compound.getTagList("offsets", Constants.NBT.TAG_LONG); + ListNBT list = compound.getTagList("offsets", Constants.NBT.TAG_LONG); for (NBTBase base : list) - this.spotOffsets.add(BlockPos.fromLong(((NBTTagLong) base).getLong())); + this.spotOffsets.add(BlockPos.fromLong(((LongNBT) base).getLong())); } @Nullable @@ -139,7 +139,7 @@ public class EntityMoverMinecart extends EntityMinecart { } @Override - public IBlockState getDisplayTile() { + public BlockState getDisplayTile() { return Blocks.STONE.getDefaultState(); } 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 ca943e81..bd2b046e 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/render/RenderEffectInhibitor.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/render/RenderEffectInhibitor.java @@ -4,32 +4,32 @@ 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.GlStateManager; -import net.minecraft.client.renderer.entity.Render; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.texture.TextureMap; +import com.mojang.blaze3d.platform.GlStateManager; +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.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import javax.annotation.Nullable; import java.util.HashMap; import java.util.Map; -@SideOnly(Side.CLIENT) -public class RenderEffectInhibitor extends Render { +@OnlyIn(Dist.CLIENT) +public class RenderEffectInhibitor extends EntityRenderer { private final Map items = new HashMap<>(); - public RenderEffectInhibitor(RenderManager renderManager) { + public RenderEffectInhibitor(EntityRendererManager renderManager) { super(renderManager); } @Nullable @Override protected ResourceLocation getEntityTexture(EntityEffectInhibitor entity) { - return TextureMap.LOCATION_BLOCKS_TEXTURE; + return AtlasTexture.LOCATION_BLOCKS_TEXTURE; } @Override 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 51345d57..7c2f2df0 100644 --- a/src/main/java/de/ellpeck/naturesaura/entities/render/RenderMoverMinecart.java +++ b/src/main/java/de/ellpeck/naturesaura/entities/render/RenderMoverMinecart.java @@ -2,25 +2,25 @@ package de.ellpeck.naturesaura.entities.render; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.entities.EntityMoverMinecart; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.model.ModelBase; import net.minecraft.client.model.ModelRenderer; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.client.renderer.entity.RenderManager; -import net.minecraft.client.renderer.entity.RenderMinecart; +import com.mojang.blaze3d.platform.GlStateManager; +import net.minecraft.client.renderer.entity.EntityRendererManager; +import net.minecraft.client.renderer.entity.MinecartRenderer; import net.minecraft.util.ResourceLocation; -public class RenderMoverMinecart extends RenderMinecart { +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(); - public RenderMoverMinecart(RenderManager renderManagerIn) { + public RenderMoverMinecart(EntityRendererManager renderManagerIn) { super(renderManagerIn); } @Override - protected void renderCartContents(EntityMoverMinecart cart, float partialTicks, IBlockState state) { + protected void renderCartContents(EntityMoverMinecart cart, float partialTicks, BlockState state) { GlStateManager.pushMatrix(); GlStateManager.translate(0, 22 / 16F, 0); GlStateManager.rotate(180, 1, 0, 0); diff --git a/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java b/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java index 8d054563..77688e89 100644 --- a/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java +++ b/src/main/java/de/ellpeck/naturesaura/events/ClientEvents.java @@ -21,18 +21,18 @@ import de.ellpeck.naturesaura.items.ModItems; import de.ellpeck.naturesaura.particles.ParticleHandler; import net.minecraft.block.Block; import net.minecraft.block.IGrowable; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.gui.GuiChat; -import net.minecraft.client.gui.GuiScreen; +import net.minecraft.client.gui.AbstractGui; +import net.minecraft.client.gui.screen.ChatScreen; +import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.ScaledResolution; -import net.minecraft.client.renderer.GlStateManager; +import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.renderer.OpenGlHelper; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.resources.I18n; import net.minecraft.entity.Entity; -import net.minecraft.init.Items; +import net.minecraft.item.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.ResourceLocation; @@ -42,7 +42,7 @@ import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeColorHelper; +import net.minecraft.world.biome.BiomeColors; import net.minecraftforge.client.event.GuiScreenEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType; @@ -50,11 +50,11 @@ import net.minecraftforge.client.event.RenderWorldLastEvent; import net.minecraftforge.common.IPlantable; import net.minecraftforge.energy.EnergyStorage; import net.minecraftforge.fml.client.config.GuiUtils; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.ClientTickEvent; import net.minecraftforge.fml.common.gameevent.TickEvent.Phase; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.items.IItemHandler; import org.apache.commons.lang3.mutable.MutableInt; import org.lwjgl.opengl.GL11; @@ -64,7 +64,7 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class ClientEvents { public static final ResourceLocation OVERLAYS = new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/overlays.png"); @@ -130,7 +130,7 @@ public class ClientEvents { 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; BlockPos pos = new BlockPos(x, mc.world.getHeight(x, z) - 1, z); - IBlockState state = mc.world.getBlockState(pos); + BlockState state = mc.world.getBlockState(pos); Block block = state.getBlock(); if (block instanceof IGrowable || block instanceof IPlantable || block.isLeaves(state, mc.world, pos)) { int excess = IAuraChunk.triangulateAuraInArea(mc.world, pos, 45) - IAuraChunk.DEFAULT_AURA; @@ -144,7 +144,7 @@ public class ClientEvents { mc.world.rand.nextGaussian() * 0.01F, mc.world.rand.nextFloat() * 0.025F, mc.world.rand.nextGaussian() * 0.01F, - BiomeColorHelper.getFoliageColorAtPos(mc.world, pos), + BiomeColors.getFoliageColorAtPos(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); @@ -265,7 +265,7 @@ public class ClientEvents { for (BlockPos pos : ItemRangeVisualizer.VISUALIZED_BLOCKS.get(dim)) { if (!mc.world.isBlockLoaded(pos)) continue; - IBlockState state = mc.world.getBlockState(pos); + BlockState state = mc.world.getBlockState(pos); Block block = state.getBlock(); if (!(block instanceof IVisualizable)) continue; @@ -315,9 +315,9 @@ public class ClientEvents { GlStateManager.color((color >> 16 & 255) / 255F, (color >> 8 & 255) / 255F, (color & 255) / 255F); mc.getTextureManager().bindTexture(OVERLAYS); if (width < 80) - Gui.drawModalRectWithCustomSizedTexture(x + width, y, width, 0, 80 - width, 6, 256, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(x + width, y, width, 0, 80 - width, 6, 256, 256); if (width > 0) - Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 6, width, 6, 256, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(x, y, 0, 6, width, 6, 256, 256); float scale = 0.75F; GlStateManager.scale(scale, scale, scale); @@ -333,7 +333,7 @@ public class ClientEvents { mc.getTextureManager().bindTexture(OVERLAYS); int conf = ModConfig.client.auraBarLocation; - if (!mc.gameSettings.showDebugInfo && (conf != 2 || !(mc.currentScreen instanceof GuiChat))) { + if (!mc.gameSettings.showDebugInfo && (conf != 2 || !(mc.currentScreen instanceof ChatScreen))) { GlStateManager.color(83 / 255F, 160 / 255F, 8 / 255F); int totalAmount = IAuraChunk.triangulateAuraInArea(mc.world, mc.player.getPosition(), 35); @@ -350,9 +350,9 @@ public class ClientEvents { int tHeight = MathHelper.ceil(MathHelper.clamp(totalPercentage, 0F, 1F) * 50); int y = !heldOcular.isEmpty() && totalPercentage > 1F ? startY + 26 : startY; if (tHeight < 50) - Gui.drawModalRectWithCustomSizedTexture(startX, y, 6, 12, 6, 50 - tHeight, 256, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(startX, y, 6, 12, 6, 50 - tHeight, 256, 256); if (tHeight > 0) - Gui.drawModalRectWithCustomSizedTexture(startX, y + 50 - tHeight, 0, 12 + 50 - tHeight, 6, tHeight, 256, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(startX, y + 50 - tHeight, 0, 12 + 50 - tHeight, 6, tHeight, 256, 256); if (!heldOcular.isEmpty()) { GlStateManager.color(160 / 255F, 83 / 255F, 8 / 255F); @@ -360,14 +360,14 @@ public class ClientEvents { int topHeight = MathHelper.ceil(MathHelper.clamp((totalPercentage - 1F) * 2F, 0F, 1F) * 25); if (topHeight > 0) { if (topHeight < 25) - Gui.drawModalRectWithCustomSizedTexture(startX, startY, 18, 12, 6, 25 - topHeight, 256, 256); - Gui.drawModalRectWithCustomSizedTexture(startX, startY + 25 - topHeight, 12, 12 + 25 - topHeight, 6, topHeight, 256, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(startX, startY, 18, 12, 6, 25 - topHeight, 256, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(startX, startY + 25 - topHeight, 12, 12 + 25 - topHeight, 6, topHeight, 256, 256); } int bottomHeight = MathHelper.floor(MathHelper.clamp((totalPercentage + 1F) * 2F - 1F, 0F, 1F) * 25); if (bottomHeight < 25) { - Gui.drawModalRectWithCustomSizedTexture(startX, startY + 51, 18, 12, 6, 25 - bottomHeight, 256, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(startX, startY + 51, 18, 12, 6, 25 - bottomHeight, 256, 256); if (bottomHeight > 0) - Gui.drawModalRectWithCustomSizedTexture(startX, startY + 51 + 25 - bottomHeight, 12, 12 + 25 - bottomHeight, 6, bottomHeight, 256, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(startX, startY + 51 + 25 - bottomHeight, 12, 12 + 25 - bottomHeight, 6, bottomHeight, 256, 256); } } @@ -396,7 +396,7 @@ public class ClientEvents { if (effect.getSecond()) { GlStateManager.disableDepth(); mc.getTextureManager().bindTexture(OVERLAYS); - Gui.drawModalRectWithCustomSizedTexture(theX, theY, 240, 0, 16, 16, 256, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(theX, theY, 240, 0, 16, 16, 256, 256); GlStateManager.enableDepth(); } stackY += 8; @@ -412,7 +412,7 @@ public class ClientEvents { if (tile != null && tile.hasCapability(NaturesAuraAPI.capAuraContainer, null)) { IAuraContainer container = tile.getCapability(NaturesAuraAPI.capAuraContainer, null); - IBlockState state = mc.world.getBlockState(pos); + BlockState state = mc.world.getBlockState(pos); ItemStack blockStack = state.getBlock().getPickBlock(state, mc.objectMouseOver, mc.world, pos, mc.player); this.drawContainerInfo(container.getStoredAura(), container.getMaxAura(), container.getAuraColor(), mc, res, 35, blockStack.getDisplayName(), null); @@ -448,7 +448,7 @@ public class ClientEvents { mc.getTextureManager().bindTexture(OVERLAYS); int u = chute.isBlacklist ? 240 : 224; GlStateManager.disableDepth(); - Gui.drawModalRectWithCustomSizedTexture(x - 18, y - 18, u, 0, 16, 16, 256, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(x - 18, y - 18, u, 0, 16, 16, 256, 256); GlStateManager.enableDepth(); } } @@ -471,9 +471,9 @@ public class ClientEvents { mc.getTextureManager().bindTexture(OVERLAYS); if (width < 80) - Gui.drawModalRectWithCustomSizedTexture(x + width, y, width, 0, 80 - width, 6, 256, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(x + width, y, width, 0, 80 - width, 6, 256, 256); if (width > 0) - Gui.drawModalRectWithCustomSizedTexture(x, y, 0, 6, width, 6, 256, 256); + AbstractGui.drawModalRectWithCustomSizedTexture(x, y, 0, 6, width, 6, 256, 256); mc.fontRenderer.drawString(name, x + 40 - mc.fontRenderer.getStringWidth(name) / 2F, y - 9, color, true); diff --git a/src/main/java/de/ellpeck/naturesaura/events/CommonEvents.java b/src/main/java/de/ellpeck/naturesaura/events/CommonEvents.java index 0898288a..b87493ca 100644 --- a/src/main/java/de/ellpeck/naturesaura/events/CommonEvents.java +++ b/src/main/java/de/ellpeck/naturesaura/events/CommonEvents.java @@ -11,14 +11,14 @@ import de.ellpeck.naturesaura.misc.WorldData; import de.ellpeck.naturesaura.packet.PacketHandler; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; -import net.minecraft.world.WorldServer; +import net.minecraft.world.ServerWorld; import net.minecraft.world.chunk.Chunk; import net.minecraftforge.common.config.Config; import net.minecraftforge.common.config.ConfigManager; import net.minecraftforge.event.AttachCapabilitiesEvent; import net.minecraftforge.event.world.ChunkWatchEvent; import net.minecraftforge.fml.client.event.ConfigChangedEvent.OnConfigChangedEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; import java.util.Iterator; @@ -41,7 +41,7 @@ public class CommonEvents { if (!event.world.isRemote && event.phase == TickEvent.Phase.END) { if (event.world.getTotalWorldTime() % 20 == 0) { event.world.profiler.func_194340_a(() -> NaturesAura.MOD_ID + ":onWorldTick"); - Iterator chunks = event.world.getPersistentChunkIterable(((WorldServer) event.world).getPlayerChunkMap().getChunkIterator()); + Iterator chunks = event.world.getPersistentChunkIterable(((ServerWorld) event.world).getPlayerChunkMap().getChunkIterator()); while (chunks.hasNext()) { Chunk chunk = chunks.next(); if (chunk.hasCapability(NaturesAuraAPI.capAuraChunk, null)) { diff --git a/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java b/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java index cd710baa..2563374e 100644 --- a/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java +++ b/src/main/java/de/ellpeck/naturesaura/gen/WorldGenAncientTree.java @@ -2,20 +2,20 @@ package de.ellpeck.naturesaura.gen; import de.ellpeck.naturesaura.blocks.ModBlocks; import net.minecraft.block.Block; -import net.minecraft.block.BlockLeaves; -import net.minecraft.block.BlockLog; +import net.minecraft.block.LeavesBlock; +import net.minecraft.block.LogBlock; import net.minecraft.block.BlockLog.EnumAxis; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; +import net.minecraft.block.BlockState; +import net.minecraft.block.Blocks; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; -import net.minecraft.world.gen.feature.WorldGenAbstractTree; +import net.minecraft.world.gen.feature.AbstractTreeFeature; import java.util.Random; -public class WorldGenAncientTree extends WorldGenAbstractTree { +public class WorldGenAncientTree extends AbstractTreeFeature { public WorldGenAncientTree(boolean notify) { super(notify); @@ -50,13 +50,13 @@ public class WorldGenAncientTree extends WorldGenAbstractTree { BlockPos goal = pos.add(x, i, z); if (this.isReplaceable(world, goal)) { this.setBlockAndNotifyAdequately(world, goal, - ModBlocks.ANCIENT_LOG.getDefaultState().withProperty(BlockLog.LOG_AXIS, EnumAxis.Y)); + ModBlocks.ANCIENT_LOG.getDefaultState().withProperty(LogBlock.LOG_AXIS, EnumAxis.Y)); } } } } this.makeLeaves(world, trunkTop.up(rand.nextInt(2) - 1), - ModBlocks.ANCIENT_LEAVES.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false), rand.nextInt(2) + 3, rand); + ModBlocks.ANCIENT_LEAVES.getDefaultState().withProperty(LeavesBlock.CHECK_DECAY, false), rand.nextInt(2) + 3, rand); //Branches int branchAmount = rand.nextInt(3) + 4; @@ -69,7 +69,7 @@ public class WorldGenAncientTree extends WorldGenAbstractTree { BlockPos goal = trunkTop.add(x, rand.nextInt(3) + 1, z); this.makeBranch(world, trunkTop, goal, ModBlocks.ANCIENT_LOG.getDefaultState(), true); this.makeLeaves(world, goal, - ModBlocks.ANCIENT_LEAVES.getDefaultState().withProperty(BlockLeaves.CHECK_DECAY, false), rand.nextInt(2) + 2, rand); + ModBlocks.ANCIENT_LEAVES.getDefaultState().withProperty(LeavesBlock.CHECK_DECAY, false), rand.nextInt(2) + 2, rand); } return true; @@ -85,7 +85,7 @@ public class WorldGenAncientTree extends WorldGenAbstractTree { } } - private void makeBranch(World world, BlockPos first, BlockPos second, IBlockState state, boolean hasAxis) { + private void makeBranch(World world, BlockPos first, BlockPos second, BlockState state, boolean hasAxis) { BlockPos pos = second.add(-first.getX(), -first.getY(), -first.getZ()); int length = this.getHighestCoord(pos); float stepX = (float) pos.getX() / (float) length; @@ -97,7 +97,7 @@ public class WorldGenAncientTree extends WorldGenAbstractTree { if (this.isReplaceable(world, goal)) { if (hasAxis) { EnumAxis axis = this.getLogAxis(first, goal); - this.setBlockAndNotifyAdequately(world, goal, state.withProperty(BlockLog.LOG_AXIS, axis)); + this.setBlockAndNotifyAdequately(world, goal, state.withProperty(LogBlock.LOG_AXIS, axis)); } else { this.setBlockAndNotifyAdequately(world, goal, state); } @@ -105,7 +105,7 @@ public class WorldGenAncientTree extends WorldGenAbstractTree { } } - private void makeLeaves(World world, BlockPos pos, IBlockState state, int radius, Random rand) { + private void makeLeaves(World world, BlockPos pos, BlockState state, int radius, Random rand) { for (int x = -radius; x <= radius; x++) { for (int y = -radius; y <= radius; y++) { for (int z = -radius; z <= radius; z++) { @@ -113,7 +113,7 @@ public class WorldGenAncientTree extends WorldGenAbstractTree { if (pos.distanceSq(goal) <= radius * radius + rand.nextInt(3) - 1) { if (this.isReplaceable(world, goal)) { Block block = world.getBlockState(goal).getBlock(); - if (!(block instanceof BlockLog) && block != Blocks.DIRT && block != Blocks.GRASS) + if (!(block instanceof LogBlock) && block != Blocks.DIRT && block != Blocks.GRASS) this.setBlockAndNotifyAdequately(world, goal, state); } } diff --git a/src/main/java/de/ellpeck/naturesaura/gui/ContainerEnderCrate.java b/src/main/java/de/ellpeck/naturesaura/gui/ContainerEnderCrate.java index a8192fc8..d07cc25d 100644 --- a/src/main/java/de/ellpeck/naturesaura/gui/ContainerEnderCrate.java +++ b/src/main/java/de/ellpeck/naturesaura/gui/ContainerEnderCrate.java @@ -1,15 +1,15 @@ package de.ellpeck.naturesaura.gui; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.Container; -import net.minecraft.inventory.Slot; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.container.Container; +import net.minecraft.inventory.container.Slot; import net.minecraft.item.ItemStack; import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.SlotItemHandler; public class ContainerEnderCrate extends Container { - public ContainerEnderCrate(EntityPlayer player, IItemHandler handler) { + public ContainerEnderCrate(PlayerEntity player, IItemHandler handler) { int i = (3 - 4) * 18; for (int j = 0; j < 3; ++j) for (int k = 0; k < 9; ++k) @@ -22,12 +22,12 @@ public class ContainerEnderCrate extends Container { } @Override - public boolean canInteractWith(EntityPlayer playerIn) { + public boolean canInteractWith(PlayerEntity playerIn) { return true; } @Override - public ItemStack transferStackInSlot(EntityPlayer playerIn, int index) { + public ItemStack transferStackInSlot(PlayerEntity playerIn, int index) { ItemStack itemstack = ItemStack.EMPTY; Slot slot = this.inventorySlots.get(index); diff --git a/src/main/java/de/ellpeck/naturesaura/gui/GuiEnderCrate.java b/src/main/java/de/ellpeck/naturesaura/gui/GuiEnderCrate.java index 0e28cdcc..e1816313 100644 --- a/src/main/java/de/ellpeck/naturesaura/gui/GuiEnderCrate.java +++ b/src/main/java/de/ellpeck/naturesaura/gui/GuiEnderCrate.java @@ -1,24 +1,24 @@ package de.ellpeck.naturesaura.gui; import de.ellpeck.naturesaura.NaturesAura; -import net.minecraft.client.gui.inventory.GuiContainer; -import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.gui.screen.inventory.ContainerScreen; +import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.resources.I18n; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.util.ResourceLocation; import net.minecraft.util.text.TextFormatting; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.items.IItemHandler; -@SideOnly(Side.CLIENT) -public class GuiEnderCrate extends GuiContainer { +@OnlyIn(Dist.CLIENT) +public class GuiEnderCrate extends ContainerScreen { private static final ResourceLocation CHEST_GUI_TEXTURE = new ResourceLocation("textures/gui/container/generic_54.png"); - private final EntityPlayer player; + private final PlayerEntity player; private final String nameKey; private final String name; - public GuiEnderCrate(EntityPlayer player, IItemHandler handler, String nameKey, String name) { + public GuiEnderCrate(PlayerEntity player, IItemHandler handler, String nameKey, String name) { super(new ContainerEnderCrate(player, handler)); this.player = player; this.nameKey = nameKey; diff --git a/src/main/java/de/ellpeck/naturesaura/gui/GuiHandler.java b/src/main/java/de/ellpeck/naturesaura/gui/GuiHandler.java index 88542c7c..43a86bbb 100644 --- a/src/main/java/de/ellpeck/naturesaura/gui/GuiHandler.java +++ b/src/main/java/de/ellpeck/naturesaura/gui/GuiHandler.java @@ -5,7 +5,7 @@ import de.ellpeck.naturesaura.api.misc.IWorldData; import de.ellpeck.naturesaura.blocks.BlockEnderCrate; import de.ellpeck.naturesaura.blocks.tiles.TileEntityEnderCrate; import de.ellpeck.naturesaura.items.ModItems; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.math.BlockPos; @@ -23,7 +23,7 @@ public class GuiHandler implements IGuiHandler { @Nullable @Override - public Object getServerGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { + public Object getServerGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) { if (id == 0) { TileEntity tile = world.getTileEntity(new BlockPos(x, y, z)); if (tile instanceof TileEntityEnderCrate) { @@ -44,7 +44,7 @@ public class GuiHandler implements IGuiHandler { @Nullable @Override - public Object getClientGuiElement(int id, EntityPlayer player, World world, int x, int y, int z) { + public Object getClientGuiElement(int id, PlayerEntity player, World world, int x, int y, int z) { if (id == 0) { TileEntity tile = world.getTileEntity(new BlockPos(x, y, z)); if (tile instanceof TileEntityEnderCrate) { diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemAuraBottle.java b/src/main/java/de/ellpeck/naturesaura/items/ItemAuraBottle.java index 68c843d4..6a837edf 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemAuraBottle.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemAuraBottle.java @@ -4,29 +4,29 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.reg.IColorProvidingItem; -import net.minecraft.block.BlockDispenser; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.DispenserBlock; +import net.minecraft.block.BlockState; import net.minecraft.client.renderer.color.IItemColor; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.dispenser.BehaviorDefaultDispenseItem; +import net.minecraft.item.ItemGroup; +import net.minecraft.dispenser.DefaultDispenseItemBehavior; import net.minecraft.dispenser.IBlockSource; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.SoundEvents; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.SoundEvents; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.Direction; import net.minecraft.util.NonNullList; import net.minecraft.util.ResourceLocation; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.RayTraceResult; -import net.minecraft.util.text.translation.I18n; +import net.minecraft.client.resources.I18n; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.eventbus.api.SubscribeEvent; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem { @@ -34,14 +34,14 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem { super("aura_bottle"); MinecraftForge.EVENT_BUS.register(this); - BlockDispenser.DISPENSE_BEHAVIOR_REGISTRY.putObject(ModItems.BOTTLE_TWO, new BehaviorDefaultDispenseItem() { + DispenserBlock.DISPENSE_BEHAVIOR_REGISTRY.putObject(ModItems.BOTTLE_TWO, new DefaultDispenseItemBehavior() { @Override protected ItemStack dispenseStack(IBlockSource source, ItemStack stack) { World world = source.getWorld(); - IBlockState state = source.getBlockState(); - EnumFacing facing = state.getValue(BlockDispenser.FACING); + BlockState state = source.getBlockState(); + Direction facing = state.getValue(DispenserBlock.FACING); BlockPos offset = source.getBlockPos().offset(facing); - IBlockState offsetState = world.getBlockState(offset); + BlockState offsetState = world.getBlockState(offset); ItemStack dispense = stack.splitStack(1); if (offsetState.getBlock().isAir(offsetState, world, offset)) { @@ -53,7 +53,7 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem { } } - doDispense(world, dispense, 6, facing, BlockDispenser.getDispensePosition(source)); + doDispense(world, dispense, 6, facing, DispenserBlock.getDispensePosition(source)); return stack; } }); @@ -64,7 +64,7 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem { ItemStack held = event.getItemStack(); if (held.isEmpty() || held.getItem() != ModItems.BOTTLE_TWO) return; - EntityPlayer player = event.getEntityPlayer(); + PlayerEntity player = event.getEntityPlayer(); RayTraceResult ray = this.rayTrace(player.world, player, true); if (ray != null && ray.typeOfHit == RayTraceResult.Type.BLOCK) return; @@ -88,7 +88,7 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem { } @Override - public void getSubItems(CreativeTabs tab, NonNullList items) { + public void getSubItems(ItemGroup tab, NonNullList items) { if (this.isInCreativeTab(tab)) { for (IAuraType type : NaturesAuraAPI.AURA_TYPES.values()) { ItemStack stack = new ItemStack(this); @@ -114,13 +114,13 @@ public class ItemAuraBottle extends ItemImpl implements IColorProvidingItem { public static ItemStack setType(ItemStack stack, IAuraType type) { if (!stack.hasTagCompound()) - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); stack.getTagCompound().setString("stored_type", type.getName().toString()); return stack; } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IItemColor getItemColor() { return (stack, tintIndex) -> tintIndex > 0 ? getType(stack).getColor() : 0xFFFFFF; } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemAuraCache.java b/src/main/java/de/ellpeck/naturesaura/items/ItemAuraCache.java index c8fd0f40..1ec20d47 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemAuraCache.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemAuraCache.java @@ -6,20 +6,20 @@ import de.ellpeck.naturesaura.api.aura.container.IAuraContainer; import de.ellpeck.naturesaura.api.aura.container.ItemAuraContainer; import de.ellpeck.naturesaura.api.aura.item.IAuraRecharge; import de.ellpeck.naturesaura.api.render.ITrinketItem; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.creativetab.CreativeTabs; +import com.mojang.blaze3d.platform.GlStateManager; +import net.minecraft.item.ItemGroup; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumFacing; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.Direction; import net.minecraft.util.NonNullList; import net.minecraft.world.World; import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import javax.annotation.Nonnull; import javax.annotation.Nullable; @@ -36,8 +36,8 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem { @Override public void onUpdate(ItemStack stackIn, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { - if (!worldIn.isRemote && entityIn instanceof EntityPlayer) { - EntityPlayer player = (EntityPlayer) entityIn; + if (!worldIn.isRemote && entityIn instanceof PlayerEntity) { + PlayerEntity player = (PlayerEntity) entityIn; if (player.isSneaking()) { IAuraContainer container = stackIn.getCapability(NaturesAuraAPI.capAuraContainer, null); if (container.getStoredAura() <= 0) @@ -55,7 +55,7 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem { } @Override - public void getSubItems(CreativeTabs tab, NonNullList items) { + public void getSubItems(ItemGroup tab, NonNullList items) { if (this.isInCreativeTab(tab)) { items.add(new ItemStack(this)); @@ -83,18 +83,18 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem { @Nullable @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) { + public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { return new ICapabilityProvider() { private final ItemAuraContainer container = new ItemAuraContainer(stack, null, ItemAuraCache.this.capacity); @Override - public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public boolean hasCapability(@Nonnull Capability capability, @Nullable Direction facing) { return capability == NaturesAuraAPI.capAuraContainer; } @Nullable @Override - public T getCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public T getCapability(@Nonnull Capability capability, @Nullable Direction facing) { if (capability == NaturesAuraAPI.capAuraContainer) { return (T) this.container; } else { @@ -105,11 +105,11 @@ public class ItemAuraCache extends ItemImpl implements ITrinketItem { } @Override - @SideOnly(Side.CLIENT) - public void render(ItemStack stack, EntityPlayer player, RenderType type, boolean isHolding) { + @OnlyIn(Dist.CLIENT) + public void render(ItemStack stack, PlayerEntity player, RenderType type, boolean isHolding) { if (type == RenderType.BODY && !isHolding) { - boolean chest = !player.inventory.armorInventory.get(EntityEquipmentSlot.CHEST.getIndex()).isEmpty(); - boolean legs = !player.inventory.armorInventory.get(EntityEquipmentSlot.LEGS.getIndex()).isEmpty(); + boolean chest = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty(); + boolean legs = !player.inventory.armorInventory.get(EquipmentSlotType.LEGS.getIndex()).isEmpty(); GlStateManager.translate(-0.15F, 0.65F, chest ? -0.195F : (legs ? -0.165F : -0.1475F)); GlStateManager.scale(0.25F, 0.25F, 0.25F); GlStateManager.rotate(180F, 1F, 0F, 0F); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemBirthSpirit.java b/src/main/java/de/ellpeck/naturesaura/items/ItemBirthSpirit.java index 54aeff6c..04f39118 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemBirthSpirit.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemBirthSpirit.java @@ -1,13 +1,13 @@ package de.ellpeck.naturesaura.items; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.item.ItemEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.BabyEntitySpawnEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; public class ItemBirthSpirit extends ItemGlowing { public ItemBirthSpirit() { @@ -17,7 +17,7 @@ public class ItemBirthSpirit extends ItemGlowing { @SubscribeEvent public void onBabyBorn(BabyEntitySpawnEvent event) { - EntityLivingBase parent = event.getParentA(); + LivingEntity parent = event.getParentA(); if (!parent.world.isRemote && event.getCausedByPlayer() != null) { BlockPos pos = parent.getPosition(); int aura = IAuraChunk.getAuraInArea(parent.world, pos, 30); @@ -25,7 +25,7 @@ public class ItemBirthSpirit extends ItemGlowing { return; int amount = parent.world.rand.nextInt(3) + 1; - EntityItem item = new EntityItem(parent.world, parent.posX, parent.posY, parent.posZ, + ItemEntity item = new ItemEntity(parent.world, parent.posX, parent.posY, parent.posZ, new ItemStack(ModItems.BIRTH_SPIRIT, amount)); parent.world.spawnEntity(item); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemCaveFinder.java b/src/main/java/de/ellpeck/naturesaura/items/ItemCaveFinder.java index a387bbcf..cc02cec8 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemCaveFinder.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemCaveFinder.java @@ -1,15 +1,15 @@ package de.ellpeck.naturesaura.items; import de.ellpeck.naturesaura.api.NaturesAuraAPI; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.EntityLiving; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.block.BlockState; +import net.minecraft.entity.MobEntity; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; -import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.LightType; import net.minecraft.world.World; public class ItemCaveFinder extends ItemImpl { @@ -19,11 +19,11 @@ public class ItemCaveFinder extends ItemImpl { } @Override - public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { + public ActionResult onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack stack = playerIn.getHeldItem(handIn); NaturesAuraAPI.IInternalHooks inst = NaturesAuraAPI.instance(); if (!inst.extractAuraFromPlayer(playerIn, 20000, worldIn.isRemote)) - return new ActionResult<>(EnumActionResult.FAIL, stack); + return new ActionResult<>(ActionResultType.FAIL, stack); if (worldIn.isRemote) { inst.setParticleDepth(false); inst.setParticleSpawnRange(64); @@ -33,17 +33,17 @@ public class ItemCaveFinder extends ItemImpl { for (int y = -range; y <= range; y++) for (int z = -range; z <= range; z++) { BlockPos offset = pos.add(x, y, z); - IBlockState state = worldIn.getBlockState(offset); - if (!state.getBlock().canCreatureSpawn(state, worldIn, offset, EntityLiving.SpawnPlacementType.ON_GROUND)) + BlockState state = worldIn.getBlockState(offset); + if (!state.getBlock().canCreatureSpawn(state, worldIn, offset, MobEntity.SpawnPlacementType.ON_GROUND)) continue; BlockPos offUp = offset.up(); - IBlockState stateUp = worldIn.getBlockState(offUp); + BlockState stateUp = worldIn.getBlockState(offUp); if (stateUp.isBlockNormalCube() || stateUp.getMaterial().isLiquid()) continue; - int sky = worldIn.getLightFor(EnumSkyBlock.SKY, offUp); - int block = worldIn.getLightFor(EnumSkyBlock.BLOCK, offUp); + int sky = worldIn.getLightFor(LightType.SKY, offUp); + int block = worldIn.getLightFor(LightType.BLOCK, offUp); if (sky > 7 || block > 7) continue; @@ -57,6 +57,6 @@ public class ItemCaveFinder extends ItemImpl { playerIn.swingArm(handIn); } playerIn.getCooldownTracker().setCooldown(this, 20 * 30); - return new ActionResult<>(EnumActionResult.SUCCESS, stack); + return new ActionResult<>(ActionResultType.SUCCESS, stack); } } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java b/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java index 84f3d60d..4b6e6db8 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemColorChanger.java @@ -5,18 +5,18 @@ import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.reg.IColorProvidingItem; import net.minecraft.block.properties.IProperty; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.renderer.color.IItemColor; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.SoundEvents; -import net.minecraft.item.EnumDyeColor; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.SoundEvents; +import net.minecraft.item.DyeColor; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class ItemColorChanger extends ItemImpl implements IColorProvidingItem { @@ -31,7 +31,7 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem { } @Override - public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(PlayerEntity player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); if (changeOrCopyColor(player, stack, worldIn, pos, null)) { return EnumActionResult.SUCCESS; @@ -40,13 +40,13 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem { } } - private static boolean changeOrCopyColor(EntityPlayer player, ItemStack stack, World world, BlockPos pos, EnumDyeColor firstColor) { - IBlockState state = world.getBlockState(pos); + private static boolean changeOrCopyColor(PlayerEntity player, ItemStack stack, World world, BlockPos pos, DyeColor firstColor) { + BlockState state = world.getBlockState(pos); for (IProperty prop : state.getProperties().keySet()) { - if (prop.getValueClass() == EnumDyeColor.class) { - EnumDyeColor color = (EnumDyeColor) state.getValue(prop); + if (prop.getValueClass() == DyeColor.class) { + DyeColor color = (DyeColor) state.getValue(prop); if (firstColor == null || color == firstColor) { - EnumDyeColor stored = getStoredColor(stack); + DyeColor stored = getStoredColor(stack); if (player.isSneaking()) { if (stored != color) { world.playSound(player, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5, @@ -82,7 +82,7 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem { } @Override - public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { + public ActionResult onItemRightClick(World worldIn, PlayerEntity playerIn, EnumHand 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); @@ -96,18 +96,18 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem { } - private static EnumDyeColor getStoredColor(ItemStack stack) { + private static DyeColor getStoredColor(ItemStack stack) { if (!stack.hasTagCompound()) { return null; } else { int color = stack.getTagCompound().getInteger("color"); - return EnumDyeColor.byMetadata(color); + return DyeColor.byMetadata(color); } } - private static void storeColor(ItemStack stack, EnumDyeColor color) { + private static void storeColor(ItemStack stack, DyeColor color) { if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); } stack.getTagCompound().setInteger("color", color.getMetadata()); } @@ -122,17 +122,17 @@ public class ItemColorChanger extends ItemImpl implements IColorProvidingItem { private static void setFillMode(ItemStack stack, boolean fill) { if (!stack.hasTagCompound()) { - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); } stack.getTagCompound().setBoolean("fill", fill); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IItemColor getItemColor() { return (stack, tintIndex) -> { if (tintIndex > 0) { - EnumDyeColor color = getStoredColor(stack); + DyeColor color = getStoredColor(stack); if (color != null) { return color.getColorValue(); } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemEffectPowder.java b/src/main/java/de/ellpeck/naturesaura/items/ItemEffectPowder.java index 071526f8..2e0573db 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemEffectPowder.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemEffectPowder.java @@ -4,16 +4,16 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.entities.EntityEffectInhibitor; import de.ellpeck.naturesaura.reg.IColorProvidingItem; import net.minecraft.client.renderer.color.IItemColor; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemGroup; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.*; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.translation.I18n; +import net.minecraft.client.resources.I18n; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem { @@ -22,7 +22,7 @@ public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem { } @Override - public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public EnumActionResult onItemUse(PlayerEntity player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (!worldIn.isRemote) { ItemStack stack = player.getHeldItem(hand); EntityEffectInhibitor.place(worldIn, stack, pos.getX() + hitX, pos.getY() + hitY + 1, pos.getZ() + hitZ); @@ -32,7 +32,7 @@ public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem { } @Override - public void getSubItems(CreativeTabs tab, NonNullList items) { + public void getSubItems(ItemGroup tab, NonNullList items) { if (this.isInCreativeTab(tab)) { for (ResourceLocation effect : NaturesAuraAPI.EFFECT_POWDERS.keySet()) { ItemStack stack = new ItemStack(this); @@ -58,13 +58,13 @@ public class ItemEffectPowder extends ItemImpl implements IColorProvidingItem { public static ItemStack setEffect(ItemStack stack, ResourceLocation effect) { if (!stack.hasTagCompound()) - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); stack.getTagCompound().setString("effect", effect.toString()); return stack; } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IItemColor getItemColor() { return (stack, tintIndex) -> NaturesAuraAPI.EFFECT_POWDERS.getOrDefault(getEffect(stack), 0xFFFFFF); } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemEnderAccess.java b/src/main/java/de/ellpeck/naturesaura/items/ItemEnderAccess.java index 354bc452..2a781887 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemEnderAccess.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemEnderAccess.java @@ -5,14 +5,14 @@ import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.blocks.BlockEnderCrate; import net.minecraft.client.util.ITooltipFlag; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumHand; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Hand; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import javax.annotation.Nullable; import java.util.List; @@ -23,20 +23,20 @@ public class ItemEnderAccess extends ItemImpl { } @Override - public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { - if (handIn != EnumHand.MAIN_HAND) - return new ActionResult<>(EnumActionResult.PASS, playerIn.getHeldItem(handIn)); + public ActionResult onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { + if (handIn != Hand.MAIN_HAND) + return new ActionResult<>(ActionResultType.PASS, playerIn.getHeldItem(handIn)); ItemStack stack = playerIn.getHeldItemMainhand(); if (!Strings.isNullOrEmpty(BlockEnderCrate.getEnderName(stack))) { if (!worldIn.isRemote && NaturesAuraAPI.instance().extractAuraFromPlayer(playerIn, 10000, false)) playerIn.openGui(NaturesAura.MOD_ID, 1, worldIn, (int) playerIn.posX, (int) playerIn.posY, (int) playerIn.posZ); - return new ActionResult<>(EnumActionResult.SUCCESS, stack); + return new ActionResult<>(ActionResultType.SUCCESS, stack); } - return new ActionResult<>(EnumActionResult.FAIL, stack); + return new ActionResult<>(ActionResultType.FAIL, stack); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public void addInformation(ItemStack stack, @Nullable World worldIn, List tooltip, ITooltipFlag flagIn) { BlockEnderCrate.addEnderNameInfo(stack, tooltip); } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemEye.java b/src/main/java/de/ellpeck/naturesaura/items/ItemEye.java index 796bda15..b8a39b79 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemEye.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemEye.java @@ -2,12 +2,12 @@ package de.ellpeck.naturesaura.items; import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.api.render.ITrinketItem; -import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.inventory.EntityEquipmentSlot; +import com.mojang.blaze3d.platform.GlStateManager; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class ItemEye extends ItemImpl implements ITrinketItem { @@ -17,10 +17,10 @@ public class ItemEye extends ItemImpl implements ITrinketItem { } @Override - @SideOnly(Side.CLIENT) - public void render(ItemStack stack, EntityPlayer player, RenderType type, boolean isHolding) { + @OnlyIn(Dist.CLIENT) + public void render(ItemStack stack, PlayerEntity player, RenderType type, boolean isHolding) { if (type == RenderType.BODY && !isHolding) { - boolean armor = !player.inventory.armorInventory.get(EntityEquipmentSlot.CHEST.getIndex()).isEmpty(); + boolean armor = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty(); GlStateManager.translate(0.1F, 0.225F, armor ? -0.195F : -0.1475F); GlStateManager.scale(0.15F, 0.15F, 0.15F); GlStateManager.rotate(180F, 1F, 0F, 0F); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemGlowing.java b/src/main/java/de/ellpeck/naturesaura/items/ItemGlowing.java index cc63b431..e35d94f3 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemGlowing.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemGlowing.java @@ -1,8 +1,8 @@ package de.ellpeck.naturesaura.items; import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class ItemGlowing extends ItemImpl { public ItemGlowing(String baseName) { @@ -10,7 +10,7 @@ public class ItemGlowing extends ItemImpl { } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public boolean hasEffect(ItemStack stack) { return true; } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemGoldFiber.java b/src/main/java/de/ellpeck/naturesaura/items/ItemGoldFiber.java index 895ca3dc..bcecf31f 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemGoldFiber.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemGoldFiber.java @@ -3,11 +3,11 @@ package de.ellpeck.naturesaura.items; import de.ellpeck.naturesaura.blocks.BlockGoldenLeaves; import de.ellpeck.naturesaura.reg.IColorProvidingItem; import net.minecraft.client.renderer.color.IItemColor; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -23,14 +23,14 @@ public class ItemGoldFiber extends ItemImpl implements IColorProvidingItem { } @Override - public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); if (BlockGoldenLeaves.convert(worldIn, pos)) { if (!worldIn.isRemote) { stack.shrink(1); } - return EnumActionResult.SUCCESS; + return ActionResultType.SUCCESS; } - return EnumActionResult.PASS; + return ActionResultType.PASS; } } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemImpl.java b/src/main/java/de/ellpeck/naturesaura/items/ItemImpl.java index c5db00ab..c578f5e5 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemImpl.java @@ -5,9 +5,6 @@ import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.item.Item; -import net.minecraftforge.fml.common.event.FMLInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; -import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; public class ItemImpl extends Item implements IModItem, ICreativeItem, IModelProvider { diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemMoverMinecart.java b/src/main/java/de/ellpeck/naturesaura/items/ItemMoverMinecart.java index e2e24fde..8fddf713 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemMoverMinecart.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemMoverMinecart.java @@ -1,12 +1,12 @@ package de.ellpeck.naturesaura.items; import de.ellpeck.naturesaura.entities.EntityMoverMinecart; -import net.minecraft.block.BlockRailBase; -import net.minecraft.entity.item.EntityMinecart; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.block.AbstractRailBlock; +import net.minecraft.entity.item.minecart.AbstractMinecartEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -21,15 +21,15 @@ public class ItemMoverMinecart extends ItemImpl { @Nonnull @Override - public EnumActionResult onItemUse(EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ) { - if (BlockRailBase.isRailBlock(world.getBlockState(pos))) { + public ActionResultType onItemUse(PlayerEntity player, World world, BlockPos pos, Hand hand, Direction side, float hitX, float hitY, float hitZ) { + if (AbstractRailBlock.isRailBlock(world.getBlockState(pos))) { if (!world.isRemote) { - EntityMinecart cart = new EntityMoverMinecart(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); + AbstractMinecartEntity cart = new EntityMoverMinecart(world, pos.getX() + 0.5, pos.getY() + 0.5, pos.getZ() + 0.5); world.spawnEntity(cart); } player.getHeldItem(hand).shrink(1); - return EnumActionResult.SUCCESS; + return ActionResultType.SUCCESS; } - return EnumActionResult.PASS; + return ActionResultType.PASS; } } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemMultiblockMaker.java b/src/main/java/de/ellpeck/naturesaura/items/ItemMultiblockMaker.java index cb3dfef3..c78502b8 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemMultiblockMaker.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemMultiblockMaker.java @@ -2,13 +2,13 @@ package de.ellpeck.naturesaura.items; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.multiblock.IMultiblock; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraft.util.ActionResult; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -24,25 +24,25 @@ public class ItemMultiblockMaker extends ItemImpl { } @Override - public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { + public ActionResult onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack stack = playerIn.getHeldItem(handIn); if (!worldIn.isRemote && playerIn.capabilities.isCreativeMode) { int curr = getMultiblock(stack); int next = (curr + 1) % multiblocks().size(); if (!stack.hasTagCompound()) - stack.setTagCompound(new NBTTagCompound()); + stack.setTagCompound(new CompoundNBT()); stack.getTagCompound().setInteger("multiblock", next); } - return new ActionResult<>(EnumActionResult.SUCCESS, stack); + return new ActionResult<>(ActionResultType.SUCCESS, stack); } @Override - public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { if (player.capabilities.isCreativeMode) { IMultiblock multi = multiblocks().get(getMultiblock(player.getHeldItem(hand))); if (multi == null) - return EnumActionResult.PASS; + return ActionResultType.PASS; if (!worldIn.isRemote) multi.forEach(pos.up(), (char) 0, (blockPos, matcher) -> { @@ -50,9 +50,9 @@ public class ItemMultiblockMaker extends ItemImpl { return true; }); - return EnumActionResult.SUCCESS; + return ActionResultType.SUCCESS; } - return EnumActionResult.PASS; + return ActionResultType.PASS; } @Override diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemRangeVisualizer.java b/src/main/java/de/ellpeck/naturesaura/items/ItemRangeVisualizer.java index 823b5563..ce5390c0 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemRangeVisualizer.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemRangeVisualizer.java @@ -5,20 +5,20 @@ import com.google.common.collect.ListMultimap; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.render.IVisualizable; import net.minecraft.block.Block; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.entity.Entity; -import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.PlayerEntity; import net.minecraft.item.ItemStack; import net.minecraft.util.ActionResult; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; -import net.minecraft.util.text.TextComponentTranslation; +import net.minecraft.util.text.TranslationTextComponent; import net.minecraft.world.World; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; public class ItemRangeVisualizer extends ItemImpl { @@ -34,26 +34,26 @@ public class ItemRangeVisualizer extends ItemImpl { } @Override - public ActionResult onItemRightClick(World worldIn, EntityPlayer playerIn, EnumHand handIn) { + public ActionResult onItemRightClick(World worldIn, PlayerEntity playerIn, Hand handIn) { ItemStack stack = playerIn.getHeldItem(handIn); if (playerIn.isSneaking()) { clear(); - playerIn.sendStatusMessage(new TextComponentTranslation("info." + NaturesAura.MOD_ID + ".range_visualizer.end_all"), true); - return new ActionResult<>(EnumActionResult.SUCCESS, stack); + playerIn.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".range_visualizer.end_all"), true); + return new ActionResult<>(ActionResultType.SUCCESS, stack); } - return new ActionResult<>(EnumActionResult.PASS, stack); + return new ActionResult<>(ActionResultType.PASS, stack); } @Override - public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { - IBlockState state = worldIn.getBlockState(pos); + public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { + BlockState state = worldIn.getBlockState(pos); Block block = state.getBlock(); if (block instanceof IVisualizable) { if (worldIn.isRemote) visualize(player, VISUALIZED_BLOCKS, worldIn.provider.getDimension(), pos); - return EnumActionResult.SUCCESS; + return ActionResultType.SUCCESS; } - return EnumActionResult.PASS; + return ActionResultType.PASS; } public static void clear() { @@ -65,13 +65,13 @@ public class ItemRangeVisualizer extends ItemImpl { VISUALIZED_RAILS.clear(); } - public static void visualize(EntityPlayer player, ListMultimap map, int dim, T value) { + public static void visualize(PlayerEntity player, ListMultimap map, int dim, T value) { if (map.containsEntry(dim, value)) { map.remove(dim, value); - player.sendStatusMessage(new TextComponentTranslation("info." + NaturesAura.MOD_ID + ".range_visualizer.end"), true); + player.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".range_visualizer.end"), true); } else { map.put(dim, value); - player.sendStatusMessage(new TextComponentTranslation("info." + NaturesAura.MOD_ID + ".range_visualizer.start"), true); + player.sendStatusMessage(new TranslationTextComponent("info." + NaturesAura.MOD_ID + ".range_visualizer.start"), true); } } @@ -87,7 +87,7 @@ public class ItemRangeVisualizer extends ItemImpl { visualize(event.getEntityPlayer(), VISUALIZED_ENTITIES, dim, entity); } event.getEntityPlayer().swingArm(event.getHand()); - event.setCancellationResult(EnumActionResult.SUCCESS); + event.setCancellationResult(ActionResultType.SUCCESS); event.setCanceled(true); } } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java b/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java index 59a90a1e..1988c123 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemShockwaveCreator.java @@ -9,19 +9,19 @@ import de.ellpeck.naturesaura.packet.PacketParticles; import net.minecraft.block.Block; import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; -import net.minecraft.client.gui.Gui; -import net.minecraft.client.renderer.GlStateManager; +import net.minecraft.client.gui.AbstractGui; +import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.MobEffects; -import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraft.entity.LivingEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.potion.Effects; +import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.PotionEffect; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.potion.EffectInstance; import net.minecraft.util.DamageSource; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.ResourceLocation; @@ -29,9 +29,9 @@ import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraft.world.WorldServer; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.world.ServerWorld; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import java.util.List; @@ -46,13 +46,13 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { @Override public void onUpdate(ItemStack stack, World worldIn, Entity entityIn, int itemSlot, boolean isSelected) { - if (worldIn.isRemote || !(entityIn instanceof EntityLivingBase)) + if (worldIn.isRemote || !(entityIn instanceof LivingEntity)) return; - EntityLivingBase living = (EntityLivingBase) entityIn; + LivingEntity living = (LivingEntity) entityIn; if (!living.onGround) { if (!stack.hasTagCompound()) - stack.setTagCompound(new NBTTagCompound()); - NBTTagCompound compound = stack.getTagCompound(); + stack.setTagCompound(new CompoundNBT()); + CompoundNBT compound = stack.getTagCompound(); if (compound.getBoolean("air")) return; @@ -63,7 +63,7 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { } else { if (!stack.hasTagCompound()) return; - NBTTagCompound compound = stack.getTagCompound(); + CompoundNBT compound = stack.getTagCompound(); if (!compound.getBoolean("air")) return; @@ -73,43 +73,43 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { return; if (living.getDistanceSq(compound.getDouble("x"), compound.getDouble("y"), compound.getDouble("z")) > 0.75F) return; - if (living instanceof EntityPlayer && !NaturesAuraAPI.instance().extractAuraFromPlayer((EntityPlayer) living, 1000, false)) + if (living instanceof PlayerEntity && !NaturesAuraAPI.instance().extractAuraFromPlayer((PlayerEntity) living, 1000, false)) return; DamageSource source; - if (living instanceof EntityPlayer) - source = DamageSource.causePlayerDamage((EntityPlayer) living); + if (living instanceof PlayerEntity) + source = DamageSource.causePlayerDamage((PlayerEntity) living); else source = DamageSource.MAGIC; boolean infusedSet = ItemArmorNA.isFullSetEquipped(living, 0); int range = 5; - List mobs = worldIn.getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB( + 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)); - for (EntityLivingBase mob : mobs) { + for (LivingEntity mob : mobs) { if (mob.isDead || mob == living) continue; if (living.getDistanceSq(mob) > range * range) continue; - if (living instanceof EntityPlayer && !NaturesAuraAPI.instance().extractAuraFromPlayer((EntityPlayer) living, 500, false)) + if (living instanceof PlayerEntity && !NaturesAuraAPI.instance().extractAuraFromPlayer((PlayerEntity) living, 500, false)) break; mob.attackEntityFrom(source, 4F); if (infusedSet) - mob.addPotionEffect(new PotionEffect(MobEffects.WITHER, 120)); + mob.addPotionEffect(new EffectInstance(Effects.WITHER, 120)); } BlockPos pos = living.getPosition(); BlockPos down = pos.down(); - IBlockState downState = worldIn.getBlockState(down); + BlockState downState = worldIn.getBlockState(down); if (downState.getMaterial() != Material.AIR) { SoundType type = downState.getBlock().getSoundType(downState, worldIn, down, null); worldIn.playSound(null, pos, type.getBreakSound(), SoundCategory.BLOCKS, type.getVolume() * 0.5F, type.getPitch() * 0.8F); } - if (worldIn instanceof WorldServer) - ((WorldServer) worldIn).spawnParticle(EnumParticleTypes.BLOCK_DUST, + if (worldIn instanceof ServerWorld) + ((ServerWorld) worldIn).spawnParticle(EnumParticleTypes.BLOCK_DUST, living.posX, living.posY + 0.01F, living.posZ, 15, 0F, 0F, 0F, 0.15F, Block.getStateId(downState)); PacketHandler.sendToAllAround(worldIn, pos, 32, @@ -118,10 +118,10 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { } @Override - @SideOnly(Side.CLIENT) - public void render(ItemStack stack, EntityPlayer player, RenderType type, boolean isHolding) { + @OnlyIn(Dist.CLIENT) + public void render(ItemStack stack, PlayerEntity player, RenderType type, boolean isHolding) { if (type == RenderType.BODY && !isHolding) { - boolean armor = !player.inventory.armorInventory.get(EntityEquipmentSlot.CHEST.getIndex()).isEmpty(); + boolean armor = !player.inventory.armorInventory.get(EquipmentSlotType.CHEST.getIndex()).isEmpty(); GlStateManager.translate(-0.1675F, -0.05F, armor ? -0.195F : -0.1475F); GlStateManager.scale(0.021F, 0.021F, 0.021F); @@ -130,7 +130,7 @@ public class ItemShockwaveCreator extends ItemImpl implements ITrinketItem { GlStateManager.pushAttrib(); RenderHelper.enableStandardItemLighting(); Minecraft.getMinecraft().getTextureManager().bindTexture(RES_WORN); - Gui.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, 16, 16, 16, 16); + AbstractGui.drawModalRectWithCustomSizedTexture(0, 0, 0, 0, 16, 16, 16, 16); RenderHelper.disableStandardItemLighting(); GlStateManager.popAttrib(); GlStateManager.enableLighting(); diff --git a/src/main/java/de/ellpeck/naturesaura/items/ItemSlabNA.java b/src/main/java/de/ellpeck/naturesaura/items/ItemSlabNA.java index 1e67b420..7d51ec6e 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ItemSlabNA.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ItemSlabNA.java @@ -3,27 +3,27 @@ package de.ellpeck.naturesaura.items; import de.ellpeck.naturesaura.blocks.BlockSlabsNA; import net.minecraft.advancements.CriteriaTriggers; import net.minecraft.block.Block; -import net.minecraft.block.BlockSlab; +import net.minecraft.block.SlabBlock; import net.minecraft.block.BlockSlab.EnumBlockHalf; import net.minecraft.block.SoundType; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; -import net.minecraft.item.ItemBlock; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; +import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import java.util.function.Supplier; -public class ItemSlabNA extends ItemBlock { +public class ItemSlabNA extends BlockItem { private final Supplier singleSlab; private final Supplier doubleSlab; @@ -35,14 +35,14 @@ public class ItemSlabNA extends ItemBlock { } @Override - public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { ItemStack stack = player.getHeldItem(hand); if (!stack.isEmpty() && player.canPlayerEdit(pos.offset(facing), facing, stack)) { - IBlockState state = worldIn.getBlockState(pos); + BlockState state = worldIn.getBlockState(pos); if (state.getBlock() == this.singleSlab.get()) { - EnumBlockHalf half = state.getValue(BlockSlab.HALF); - if (facing == EnumFacing.UP && half == EnumBlockHalf.BOTTOM || facing == EnumFacing.DOWN && half == EnumBlockHalf.TOP) { - IBlockState newState = this.doubleSlab.get().getDefaultState(); + EnumBlockHalf half = state.getValue(SlabBlock.HALF); + if (facing == Direction.UP && half == EnumBlockHalf.BOTTOM || facing == Direction.DOWN && half == EnumBlockHalf.TOP) { + BlockState newState = this.doubleSlab.get().getDefaultState(); AxisAlignedBB bound = newState.getCollisionBoundingBox(worldIn, pos); if (bound != Block.NULL_AABB && worldIn.checkNoEntityCollision(bound.offset(pos)) && worldIn.setBlockState(pos, newState, 11)) { @@ -51,29 +51,29 @@ public class ItemSlabNA extends ItemBlock { (sound.getVolume() + 1.0F) / 2.0F, sound.getPitch() * 0.8F); stack.shrink(1); - if (player instanceof EntityPlayerMP) { - CriteriaTriggers.PLACED_BLOCK.trigger((EntityPlayerMP) player, pos, stack); + if (player instanceof ServerPlayerEntity) { + CriteriaTriggers.PLACED_BLOCK.trigger((ServerPlayerEntity) player, pos, stack); } } - return EnumActionResult.SUCCESS; + return ActionResultType.SUCCESS; } } return super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ); } else { - return EnumActionResult.FAIL; + return ActionResultType.FAIL; } } @Override - @SideOnly(Side.CLIENT) - public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, EnumFacing side, EntityPlayer player, ItemStack stack) { - IBlockState state = worldIn.getBlockState(pos); + @OnlyIn(Dist.CLIENT) + public boolean canPlaceBlockOnSide(World worldIn, BlockPos pos, Direction side, PlayerEntity player, ItemStack stack) { + BlockState state = worldIn.getBlockState(pos); if (state.getBlock() == this.singleSlab.get()) - if (state.getValue(BlockSlab.HALF) == EnumBlockHalf.TOP ? side == EnumFacing.DOWN : side == EnumFacing.UP) + if (state.getValue(SlabBlock.HALF) == EnumBlockHalf.TOP ? side == Direction.DOWN : side == Direction.UP) return true; - IBlockState other = worldIn.getBlockState(pos.offset(side)); + BlockState other = worldIn.getBlockState(pos.offset(side)); return other.getBlock() == this.singleSlab.get() || super.canPlaceBlockOnSide(worldIn, pos, side, player, stack); } } diff --git a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java index ee458273..e7ce8e44 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/ModItems.java +++ b/src/main/java/de/ellpeck/naturesaura/items/ModItems.java @@ -2,8 +2,8 @@ package de.ellpeck.naturesaura.items; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.items.tools.*; -import net.minecraft.init.SoundEvents; -import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraft.util.SoundEvents; +import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.Item; import net.minecraft.item.Item.ToolMaterial; import net.minecraft.item.ItemArmor.ArmorMaterial; @@ -21,10 +21,10 @@ public final class ModItems { public static final ArmorMaterial ARMOR_INFUSED = EnumHelper.addArmorMaterial( NaturesAura.MOD_ID_UPPER + "INFUSED_IRON", NaturesAura.MOD_ID + ":infused_iron", 19, new int[]{2, 5, 6, 2}, 16, SoundEvents.ITEM_ARMOR_EQUIP_GENERIC, 0F); - public static final Item INFUSED_HELMET = new ItemArmorNA("infused_iron_helmet", ARMOR_INFUSED, EntityEquipmentSlot.HEAD); - public static final Item INFUSED_CHEST = new ItemArmorNA("infused_iron_chest", ARMOR_INFUSED, EntityEquipmentSlot.CHEST); - public static final Item INFUSED_PANTS = new ItemArmorNA("infused_iron_pants", ARMOR_INFUSED, EntityEquipmentSlot.LEGS); - public static final Item INFUSED_SHOES = new ItemArmorNA("infused_iron_shoes", ARMOR_INFUSED, EntityEquipmentSlot.FEET); + public static final Item INFUSED_HELMET = new ItemArmorNA("infused_iron_helmet", ARMOR_INFUSED, EquipmentSlotType.HEAD); + public static final Item INFUSED_CHEST = new ItemArmorNA("infused_iron_chest", ARMOR_INFUSED, EquipmentSlotType.CHEST); + public static final Item INFUSED_PANTS = new ItemArmorNA("infused_iron_pants", ARMOR_INFUSED, EquipmentSlotType.LEGS); + public static final Item INFUSED_SHOES = new ItemArmorNA("infused_iron_shoes", ARMOR_INFUSED, EquipmentSlotType.FEET); public static final Item EYE = new ItemEye("eye"); public static final Item EYE_IMPROVED = new ItemEye("eye_improved"); diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemArmorNA.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemArmorNA.java index 371d6748..887b1985 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemArmorNA.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemArmorNA.java @@ -7,32 +7,32 @@ import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.entity.Entity; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.init.MobEffects; -import net.minecraft.inventory.EntityEquipmentSlot; +import net.minecraft.entity.LivingEntity; +import net.minecraft.potion.Effects; +import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.item.Item; -import net.minecraft.item.ItemArmor; +import net.minecraft.item.ArmorItem; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.PotionEffect; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.potion.EffectInstance; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.event.entity.living.LivingAttackEvent; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import javax.annotation.Nullable; import java.util.ArrayList; import java.util.List; -public class ItemArmorNA extends ItemArmor implements IModItem, ICreativeItem, IModelProvider { +public class ItemArmorNA extends ArmorItem implements IModItem, ICreativeItem, IModelProvider { private static List sets; private final String baseName; - public ItemArmorNA(String baseName, ArmorMaterial materialIn, EntityEquipmentSlot equipmentSlotIn) { + public ItemArmorNA(String baseName, ArmorMaterial materialIn, EquipmentSlotType equipmentSlotIn) { super(materialIn, 0, equipmentSlotIn); this.baseName = baseName; ModRegistry.add(this); @@ -42,13 +42,13 @@ public class ItemArmorNA extends ItemArmor implements IModItem, ICreativeItem, I @SubscribeEvent public void onAttack(LivingAttackEvent event) { - EntityLivingBase entity = event.getEntityLiving(); + LivingEntity entity = event.getEntityLiving(); if (!entity.world.isRemote) { if (!isFullSetEquipped(entity, 0)) return; Entity source = event.getSource().getTrueSource(); - if (source instanceof EntityLivingBase) - ((EntityLivingBase) source).addPotionEffect(new PotionEffect(MobEffects.WITHER, 40)); + if (source instanceof LivingEntity) + ((LivingEntity) source).addPotionEffect(new EffectInstance(Effects.WITHER, 40)); } } @@ -74,11 +74,11 @@ public class ItemArmorNA extends ItemArmor implements IModItem, ICreativeItem, I @Nullable @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) { + public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { return Helper.makeRechargeProvider(stack, false); } - public static boolean isFullSetEquipped(EntityLivingBase entity, int setIndex) { + public static boolean isFullSetEquipped(LivingEntity entity, int setIndex) { if (sets == null) { sets = new ArrayList<>(); sets.add(new Item[]{ModItems.INFUSED_SHOES, ModItems.INFUSED_PANTS, ModItems.INFUSED_CHEST, ModItems.INFUSED_HELMET}); @@ -86,7 +86,7 @@ public class ItemArmorNA extends ItemArmor implements IModItem, ICreativeItem, I Item[] set = sets.get(setIndex); for (int i = 0; i < 4; i++) { - EntityEquipmentSlot slot = EntityEquipmentSlot.values()[i + 2]; + EquipmentSlotType slot = EquipmentSlotType.values()[i + 2]; ItemStack stack = entity.getItemStackFromSlot(slot); if (stack.isEmpty() || stack.getItem() != set[i]) return false; diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxeNA.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxeNA.java index 1bd6ab52..c6af4ab5 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxeNA.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemAxeNA.java @@ -7,10 +7,10 @@ import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.item.ItemAxe; +import net.minecraft.block.BlockState; +import net.minecraft.item.AxeItem; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.nbt.CompoundNBT; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; @@ -18,7 +18,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import javax.annotation.Nullable; -public class ItemAxeNA extends ItemAxe implements IModItem, ICreativeItem, IModelProvider { +public class ItemAxeNA extends AxeItem implements IModItem, ICreativeItem, IModelProvider { private final String baseName; public ItemAxeNA(String baseName, ToolMaterial material, float damage, float speed) { @@ -47,7 +47,7 @@ public class ItemAxeNA extends ItemAxe implements IModItem, ICreativeItem, IMode } @Override - public float getDestroySpeed(ItemStack stack, IBlockState state) { + public float getDestroySpeed(ItemStack stack, BlockState state) { if (this == ModItems.INFUSED_AXE && state.getMaterial() == Material.LEAVES) { return this.efficiency; } else { @@ -57,7 +57,7 @@ public class ItemAxeNA extends ItemAxe implements IModItem, ICreativeItem, IMode @Nullable @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) { + public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { if (this == ModItems.INFUSED_AXE) return Helper.makeRechargeProvider(stack, true); else return null; diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoeNA.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoeNA.java index fd230c61..f0b8af92 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoeNA.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemHoeNA.java @@ -6,15 +6,15 @@ import de.ellpeck.naturesaura.reg.ICreativeItem; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; -import net.minecraft.entity.item.EntityItem; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Items; -import net.minecraft.item.ItemHoe; +import net.minecraft.entity.item.ItemEntity; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.item.Items; +import net.minecraft.item.HoeItem; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; @@ -25,7 +25,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import javax.annotation.Nullable; -public class ItemHoeNA extends ItemHoe implements IModItem, ICreativeItem, IModelProvider { +public class ItemHoeNA extends HoeItem implements IModItem, ICreativeItem, IModelProvider { private final String baseName; @@ -36,9 +36,9 @@ public class ItemHoeNA extends ItemHoe implements IModItem, ICreativeItem, IMode } @Override - public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { - EnumActionResult result = super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ); - if (!worldIn.isRemote && result == EnumActionResult.SUCCESS && this == ModItems.INFUSED_HOE) { + public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { + ActionResultType result = super.onItemUse(player, worldIn, pos, hand, facing, hitX, hitY, hitZ); + if (!worldIn.isRemote && result == ActionResultType.SUCCESS && this == ModItems.INFUSED_HOE) { ItemStack seed = ItemStack.EMPTY; if (worldIn.rand.nextInt(5) == 0) { @@ -55,7 +55,7 @@ public class ItemHoeNA extends ItemHoe implements IModItem, ICreativeItem, IMode } if (!seed.isEmpty()) { - EntityItem item = new EntityItem(worldIn, pos.getX() + worldIn.rand.nextFloat(), pos.getY() + 1F, pos.getZ() + worldIn.rand.nextFloat(), seed); + ItemEntity item = new ItemEntity(worldIn, pos.getX() + worldIn.rand.nextFloat(), pos.getY() + 1F, pos.getZ() + worldIn.rand.nextFloat(), seed); worldIn.spawnEntity(item); } } @@ -84,7 +84,7 @@ public class ItemHoeNA extends ItemHoe implements IModItem, ICreativeItem, IMode @Nullable @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) { + public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { if (this == ModItems.INFUSED_HOE) return Helper.makeRechargeProvider(stack, true); else return null; diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxeNA.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxeNA.java index f1886d41..d3994286 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxeNA.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemPickaxeNA.java @@ -7,15 +7,15 @@ import de.ellpeck.naturesaura.reg.ICreativeItem; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.SoundEvents; -import net.minecraft.item.ItemPickaxe; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.util.SoundEvents; +import net.minecraft.item.PickaxeItem; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -26,7 +26,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import javax.annotation.Nullable; -public class ItemPickaxeNA extends ItemPickaxe implements IModItem, ICreativeItem, IModelProvider { +public class ItemPickaxeNA extends PickaxeItem implements IModItem, ICreativeItem, IModelProvider { private final String baseName; @@ -56,25 +56,25 @@ public class ItemPickaxeNA extends ItemPickaxe implements IModItem, ICreativeIte } @Override - public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { if (this == ModItems.INFUSED_PICKAXE) { ItemStack stack = player.getHeldItem(hand); - IBlockState state = worldIn.getBlockState(pos); - IBlockState result = NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.get(state); + BlockState state = worldIn.getBlockState(pos); + BlockState result = NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.get(state); if (result != null) { if (!worldIn.isRemote) worldIn.setBlockState(pos, result); worldIn.playSound(player, pos, SoundEvents.BLOCK_STONE_PLACE, SoundCategory.BLOCKS, 1.0F, 1.0F); stack.damageItem(15, player); - return EnumActionResult.SUCCESS; + return ActionResultType.SUCCESS; } } - return EnumActionResult.PASS; + return ActionResultType.PASS; } @Nullable @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) { + public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { if (this == ModItems.INFUSED_PICKAXE) return Helper.makeRechargeProvider(stack, true); else return null; diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovelNA.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovelNA.java index 98dcbc8c..db902859 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovelNA.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemShovelNA.java @@ -8,16 +8,16 @@ import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.block.BlockDirt; import net.minecraft.block.material.Material; -import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.SoundEvents; -import net.minecraft.item.ItemSpade; +import net.minecraft.block.BlockState; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.block.Blocks; +import net.minecraft.util.SoundEvents; +import net.minecraft.item.ShovelItem; import net.minecraft.item.ItemStack; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumActionResult; -import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumHand; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.util.ActionResultType; +import net.minecraft.util.Direction; +import net.minecraft.util.Hand; import net.minecraft.util.SoundCategory; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; @@ -28,7 +28,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import javax.annotation.Nullable; -public class ItemShovelNA extends ItemSpade implements IModItem, ICreativeItem, IModelProvider { +public class ItemShovelNA extends ShovelItem implements IModItem, ICreativeItem, IModelProvider { private final String baseName; public ItemShovelNA(String baseName, ToolMaterial material) { @@ -38,10 +38,10 @@ public class ItemShovelNA extends ItemSpade implements IModItem, ICreativeItem, } @Override - public EnumActionResult onItemUse(EntityPlayer player, World worldIn, BlockPos pos, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { + public ActionResultType onItemUse(PlayerEntity player, World worldIn, BlockPos pos, Hand hand, Direction facing, float hitX, float hitY, float hitZ) { if (this == ModItems.INFUSED_SHOVEL) { ItemStack stack = player.getHeldItem(hand); - IBlockState state = worldIn.getBlockState(pos); + BlockState state = worldIn.getBlockState(pos); int damage = 0; if (state.getBlock() instanceof BlockDirt) { @@ -55,7 +55,7 @@ public class ItemShovelNA extends ItemSpade implements IModItem, ICreativeItem, for (int y = -range; y <= range; y++) { BlockPos actualPos = pos.add(x, 0, y); if (player.canPlayerEdit(actualPos.offset(facing), facing, stack)) { - if (facing != EnumFacing.DOWN + if (facing != Direction.DOWN && worldIn.getBlockState(actualPos.up()).getMaterial() == Material.AIR && worldIn.getBlockState(actualPos).getBlock() == Blocks.GRASS) { if (!worldIn.isRemote) { @@ -71,10 +71,10 @@ public class ItemShovelNA extends ItemSpade implements IModItem, ICreativeItem, if (damage > 0) { worldIn.playSound(player, pos, SoundEvents.ITEM_SHOVEL_FLATTEN, SoundCategory.BLOCKS, 1.0F, 1.0F); stack.damageItem(damage, player); - return EnumActionResult.SUCCESS; + return ActionResultType.SUCCESS; } } - return EnumActionResult.PASS; + return ActionResultType.PASS; } @Override @@ -98,7 +98,7 @@ public class ItemShovelNA extends ItemSpade implements IModItem, ICreativeItem, @Nullable @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) { + public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { if (this == ModItems.INFUSED_SHOVEL) return Helper.makeRechargeProvider(stack, true); else return null; diff --git a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemSwordNA.java b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemSwordNA.java index 78c06798..4fe5fd6c 100644 --- a/src/main/java/de/ellpeck/naturesaura/items/tools/ItemSwordNA.java +++ b/src/main/java/de/ellpeck/naturesaura/items/tools/ItemSwordNA.java @@ -6,12 +6,12 @@ import de.ellpeck.naturesaura.reg.ICreativeItem; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.ModRegistry; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.init.MobEffects; +import net.minecraft.entity.LivingEntity; +import net.minecraft.potion.Effects; import net.minecraft.item.ItemStack; -import net.minecraft.item.ItemSword; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.potion.PotionEffect; +import net.minecraft.item.SwordItem; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.potion.EffectInstance; import net.minecraftforge.common.capabilities.ICapabilityProvider; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; @@ -19,7 +19,7 @@ import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; import javax.annotation.Nullable; -public class ItemSwordNA extends ItemSword implements IModItem, ICreativeItem, IModelProvider { +public class ItemSwordNA extends SwordItem implements IModItem, ICreativeItem, IModelProvider { private final String baseName; public ItemSwordNA(String baseName, ToolMaterial material) { @@ -49,15 +49,15 @@ public class ItemSwordNA extends ItemSword implements IModItem, ICreativeItem, I } @Override - public boolean hitEntity(ItemStack stack, EntityLivingBase target, EntityLivingBase attacker) { + public boolean hitEntity(ItemStack stack, LivingEntity target, LivingEntity attacker) { if (this == ModItems.INFUSED_SWORD) - target.addPotionEffect(new PotionEffect(MobEffects.SLOWNESS, 60, 2)); + target.addPotionEffect(new EffectInstance(Effects.SLOWNESS, 60, 2)); return super.hitEntity(stack, target, attacker); } @Nullable @Override - public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable NBTTagCompound nbt) { + public ICapabilityProvider initCapabilities(ItemStack stack, @Nullable CompoundNBT nbt) { if (this == ModItems.INFUSED_SWORD) return Helper.makeRechargeProvider(stack, true); else return null; diff --git a/src/main/java/de/ellpeck/naturesaura/misc/WorldData.java b/src/main/java/de/ellpeck/naturesaura/misc/WorldData.java index 027955f2..c8432f50 100644 --- a/src/main/java/de/ellpeck/naturesaura/misc/WorldData.java +++ b/src/main/java/de/ellpeck/naturesaura/misc/WorldData.java @@ -9,9 +9,9 @@ import de.ellpeck.naturesaura.blocks.tiles.ItemStackHandlerNA; import de.ellpeck.naturesaura.items.ModItems; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTBase; -import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.EnumFacing; +import net.minecraft.nbt.CompoundNBT; +import net.minecraft.nbt.ListNBT; +import net.minecraft.util.Direction; import net.minecraft.util.ResourceLocation; import net.minecraft.util.Tuple; import net.minecraft.util.math.Vec3d; @@ -27,26 +27,26 @@ public class WorldData implements IWorldData { public final ListMultimap> effectPowders = ArrayListMultimap.create(); @Override - public boolean hasCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public boolean hasCapability(@Nonnull Capability capability, @Nullable Direction facing) { return capability == NaturesAuraAPI.capWorldData; } @Nullable @Override - public T getCapability(@Nonnull Capability capability, @Nullable EnumFacing facing) { + public T getCapability(@Nonnull Capability capability, @Nullable Direction facing) { return capability == NaturesAuraAPI.capWorldData ? (T) this : null; } @Override - public NBTTagCompound serializeNBT() { - NBTTagCompound compound = new NBTTagCompound(); + public CompoundNBT serializeNBT() { + CompoundNBT compound = new CompoundNBT(); - NBTTagList storages = new NBTTagList(); + ListNBT storages = new ListNBT(); for (Map.Entry entry : this.enderStorages.entrySet()) { ItemStackHandlerNA handler = entry.getValue(); if (Helper.isEmpty(handler)) continue; - NBTTagCompound storageComp = handler.serializeNBT(); + CompoundNBT storageComp = handler.serializeNBT(); storageComp.setString("name", entry.getKey()); storages.appendTag(storageComp); } @@ -56,11 +56,11 @@ public class WorldData implements IWorldData { } @Override - public void deserializeNBT(NBTTagCompound compound) { + public void deserializeNBT(CompoundNBT compound) { this.enderStorages.clear(); - NBTTagList storages = compound.getTagList("storages", 10); + ListNBT storages = compound.getTagList("storages", 10); for (NBTBase base : storages) { - NBTTagCompound storageComp = (NBTTagCompound) base; + CompoundNBT storageComp = (CompoundNBT) base; ItemStackHandlerNA storage = this.getEnderStorage(storageComp.getString("name")); storage.deserializeNBT(storageComp); } diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketAuraChunk.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketAuraChunk.java index 24be563c..65596646 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketAuraChunk.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketAuraChunk.java @@ -11,8 +11,8 @@ import net.minecraft.world.chunk.Chunk; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import org.apache.commons.lang3.mutable.MutableInt; import java.util.HashMap; @@ -64,7 +64,7 @@ public class PacketAuraChunk implements IMessage { public static class Handler implements IMessageHandler { @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IMessage onMessage(PacketAuraChunk message, MessageContext ctx) { NaturesAura.proxy.scheduleTask(() -> { World world = Minecraft.getMinecraft().world; diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketClient.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketClient.java index 88304989..0011a082 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketClient.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketClient.java @@ -8,8 +8,8 @@ import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class PacketClient implements IMessage { @@ -44,7 +44,7 @@ public class PacketClient implements IMessage { public static class Handler implements IMessageHandler { @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IMessage onMessage(PacketClient message, MessageContext ctx) { NaturesAura.proxy.scheduleTask(() -> { Minecraft mc = Minecraft.getMinecraft(); diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketHandler.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketHandler.java index 753e22e1..9e3f95a3 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketHandler.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketHandler.java @@ -1,14 +1,14 @@ package de.ellpeck.naturesaura.packet; import de.ellpeck.naturesaura.NaturesAura; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EntityPlayerMP; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.ServerPlayerEntity; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.SimpleNetworkWrapper; -import net.minecraftforge.fml.relauncher.Side; +import net.minecraftforge.api.distmarker.Dist; public final class PacketHandler { @@ -16,10 +16,10 @@ public final class PacketHandler { public static void init() { network = new SimpleNetworkWrapper(NaturesAura.MOD_ID); - network.registerMessage(PacketParticleStream.Handler.class, PacketParticleStream.class, 0, Side.CLIENT); - network.registerMessage(PacketParticles.Handler.class, PacketParticles.class, 1, Side.CLIENT); - network.registerMessage(PacketAuraChunk.Handler.class, PacketAuraChunk.class, 2, Side.CLIENT); - network.registerMessage(PacketClient.Handler.class, PacketClient.class, 3, Side.CLIENT); + network.registerMessage(PacketParticleStream.Handler.class, PacketParticleStream.class, 0, Dist.CLIENT); + network.registerMessage(PacketParticles.Handler.class, PacketParticles.class, 1, Dist.CLIENT); + network.registerMessage(PacketAuraChunk.Handler.class, PacketAuraChunk.class, 2, Dist.CLIENT); + network.registerMessage(PacketClient.Handler.class, PacketClient.class, 3, Dist.CLIENT); } public static void sendToAllLoaded(World world, BlockPos pos, IMessage message) { @@ -30,7 +30,7 @@ public final class PacketHandler { network.sendToAllAround(message, new NetworkRegistry.TargetPoint(world.provider.getDimension(), pos.getX(), pos.getY(), pos.getZ(), range)); } - public static void sendTo(EntityPlayer player, IMessage message) { - network.sendTo(message, (EntityPlayerMP) player); + public static void sendTo(PlayerEntity player, IMessage message) { + network.sendTo(message, (ServerPlayerEntity) player); } } diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticleStream.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticleStream.java index 833ed626..3da1be1f 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticleStream.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticleStream.java @@ -6,8 +6,8 @@ import io.netty.buffer.ByteBuf; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class PacketParticleStream implements IMessage { @@ -68,7 +68,7 @@ public class PacketParticleStream implements IMessage { public static class Handler implements IMessageHandler { @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IMessage onMessage(PacketParticleStream message, MessageContext ctx) { NaturesAura.proxy.scheduleTask(() -> NaturesAuraAPI.instance().spawnParticleStream( message.startX, message.startY, message.startZ, diff --git a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java index c1487915..1412a7ab 100644 --- a/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java +++ b/src/main/java/de/ellpeck/naturesaura/packet/PacketParticles.java @@ -5,18 +5,18 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import io.netty.buffer.ByteBuf; -import net.minecraft.block.state.IBlockState; +import net.minecraft.block.BlockState; import net.minecraft.client.Minecraft; import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeColorHelper; +import net.minecraft.world.biome.BiomeColors; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; import net.minecraftforge.fml.common.network.simpleimpl.MessageContext; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public class PacketParticles implements IMessage { @@ -67,7 +67,7 @@ public class PacketParticles implements IMessage { public static class Handler implements IMessageHandler { @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public IMessage onMessage(PacketParticles message, MessageContext ctx) { NaturesAura.proxy.scheduleTask(() -> { World world = Minecraft.getMinecraft().world; @@ -76,7 +76,7 @@ public class PacketParticles implements IMessage { case 0: // Tree ritual: Gold powder BlockPos pos = new BlockPos(message.posX, message.posY, message.posZ); Multiblocks.TREE_RITUAL.forEach(pos, 'G', (dustPos, matcher) -> { - IBlockState state = world.getBlockState(dustPos); + BlockState state = world.getBlockState(dustPos); AxisAlignedBB box = state.getBoundingBox(world, dustPos); NaturesAuraAPI.instance().spawnMagicParticle( dustPos.getX() + box.minX + (box.maxX - box.minX) * world.rand.nextFloat(), @@ -225,7 +225,7 @@ public class PacketParticles implements IMessage { message.posX + 0.5F, message.posY + 0.5F, message.posZ + 0.5F, - 0.6F, BiomeColorHelper.getFoliageColorAtPos(world, new BlockPos(sapX, sapY, sapZ)), 1.5F); + 0.6F, BiomeColors.getFoliageColorAtPos(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 8b67654d..c341cba6 100644 --- a/src/main/java/de/ellpeck/naturesaura/particles/ParticleHandler.java +++ b/src/main/java/de/ellpeck/naturesaura/particles/ParticleHandler.java @@ -5,19 +5,19 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.particle.Particle; import net.minecraft.client.renderer.ActiveRenderInfo; import net.minecraft.client.renderer.BufferBuilder; -import net.minecraft.client.renderer.GlStateManager; +import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import org.lwjgl.opengl.GL11; import java.util.ArrayList; import java.util.List; import java.util.function.Supplier; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public final class ParticleHandler { public static boolean depthEnabled = true; @@ -65,7 +65,7 @@ public final class ParticleHandler { public static void renderParticles(float partialTicks) { Minecraft mc = Minecraft.getMinecraft(); - EntityPlayer player = mc.player; + PlayerEntity player = mc.player; if (player != null) { float x = ActiveRenderInfo.getRotationX(); diff --git a/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java b/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java index e6839320..1c9675f0 100644 --- a/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java +++ b/src/main/java/de/ellpeck/naturesaura/particles/ParticleMagic.java @@ -6,10 +6,10 @@ import net.minecraft.client.renderer.BufferBuilder; import net.minecraft.entity.Entity; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class ParticleMagic extends Particle { public static final ResourceLocation TEXTURE = new ResourceLocation(NaturesAura.MOD_ID, "textures/particles/magic_round.png"); diff --git a/src/main/java/de/ellpeck/naturesaura/potion/ModPotions.java b/src/main/java/de/ellpeck/naturesaura/potion/ModPotions.java index 3d6a18dc..79934134 100644 --- a/src/main/java/de/ellpeck/naturesaura/potion/ModPotions.java +++ b/src/main/java/de/ellpeck/naturesaura/potion/ModPotions.java @@ -1,9 +1,9 @@ package de.ellpeck.naturesaura.potion; -import net.minecraft.potion.Potion; +import net.minecraft.potion.Effect; public final class ModPotions { - public static final Potion BREATHLESS = new PotionBreathless().setIconIndex(0, 0); + public static final Effect BREATHLESS = new PotionBreathless().setIconIndex(0, 0); } diff --git a/src/main/java/de/ellpeck/naturesaura/potion/PotionBreathless.java b/src/main/java/de/ellpeck/naturesaura/potion/PotionBreathless.java index 60a72949..824d928c 100644 --- a/src/main/java/de/ellpeck/naturesaura/potion/PotionBreathless.java +++ b/src/main/java/de/ellpeck/naturesaura/potion/PotionBreathless.java @@ -1,11 +1,11 @@ package de.ellpeck.naturesaura.potion; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.potion.PotionEffect; +import net.minecraft.entity.LivingEntity; +import net.minecraft.potion.EffectInstance; import net.minecraft.util.DamageSource; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.event.entity.living.LivingHealEvent; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import java.util.Random; @@ -20,7 +20,7 @@ public class PotionBreathless extends PotionImpl { @SubscribeEvent public void onHeal(LivingHealEvent event) { - PotionEffect effect = event.getEntityLiving().getActivePotionEffect(this); + EffectInstance effect = event.getEntityLiving().getActivePotionEffect(this); if (effect == null) return; float chance = (effect.getAmplifier() + 1) / 15F; @@ -36,7 +36,7 @@ public class PotionBreathless extends PotionImpl { } @Override - public void performEffect(EntityLivingBase entity, int amplifier) { + public void performEffect(LivingEntity entity, int amplifier) { entity.attackEntityFrom(DamageSource.MAGIC, 1F); } } diff --git a/src/main/java/de/ellpeck/naturesaura/potion/PotionImpl.java b/src/main/java/de/ellpeck/naturesaura/potion/PotionImpl.java index 1271741f..a31ceda7 100644 --- a/src/main/java/de/ellpeck/naturesaura/potion/PotionImpl.java +++ b/src/main/java/de/ellpeck/naturesaura/potion/PotionImpl.java @@ -4,15 +4,15 @@ import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.reg.IModItem; import de.ellpeck.naturesaura.reg.ModRegistry; import net.minecraft.client.Minecraft; -import net.minecraft.potion.Potion; +import net.minecraft.potion.Effect; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; -public class PotionImpl extends Potion implements IModItem { +public class PotionImpl extends Effect implements IModItem { private static final ResourceLocation TEXTURE = new ResourceLocation(NaturesAura.MOD_ID, "textures/gui/potions.png"); protected final String baseName; @@ -25,12 +25,12 @@ public class PotionImpl extends Potion implements IModItem { } @Override - public Potion setIconIndex(int x, int y) { + public Effect setIconIndex(int x, int y) { return super.setIconIndex(x, y); } @Override - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) public int getStatusIconIndex() { Minecraft.getMinecraft().renderEngine.bindTexture(TEXTURE); return super.getStatusIconIndex(); diff --git a/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java b/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java index 32b25d27..17f5d7a3 100644 --- a/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/naturesaura/proxy/ClientProxy.java @@ -11,11 +11,11 @@ import de.ellpeck.naturesaura.renderers.PlayerLayerTrinkets; import de.ellpeck.naturesaura.renderers.SupporterFancyHandler; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.client.renderer.color.IItemColor; import net.minecraft.client.renderer.color.ItemColors; -import net.minecraft.client.renderer.entity.RenderPlayer; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.client.renderer.entity.PlayerRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; @@ -42,8 +42,8 @@ public class ClientProxy implements IProxy { @Override public void init(FMLInitializationEvent event) { - Map skinMap = Minecraft.getMinecraft().getRenderManager().getSkinMap(); - for (RenderPlayer render : new RenderPlayer[]{skinMap.get("default"), skinMap.get("slim")}) { + Map skinMap = Minecraft.getMinecraft().getRenderManager().getSkinMap(); + for (PlayerRenderer render : new PlayerRenderer[]{skinMap.get("default"), skinMap.get("slim")}) { render.addLayer(new PlayerLayerTrinkets()); } new SupporterFancyHandler(); @@ -80,7 +80,7 @@ public class ClientProxy implements IProxy { @Override public void registerTESR(ITESRProvider provider) { - Tuple tesr = provider.getTESR(); + Tuple tesr = provider.getTESR(); ClientRegistry.bindTileEntitySpecialRenderer(tesr.getFirst(), tesr.getSecond()); } diff --git a/src/main/java/de/ellpeck/naturesaura/proxy/IProxy.java b/src/main/java/de/ellpeck/naturesaura/proxy/IProxy.java index 1f60469d..9a02eebc 100644 --- a/src/main/java/de/ellpeck/naturesaura/proxy/IProxy.java +++ b/src/main/java/de/ellpeck/naturesaura/proxy/IProxy.java @@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.proxy; import de.ellpeck.naturesaura.reg.IColorProvidingBlock; import de.ellpeck.naturesaura.reg.IColorProvidingItem; import de.ellpeck.naturesaura.reg.ITESRProvider; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.registry.IRenderFactory; diff --git a/src/main/java/de/ellpeck/naturesaura/proxy/ServerProxy.java b/src/main/java/de/ellpeck/naturesaura/proxy/ServerProxy.java index 2676d656..39732c83 100644 --- a/src/main/java/de/ellpeck/naturesaura/proxy/ServerProxy.java +++ b/src/main/java/de/ellpeck/naturesaura/proxy/ServerProxy.java @@ -3,7 +3,7 @@ package de.ellpeck.naturesaura.proxy; import de.ellpeck.naturesaura.reg.IColorProvidingBlock; import de.ellpeck.naturesaura.reg.IColorProvidingItem; import de.ellpeck.naturesaura.reg.ITESRProvider; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.entity.Entity; import net.minecraft.item.ItemStack; import net.minecraftforge.fml.client.registry.IRenderFactory; diff --git a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java index d4760d51..5e6c32e7 100644 --- a/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java +++ b/src/main/java/de/ellpeck/naturesaura/recipes/ModRecipes.java @@ -14,17 +14,17 @@ import de.ellpeck.naturesaura.items.ItemAuraBottle; import de.ellpeck.naturesaura.items.ItemEffectPowder; import de.ellpeck.naturesaura.items.ModItems; import net.minecraft.block.Block; -import net.minecraft.block.BlockFlower; +import net.minecraft.block.FlowerBlock; import net.minecraft.block.BlockStoneBrick; -import net.minecraft.block.BlockWall; +import net.minecraft.block.WallBlock; import net.minecraft.entity.Entity; -import net.minecraft.entity.passive.EntitySheep; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.init.PotionTypes; -import net.minecraft.item.EnumDyeColor; +import net.minecraft.entity.passive.SheepEntity; +import net.minecraft.block.Blocks; +import net.minecraft.item.Items; +import net.minecraft.potion.Potions; +import net.minecraft.item.DyeColor; import net.minecraft.item.Item; -import net.minecraft.item.ItemPotion; +import net.minecraft.item.PotionItem; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.Ingredient; import net.minecraft.potion.PotionHelper; @@ -171,7 +171,7 @@ public final class ModRecipes { new AltarRecipe(res("soul_sand"), ing(Blocks.SAND), new ItemStack(Blocks.SOUL_SAND), conversion, 5000, 100).register(); new AltarRecipe(res("nether_wart"), ing(Blocks.RED_MUSHROOM), new ItemStack(Items.NETHER_WART), conversion, 30000, 250).register(); new AltarRecipe(res("prismarine"), ing(Items.QUARTZ), new ItemStack(Items.PRISMARINE_SHARD), conversion, 55000, 200).register(); - new AltarRecipe(res("water"), ing(Items.GLASS_BOTTLE), PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), PotionTypes.WATER), conversion, 25000, 200).register(); + new AltarRecipe(res("water"), ing(Items.GLASS_BOTTLE), PotionUtils.addPotionToItemStack(new ItemStack(Items.POTIONITEM), Potions.WATER), conversion, 25000, 200).register(); new AltarRecipe(res("coal"),ing(new ItemStack(Items.COAL, 1, 1)), new ItemStack(Items.COAL), conversion, 30000, 250).register(); Ingredient crushing = ing(ModBlocks.CRUSHING_CATALYST); @@ -213,21 +213,21 @@ public final class ModRecipes { Blocks.STONEBRICK.getDefaultState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.DEFAULT), Blocks.STONEBRICK.getDefaultState().withProperty(BlockStoneBrick.VARIANT, BlockStoneBrick.EnumType.MOSSY)); NaturesAuraAPI.BOTANIST_PICKAXE_CONVERSIONS.put( - Blocks.COBBLESTONE_WALL.getDefaultState().withProperty(BlockWall.VARIANT, BlockWall.EnumType.NORMAL), - Blocks.COBBLESTONE_WALL.getDefaultState().withProperty(BlockWall.VARIANT, BlockWall.EnumType.MOSSY)); + Blocks.COBBLESTONE_WALL.getDefaultState().withProperty(WallBlock.VARIANT, WallBlock.EnumType.NORMAL), + Blocks.COBBLESTONE_WALL.getDefaultState().withProperty(WallBlock.VARIANT, WallBlock.EnumType.MOSSY)); for (Block block : ForgeRegistries.BLOCKS) - if (block instanceof BlockFlower) + if (block instanceof FlowerBlock) NaturesAuraAPI.FLOWERS.addAll(block.getBlockState().getValidStates()); spawner("cow", "minecraft:cow", 50000, 60, ing(Items.BEEF), ing(Items.LEATHER)); - for (EnumDyeColor color : EnumDyeColor.values()) + for (DyeColor color : DyeColor.values()) new AnimalSpawnerRecipe(res("sheep_" + color.getName()), new ResourceLocation("minecraft:sheep"), 500, 60, ing(ModItems.BIRTH_SPIRIT), ing(Items.MUTTON), ing(new ItemStack(Blocks.WOOL, 1, color.getMetadata()))) { @Override public Entity makeEntity(World world, double x, double y, double z) { - EntitySheep sheep = (EntitySheep) super.makeEntity(world, x, y, z); + SheepEntity sheep = (SheepEntity) super.makeEntity(world, x, y, z); sheep.setFleeceColor(color); return sheep; } @@ -246,7 +246,7 @@ public final class ModRecipes { spawner("skeleton", "minecraft:skeleton", 100000, 120, ing(Items.BONE), ing(Items.ARROW)); spawner("enderman", "minecraft:enderman", 120000, 120, ing(Items.ENDER_PEARL)); spawner("silverfish", "minecraft:silverfish", 30000, 40, ing(Blocks.STONE)); - spawner("squid", "minecraft:squid", 50000, 40, ing(new ItemStack(Items.DYE, 1, EnumDyeColor.BLACK.getDyeDamage()))); + spawner("squid", "minecraft:squid", 50000, 40, ing(new ItemStack(Items.DYE, 1, DyeColor.BLACK.getDyeDamage()))); spawner("stray", "minecraft:stray", 100000, 120, ing(Items.BONE), ing(Blocks.ICE)); spawner("shulker", "minecraft:shulker", 150000, 100, ing(Items.SHULKER_SHELL)); spawner("husk", "minecraft:husk", 100000, 120, ing(Items.ROTTEN_FLESH), ing(Blocks.SAND)); diff --git a/src/main/java/de/ellpeck/naturesaura/reg/IColorProvidingBlock.java b/src/main/java/de/ellpeck/naturesaura/reg/IColorProvidingBlock.java index d55a80a1..6d4202c4 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/IColorProvidingBlock.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/IColorProvidingBlock.java @@ -1,12 +1,12 @@ package de.ellpeck.naturesaura.reg; import net.minecraft.client.renderer.color.IBlockColor; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public interface IColorProvidingBlock { - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) IBlockColor getBlockColor(); } diff --git a/src/main/java/de/ellpeck/naturesaura/reg/IColorProvidingItem.java b/src/main/java/de/ellpeck/naturesaura/reg/IColorProvidingItem.java index 2a66dd63..1a5a734a 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/IColorProvidingItem.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/IColorProvidingItem.java @@ -1,12 +1,12 @@ package de.ellpeck.naturesaura.reg; import net.minecraft.client.renderer.color.IItemColor; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public interface IColorProvidingItem { - @SideOnly(Side.CLIENT) + @OnlyIn(Dist.CLIENT) IItemColor getItemColor(); } diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ICreativeItem.java b/src/main/java/de/ellpeck/naturesaura/reg/ICreativeItem.java index c021ae81..82a7ec0f 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ICreativeItem.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ICreativeItem.java @@ -1,11 +1,11 @@ package de.ellpeck.naturesaura.reg; import de.ellpeck.naturesaura.NaturesAura; -import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.ItemGroup; public interface ICreativeItem { - default CreativeTabs getTabToAdd() { + default ItemGroup getTabToAdd() { return NaturesAura.CREATIVE_TAB; } } diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ICustomItemBlockProvider.java b/src/main/java/de/ellpeck/naturesaura/reg/ICustomItemBlockProvider.java index f308efc7..2eff36a8 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ICustomItemBlockProvider.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ICustomItemBlockProvider.java @@ -1,9 +1,9 @@ package de.ellpeck.naturesaura.reg; -import net.minecraft.item.ItemBlock; +import net.minecraft.item.BlockItem; public interface ICustomItemBlockProvider { - ItemBlock getItemBlock(); + BlockItem getItemBlock(); } diff --git a/src/main/java/de/ellpeck/naturesaura/reg/IModelProvider.java b/src/main/java/de/ellpeck/naturesaura/reg/IModelProvider.java index 1e202408..abe75c4c 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/IModelProvider.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/IModelProvider.java @@ -2,7 +2,7 @@ package de.ellpeck.naturesaura.reg; import de.ellpeck.naturesaura.NaturesAura; import net.minecraft.block.Block; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; +import net.minecraft.client.renderer.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ITESRProvider.java b/src/main/java/de/ellpeck/naturesaura/reg/ITESRProvider.java index 2c150201..17a5959b 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ITESRProvider.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ITESRProvider.java @@ -1,13 +1,13 @@ package de.ellpeck.naturesaura.reg; -import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; +import net.minecraft.client.renderer.tileentity.TileEntityRenderer; import net.minecraft.util.Tuple; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; public interface ITESRProvider { - @SideOnly(Side.CLIENT) - Tuple getTESR(); + @OnlyIn(Dist.CLIENT) + Tuple getTESR(); } diff --git a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java index 8505f01b..922ebed4 100644 --- a/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java +++ b/src/main/java/de/ellpeck/naturesaura/reg/ModRegistry.java @@ -2,12 +2,12 @@ package de.ellpeck.naturesaura.reg; import de.ellpeck.naturesaura.NaturesAura; import net.minecraft.block.Block; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.client.renderer.model.ModelResourceLocation; +import net.minecraft.item.ItemGroup; import net.minecraft.item.Item; -import net.minecraft.item.ItemBlock; +import net.minecraft.item.BlockItem; import net.minecraft.item.ItemStack; -import net.minecraft.potion.Potion; +import net.minecraft.potion.Effect; import net.minecraftforge.fml.common.event.FMLInitializationEvent; import net.minecraftforge.fml.common.event.FMLPostInitializationEvent; import net.minecraftforge.fml.common.event.FMLPreInitializationEvent; @@ -25,14 +25,14 @@ public final class ModRegistry { ALL_ITEMS.add(item); } - private static void registerPotion(Potion potion, String name) { + private static void registerPotion(Effect potion, String name) { potion.setPotionName("potion." + NaturesAura.MOD_ID + "." + name + ".name"); potion.setRegistryName(NaturesAura.MOD_ID, name); ForgeRegistries.POTIONS.register(potion); } - private static void registerItem(Item item, String name, CreativeTabs tab) { + private static void registerItem(Item item, String name, ItemGroup tab) { item.setTranslationKey(NaturesAura.MOD_ID + "." + name); item.setRegistryName(NaturesAura.MOD_ID, name); @@ -41,7 +41,7 @@ public final class ModRegistry { item.setCreativeTab(tab); } - private static void registerBlock(Block block, String name, ItemBlock item, CreativeTabs tab) { + private static void registerBlock(Block block, String name, BlockItem item, ItemGroup tab) { block.setTranslationKey(NaturesAura.MOD_ID + "." + name); block.setRegistryName(NaturesAura.MOD_ID, name); @@ -55,7 +55,7 @@ public final class ModRegistry { block.setCreativeTab(tab); } - private static CreativeTabs getTab(IModItem item) { + private static ItemGroup getTab(IModItem item) { if (item instanceof ICreativeItem) return ((ICreativeItem) item).getTabToAdd(); return null; @@ -68,15 +68,15 @@ public final class ModRegistry { } else if (item instanceof Block) { Block block = (Block) item; - ItemBlock itemBlock; + BlockItem itemBlock; if (item instanceof ICustomItemBlockProvider) itemBlock = ((ICustomItemBlockProvider) item).getItemBlock(); else - itemBlock = new ItemBlock(block); + itemBlock = new BlockItem(block); registerBlock(block, item.getBaseName(), itemBlock, getTab(item)); - } else if (item instanceof Potion) - registerPotion((Potion) item, item.getBaseName()); + } else if (item instanceof Effect) + registerPotion((Effect) item, item.getBaseName()); if (item instanceof IModelProvider) { Map models = ((IModelProvider) item).getModelLocations(); diff --git a/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java b/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java index e7536a53..56b47162 100644 --- a/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java +++ b/src/main/java/de/ellpeck/naturesaura/renderers/PlayerLayerTrinkets.java @@ -4,28 +4,28 @@ import baubles.api.BaublesApi; 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.renderer.GlStateManager; +import com.mojang.blaze3d.platform.GlStateManager; import net.minecraft.client.renderer.entity.layers.LayerRenderer; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.MobEffects; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.potion.Effects; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.items.IItemHandler; import javax.annotation.Nonnull; import java.util.HashSet; import java.util.Set; -@SideOnly(Side.CLIENT) -public class PlayerLayerTrinkets implements LayerRenderer { +@OnlyIn(Dist.CLIENT) +public class PlayerLayerTrinkets implements LayerRenderer { private final Set alreadyRendered = new HashSet<>(); @Override - public void doRenderLayer(@Nonnull EntityPlayer player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { - if (player.getActivePotionEffect(MobEffects.INVISIBILITY) != null) + public void doRenderLayer(@Nonnull PlayerEntity player, float limbSwing, float limbSwingAmount, float partialTicks, float ageInTicks, float netHeadYaw, float headPitch, float scale) { + if (player.getActivePotionEffect(Effects.INVISIBILITY) != null) return; ItemStack main = player.getHeldItemMainhand(); ItemStack second = player.getHeldItemOffhand(); @@ -45,7 +45,7 @@ public class PlayerLayerTrinkets implements LayerRenderer { } - private void render(EntityPlayer player, RenderType type, ItemStack main, ItemStack second) { + private void render(PlayerEntity player, RenderType type, ItemStack main, ItemStack second) { for (int i = 0; i < player.inventory.getSizeInventory(); i++) { this.renderStack(player.inventory.getStackInSlot(i), player, type, main, second); } @@ -58,7 +58,7 @@ public class PlayerLayerTrinkets implements LayerRenderer { } } - private void renderStack(ItemStack stack, EntityPlayer player, RenderType type, ItemStack main, ItemStack second) { + private void renderStack(ItemStack stack, PlayerEntity player, RenderType type, ItemStack main, ItemStack second) { if (!stack.isEmpty()) { Item item = stack.getItem(); if (item instanceof ITrinketItem && !this.alreadyRendered.contains(item)) { diff --git a/src/main/java/de/ellpeck/naturesaura/renderers/SupporterFancyHandler.java b/src/main/java/de/ellpeck/naturesaura/renderers/SupporterFancyHandler.java index 13be19f8..64e4b2de 100644 --- a/src/main/java/de/ellpeck/naturesaura/renderers/SupporterFancyHandler.java +++ b/src/main/java/de/ellpeck/naturesaura/renderers/SupporterFancyHandler.java @@ -5,16 +5,16 @@ import com.google.gson.stream.JsonReader; import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.api.NaturesAuraAPI; import net.minecraft.client.Minecraft; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.entity.player.EnumPlayerModelParts; +import net.minecraft.entity.player.PlayerEntity; +import net.minecraft.entity.player.PlayerModelPart; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import net.minecraft.world.biome.BiomeColorHelper; +import net.minecraft.world.biome.BiomeColors; import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; +import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; -import net.minecraftforge.fml.relauncher.Side; -import net.minecraftforge.fml.relauncher.SideOnly; +import net.minecraftforge.api.distmarker.Dist; +import net.minecraftforge.api.distmarker.OnlyIn; import java.io.File; import java.io.FileInputStream; @@ -25,7 +25,7 @@ import java.util.HashMap; import java.util.Map; import java.util.Random; -@SideOnly(Side.CLIENT) +@OnlyIn(Dist.CLIENT) public class SupporterFancyHandler { public static final Map FANCY_INFOS = new HashMap<>(); @@ -39,10 +39,10 @@ public class SupporterFancyHandler { public void onPlayerTick(TickEvent.PlayerTickEvent event) { if (event.phase != TickEvent.Phase.END) return; - EntityPlayer player = event.player; + PlayerEntity player = event.player; if (!player.world.isRemote) return; - if (player.isInvisible() || !player.isWearing(EnumPlayerModelParts.CAPE)) + if (player.isInvisible() || !player.isWearing(PlayerModelPart.CAPE)) return; Minecraft mc = Minecraft.getMinecraft(); if (player == mc.player && mc.gameSettings.thirdPersonView == 0) @@ -56,7 +56,7 @@ public class SupporterFancyHandler { int color; if (info.tier == 1) { BlockPos pos = player.getPosition(); - color = BiomeColorHelper.getFoliageColorAtPos(player.world, pos); + color = BiomeColors.getFoliageColorAtPos(player.world, pos); } else { color = info.color; }