From 1e2732195def8103fcefba425f2daa1e6bf8b03a Mon Sep 17 00:00:00 2001 From: Ellpeck Date: Fri, 18 Mar 2016 23:47:22 +0100 Subject: [PATCH] 1.9. Fuck my face. --- build.gradle | 8 +- .../actuallyadditions/api/lens/Lens.java | 9 +- .../api/recipe/coffee/CoffeeBrewing.java | 15 ++- .../api/tile/IPhantomTile.java | 2 +- .../mod/ActuallyAdditions.java | 5 +- .../mod/blocks/BlockAtomicReconstructor.java | 21 ++-- .../mod/blocks/BlockBreaker.java | 10 +- .../mod/blocks/BlockCanolaPress.java | 8 +- .../mod/blocks/BlockCoalGenerator.java | 10 +- .../mod/blocks/BlockCoffeeMachine.java | 18 +-- .../mod/blocks/BlockColoredLamp.java | 14 +-- .../mod/blocks/BlockCompost.java | 37 +++--- .../mod/blocks/BlockDirectionalBreaker.java | 10 +- .../mod/blocks/BlockDropper.java | 10 +- .../mod/blocks/BlockEnergizer.java | 8 +- .../mod/blocks/BlockFeeder.java | 8 +- .../mod/blocks/BlockFermentingBarrel.java | 8 +- .../mod/blocks/BlockFireworkBox.java | 8 +- .../mod/blocks/BlockFishingNet.java | 11 +- .../mod/blocks/BlockFluidCollector.java | 10 +- .../mod/blocks/BlockFurnaceDouble.java | 16 +-- .../mod/blocks/BlockFurnaceSolar.java | 12 +- .../mod/blocks/BlockGeneric.java | 3 +- .../mod/blocks/BlockGiantChest.java | 8 +- .../mod/blocks/BlockGreenhouseGlass.java | 20 ++-- .../mod/blocks/BlockGrinder.java | 12 +- .../mod/blocks/BlockHeatCollector.java | 3 +- .../mod/blocks/BlockInputter.java | 8 +- .../mod/blocks/BlockItemRepairer.java | 10 +- .../mod/blocks/BlockLampPowerer.java | 7 +- .../mod/blocks/BlockLaserRelay.java | 46 +------- .../blocks/BlockLavaFactoryController.java | 7 +- .../mod/blocks/BlockLeafGenerator.java | 5 +- .../mod/blocks/BlockMiner.java | 14 ++- .../mod/blocks/BlockOilGenerator.java | 10 +- .../mod/blocks/BlockPhantom.java | 21 ++-- .../mod/blocks/BlockPhantomBooster.java | 13 ++- .../mod/blocks/BlockRangedCollector.java | 8 +- .../mod/blocks/BlockSlabs.java | 51 +++++---- .../mod/blocks/BlockSmileyCloud.java | 85 +++++++------- .../mod/blocks/BlockTreasureChest.java | 14 ++- .../mod/blocks/BlockWallAA.java | 108 ++++++++---------- .../mod/blocks/BlockWildPlant.java | 14 ++- .../mod/blocks/BlockXPSolidifier.java | 10 +- .../mod/blocks/IHudDisplay.java | 4 +- .../mod/blocks/base/BlockBase.java | 6 +- .../mod/blocks/base/BlockBushBase.java | 9 +- .../mod/blocks/base/BlockContainerBase.java | 20 ++-- .../mod/blocks/base/BlockFluidFlowing.java | 2 +- .../mod/blocks/base/BlockPlant.java | 22 ++-- .../mod/booklet/BookletUtils.java | 16 +-- .../mod/booklet/GuiBooklet.java | 36 +++--- .../mod/booklet/button/BookmarkButton.java | 10 +- .../mod/booklet/button/IndexButton.java | 4 +- .../mod/booklet/chapter/BookletChapter.java | 10 +- .../mod/booklet/entry/BookletEntry.java | 10 +- .../mod/booklet/page/BookletPageAA.java | 14 +-- .../mod/booklet/page/PageCrafting.java | 4 +- .../mod/booklet/page/PageCrusherRecipe.java | 4 +- .../mod/booklet/page/PageFurnace.java | 4 +- .../mod/booklet/page/PageReconstructor.java | 4 +- .../mod/creative/CreativeTab.java | 2 +- .../mod/event/BucketFillEvent.java | 6 +- .../actuallyadditions/mod/event/HudEvent.java | 14 +-- .../mod/event/TooltipEvent.java | 14 +-- .../mod/event/WorldDecorationEvent.java | 6 +- .../mod/gen/JamVillagerTradeHandler.java | 2 +- .../actuallyadditions/mod/gen/OreGen.java | 15 +-- .../mod/inventory/ContainerDrill.java | 9 +- .../mod/inventory/ContainerEnergizer.java | 2 +- .../mod/inventory/ContainerEnervator.java | 5 +- .../mod/inventory/ContainerInputter.java | 5 +- .../inventory/ContainerRangedCollector.java | 5 +- .../mod/inventory/GuiHandler.java | 2 +- .../mod/inventory/gui/GuiInputter.java | 6 +- .../mod/inventory/gui/GuiSmileyCloud.java | 4 +- .../mod/items/InitItems.java | 74 ++++++------ .../mod/items/ItemBooklet.java | 37 +++--- .../mod/items/ItemChestToCrateUpgrade.java | 10 +- .../mod/items/ItemCoffee.java | 24 ++-- .../mod/items/ItemCrafterOnAStick.java | 7 +- .../mod/items/ItemDrill.java | 57 +++++---- .../mod/items/ItemDrillUpgrade.java | 8 +- .../actuallyadditions/mod/items/ItemDust.java | 5 +- .../mod/items/ItemFertilizer.java | 10 +- .../mod/items/ItemFoods.java | 8 +- .../mod/items/ItemGrowthRing.java | 9 +- .../mod/items/ItemHairyBall.java | 13 ++- .../actuallyadditions/mod/items/ItemJams.java | 17 +-- .../mod/items/ItemKnife.java | 7 +- .../mod/items/ItemLaserWrench.java | 21 ++-- .../mod/items/ItemLeafBlower.java | 21 ++-- .../mod/items/ItemMagnetRing.java | 8 +- .../mod/items/ItemPhantomConnector.java | 26 +++-- .../mod/items/ItemPotionRing.java | 15 ++- .../mod/items/ItemResonantRice.java | 8 +- .../mod/items/ItemSolidifiedExperience.java | 7 +- .../mod/items/ItemTeleStaff.java | 25 ++-- .../mod/items/ItemWaterRemovalRing.java | 6 +- .../mod/items/base/ItemAllToolAA.java | 24 ++-- .../mod/items/base/ItemArmorAA.java | 10 +- .../mod/items/base/ItemSeed.java | 2 +- .../mod/items/lens/LensColor.java | 9 +- .../mod/items/lens/LensDeath.java | 11 +- .../mod/items/lens/LensDetonation.java | 7 +- .../mod/items/lens/LensNone.java | 11 +- .../mod/items/metalists/ThePotionRings.java | 25 ++-- .../mod/jei/booklet/BookletRecipeWrapper.java | 12 +- .../mod/material/InitArmorMaterials.java | 20 ++-- .../mod/misc/DamageSources.java | 8 +- .../mod/misc/DispenserHandlerEmptyBucket.java | 5 +- .../mod/misc/DispenserHandlerFertilize.java | 2 +- .../mod/misc/DispenserHandlerFillBucket.java | 2 +- .../mod/misc/DungeonLoot.java | 15 +-- .../mod/misc/LaserRelayConnectionHandler.java | 2 +- .../actuallyadditions/mod/misc/WorldData.java | 3 +- .../mod/misc/special/RenderSpecial.java | 6 +- .../mod/network/PacketParticle.java | 4 +- .../mod/network/PacketUpdateTileEntity.java | 2 +- .../mod/network/gui/PacketGuiButton.java | 4 +- .../mod/network/gui/PacketGuiNumber.java | 4 +- .../mod/network/gui/PacketGuiString.java | 4 +- .../mod/proxy/ClientProxy.java | 4 +- .../tile/TileEntityAtomicReconstructor.java | 9 +- .../mod/tile/TileEntityBase.java | 10 +- .../mod/tile/TileEntityBreaker.java | 11 +- .../mod/tile/TileEntityCoffeeMachine.java | 3 +- .../tile/TileEntityDirectionalBreaker.java | 6 +- .../mod/tile/TileEntityFeeder.java | 4 +- .../mod/tile/TileEntityFireworkBox.java | 2 +- .../mod/tile/TileEntityFishingNet.java | 31 +++-- .../mod/tile/TileEntityFluidCollector.java | 2 +- .../mod/tile/TileEntityFurnaceSolar.java | 4 +- .../mod/tile/TileEntityGreenhouseGlass.java | 2 +- .../mod/tile/TileEntityGrinder.java | 3 +- .../mod/tile/TileEntityHeatCollector.java | 4 +- .../mod/tile/TileEntityInventoryBase.java | 8 +- .../mod/tile/TileEntityLaserRelay.java | 2 +- .../tile/TileEntityLavaFactoryController.java | 2 +- .../mod/tile/TileEntityLeafGenerator.java | 9 +- .../mod/tile/TileEntityMiner.java | 8 +- .../mod/tile/TileEntityPhantomPlacer.java | 12 +- .../mod/tile/TileEntityPhantomface.java | 7 +- .../mod/tile/TileEntityRangedCollector.java | 4 +- .../UpdateCheckerClientNotificationEvent.java | 10 +- .../actuallyadditions/mod/util/AssetUtil.java | 26 ++--- .../mod/util/FluidStateMapper.java | 2 +- .../actuallyadditions/mod/util/ItemUtil.java | 4 +- .../actuallyadditions/mod/util/PosUtil.java | 10 +- .../mod/util/StringUtil.java | 6 +- .../actuallyadditions/mod/util/Util.java | 16 +-- .../actuallyadditions/mod/util/WorldUtil.java | 44 ++++--- 152 files changed, 1008 insertions(+), 883 deletions(-) diff --git a/build.gradle b/build.gradle index d3a1eedf1..71a7368cf 100644 --- a/build.gradle +++ b/build.gradle @@ -17,12 +17,12 @@ group = "de.ellpeck.actuallyadditions" archivesBaseName = "ActuallyAdditions" minecraft { - version = "1.8.9-11.15.1.1764" + version = "1.9-12.16.0.1767-1.9" runDir = "idea" - mappings = "stable_22" + mappings = "snapshot_20160312" makeObfSourceJar = false - useDepAts = true + //useDepAts = true replaceIn "ModUtil.java" replace "@VERSION@", project.version.toString() @@ -42,7 +42,7 @@ dependencies { //compile "codechicken:CodeChickenCore:1.8-1.0.5.36:dev" //compile "codechicken:NotEnoughItems:1.8-1.0.5.104:dev" - deobfCompile "mezz.jei:jei_1.8.9:2.28.6.173" + //deobfCompile "mezz.jei:jei_1.8.9:2.28.6.173" } processResources { diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java b/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java index de2bd038c..0e54094d8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/lens/Lens.java @@ -11,8 +11,9 @@ package de.ellpeck.actuallyadditions.api.lens; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; +import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; /** * This is the base class for a Reconstructor Lens Type (NOT THE ITEM!) @@ -32,7 +33,7 @@ public abstract class Lens{ * @param tile The tile the lens was invoked from * @return If the Reconstructor should stop continuing (return false if you want it to go through blocks) */ - public abstract boolean invoke(BlockPos hitBlock, IAtomicReconstructor tile); + public abstract boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile); /** * Returns the color in an array of 3 float values that are r, g, b @@ -40,12 +41,12 @@ public abstract class Lens{ public abstract float[] getColor(); /** - * Gets the maximum distance the beam goes with this lense + * Gets the maximum distance the beam goes with this lens */ public abstract int getDistance(); /** - * Sets the item corresponding to the lense + * Sets the item corresponding to the lens */ public void setLensItem(Item item){ this.lensItem = item; diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/coffee/CoffeeBrewing.java b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/coffee/CoffeeBrewing.java index b7ec3e8b6..a8e07bfdc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/recipe/coffee/CoffeeBrewing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/recipe/coffee/CoffeeBrewing.java @@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.api.recipe.coffee; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import java.util.ArrayList; @@ -49,7 +50,7 @@ public class CoffeeBrewing{ PotionEffect[] effectsStack = getEffectsFromStack(stack); if(effectsStack != null && effectsStack.length > 0){ for(PotionEffect effectStack : effectsStack){ - if(effect.getPotionID() == effectStack.getPotionID()){ + if(effect.getPotion() == effectStack.getPotion()){ return effectStack; } } @@ -61,8 +62,8 @@ public class CoffeeBrewing{ PotionEffect[] effects = getEffectsFromStack(stack); stack.setTagCompound(new NBTTagCompound()); for(int i = 0; i < effects.length; i++){ - if(effects[i].getPotionID() == effect.getPotionID()){ - effects[i] = new PotionEffect(effects[i].getPotionID(), effects[i].getDuration()+(addDur ? effect.getDuration() : 0), effects[i].getAmplifier()+(addAmp ? (effect.getAmplifier() > 0 ? effect.getAmplifier() : 1) : 0)); + if(effects[i].getPotion() == effect.getPotion()){ + effects[i] = new PotionEffect(effects[i].getPotion(), effects[i].getDuration()+(addDur ? effect.getDuration() : 0), effects[i].getAmplifier()+(addAmp ? (effect.getAmplifier() > 0 ? effect.getAmplifier() : 1) : 0)); } addEffectToStack(stack, effects[i]); } @@ -76,7 +77,7 @@ public class CoffeeBrewing{ int prevCounter = tag.getInteger("Counter"); NBTTagCompound compound = new NBTTagCompound(); - compound.setInteger("ID", effect.getPotionID()); + compound.setInteger("ID", Potion.getIdFromPotion(effect.getPotion())); compound.setInteger("Duration", effect.getDuration()); compound.setInteger("Amplifier", effect.getAmplifier()); @@ -94,10 +95,8 @@ public class CoffeeBrewing{ int counter = tag.getInteger("Counter"); while(counter > 0){ NBTTagCompound compound = (NBTTagCompound)tag.getTag(counter+""); - PotionEffect effect = new PotionEffect(compound.getInteger("ID"), compound.getInteger("Duration"), compound.getByte("Amplifier")); - if(effect.getPotionID() > 0){ - effects.add(effect); - } + PotionEffect effect = new PotionEffect(Potion.getPotionById(compound.getInteger("ID")), compound.getInteger("Duration"), compound.getByte("Amplifier")); + effects.add(effect); counter--; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/api/tile/IPhantomTile.java b/src/main/java/de/ellpeck/actuallyadditions/api/tile/IPhantomTile.java index e034a2228..3cae62727 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/api/tile/IPhantomTile.java +++ b/src/main/java/de/ellpeck/actuallyadditions/api/tile/IPhantomTile.java @@ -10,7 +10,7 @@ package de.ellpeck.actuallyadditions.api.tile; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; /** * Extending this will cause a TileEntity to be able to be connected via a Phantom Connector diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java index 049dc4f1a..619ee1700 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/ActuallyAdditions.java @@ -121,11 +121,8 @@ public class ActuallyAdditions{ Util.registerDispenserHandler(InitItems.itemBucketCanolaOil, new DispenserHandlerEmptyBucket()); Util.registerDispenserHandler(Items.bucket, new DispenserHandlerFillBucket()); Util.registerDispenserHandler(InitItems.itemFertilizer, new DispenserHandlerFertilize()); - } - @EventHandler - public void serverStarted(FMLServerStartedEvent event){ - WorldData.init(); + WorldData.init(event.getServer()); } @EventHandler diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java index e96154ccf..1d3ba4006 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockAtomicReconstructor.java @@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityAtomicReconstructor; import de.ellpeck.actuallyadditions.mod.util.*; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -28,10 +29,11 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.profiler.Profiler; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -49,23 +51,22 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud this.setHarvestLevel("pickaxe", 0); this.setHardness(10F); this.setResistance(80F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override - public boolean isOpaqueCube(){ + public boolean isOpaqueCube(IBlockState state){ return false; } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing par6, float par7, float par8, float par9){ if(this.tryToggleRedstone(world, pos, player)){ return true; } if(!world.isRemote){ TileEntityAtomicReconstructor reconstructor = (TileEntityAtomicReconstructor)world.getTileEntity(pos); if(reconstructor != null){ - ItemStack heldItem = player.getCurrentEquippedItem(); if(heldItem != null){ if(heldItem.getItem() instanceof ILensItem && reconstructor.getStackInSlot(0) == null){ ItemStack toPut = heldItem.copy(); @@ -98,7 +99,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud @Override @SideOnly(Side.CLIENT) - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){ + public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); if(tile instanceof TileEntityAtomicReconstructor){ ItemStack slot = ((TileEntityAtomicReconstructor)tile).getStackInSlot(0); @@ -111,7 +112,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud AssetUtil.renderStackToGui(slot, resolution.getScaledWidth()/2+15, resolution.getScaledHeight()/2-29, 1F); } - minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE); } } @@ -127,7 +128,7 @@ public class BlockAtomicReconstructor extends BlockContainerBase implements IHud @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ - int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal(); + int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal(); PosUtil.setMetadata(pos, world, rotation, 2); super.onBlockPlacedBy(world, pos, state, player, stack); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java index a09f346c6..256528f26 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockBreaker.java @@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBreaker; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -25,8 +26,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockBreaker extends BlockContainerBase{ @@ -40,7 +42,7 @@ public class BlockBreaker extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override @@ -49,7 +51,7 @@ public class BlockBreaker extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(this.tryToggleRedstone(world, pos, player)){ return true; } @@ -70,7 +72,7 @@ public class BlockBreaker extends BlockContainerBase{ @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ - int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal(); + int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal(); PosUtil.setMetadata(pos, world, rotation, 2); super.onBlockPlacedBy(world, pos, state, player, stack); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java index 1487ff364..dd76ce5b2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCanolaPress.java @@ -14,14 +14,16 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCanolaPress; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockCanolaPress extends BlockContainerBase{ @@ -31,7 +33,7 @@ public class BlockCanolaPress extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override @@ -40,7 +42,7 @@ public class BlockCanolaPress extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityCanolaPress press = (TileEntityCanolaPress)world.getTileEntity(pos); if(press != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java index 01bf95c68..16f90805f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoalGenerator.java @@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoalGenerator; import de.ellpeck.actuallyadditions.mod.util.PosUtil; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -24,9 +25,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -42,7 +44,7 @@ public class BlockCoalGenerator extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); this.setTickRandomly(true); } @@ -53,7 +55,7 @@ public class BlockCoalGenerator extends BlockContainerBase{ @Override @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){ + public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){ int meta = PosUtil.getMetadata(state); if(meta == 1){ @@ -64,7 +66,7 @@ public class BlockCoalGenerator extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityCoalGenerator press = (TileEntityCoalGenerator)world.getTileEntity(pos); if(press != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java index 7c49c7e23..d8cc50724 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCoffeeMachine.java @@ -15,6 +15,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCoffeeMachine; import de.ellpeck.actuallyadditions.mod.util.PosUtil; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -23,11 +24,13 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; +//TODO Fix bounding box public class BlockCoffeeMachine extends BlockContainerBase{ private static final PropertyInteger META = PropertyInteger.create("meta", 0, 3); @@ -37,24 +40,21 @@ public class BlockCoffeeMachine extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); - - float f = 1/16F; - this.setBlockBounds(f, 0F, f, 1F-f, 1F-2*f, 1F-f); + this.setStepSound(SoundType.STONE); } @Override - public boolean isFullCube(){ + public boolean isFullCube(IBlockState state){ return false; } @Override - public boolean isOpaqueCube(){ + public boolean isOpaqueCube(IBlockState state){ return false; } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing f6, float f7, float f8, float f9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing f6, float f7, float f8, float f9){ if(!world.isRemote){ TileEntityCoffeeMachine machine = (TileEntityCoffeeMachine)world.getTileEntity(pos); if(machine != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java index 31e397b35..9bb11da4a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockColoredLamp.java @@ -27,9 +27,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -64,7 +65,7 @@ public class BlockColoredLamp extends BlockBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing side, float hitX, float hitY, float hitZ){ //Turning On if(player.isSneaking()){ if(!world.isRemote){ @@ -73,7 +74,6 @@ public class BlockColoredLamp extends BlockBase{ return true; } - ItemStack stack = player.getCurrentEquippedItem(); if(stack != null){ //Changing Colors int[] oreIDs = OreDictionary.getOreIDs(stack); @@ -104,12 +104,6 @@ public class BlockColoredLamp extends BlockBase{ return new ItemStack(InitBlocks.blockColoredLamp, 1, this.getMetaFromState(state)); } - @Override - @SideOnly(Side.CLIENT) - public Item getItem(World world, BlockPos pos){ - return Item.getItemFromBlock(InitBlocks.blockColoredLamp); - } - @SuppressWarnings("all") @SideOnly(Side.CLIENT) public void getSubBlocks(Item item, CreativeTabs tab, List list){ @@ -119,7 +113,7 @@ public class BlockColoredLamp extends BlockBase{ } @Override - public int getLightValue(IBlockAccess world, BlockPos pos){ + public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){ return this.isOn ? 15 : 0; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java index cb2ce873e..74993b07d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockCompost.java @@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.tile.TileEntityCompost; import de.ellpeck.actuallyadditions.mod.util.AssetUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -28,12 +29,13 @@ import net.minecraft.item.ItemStack; import net.minecraft.profiler.Profiler; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import java.util.List; - public class BlockCompost extends BlockContainerBase implements IHudDisplay{ public BlockCompost(String name){ @@ -41,11 +43,17 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{ this.setHarvestLevel("axe", 0); this.setHardness(0.5F); this.setResistance(5.0F); - this.setStepSound(soundTypeWood); + this.setStepSound(SoundType.WOOD); - this.setBlockBoundsForItemRender(); + //this.setBlockBoundsForItemRender(); } + //TODO Fix bounding box + /*@Override + public void setBlockBoundsForItemRender(){ + float f = 1.0F/16.0F; + this.setBlockBounds(f, 0.0F, f, 1.0F-f, 11*f, 1.0F-f); + } @Override public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB mask, List list, Entity collidingEntity){ this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.3125F, 1.0F); @@ -60,22 +68,21 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{ this.setBlockBounds(0.0F, 0.0F, 1.0F-f, 1.0F, y, 1.0F); super.addCollisionBoxesToList(world, pos, state, mask, list, collidingEntity); this.setBlockBoundsForItemRender(); - } + }*/ @Override - public boolean isOpaqueCube(){ + public boolean isOpaqueCube(IBlockState state){ return false; } @Override - public boolean isFullCube(){ + public boolean isFullCube(IBlockState state){ return false; } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing f6, float f7, float f8, float f9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stackPlayer, EnumFacing f6, float f7, float f8, float f9){ if(!world.isRemote){ - ItemStack stackPlayer = player.getCurrentEquippedItem(); TileEntityCompost tile = (TileEntityCompost)world.getTileEntity(pos); //Add items to be composted if(stackPlayer != null && stackPlayer.getItem() instanceof ItemMisc && stackPlayer.getItemDamage() == TheMiscItems.MASHED_FOOD.ordinal() && (tile.slots[0] == null || (!(tile.slots[0].getItem() instanceof ItemFertilizer) && tile.slots[0].stackSize < TileEntityCompost.AMOUNT))){ @@ -97,7 +104,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{ player.inventory.setInventorySlotContents(player.inventory.currentItem, tile.slots[0].copy()); } else{ - player.getCurrentEquippedItem().stackSize += tile.slots[0].stackSize; + player.getActiveItemStack().stackSize += tile.slots[0].stackSize; } tile.slots[0] = null; tile.markDirty(); @@ -106,12 +113,6 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{ return true; } - @Override - public void setBlockBoundsForItemRender(){ - float f = 1.0F/16.0F; - this.setBlockBounds(f, 0.0F, f, 1.0F-f, 11*f, 1.0F-f); - } - @Override public TileEntity createNewTileEntity(World world, int meta){ return new TileEntityCompost(); @@ -130,7 +131,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{ @Override @SideOnly(Side.CLIENT) - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){ + public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); if(tile instanceof TileEntityCompost){ ItemStack slot = ((TileEntityCompost)tile).getStackInSlot(0); @@ -143,7 +144,7 @@ public class BlockCompost extends BlockContainerBase implements IHudDisplay{ AssetUtil.renderStackToGui(slot, resolution.getScaledWidth()/2+15, resolution.getScaledHeight()/2-29, 1F); } - minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg, resolution.getScaledWidth()/2+35, resolution.getScaledHeight()/2-25, StringUtil.DECIMAL_COLOR_WHITE); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java index bbc3db8cf..8105849d2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDirectionalBreaker.java @@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDirectionalBreaker; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -25,8 +26,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockDirectionalBreaker extends BlockContainerBase{ @@ -38,7 +40,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override @@ -47,7 +49,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(this.tryToggleRedstone(world, pos, player)){ return true; } @@ -68,7 +70,7 @@ public class BlockDirectionalBreaker extends BlockContainerBase{ @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ - int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal(); + int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal(); PosUtil.setMetadata(pos, world, rotation, 2); super.onBlockPlacedBy(world, pos, state, player, stack); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java index 44d0e2c50..8c38f3a98 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockDropper.java @@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityDropper; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -24,8 +25,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockDropper extends BlockContainerBase{ @@ -37,7 +39,7 @@ public class BlockDropper extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override @@ -46,7 +48,7 @@ public class BlockDropper extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(this.tryToggleRedstone(world, pos, player)){ return true; } @@ -67,7 +69,7 @@ public class BlockDropper extends BlockContainerBase{ @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ - int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal(); + int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal(); PosUtil.setMetadata(pos, world, rotation, 2); super.onBlockPlacedBy(world, pos, state, player, stack); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java index f778ebd5a..83797a8a2 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockEnergizer.java @@ -15,14 +15,16 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnergizer; import de.ellpeck.actuallyadditions.mod.tile.TileEntityEnervator; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockEnergizer extends BlockContainerBase{ @@ -35,7 +37,7 @@ public class BlockEnergizer extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(2.0F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override @@ -44,7 +46,7 @@ public class BlockEnergizer extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ if(this.isEnergizer){ TileEntityEnergizer energizer = (TileEntityEnergizer)world.getTileEntity(pos); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java index a65c7b701..d139dc427 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFeeder.java @@ -14,14 +14,16 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFeeder; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockFeeder extends BlockContainerBase{ @@ -31,7 +33,7 @@ public class BlockFeeder extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(0.5F); this.setResistance(6.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override @@ -40,7 +42,7 @@ public class BlockFeeder extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityFeeder feeder = (TileEntityFeeder)world.getTileEntity(pos); if(feeder != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java index b7c5922e1..2777b4264 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFermentingBarrel.java @@ -14,14 +14,16 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFermentingBarrel; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockFermentingBarrel extends BlockContainerBase{ @@ -31,7 +33,7 @@ public class BlockFermentingBarrel extends BlockContainerBase{ this.setHarvestLevel("axe", 0); this.setHardness(0.5F); this.setResistance(5.0F); - this.setStepSound(soundTypeWood); + this.setStepSound(SoundType.WOOD); } @Override @@ -46,7 +48,7 @@ public class BlockFermentingBarrel extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityFermentingBarrel press = (TileEntityFermentingBarrel)world.getTileEntity(pos); if(press != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java index 0b53d74b7..b21028f58 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFireworkBox.java @@ -13,14 +13,16 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFireworkBox; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockFireworkBox extends BlockContainerBase{ @@ -30,7 +32,7 @@ public class BlockFireworkBox extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override @@ -39,7 +41,7 @@ public class BlockFireworkBox extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ return this.tryToggleRedstone(world, pos, player); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java index e1edeea3b..927960329 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFishingNet.java @@ -12,7 +12,9 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFishingNet; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -25,8 +27,9 @@ public class BlockFishingNet extends BlockContainerBase{ this.setHarvestLevel("axe", 0); this.setHardness(0.5F); this.setResistance(3.0F); - this.setStepSound(soundTypeWood); - this.setBlockBounds(0F, 0F, 0F, 1F, 1F/16F, 1F); + this.setStepSound(SoundType.WOOD); + //TODO Fix block bounds + //this.setBlockBounds(0F, 0F, 0F, 1F, 1F/16F, 1F); } @Override @@ -35,12 +38,12 @@ public class BlockFishingNet extends BlockContainerBase{ } @Override - public boolean isFullCube(){ + public boolean isFullCube(IBlockState state){ return false; } @Override - public boolean isOpaqueCube(){ + public boolean isOpaqueCube(IBlockState state){ return false; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java index 431e0c54d..dbf04cddf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFluidCollector.java @@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFluidCollector; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -25,8 +26,9 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockFluidCollector extends BlockContainerBase{ @@ -41,7 +43,7 @@ public class BlockFluidCollector extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override @@ -50,7 +52,7 @@ public class BlockFluidCollector extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(this.tryToggleRedstone(world, pos, player)){ return true; } @@ -71,7 +73,7 @@ public class BlockFluidCollector extends BlockContainerBase{ @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ - int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal(); + int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal(); PosUtil.setMetadata(pos, world, rotation, 2); super.onBlockPlacedBy(world, pos, state, player, stack); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java index 0b2bde8a0..d25f4726f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceDouble.java @@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceDouble; import de.ellpeck.actuallyadditions.mod.util.PosUtil; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -24,10 +25,11 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.MathHelper; +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; @@ -44,7 +46,7 @@ public class BlockFurnaceDouble extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); this.setTickRandomly(true); } @@ -55,7 +57,7 @@ public class BlockFurnaceDouble extends BlockContainerBase{ @Override @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){ + public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){ int meta = PosUtil.getMetadata(state); if(meta > 3){ @@ -89,7 +91,7 @@ public class BlockFurnaceDouble extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityFurnaceDouble furnace = (TileEntityFurnaceDouble)world.getTileEntity(pos); if(furnace != null){ @@ -101,8 +103,8 @@ public class BlockFurnaceDouble extends BlockContainerBase{ } @Override - public int getLightValue(IBlockAccess world, BlockPos pos){ - return PosUtil.getMetadata(pos, world) > 3 ? 12 : 0; + public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){ + return PosUtil.getMetadata(state) > 3 ? 12 : 0; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java index 391bf1903..81f9aa944 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockFurnaceSolar.java @@ -12,7 +12,9 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityFurnaceSolar; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -25,8 +27,10 @@ public class BlockFurnaceSolar extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); - this.setBlockBounds(0F, 0F, 0F, 1F, 6F/16F, 1F); + this.setStepSound(SoundType.STONE); + + //TODO Block bounds + //this.setBlockBounds(0F, 0F, 0F, 1F, 6F/16F, 1F); } @Override @@ -35,12 +39,12 @@ public class BlockFurnaceSolar extends BlockContainerBase{ } @Override - public boolean isFullCube(){ + public boolean isFullCube(IBlockState state){ return false; } @Override - public boolean isOpaqueCube(){ + public boolean isOpaqueCube(IBlockState state){ return false; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGeneric.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGeneric.java index a1a584a64..da301b1ad 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGeneric.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGeneric.java @@ -11,6 +11,7 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -22,7 +23,7 @@ public class BlockGeneric extends BlockBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java index 0794f9d29..6d8ace673 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGiantChest.java @@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGiantChest; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; @@ -25,8 +26,9 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -39,7 +41,7 @@ public class BlockGiantChest extends BlockContainerBase{ this.setHarvestLevel("axe", 0); this.setHardness(0.5F); this.setResistance(15.0F); - this.setStepSound(soundTypeWood); + this.setStepSound(SoundType.WOOD); } @Override @@ -48,7 +50,7 @@ public class BlockGiantChest extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityGiantChest chest = (TileEntityGiantChest)world.getTileEntity(pos); if(chest != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java index b23451304..6017160f5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGreenhouseGlass.java @@ -13,14 +13,15 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGreenhouseGlass; 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.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.EnumFacing; -import net.minecraft.util.EnumWorldBlockLayer; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -33,32 +34,31 @@ public class BlockGreenhouseGlass extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(0.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override - public boolean isFullCube(){ + public boolean isFullCube(IBlockState state){ return false; } @Override @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){ - IBlockState state = worldIn.getBlockState(pos); + public boolean shouldSideBeRendered(IBlockState state, IBlockAccess worldIn, BlockPos pos, EnumFacing side){ Block block = state.getBlock(); - return worldIn.getBlockState(pos.offset(side.getOpposite())) != state || block != this && block != this && super.shouldSideBeRendered(worldIn, pos, side); + return worldIn.getBlockState(pos.offset(side.getOpposite())) != state || block != this && block != this && super.shouldSideBeRendered(state, worldIn, pos, side); } @Override - public boolean isOpaqueCube(){ + public boolean isOpaqueCube(IBlockState state){ return false; } @Override @SideOnly(Side.CLIENT) - public EnumWorldBlockLayer getBlockLayer(){ - return EnumWorldBlockLayer.CUTOUT; + public BlockRenderLayer getBlockLayer(){ + return BlockRenderLayer.CUTOUT; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java index 0832e3703..d7938d1fc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockGrinder.java @@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy; import de.ellpeck.actuallyadditions.mod.tile.TileEntityGrinder; import de.ellpeck.actuallyadditions.mod.util.PosUtil; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -23,9 +24,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -44,7 +46,7 @@ public class BlockGrinder extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); this.setTickRandomly(true); } @@ -55,7 +57,7 @@ public class BlockGrinder extends BlockContainerBase{ @Override @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){ + public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){ int meta = PosUtil.getMetadata(state); if(meta == 1){ @@ -69,7 +71,7 @@ public class BlockGrinder extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityGrinder grinder = (TileEntityGrinder)world.getTileEntity(pos); if(grinder != null){ @@ -81,7 +83,7 @@ public class BlockGrinder extends BlockContainerBase{ } @Override - public int getLightValue(IBlockAccess world, BlockPos pos){ + public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){ return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java index cc02ddf0f..bff65e535 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockHeatCollector.java @@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityHeatCollector; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -25,7 +26,7 @@ public class BlockHeatCollector extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(2.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java index e33c2a118..b9d541cae 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockInputter.java @@ -21,14 +21,16 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.Util; 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.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockInputter extends BlockContainerBase{ @@ -42,7 +44,7 @@ public class BlockInputter extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); this.setTickRandomly(true); this.isAdvanced = isAdvanced; } @@ -53,7 +55,7 @@ public class BlockInputter extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityInputter inputter = (TileEntityInputter)world.getTileEntity(pos); if(inputter != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemRepairer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemRepairer.java index 18f1baee6..a491fad67 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemRepairer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockItemRepairer.java @@ -16,14 +16,16 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityItemRepairer; import de.ellpeck.actuallyadditions.mod.util.PosUtil; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -34,7 +36,7 @@ public class BlockItemRepairer extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(20.0F); this.setResistance(15.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); this.setTickRandomly(true); } @@ -44,7 +46,7 @@ public class BlockItemRepairer extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityItemRepairer repairer = (TileEntityItemRepairer)world.getTileEntity(pos); if(repairer != null){ @@ -56,7 +58,7 @@ public class BlockItemRepairer extends BlockContainerBase{ } @Override - public int getLightValue(IBlockAccess world, BlockPos pos){ + public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos){ return PosUtil.getMetadata(pos, world) == 1 ? 12 : 0; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java index 73b9d2f89..dfac56797 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLampPowerer.java @@ -16,13 +16,14 @@ import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockPistonBase; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockLampPowerer extends BlockBase{ @@ -34,7 +35,7 @@ public class BlockLampPowerer extends BlockBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override @@ -49,7 +50,7 @@ public class BlockLampPowerer extends BlockBase{ @Override public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase player, ItemStack stack){ - int rotation = BlockPistonBase.getFacingFromEntity(world, pos, player).ordinal(); + int rotation = BlockPistonBase.getFacingFromEntity(pos, player).ordinal(); PosUtil.setMetadata(pos, world, rotation, 2); super.onBlockPlacedBy(world, pos, state, player, stack); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java index 2b02cccb3..7e64c02f7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLaserRelay.java @@ -13,22 +13,19 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay; import de.ellpeck.actuallyadditions.mod.util.PosUtil; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.world.IBlockAccess; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import java.util.List; - +//TODO Fix bounding box public class BlockLaserRelay extends BlockContainerBase{ private static final PropertyInteger META = PropertyInteger.create("meta", 0, 5); @@ -38,22 +35,16 @@ public class BlockLaserRelay extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override - public boolean isFullCube(){ + public boolean isFullCube(IBlockState state){ return false; } @Override - public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){ - this.setBlockBoundsBasedOnState(world, pos); - super.addCollisionBoxesToList(world, pos, state, axis, list, entity); - } - - @Override - public boolean isOpaqueCube(){ + public boolean isOpaqueCube(IBlockState state){ return false; } @@ -62,31 +53,6 @@ public class BlockLaserRelay extends BlockContainerBase{ return this.getStateFromMeta(side.ordinal()); } - @Override - public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){ - int meta = PosUtil.getMetadata(pos, world); - - float pixel = 1F/16F; - if(meta == 0){ - this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F-3*pixel, 1F, 1F-3*pixel); - } - else if(meta == 1){ - this.setBlockBounds(3*pixel, 0F, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel); - } - else if(meta == 2){ - this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F); - } - else if(meta == 3){ - this.setBlockBounds(3*pixel, 3*pixel, 0F, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel); - } - else if(meta == 4){ - this.setBlockBounds(3*pixel, 3*pixel, 3*pixel, 1F, 1F-3*pixel, 1F-3*pixel); - } - else if(meta == 5){ - this.setBlockBounds(0F, 3*pixel, 3*pixel, 1F-3*pixel, 1F-3*pixel, 1F-3*pixel); - } - } - @Override public EnumRarity getRarity(ItemStack stack){ return EnumRarity.EPIC; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java index 6788bc528..d6e13c6aa 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLavaFactoryController.java @@ -14,6 +14,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLavaFactoryController; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.ScaledResolution; @@ -22,7 +23,7 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.profiler.Profiler; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -34,7 +35,7 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IH this.setHarvestLevel("pickaxe", 0); this.setHardness(4.5F); this.setResistance(20.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override @@ -49,7 +50,7 @@ public class BlockLavaFactoryController extends BlockContainerBase implements IH @Override @SideOnly(Side.CLIENT) - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){ + public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ TileEntityLavaFactoryController factory = (TileEntityLavaFactoryController)minecraft.theWorld.getTileEntity(posHit.getBlockPos()); if(factory != null){ int state = factory.isMultiblock(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java index 66214b816..fd6bef369 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockLeafGenerator.java @@ -12,12 +12,13 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityLeafGenerator; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockLeafGenerator extends BlockContainerBase{ @@ -27,7 +28,7 @@ public class BlockLeafGenerator extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(5.0F); this.setResistance(10.0F); - this.setStepSound(soundTypeMetal); + this.setStepSound(SoundType.METAL); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java index 8b66b8363..b8bfee837 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockMiner.java @@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityMiner; import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -25,9 +26,10 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.profiler.Profiler; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -39,16 +41,16 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay{ this.setHarvestLevel("pickaxe", 0); this.setHardness(8F); this.setResistance(30F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override - public boolean isOpaqueCube(){ + public boolean isOpaqueCube(IBlockState state){ return false; } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntity tile = world.getTileEntity(pos); if(tile instanceof TileEntityMiner){ @@ -76,7 +78,7 @@ public class BlockMiner extends BlockContainerBase implements IHudDisplay{ @Override @SideOnly(Side.CLIENT) - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){ + public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); if(tile instanceof TileEntityMiner){ String info = ((TileEntityMiner)tile).layerAt <= 0 ? "Done Mining!" : "Mining at Y = "+((TileEntityMiner)tile).layerAt+"."; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java index 7de606aeb..e9dd58f0d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockOilGenerator.java @@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.proxy.ClientProxy; import de.ellpeck.actuallyadditions.mod.tile.TileEntityOilGenerator; import de.ellpeck.actuallyadditions.mod.util.PosUtil; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -24,9 +25,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -42,7 +44,7 @@ public class BlockOilGenerator extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); this.setTickRandomly(true); } @@ -53,7 +55,7 @@ public class BlockOilGenerator extends BlockContainerBase{ @Override @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){ + public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){ if(PosUtil.getMetadata(state) == 1){ for(int i = 0; i < 5; i++){ world.spawnParticle(ClientProxy.bulletForMyValentine ? EnumParticleTypes.HEART : EnumParticleTypes.SMOKE_NORMAL, (double)pos.getX()+0.5F, (double)pos.getY()+1.0F, (double)pos.getZ()+0.5F, 0.0D, 0.0D, 0.0D); @@ -62,7 +64,7 @@ public class BlockOilGenerator extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityOilGenerator generator = (TileEntityOilGenerator)world.getTileEntity(pos); if(generator != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java index d5234313e..cf9046eda 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantom.java @@ -17,6 +17,7 @@ import de.ellpeck.actuallyadditions.mod.tile.*; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.client.Minecraft; @@ -28,6 +29,10 @@ import net.minecraft.item.ItemStack; import net.minecraft.profiler.Profiler; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -43,7 +48,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{ this.setHarvestLevel("pickaxe", 0); this.setHardness(4.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); if(type == Type.FACE || type == Type.LIQUIFACE || type == Type.ENERGYFACE){ this.range = TileEntityPhantomface.RANGE; @@ -78,7 +83,7 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ){ if(this.tryToggleRedstone(world, pos, player)){ return true; } @@ -98,27 +103,27 @@ public class BlockPhantom extends BlockContainerBase implements IHudDisplay{ @Override @SideOnly(Side.CLIENT) - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){ + public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ TileEntity tile = minecraft.theWorld.getTileEntity(posHit.getBlockPos()); if(tile != null){ if(tile instanceof IPhantomTile){ IPhantomTile phantom = (IPhantomTile)tile; - minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.GOLD+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc")+": "+phantom.getRange(), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-40, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.GOLD+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".blockPhantomRange.desc")+": "+phantom.getRange(), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-40, StringUtil.DECIMAL_COLOR_WHITE); if(phantom.hasBoundPosition()){ - int distance = (int)new Vec3(posHit.getBlockPos()).distanceTo(new Vec3(phantom.getBoundPosition())); + int distance = (int)new Vec3d(posHit.getBlockPos()).distanceTo(new Vec3d(phantom.getBoundPosition())); Item item = PosUtil.getItemBlock(phantom.getBoundPosition(), minecraft.theWorld); String name = item == null ? "Absolutely Nothing" : item.getItemStackDisplayName(new ItemStack(PosUtil.getBlock(phantom.getBoundPosition(), minecraft.theWorld), 1, PosUtil.getMetadata(phantom.getBoundPosition(), minecraft.theWorld))); StringUtil.drawSplitString(minecraft.fontRendererObj, StringUtil.localizeFormatted("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.blockInfo.desc", name, phantom.getBoundPosition().getX(), phantom.getBoundPosition().getY(), phantom.getBoundPosition().getZ(), distance), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2-30, 200, StringUtil.DECIMAL_COLOR_WHITE, true); if(phantom.isBoundThingInRange()){ - StringUtil.drawSplitString(minecraft.fontRendererObj, EnumChatFormatting.DARK_GREEN+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true); + StringUtil.drawSplitString(minecraft.fontRendererObj, TextFormatting.DARK_GREEN+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true); } else{ - StringUtil.drawSplitString(minecraft.fontRendererObj, EnumChatFormatting.DARK_RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true); + StringUtil.drawSplitString(minecraft.fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connectedNoRange.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, 200, StringUtil.DECIMAL_COLOR_WHITE, true); } } else{ - minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.RED+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.notConnected.desc"), resolution.getScaledWidth()/2+5, resolution.getScaledHeight()/2+25, StringUtil.DECIMAL_COLOR_WHITE); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java index eef04cd9d..dba6d34cf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockPhantomBooster.java @@ -12,7 +12,9 @@ package de.ellpeck.actuallyadditions.mod.blocks; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.tile.TileEntityPhantomBooster; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; +import net.minecraft.block.state.IBlockState; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; @@ -25,19 +27,20 @@ public class BlockPhantomBooster extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); - float f = 1F/16F; - this.setBlockBounds(2*f, 0F, 2*f, 1-2*f, 1F, 1-2*f); + //TODO Fix block bounds + //float f = 1F/16F; + //this.setBlockBounds(2*f, 0F, 2*f, 1-2*f, 1F, 1-2*f); } @Override - public boolean isFullCube(){ + public boolean isFullCube(IBlockState state){ return false; } @Override - public boolean isOpaqueCube(){ + public boolean isOpaqueCube(IBlockState state){ return false; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java index 6d608829a..b28ef8bb4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockRangedCollector.java @@ -14,14 +14,16 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockContainerBase; import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntityRangedCollector; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockRangedCollector extends BlockContainerBase{ @@ -31,7 +33,7 @@ public class BlockRangedCollector extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(1.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override @@ -40,7 +42,7 @@ public class BlockRangedCollector extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityRangedCollector breaker = (TileEntityRangedCollector)world.getTileEntity(pos); if(breaker != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java index 4bc6355c8..e1d9c5de3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSlabs.java @@ -21,9 +21,11 @@ import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; @@ -40,35 +42,19 @@ public class BlockSlabs extends BlockBase{ } public BlockSlabs(String name, Block fullBlock, int meta){ - super(fullBlock.getMaterial(), name); + super(fullBlock.getMaterial(fullBlock.getDefaultState()), name); this.setHardness(1.5F); this.setResistance(10.0F); this.fullBlock = fullBlock; this.meta = meta; } - @Override + /*@Override public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){ this.setBlockBoundsBasedOnState(world, pos); super.addCollisionBoxesToList(world, pos, state, axis, list, entity); } - @Override - public boolean isOpaqueCube(){ - return false; - } - - @Override - public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){ - if(facing.ordinal() == 1){ - return this.getStateFromMeta(meta); - } - if(facing.ordinal() == 0 || hitY >= 0.5F){ - return this.getStateFromMeta(meta+1); - } - return this.getStateFromMeta(meta); - } - @Override public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){ int meta = PosUtil.getMetadata(pos, world); @@ -80,6 +66,22 @@ public class BlockSlabs extends BlockBase{ @Override public void setBlockBoundsForItemRender(){ this.setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F); + }*/ + + @Override + public boolean isOpaqueCube(IBlockState state){ + return false; + } + + @Override + public IBlockState onBlockPlaced(World world, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, int meta, EntityLivingBase placer){ + if(facing.ordinal() == 1){ + return this.getStateFromMeta(meta); + } + if(facing.ordinal() == 0 || hitY >= 0.5F){ + return this.getStateFromMeta(meta+1); + } + return this.getStateFromMeta(meta); } @Override @@ -106,15 +108,16 @@ public class BlockSlabs extends BlockBase{ } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){ + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ){ if(PosUtil.getBlock(pos, world) == this.block && ((side.ordinal() == 1 && PosUtil.getMetadata(pos, world) == 0) || (side.ordinal() == 0 && PosUtil.getMetadata(pos, world) == 1))){ if(PosUtil.setBlock(pos, world, ((BlockSlabs)this.block).fullBlock, ((BlockSlabs)this.block).meta, 3)){ - world.playSoundEffect(pos.getX()+0.5F, pos.getY()+0.5F, pos.getZ()+0.5F, this.block.stepSound.getBreakSound(), (this.block.stepSound.getVolume()+1.0F)/2.0F, this.block.stepSound.frequency*0.8F); + //TODO Fix sounds + //world.playSoundEffect(pos.getX()+0.5F, pos.getY()+0.5F, pos.getZ()+0.5F, this.block.stepSound.getBreakSound(), (this.block.stepSound.getVolume()+1.0F)/2.0F, this.block.stepSound.frequency*0.8F); stack.stackSize--; - return true; + return EnumActionResult.SUCCESS; } } - return super.onItemUse(stack, player, world, pos, side, hitX, hitY, hitZ); + return super.onItemUse(stack, player, world, pos, hand, side, hitX, hitY, hitZ); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java index 708696175..07af8bbf5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockSmileyCloud.java @@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.GuiHandler; import de.ellpeck.actuallyadditions.mod.tile.TileEntitySmileyCloud; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.Util; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -28,6 +29,9 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; +import net.minecraft.util.math.AxisAlignedBB; +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; @@ -44,53 +48,17 @@ public class BlockSmileyCloud extends BlockContainerBase{ super(Material.cloth, name); this.setHardness(0.5F); this.setResistance(5.0F); - this.setStepSound(soundTypeCloth); + this.setStepSound(SoundType.CLOTH); this.setTickRandomly(true); } @Override - public boolean isFullCube(){ + public boolean isFullCube(IBlockState state){ return false; } - @Override - public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){ - this.setBlockBoundsBasedOnState(world, pos); - super.addCollisionBoxesToList(world, pos, state, axis, list, entity); - } - - @Override - public boolean isOpaqueCube(){ - return false; - } - - @Override - @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){ - if(Util.RANDOM.nextInt(30) == 0){ - for(int i = 0; i < 2; i++){ - double d = Util.RANDOM.nextGaussian()*0.02D; - double d1 = Util.RANDOM.nextGaussian()*0.02D; - double d2 = Util.RANDOM.nextGaussian()*0.02D; - world.spawnParticle(EnumParticleTypes.HEART, pos.getX()+Util.RANDOM.nextFloat(), pos.getY()+0.65+Util.RANDOM.nextFloat(), pos.getZ()+Util.RANDOM.nextFloat(), d, d1, d2); - } - } - } - - @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing f6, float f7, float f8, float f9){ - if(!world.isRemote){ - TileEntity tile = world.getTileEntity(pos); - if(tile instanceof TileEntitySmileyCloud){ - player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CLOUD.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); - - player.triggerAchievement(TheAchievements.NAME_SMILEY_CLOUD.ach); - } - } - return true; - } - - @Override + //TODO Fix bounding box + /*@Override public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos){ int meta = PosUtil.getMetadata(pos, world); float f = 0.0625F; @@ -109,6 +77,43 @@ public class BlockSmileyCloud extends BlockContainerBase{ } } + @Override + public void addCollisionBoxesToList(World world, BlockPos pos, IBlockState state, AxisAlignedBB axis, List list, Entity entity){ + this.setBlockBoundsBasedOnState(world, pos); + super.addCollisionBoxesToList(world, pos, state, axis, list, entity); + }*/ + + @Override + public boolean isOpaqueCube(IBlockState state){ + return false; + } + + @Override + @SideOnly(Side.CLIENT) + public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){ + if(Util.RANDOM.nextInt(30) == 0){ + for(int i = 0; i < 2; i++){ + double d = Util.RANDOM.nextGaussian()*0.02D; + double d1 = Util.RANDOM.nextGaussian()*0.02D; + double d2 = Util.RANDOM.nextGaussian()*0.02D; + world.spawnParticle(EnumParticleTypes.HEART, pos.getX()+Util.RANDOM.nextFloat(), pos.getY()+0.65+Util.RANDOM.nextFloat(), pos.getZ()+Util.RANDOM.nextFloat(), d, d1, d2); + } + } + } + + @Override + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing f6, float f7, float f8, float f9){ + if(!world.isRemote){ + TileEntity tile = world.getTileEntity(pos); + if(tile instanceof TileEntitySmileyCloud){ + player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CLOUD.ordinal(), world, pos.getX(), pos.getY(), pos.getZ()); + + player.addStat(TheAchievements.NAME_SMILEY_CLOUD.ach); + } + } + return true; + } + @Override public TileEntity createNewTileEntity(World world, int meta){ return new TileEntitySmileyCloud(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java index 18e4745fc..2d6c4fddc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockTreasureChest.java @@ -16,6 +16,7 @@ import de.ellpeck.actuallyadditions.mod.achievement.TheAchievements; import de.ellpeck.actuallyadditions.mod.blocks.base.BlockBase; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.Util; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -27,6 +28,8 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -42,13 +45,13 @@ public class BlockTreasureChest extends BlockBase{ this.setHarvestLevel("axe", 0); this.setHardness(300.0F); this.setResistance(50.0F); - this.setStepSound(soundTypeWood); + this.setStepSound(SoundType.WOOD); this.setTickRandomly(true); } @Override @SideOnly(Side.CLIENT) - public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand){ + public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand){ for(int i = 0; i < 2; i++){ for(float f = 0; f <= 3; f += 0.5){ float particleX = rand.nextFloat(); @@ -64,13 +67,14 @@ public class BlockTreasureChest extends BlockBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ - world.playSoundAtEntity(player, "random.chestopen", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F); + //TODO Fix sounds + //world.playSoundAtEntity(player, "random.chestopen", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F); this.dropItems(world, pos); world.setBlockToAir(pos); - player.triggerAchievement(TheAchievements.OPEN_TREASURE_CHEST.ach); + //player.triggerAchievement(TheAchievements.OPEN_TREASURE_CHEST.ach); } return true; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java index 9d554a43d..fce909380 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWallAA.java @@ -16,15 +16,16 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockFenceGate; import net.minecraft.block.BlockWall; import net.minecraft.block.material.Material; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateBase; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +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; @@ -40,13 +41,17 @@ public class BlockWallAA extends BlockBase{ this(name, base, 0); } + protected static final AxisAlignedBB[] field_185751_g = new AxisAlignedBB[]{new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.3125D, 0.0D, 0.0D, 0.6875D, 0.875D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.75D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.3125D, 1.0D, 0.875D, 0.6875D), new AxisAlignedBB(0.0D, 0.0D, 0.25D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.25D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.75D), new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D)}; + protected static final AxisAlignedBB[] field_185750_B = new AxisAlignedBB[]{field_185751_g[0].setMaxY(1.5D), field_185751_g[1].setMaxY(1.5D), field_185751_g[2].setMaxY(1.5D), field_185751_g[3].setMaxY(1.5D), field_185751_g[4].setMaxY(1.5D), field_185751_g[5].setMaxY(1.5D), field_185751_g[6].setMaxY(1.5D), field_185751_g[7].setMaxY(1.5D), field_185751_g[8].setMaxY(1.5D), field_185751_g[9].setMaxY(1.5D), field_185751_g[10].setMaxY(1.5D), field_185751_g[11].setMaxY(1.5D), field_185751_g[12].setMaxY(1.5D), field_185751_g[13].setMaxY(1.5D), field_185751_g[14].setMaxY(1.5D), field_185751_g[15].setMaxY(1.5D)}; + + public BlockWallAA(String name, Block base, int meta){ - super(base.getMaterial(), name); + super(base.getMaterial(base.getDefaultState()), name); this.meta = meta; this.setHardness(1.5F); this.setResistance(10F); - this.setStepSound(base.stepSound); + this.setStepSound(base.getStepSound()); this.setDefaultState(this.blockState.getBaseState().withProperty(BlockWall.UP, false).withProperty(BlockWall.NORTH, false).withProperty(BlockWall.EAST, false).withProperty(BlockWall.SOUTH, false).withProperty(BlockWall.WEST, false)); } @@ -57,7 +62,7 @@ public class BlockWallAA extends BlockBase{ } @Override - public boolean isFullCube(){ + public boolean isFullCube(IBlockState state){ return false; } @@ -68,19 +73,44 @@ public class BlockWallAA extends BlockBase{ @Override @SideOnly(Side.CLIENT) - public boolean shouldSideBeRendered(IBlockAccess worldIn, BlockPos pos, EnumFacing side){ - return side != EnumFacing.DOWN || super.shouldSideBeRendered(worldIn, pos, side); + public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side){ + return side != EnumFacing.DOWN || super.shouldSideBeRendered(blockState, blockAccess, pos, side); + } + + public AxisAlignedBB getBoundingBox(IBlockState state, IBlockAccess source, BlockPos pos){ + state = this.getActualState(state, source, pos); + return field_185751_g[figureOutSomeWallStuff(state)]; + } + + public AxisAlignedBB getSelectedBoundingBox(IBlockState blockState, World worldIn, BlockPos pos){ + blockState = this.getActualState(blockState, worldIn, pos); + return field_185750_B[figureOutSomeWallStuff(blockState)]; + } + + private static int figureOutSomeWallStuff(IBlockState state){ + int i = 0; + + if(state.getValue(BlockWall.NORTH)){ + i |= 1 << EnumFacing.NORTH.getHorizontalIndex(); + } + + if(state.getValue(BlockWall.EAST)){ + i |= 1 << EnumFacing.EAST.getHorizontalIndex(); + } + + if(state.getValue(BlockWall.SOUTH)){ + i |= 1 << EnumFacing.SOUTH.getHorizontalIndex(); + } + + if(state.getValue(BlockWall.WEST)){ + i |= 1 << EnumFacing.WEST.getHorizontalIndex(); + } + + return i; } @Override - public AxisAlignedBB getCollisionBoundingBox(World worldIn, BlockPos pos, IBlockState state){ - this.setBlockBoundsBasedOnState(worldIn, pos); - this.maxY = 1.5D; - return super.getCollisionBoundingBox(worldIn, pos, state); - } - - @Override - public boolean isOpaqueCube(){ + public boolean isOpaqueCube(IBlockState state){ return false; } @@ -89,45 +119,6 @@ public class BlockWallAA extends BlockBase{ return meta; } - @Override - public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos){ - boolean flag = this.canConnectTo(worldIn, pos.north()); - boolean flag1 = this.canConnectTo(worldIn, pos.south()); - boolean flag2 = this.canConnectTo(worldIn, pos.west()); - boolean flag3 = this.canConnectTo(worldIn, pos.east()); - float f = 0.25F; - float f1 = 0.75F; - float f2 = 0.25F; - float f3 = 0.75F; - float f4 = 1.0F; - - if(flag){ - f2 = 0.0F; - } - if(flag1){ - f3 = 1.0F; - } - if(flag2){ - f = 0.0F; - } - if(flag3){ - f1 = 1.0F; - } - - if(flag && flag1 && !flag2 && !flag3){ - f4 = 0.8125F; - f = 0.3125F; - f1 = 0.6875F; - } - else if(!flag && !flag1 && flag2 && flag3){ - f4 = 0.8125F; - f2 = 0.3125F; - f3 = 0.6875F; - } - - this.setBlockBounds(f, 0.0F, f2, f1, f4, f3); - } - @SuppressWarnings("unchecked") @Override @SideOnly(Side.CLIENT) @@ -137,7 +128,8 @@ public class BlockWallAA extends BlockBase{ public boolean canConnectTo(IBlockAccess worldIn, BlockPos pos){ Block block = PosUtil.getBlock(pos, worldIn); - return block != Blocks.barrier && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial().isOpaque() && block.isFullCube()) && block.getMaterial() != Material.gourd)); + IBlockState state = worldIn.getBlockState(pos); + return block != Blocks.barrier && (!(block != this && !(block instanceof BlockFenceGate)) || ((block.getMaterial(state).isOpaque() && block.isFullCube(state)) && block.getMaterial(state) != Material.gourd)); } @Override @@ -151,7 +143,7 @@ public class BlockWallAA extends BlockBase{ } @Override - protected BlockState createBlockState(){ - return new BlockState(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH); + protected BlockStateContainer createBlockState(){ + return new BlockStateContainer(this, BlockWall.UP, BlockWall.NORTH, BlockWall.EAST, BlockWall.WEST, BlockWall.SOUTH); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java index 5c345f0d7..2bcb28691 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockWildPlant.java @@ -20,6 +20,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.block.Block; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -28,9 +29,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -45,20 +47,20 @@ public class BlockWildPlant extends BlockBushBase{ public BlockWildPlant(String name){ super(name); - this.setStepSound(soundTypeGrass); + this.setStepSound(SoundType.PLANT); } @Override public boolean canBlockStay(World world, BlockPos pos, IBlockState state){ BlockPos offset = PosUtil.offset(pos, 0, -1, 0); - return PosUtil.getMetadata(state) == TheWildPlants.RICE.ordinal() ? PosUtil.getMaterial(offset, world) == Material.water : PosUtil.getBlock(offset, world).canSustainPlant(world, offset, EnumFacing.UP, this); + return PosUtil.getMetadata(state) == TheWildPlants.RICE.ordinal() ? PosUtil.getMaterial(offset, world) == Material.water : PosUtil.getBlock(offset, world).canSustainPlant(world.getBlockState(offset), world, offset, EnumFacing.UP, this); } @Override @SideOnly(Side.CLIENT) - public Item getItem(World world, BlockPos pos){ - int metadata = PosUtil.getMetadata(pos, world); - return metadata >= allWildPlants.length ? null : ((BlockPlant)allWildPlants[metadata].wildVersionOf).seedItem; + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player){ + int metadata = PosUtil.getMetadata(pos, world); + return metadata >= allWildPlants.length ? null : new ItemStack(((BlockPlant)allWildPlants[metadata].wildVersionOf).seedItem); } @SuppressWarnings("all") diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java index ab5dc92d0..e4e0858c4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/BlockXPSolidifier.java @@ -18,6 +18,7 @@ import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.tile.TileEntityXPSolidifier; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.Util; +import net.minecraft.block.SoundType; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; import net.minecraft.block.state.IBlockState; @@ -27,9 +28,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; public class BlockXPSolidifier extends BlockContainerBase{ @@ -41,7 +43,7 @@ public class BlockXPSolidifier extends BlockContainerBase{ this.setHarvestLevel("pickaxe", 0); this.setHardness(2.5F); this.setResistance(10.0F); - this.setStepSound(soundTypeStone); + this.setStepSound(SoundType.STONE); } @Override @@ -50,7 +52,7 @@ public class BlockXPSolidifier extends BlockContainerBase{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing par6, float par7, float par8, float par9){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing par6, float par7, float par8, float par9){ if(!world.isRemote){ TileEntityXPSolidifier solidifier = (TileEntityXPSolidifier)world.getTileEntity(pos); if(solidifier != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java index 1cce30d2f..bacb6f808 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/IHudDisplay.java @@ -15,13 +15,13 @@ import net.minecraft.client.gui.ScaledResolution; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.profiler.Profiler; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; public interface IHudDisplay{ @SideOnly(Side.CLIENT) - void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution); + void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java index 8b38d1fc4..0d149743f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBase.java @@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -70,8 +70,8 @@ public class BlockBase extends Block{ } @Override - protected BlockState createBlockState(){ - return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty()); + protected BlockStateContainer createBlockState(){ + return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty()); } protected PropertyInteger getMetaProperty(){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java index 292530844..262caa639 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockBushBase.java @@ -14,8 +14,9 @@ import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import net.minecraft.block.BlockBush; +import net.minecraft.block.SoundType; import net.minecraft.block.properties.PropertyInteger; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -27,7 +28,7 @@ public class BlockBushBase extends BlockBush{ public BlockBushBase(String name){ this.name = name; - this.setStepSound(soundTypeGrass); + this.setStepSound(SoundType.PLANT); this.register(); } @@ -69,8 +70,8 @@ public class BlockBushBase extends BlockBush{ } @Override - protected BlockState createBlockState(){ - return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty()); + protected BlockStateContainer createBlockState(){ + return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty()); } protected PropertyInteger getMetaProperty(){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java index abc4adbdf..67e108062 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockContainerBase.java @@ -20,7 +20,8 @@ import net.minecraft.block.BlockContainer; import net.minecraft.block.BlockRedstoneTorch; import net.minecraft.block.material.Material; import net.minecraft.block.properties.PropertyInteger; -import net.minecraft.block.state.BlockState; +import net.minecraft.block.state.BlockStateBase; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; @@ -31,8 +32,9 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.FluidStack; @@ -118,7 +120,7 @@ public abstract class BlockContainerBase extends BlockContainer{ } public boolean tryToggleRedstone(World world, BlockPos pos, EntityPlayer player){ - ItemStack stack = player.getCurrentEquippedItem(); + ItemStack stack = player.getActiveItemStack(); if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){ TileEntity tile = world.getTileEntity(pos); if(tile instanceof IRedstoneToggle){ @@ -224,12 +226,12 @@ public abstract class BlockContainerBase extends BlockContainer{ } @Override - public boolean hasComparatorInputOverride(){ + public boolean hasComparatorInputOverride(IBlockState state){ return true; } @Override - public int getComparatorInputOverride(World world, BlockPos pos){ + public int getComparatorInputOverride(IBlockState state, World world, BlockPos pos){ TileEntity tile = world.getTileEntity(pos); if(tile instanceof IInventory){ return Container.calcRedstoneFromInventory((IInventory)tile); @@ -238,8 +240,8 @@ public abstract class BlockContainerBase extends BlockContainer{ } @Override - protected BlockState createBlockState(){ - return this.getMetaProperty() == null ? super.createBlockState() : new BlockState(this, this.getMetaProperty()); + protected BlockStateContainer createBlockState(){ + return this.getMetaProperty() == null ? super.createBlockState() : new BlockStateContainer(this, this.getMetaProperty()); } @Override @@ -290,7 +292,7 @@ public abstract class BlockContainerBase extends BlockContainer{ } @Override - public int getRenderType(){ - return 3; + public EnumBlockRenderType getRenderType(IBlockState state){ + return EnumBlockRenderType.MODEL; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java index 435bb9aa1..c88ffda61 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockFluidFlowing.java @@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.util.PosUtil; import net.minecraft.block.material.Material; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fluids.BlockFluidClassic; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java index c4a9df956..9ff9a0d40 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/blocks/base/BlockPlant.java @@ -20,9 +20,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.common.EnumPlantType; @@ -83,21 +84,21 @@ public class BlockPlant extends BlockCrops{ } @Override - public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing facing, float hitX, float hitY, float hitZ){ + public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, ItemStack stack, EnumFacing facing, float hitX, float hitY, float hitZ){ if(getMetaFromState(state) >= 7){ if(!world.isRemote){ List drops = getDrops(world, pos, state, 0); boolean deductedSeedSize = false; - for(ItemStack stack : drops){ - if(stack != null){ - if(stack.getItem() == this.seedItem && !deductedSeedSize){ - stack.stackSize--; + for(ItemStack drop : drops){ + if(drop != null){ + if(drop.getItem() == this.seedItem && !deductedSeedSize){ + drop.stackSize--; deductedSeedSize = true; } - if(stack.stackSize > 0){ - EntityItem entity = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, stack); + if(drop.stackSize > 0){ + EntityItem entity = new EntityItem(world, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, drop); world.spawnEntityInWorld(entity); } } @@ -110,11 +111,6 @@ public class BlockPlant extends BlockCrops{ return false; } - @Override - public int getDamageValue(World world, BlockPos pos){ - return 0; - } - @Override public Item getSeed(){ return this.seedItem; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/BookletUtils.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/BookletUtils.java index 5e36ca6fe..ffa745839 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/BookletUtils.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/BookletUtils.java @@ -29,7 +29,7 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.item.ItemStack; import net.minecraft.stats.Achievement; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import java.awt.*; import java.net.URI; @@ -80,9 +80,9 @@ public class BookletUtils{ //Draw No Entry title if(booklet.currentEntrySet.entry == null){ - String strg = EnumChatFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.manualName.1"); + String strg = TextFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.manualName.1"); booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+12, 0); - strg = EnumChatFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.manualName.2"); + strg = TextFormatting.DARK_GREEN+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.manualName.2"); booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+12+booklet.getFontRenderer().FONT_HEIGHT, 0); String version; @@ -105,7 +105,7 @@ public class BookletUtils{ else{ version = StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".booklet.edition")+" "+ModUtil.VERSION.substring(ModUtil.VERSION.indexOf("r")+1); } - strg = EnumChatFormatting.GOLD+EnumChatFormatting.ITALIC.toString()+"-"+version+"-"; + strg = TextFormatting.GOLD+TextFormatting.ITALIC.toString()+"-"+version+"-"; booklet.getFontRenderer().drawString(strg, booklet.guiLeft+booklet.xSize/2-booklet.getFontRenderer().getStringWidth(strg)/2-3, booklet.guiTop+33, 0); } @@ -139,10 +139,10 @@ public class BookletUtils{ if(mouseX >= booklet.guiLeft+booklet.xSize+1 && mouseX < booklet.guiLeft+booklet.xSize+1+22 && mouseY >= booklet.guiTop-18 && mouseY < booklet.guiTop-18+21){ if(infoList == null){ infoList = new ArrayList(); - infoList.add(EnumChatFormatting.GOLD+"Achievements related to this chapter:"); + infoList.add(TextFormatting.GOLD+"Achievements related to this chapter:"); } infoList.add("-"+StringUtil.localize(achievement.statId)); - infoList.add(EnumChatFormatting.GRAY+"("+achievement.getDescription()+")"); + infoList.add(TextFormatting.GRAY+"("+achievement.getDescription()+")"); } } } @@ -178,10 +178,10 @@ public class BookletUtils{ //Renders the amount of words and chars the book has else{ String wordCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".amountOfWords", ClientProxy.bookletWordCount); - booklet.getFontRenderer().drawString(EnumChatFormatting.ITALIC+wordCountString, booklet.guiLeft+booklet.xSize-booklet.getFontRenderer().getStringWidth(wordCountString)-15, booklet.guiTop+booklet.ySize-18-booklet.getFontRenderer().FONT_HEIGHT, 0); + booklet.getFontRenderer().drawString(TextFormatting.ITALIC+wordCountString, booklet.guiLeft+booklet.xSize-booklet.getFontRenderer().getStringWidth(wordCountString)-15, booklet.guiTop+booklet.ySize-18-booklet.getFontRenderer().FONT_HEIGHT, 0); String charCountString = StringUtil.localizeFormatted("booklet."+ModUtil.MOD_ID_LOWER+".amountOfChars", ClientProxy.bookletCharCount); - booklet.getFontRenderer().drawString(EnumChatFormatting.ITALIC+charCountString, booklet.guiLeft+booklet.xSize-booklet.getFontRenderer().getStringWidth(charCountString)-15, booklet.guiTop+booklet.ySize-18, 0); + booklet.getFontRenderer().drawString(TextFormatting.ITALIC+charCountString, booklet.guiLeft+booklet.xSize-booklet.getFontRenderer().getStringWidth(charCountString)-15, booklet.guiTop+booklet.ySize-18, 0); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java index c217b0012..f39d8b2ad 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/GuiBooklet.java @@ -34,9 +34,9 @@ import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.IChatComponent; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import org.lwjgl.input.Keyboard; @@ -164,7 +164,8 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{ public void keyTyped(char theChar, int key){ if(AND_HIS_NAME_IS.length > this.hisNameIsAt && AND_HIS_NAME_IS[this.hisNameIsAt] == key){ if(this.hisNameIsAt+1 >= AND_HIS_NAME_IS.length){ - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation(ModUtil.MOD_ID_LOWER, "duhDuhDuhDuuuh"))); + //TODO Fix sound + //Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation(ModUtil.MOD_ID_LOWER, "duhDuhDuhDuuuh"))); ModUtil.LOGGER.info("AND HIS NAME IS JOHN CENA DUH DUH DUH DUUUH"); this.hisNameIsAt = 0; } @@ -274,46 +275,46 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{ this.guiLeft = (this.width-this.xSize)/2; this.guiTop = (this.height-this.ySize)/2; - this.buttonForward = new TexturedButton(0, this.guiLeft+this.xSize-26, this.guiTop+this.ySize+1, 164, 0, 18, 10, Collections.singletonList(EnumChatFormatting.GOLD+"Next Page")); + this.buttonForward = new TexturedButton(0, this.guiLeft+this.xSize-26, this.guiTop+this.ySize+1, 164, 0, 18, 10, Collections.singletonList(TextFormatting.GOLD+"Next Page")); this.buttonList.add(this.buttonForward); - this.buttonBackward = new TexturedButton(1, this.guiLeft+8, this.guiTop+this.ySize+1, 146, 0, 18, 10, Collections.singletonList(EnumChatFormatting.GOLD+"Previous Page")); + this.buttonBackward = new TexturedButton(1, this.guiLeft+8, this.guiTop+this.ySize+1, 146, 0, 18, 10, Collections.singletonList(TextFormatting.GOLD+"Previous Page")); this.buttonList.add(this.buttonBackward); - this.buttonPreviousScreen = new TexturedButton(2, this.guiLeft+this.xSize/2-7, this.guiTop+this.ySize+1, 182, 0, 15, 10, Collections.singletonList(EnumChatFormatting.GOLD+"Back")); + this.buttonPreviousScreen = new TexturedButton(2, this.guiLeft+this.xSize/2-7, this.guiTop+this.ySize+1, 182, 0, 15, 10, Collections.singletonList(TextFormatting.GOLD+"Back")); this.buttonList.add(this.buttonPreviousScreen); ArrayList updateHover = new ArrayList(); if(UpdateChecker.checkFailed){ - updateHover.add(IChatComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.failed")).getFormattedText()); + updateHover.add(ITextComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.failed")).getFormattedText()); } else if(UpdateChecker.needsUpdateNotify){ - updateHover.add(IChatComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.generic")).getFormattedText()); - updateHover.add(IChatComponent.Serializer.jsonToComponent(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".update.versionCompare", ModUtil.VERSION, UpdateChecker.updateVersionString)).getFormattedText()); + updateHover.add(ITextComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.generic")).getFormattedText()); + updateHover.add(ITextComponent.Serializer.jsonToComponent(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".update.versionCompare", ModUtil.VERSION, UpdateChecker.updateVersionString)).getFormattedText()); updateHover.add(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.buttonOptions")); } this.buttonUpdate = new TexturedButton(4, this.guiLeft-11, this.guiTop-11, 245, 0, 11, 11, updateHover); this.buttonUpdate.visible = UpdateChecker.needsUpdateNotify; this.buttonList.add(this.buttonUpdate); - this.buttonTwitter = new TexturedButton(5, this.guiLeft, this.guiTop, 213, 0, 8, 8, Collections.singletonList(EnumChatFormatting.GOLD+"Open @ActAddMod on Twitter in Browser")); + this.buttonTwitter = new TexturedButton(5, this.guiLeft, this.guiTop, 213, 0, 8, 8, Collections.singletonList(TextFormatting.GOLD+"Open @ActAddMod on Twitter in Browser")); this.buttonList.add(this.buttonTwitter); - this.buttonForum = new TexturedButton(6, this.guiLeft, this.guiTop+10, 221, 0, 8, 8, Collections.singletonList(EnumChatFormatting.GOLD+"Open Minecraft Forum Post in Browser")); + this.buttonForum = new TexturedButton(6, this.guiLeft, this.guiTop+10, 221, 0, 8, 8, Collections.singletonList(TextFormatting.GOLD+"Open Minecraft Forum Post in Browser")); this.buttonList.add(this.buttonForum); - this.buttonAchievements = new TexturedButton(7, this.guiLeft+138, this.guiTop, 205, 0, 8, 8, Collections.singletonList(EnumChatFormatting.GOLD+"Show Achievements")); + this.buttonAchievements = new TexturedButton(7, this.guiLeft+138, this.guiTop, 205, 0, 8, 8, Collections.singletonList(TextFormatting.GOLD+"Show Achievements")); this.buttonList.add(this.buttonAchievements); ArrayList websiteHover = new ArrayList(); - websiteHover.add(EnumChatFormatting.GOLD+"Open Author's Website"); + websiteHover.add(TextFormatting.GOLD+"Open Author's Website"); websiteHover.add("(There's some cool stuff there!)"); - websiteHover.add(EnumChatFormatting.GRAY+""+EnumChatFormatting.ITALIC+"Would you call this Product Placement?"); + websiteHover.add(TextFormatting.GRAY+""+TextFormatting.ITALIC+"Would you call this Product Placement?"); this.buttonWebsite = new TexturedButton(-99, this.guiLeft, this.guiTop+20, 228, 0, 8, 8, websiteHover); this.buttonList.add(this.buttonWebsite); ArrayList configHover = new ArrayList(); - configHover.add(EnumChatFormatting.GOLD+"Show Configuration GUI"); + configHover.add(TextFormatting.GOLD+"Show Configuration GUI"); configHover.addAll(this.fontRendererObj.listFormattedStringToWidth("It is highly recommended that you restart your game after changing anything as that prevents possible bugs occuring!", 200)); this.buttonConfig = new TexturedButton(8, this.guiLeft+138, this.guiTop+10, 197, 0, 8, 8, configHover); this.buttonList.add(this.buttonConfig); @@ -416,7 +417,7 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{ list.set(k, stack.getRarity().rarityColor+(String)list.get(k)); } else{ - list.set(k, EnumChatFormatting.GRAY+(String)list.get(k)); + list.set(k, TextFormatting.GRAY+(String)list.get(k)); } } @@ -428,7 +429,8 @@ public class GuiBooklet extends GuiScreen implements IBookletGui{ if(mousePressed){ BookletUtils.openIndexEntry(this, page.getChapter().getEntry(), ActuallyAdditionsAPI.bookletEntries.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1, true); BookletUtils.openChapter(this, page.getChapter(), page); - Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); + //TODO Fix sound + //Minecraft.getMinecraft().getSoundHandler().playSound(PositionedSoundRecord.create(new ResourceLocation("gui.button.press"), 1.0F)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java index 233a98e34..2816f8d50 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/BookmarkButton.java @@ -20,7 +20,7 @@ import net.minecraft.client.gui.GuiButton; import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import java.util.ArrayList; @@ -83,16 +83,16 @@ public class BookmarkButton extends GuiButton{ ArrayList list = new ArrayList(); if(this.assignedEntry.entry != null){ if(this.assignedEntry.chapter != null){ - list.add(EnumChatFormatting.GOLD+this.assignedEntry.chapter.getLocalizedName()+", Page "+this.assignedEntry.page.getID()); + list.add(TextFormatting.GOLD+this.assignedEntry.chapter.getLocalizedName()+", Page "+this.assignedEntry.page.getID()); } else{ - list.add(EnumChatFormatting.GOLD+this.assignedEntry.entry.getLocalizedName()+", Page "+this.assignedEntry.pageInIndex); + list.add(TextFormatting.GOLD+this.assignedEntry.entry.getLocalizedName()+", Page "+this.assignedEntry.pageInIndex); } list.add("Click to open"); - list.add(EnumChatFormatting.ITALIC+"Shift-Click to remove"); + list.add(TextFormatting.ITALIC+"Shift-Click to remove"); } else{ - list.add(EnumChatFormatting.GOLD+"None"); + list.add(TextFormatting.GOLD+"None"); list.add("Click to save current page"); } this.booklet.drawHoveringText(list, mouseX, mouseY); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/IndexButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/IndexButton.java index 8107169ab..87b019555 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/IndexButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/button/IndexButton.java @@ -19,7 +19,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiButton; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; public class IndexButton extends GuiButton{ @@ -63,7 +63,7 @@ public class IndexButton extends GuiButton{ public void drawHover(int mouseX, int mouseY){ if(this.chap instanceof BookletChapter && ((BookletChapter)this.chap).isIncomplete){ - this.gui.drawHoveringText(this.gui.getFontRenderer().listFormattedStringToWidth(EnumChatFormatting.RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".unavailable"), 250), mouseX, mouseY); + this.gui.drawHoveringText(this.gui.getFontRenderer().listFormattedStringToWidth(TextFormatting.RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".unavailable"), 250), mouseX, mouseY); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java index 3eb2144af..b8de3244d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/chapter/BookletChapter.java @@ -17,7 +17,7 @@ import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; public class BookletChapter implements IBookletChapter{ @@ -25,7 +25,7 @@ public class BookletChapter implements IBookletChapter{ public final IBookletEntry entry; public final ItemStack displayStack; private final String unlocalizedName; - public EnumChatFormatting color; + public TextFormatting color; public boolean isIncomplete; @@ -42,7 +42,7 @@ public class BookletChapter implements IBookletChapter{ page.setChapter(this); } - this.color = EnumChatFormatting.RESET; + this.color = TextFormatting.RESET; } @Override @@ -81,12 +81,12 @@ public class BookletChapter implements IBookletChapter{ } public BookletChapter setImportant(){ - this.color = EnumChatFormatting.DARK_GREEN; + this.color = TextFormatting.DARK_GREEN; return this; } public BookletChapter setSpecial(){ - this.color = EnumChatFormatting.DARK_PURPLE; + this.color = TextFormatting.DARK_PURPLE; return this; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java index 74011bbc3..26dc947fc 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/entry/BookletEntry.java @@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.api.booklet.IBookletChapter; import de.ellpeck.actuallyadditions.api.booklet.IBookletEntry; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import java.util.ArrayList; import java.util.List; @@ -24,13 +24,13 @@ public class BookletEntry implements IBookletEntry{ private final String unlocalizedName; public List chapters = new ArrayList(); - private EnumChatFormatting color; + private TextFormatting color; public BookletEntry(String unlocalizedName){ this.unlocalizedName = unlocalizedName; ActuallyAdditionsAPI.addBookletEntry(this); - this.color = EnumChatFormatting.RESET; + this.color = TextFormatting.RESET; } @Override @@ -64,12 +64,12 @@ public class BookletEntry implements IBookletEntry{ } public BookletEntry setImportant(){ - this.color = EnumChatFormatting.DARK_GREEN; + this.color = TextFormatting.DARK_GREEN; return this; } public BookletEntry setSpecial(){ - this.color = EnumChatFormatting.DARK_PURPLE; + this.color = TextFormatting.DARK_PURPLE; return this; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java index 4eef6f123..c6d3553c6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/BookletPageAA.java @@ -17,7 +17,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import java.util.HashMap; import java.util.Map; @@ -44,12 +44,12 @@ public class BookletPageAA extends BookletPage{ } String base = StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".chapter."+this.chapter.getUnlocalizedName()+".text."+this.localizationKey); - base = base.replaceAll("", EnumChatFormatting.DARK_GREEN+""); - base = base.replaceAll("", EnumChatFormatting.BLUE+""); - base = base.replaceAll("", EnumChatFormatting.BLACK+""); + base = base.replaceAll("", TextFormatting.DARK_GREEN+""); + base = base.replaceAll("", TextFormatting.BLUE+""); + base = base.replaceAll("", TextFormatting.BLACK+""); base = base.replaceAll("", "\n"); - base = base.replaceAll("", EnumChatFormatting.ITALIC+""); - base = base.replaceAll("", EnumChatFormatting.DARK_RED+""+EnumChatFormatting.UNDERLINE); //This is fucking important so go read it now + base = base.replaceAll("", TextFormatting.ITALIC+""); + base = base.replaceAll("", TextFormatting.DARK_RED+""+TextFormatting.UNDERLINE); //This is fucking important so go read it now for(Object o : this.textReplacements.entrySet()){ Map.Entry e = (Map.Entry)o; @@ -80,7 +80,7 @@ public class BookletPageAA extends BookletPage{ @Override public String getClickToSeeRecipeString(){ - return EnumChatFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe"); + return TextFormatting.GOLD+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".clickToSeeRecipe"); } public BookletPage setNoText(){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java index 3f512c03f..230e6a9fd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrafting.java @@ -22,7 +22,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.IRecipe; import net.minecraft.item.crafting.ShapedRecipes; import net.minecraft.item.crafting.ShapelessRecipes; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.ReflectionHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -64,7 +64,7 @@ public class PageCrafting extends BookletPageAA{ IRecipe recipe = this.recipes[this.recipePos]; if(recipe == null){ - StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false); + StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false); } else{ String strg = StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+"."+(recipe instanceof ShapedRecipes ? "shapedRecipe" : (recipe instanceof ShapelessRecipes ? "shapelessRecipe" : (recipe instanceof ShapelessOreRecipe ? "shapelessOreRecipe" : "shapedOreRecipe")))); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java index 288d874f9..85028df26 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageCrusherRecipe.java @@ -20,7 +20,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -53,7 +53,7 @@ public class PageCrusherRecipe extends BookletPageAA{ @SideOnly(Side.CLIENT) public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ if(recipe == null){ - StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false); + StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false); } else{ String strg = "Crusher Recipe"; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java index f8cde97b0..75d591dbe 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageFurnace.java @@ -20,7 +20,7 @@ import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; import net.minecraft.item.crafting.FurnaceRecipes; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -57,7 +57,7 @@ public class PageFurnace extends BookletPageAA{ public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ ItemStack input = this.input != null ? this.input : this.getInputForOutput(this.result); if(input == null){ - StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false); + StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false); } else{ String strg = "Furnace Recipe"; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java index d74c04856..ffd2988de 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/booklet/page/PageReconstructor.java @@ -21,7 +21,7 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.client.Minecraft; import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -58,7 +58,7 @@ public class PageReconstructor extends BookletPageAA{ public void render(IBookletGui gui, int mouseX, int mouseY, int ticksElapsed, boolean mousePressed){ LensNoneRecipe recipe = this.recipes[this.recipePos]; if(recipe == null){ - StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, EnumChatFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false); + StringUtil.drawSplitString(Minecraft.getMinecraft().fontRendererObj, TextFormatting.DARK_RED+StringUtil.localize("booklet."+ModUtil.MOD_ID_LOWER+".recipeDisabled"), gui.getGuiLeft()+14, gui.getGuiTop()+15, 115, 0, false); } else{ String strg = "Atomic Reconstructor"; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java index fb9c016fd..30fe6f917 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/creative/CreativeTab.java @@ -44,7 +44,7 @@ public class CreativeTab extends CreativeTabs{ @Override @SideOnly(Side.CLIENT) - public void displayAllReleventItems(List list){ + public void displayAllRelevantItems(List list){ this.list = list; add(InitItems.itemBooklet); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/BucketFillEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/BucketFillEvent.java index f86ab2dfe..1aa29f8a1 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/BucketFillEvent.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/BucketFillEvent.java @@ -30,10 +30,10 @@ public class BucketFillEvent{ } private void fillBucket(FillBucketEvent event, Item item, Block fluid){ - Block block = PosUtil.getBlock(event.target.getBlockPos(), event.world); + Block block = PosUtil.getBlock(event.getTarget().getBlockPos(), event.getWorld()); if(block == fluid){ - event.world.setBlockToAir(event.target.getBlockPos()); - event.result = new ItemStack(item); + event.getWorld().setBlockToAir(event.getTarget().getBlockPos()); + event.setFilledBucket(new ItemStack(item)); event.setResult(Event.Result.ALLOW); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/HudEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/HudEvent.java index ceb691ded..d8ebcd2e0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/HudEvent.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/HudEvent.java @@ -24,8 +24,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.profiler.Profiler; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.EnumChatFormatting; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.client.event.RenderGameOverlayEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; @@ -37,9 +37,9 @@ public class HudEvent{ Minecraft minecraft = Minecraft.getMinecraft(); Profiler profiler = minecraft.mcProfiler; EntityPlayer player = minecraft.thePlayer; - MovingObjectPosition posHit = minecraft.objectMouseOver; + RayTraceResult posHit = minecraft.objectMouseOver; FontRenderer font = minecraft.fontRendererObj; - ItemStack stack = player.getCurrentEquippedItem(); + ItemStack stack = player.getActiveItemStack(); profiler.startSection(ModUtil.MOD_ID+"Hud"); @@ -64,11 +64,11 @@ public class HudEvent{ if(tileHit instanceof IRedstoneToggle){ profiler.startSection("RedstoneToggleHudDisplay"); - String strg = "Redstone Mode: "+EnumChatFormatting.DARK_RED+(((IRedstoneToggle)tileHit).isPulseMode() ? "Pulse" : "Deactivation")+EnumChatFormatting.RESET; + String strg = "Redstone Mode: "+TextFormatting.DARK_RED+(((IRedstoneToggle)tileHit).isPulseMode() ? "Pulse" : "Deactivation")+TextFormatting.RESET; font.drawStringWithShadow(strg, event.resolution.getScaledWidth()/2+5, event.resolution.getScaledHeight()/2+5, StringUtil.DECIMAL_COLOR_WHITE); if(stack != null && Block.getBlockFromItem(stack.getItem()) instanceof BlockRedstoneTorch){ - String expl = EnumChatFormatting.GREEN+"Right-Click to toggle!"; + String expl = TextFormatting.GREEN+"Right-Click to toggle!"; font.drawStringWithShadow(expl, event.resolution.getScaledWidth()/2+5, event.resolution.getScaledHeight()/2+15, StringUtil.DECIMAL_COLOR_WHITE); } @@ -78,7 +78,7 @@ public class HudEvent{ if(tileHit instanceof IEnergyDisplay){ profiler.startSection("EnergyDisplay"); String strg = ((IEnergyDisplay)tileHit).getEnergy()+"/"+((IEnergyDisplay)tileHit).getMaxEnergy()+" RF"; - font.drawStringWithShadow(EnumChatFormatting.GOLD+strg, event.resolution.getScaledWidth()/2+5, event.resolution.getScaledHeight()/2-10, StringUtil.DECIMAL_COLOR_WHITE); + font.drawStringWithShadow(TextFormatting.GOLD+strg, event.resolution.getScaledWidth()/2+5, event.resolution.getScaledHeight()/2-10, StringUtil.DECIMAL_COLOR_WHITE); profiler.endSection(); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java index b8d8b5ea9..fdb41da12 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/TooltipEvent.java @@ -17,7 +17,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiScreen; import net.minecraft.item.Item; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.oredict.OreDictionary; @@ -26,8 +26,8 @@ import java.util.List; public class TooltipEvent{ - private static final String ADVANCED_INFO_TEXT_PRE = EnumChatFormatting.DARK_GRAY+" "; - private static final String ADVANCED_INFO_HEADER_PRE = EnumChatFormatting.GRAY+" -"; + private static final String ADVANCED_INFO_TEXT_PRE = TextFormatting.DARK_GRAY+" "; + private static final String ADVANCED_INFO_HEADER_PRE = TextFormatting.GRAY+" -"; @SuppressWarnings("unchecked") @SubscribeEvent @@ -36,7 +36,7 @@ public class TooltipEvent{ if(event.itemStack.getItem() != null){ if(ConfigBoolValues.CTRL_EXTRA_INFO.isEnabled()){ if(GuiScreen.isCtrlKeyDown()){ - event.toolTip.add(EnumChatFormatting.DARK_GRAY+""+EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".extraInfo.desc")+":"); + event.toolTip.add(TextFormatting.DARK_GRAY+""+TextFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".extraInfo.desc")+":"); //OreDict Names int[] oreIDs = OreDictionary.getOreIDs(event.itemStack); @@ -84,17 +84,17 @@ public class TooltipEvent{ } } else{ - event.toolTip.add(ADVANCED_INFO_TEXT_PRE+EnumChatFormatting.ITALIC+"["+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".pressShift.desc")+"]"); + event.toolTip.add(ADVANCED_INFO_TEXT_PRE+TextFormatting.ITALIC+"["+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".pressShift.desc")+"]"); } } //Disabling Info - event.toolTip.addAll(Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".disablingInfo.desc"), 200)); + event.toolTip.addAll(Minecraft.getMinecraft().fontRendererObj.listFormattedStringToWidth(TextFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".disablingInfo.desc"), 200)); } else{ if(ConfigBoolValues.CTRL_INFO_FOR_EXTRA_INFO.isEnabled()){ - event.toolTip.add(EnumChatFormatting.DARK_GRAY+""+EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".ctrlForMoreInfo.desc")); + event.toolTip.add(TextFormatting.DARK_GRAY+""+TextFormatting .ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".ctrlForMoreInfo.desc")); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/event/WorldDecorationEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/event/WorldDecorationEvent.java index 07d014a31..cb93092f6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/event/WorldDecorationEvent.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/event/WorldDecorationEvent.java @@ -21,7 +21,7 @@ import de.ellpeck.actuallyadditions.mod.util.Util; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.biome.BiomeGenOcean; import net.minecraftforge.event.terraingen.DecorateBiomeEvent; import net.minecraftforge.fml.common.eventhandler.Event; @@ -34,7 +34,7 @@ public class WorldDecorationEvent{ @SubscribeEvent public void onWorldDecoration(DecorateBiomeEvent.Decorate event){ if((event.getResult() == Event.Result.ALLOW || event.getResult() == Event.Result.DEFAULT)){ - if(Util.arrayContains(ConfigValues.plantDimensionBlacklist, event.world.provider.getDimensionId()) < 0){ + if(Util.arrayContains(ConfigValues.plantDimensionBlacklist, event.world.provider.getDimension()) < 0){ this.generateRice(event); this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.CANOLA.ordinal(), ConfigIntValues.CANOLA_AMOUNT.getValue(), ConfigBoolValues.DO_CANOLA_GEN.isEnabled(), Material.grass, event); this.genPlantNormally(InitBlocks.blockWildPlant, TheWildPlants.FLAX.ordinal(), ConfigIntValues.FLAX_AMOUNT.getValue(), ConfigBoolValues.DO_FLAX_GEN.isEnabled(), Material.grass, event); @@ -50,7 +50,7 @@ public class WorldDecorationEvent{ if(event.world.getBiomeGenForCoords(randomPos) instanceof BiomeGenOcean){ if(randomPos.getY() >= 25 && randomPos.getY() <= 45){ - if(PosUtil.getBlock(randomPos, event.world).getMaterial() == Material.water){ + if(PosUtil.getBlock(randomPos, event.world).getMaterial(event.world.getBlockState(randomPos)) == Material.water){ if(PosUtil.getMaterial(PosUtil.offset(randomPos, 0, -1, 0), event.world).isSolid()){ PosUtil.setBlock(randomPos, event.world, InitBlocks.blockTreasureChest, event.rand.nextInt(4), 2); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/JamVillagerTradeHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/JamVillagerTradeHandler.java index a67fbfeb7..7228c4f7d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/JamVillagerTradeHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/JamVillagerTradeHandler.java @@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheJams; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.MathHelper; import net.minecraft.village.MerchantRecipe; import net.minecraft.village.MerchantRecipeList; import net.minecraftforge.oredict.OreDictionary; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java index 46a556502..fe7821a2b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/gen/OreGen.java @@ -17,12 +17,13 @@ import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.block.Block; -import net.minecraft.block.state.pattern.BlockHelper; +import net.minecraft.block.state.pattern.BlockMatcher; import net.minecraft.init.Blocks; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraft.world.WorldType; +import net.minecraft.world.chunk.IChunkGenerator; import net.minecraft.world.chunk.IChunkProvider; import net.minecraft.world.gen.feature.WorldGenMinable; import net.minecraftforge.fml.common.IWorldGenerator; @@ -41,9 +42,9 @@ public class OreGen implements IWorldGenerator{ } @Override - public void generate(Random random, int chunkX, int chunkZ, World world, IChunkProvider chunkGenerator, IChunkProvider chunkProvider){ - if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.getDimensionId()) < 0){ - switch(world.provider.getDimensionId()){ + public void generate(Random random, int chunkX, int chunkZ, World world, IChunkGenerator chunkGenerator, IChunkProvider chunkProvider){ + if(world.getWorldType() != WorldType.FLAT && Util.arrayContains(ConfigValues.oreGenDimensionBlacklist, world.provider.getDimension()) < 0){ + switch(world.provider.getDimension()){ case -1: generateNether(world, random, chunkX*16, chunkZ*16); //case 0: @@ -79,7 +80,7 @@ public class OreGen implements IWorldGenerator{ int posX = blockXPos+random.nextInt(16); int posY = minY+random.nextInt(yDiff); int posZ = blockZPos+random.nextInt(16); - new WorldGenMinable(block.getStateFromMeta(meta), maxVeinSize, BlockHelper.forBlock(blockIn)).generate(world, random, new BlockPos(posX, posY, posZ)); + new WorldGenMinable(block.getStateFromMeta(meta), maxVeinSize, BlockMatcher.forBlock(blockIn)).generate(world, random, new BlockPos(posX, posY, posZ)); } } else{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java index 17914bb9e..f2b8a0d83 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerDrill.java @@ -21,7 +21,7 @@ import net.minecraft.inventory.Container; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemStack; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; @InventoryContainer public class ContainerDrill extends Container{ @@ -119,7 +119,8 @@ public class ContainerDrill extends Container{ return null; } - @Override + //TODO Fix slotClick() + /*@Override public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){ //par3 appears to be the type of clicking //par3 == 2 appears to be one of the number keys being hit @@ -129,7 +130,7 @@ public class ContainerDrill extends Container{ else{ return super.slotClick(par1, par2, par3, player); } - } + }*/ @Override public void onContainerClosed(EntityPlayer player){ @@ -160,7 +161,7 @@ public class ContainerDrill extends Container{ } @Override - public IChatComponent getDisplayName(){ + public ITextComponent getDisplayName(){ return null; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java index d28356719..d98edf938 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnergizer.java @@ -50,7 +50,7 @@ public class ContainerEnergizer extends Container{ this.addSlotToContainer(new Slot(inventory, inventory.getSizeInventory()-1-i, 102, 19+i*18){ @Override public boolean isItemValid(ItemStack stack){ - return stack != null && stack.getItem().isValidArmor(stack, finalI, finalPlayer); + return stack != null && stack.getItem().isValidArmor(stack, ContainerEnervator.ARMOR_SLOTS[finalI], finalPlayer); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java index 95829c910..c72dbfe2f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerEnervator.java @@ -18,6 +18,7 @@ import invtweaks.api.container.InventoryContainer; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.inventory.Container; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.inventory.Slot; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; @@ -29,6 +30,8 @@ public class ContainerEnervator extends Container{ private TileEntityEnervator enervator; + public static final EntityEquipmentSlot[] ARMOR_SLOTS = new EntityEquipmentSlot[] {EntityEquipmentSlot.HEAD, EntityEquipmentSlot.CHEST, EntityEquipmentSlot.LEGS, EntityEquipmentSlot.FEET}; + public ContainerEnervator(EntityPlayer player, TileEntityBase tile){ this.enervator = (TileEntityEnervator)tile; InventoryPlayer inventory = player.inventory; @@ -50,7 +53,7 @@ public class ContainerEnervator extends Container{ this.addSlotToContainer(new Slot(inventory, inventory.getSizeInventory()-1-i, 102, 19+i*18){ @Override public boolean isItemValid(ItemStack stack){ - return stack != null && stack.getItem().isValidArmor(stack, finalI, finalPlayer); + return stack != null && stack.getItem().isValidArmor(stack, ARMOR_SLOTS[finalI], finalPlayer); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java index 82efa927d..0567c9b1e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerInputter.java @@ -103,7 +103,8 @@ public class ContainerInputter extends Container{ return null; } - @Override + //TODO slotClick() + /*@Override public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){ if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){ //Calls the Filter's SlotClick function @@ -112,7 +113,7 @@ public class ContainerInputter extends Container{ else{ return super.slotClick(par1, par2, par3, player); } - } + }*/ @Override public boolean canInteractWith(EntityPlayer player){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java index 89eb7b93c..dd2273110 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/ContainerRangedCollector.java @@ -98,7 +98,8 @@ public class ContainerRangedCollector extends Container{ return null; } - @Override + //TODO Find a replacement for slotClick() + /*@Override public ItemStack slotClick(int par1, int par2, int par3, EntityPlayer player){ if(par1 >= 0 && par1 < this.inventorySlots.size() && this.getSlot(par1) instanceof SlotFilter){ //Calls the Filter's SlotClick function @@ -107,7 +108,7 @@ public class ContainerRangedCollector extends Container{ else{ return super.slotClick(par1, par2, par3, player); } - } + }*/ @Override public boolean canInteractWith(EntityPlayer player){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java index 3ce88f5d0..4df893416 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/GuiHandler.java @@ -16,7 +16,7 @@ import de.ellpeck.actuallyadditions.mod.inventory.gui.*; import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.IGuiHandler; import net.minecraftforge.fml.common.network.NetworkRegistry; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java index ba72bc1ff..46a5154d5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiInputter.java @@ -25,8 +25,8 @@ import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.entity.player.InventoryPlayer; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -128,14 +128,14 @@ public class GuiInputter extends GuiContainer{ String text1 = this.tileInputter.isPullWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.blacklist"); if(x >= guiLeft+3 && y >= guiTop+16 && x <= guiLeft+18 && y <= guiTop+31){ ArrayList list = new ArrayList(); - list.add(EnumChatFormatting.BOLD+text1); + list.add(TextFormatting.BOLD+text1); list.addAll(infoList); this.drawHoveringText(list, x, y); } String text2 = this.tileInputter.isPutWhitelist ? StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.whitelist") : StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.blacklist"); if(x >= guiLeft+157 && y >= guiTop+16 && x <= guiLeft+172 && y <= guiTop+31){ ArrayList list = new ArrayList(); - list.add(EnumChatFormatting.BOLD+text2); + list.add(TextFormatting.BOLD+text2); list.addAll(infoList); this.drawHoveringText(list, x, y); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiSmileyCloud.java b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiSmileyCloud.java index 3ec364c7b..b25c7454d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiSmileyCloud.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/inventory/gui/GuiSmileyCloud.java @@ -22,8 +22,8 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.inventory.GuiContainer; import net.minecraft.client.renderer.GlStateManager; -import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -75,7 +75,7 @@ public class GuiSmileyCloud extends GuiContainer{ @Override public void drawGuiContainerForegroundLayer(int x, int y){ - String name = cloud.name == null || cloud.name.isEmpty() ? "" : EnumChatFormatting.GOLD+cloud.name+EnumChatFormatting.RESET+" "+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.the")+" "; + String name = cloud.name == null || cloud.name.isEmpty() ? "" : TextFormatting.GOLD+cloud.name+TextFormatting.RESET+" "+StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".gui.the")+" "; String localizedName = name+StringUtil.localize("container."+ModUtil.MOD_ID_LOWER+".cloud.name"); this.fontRendererObj.drawString(localizedName, xSize/2-this.fontRendererObj.getStringWidth(localizedName)/2, -10, StringUtil.DECIMAL_COLOR_WHITE); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java index 6ccded60d..c2226fcfe 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/InitItems.java @@ -220,18 +220,18 @@ public class InitItems{ itemGrowthRing = new ItemGrowthRing("itemGrowthRing"); itemMagnetRing = new ItemMagnetRing("itemSuctionRing"); itemWaterRemovalRing = new ItemWaterRemovalRing("itemWaterRemovalRing"); - itemHelmEmerald = new ItemArmorAA("itemHelmEmerald", InitArmorMaterials.armorMaterialEmerald, 0, new ItemStack(Items.emerald), "armorEmerald"); - itemChestEmerald = new ItemArmorAA("itemChestEmerald", InitArmorMaterials.armorMaterialEmerald, 1, new ItemStack(Items.emerald), "armorEmerald"); - itemPantsEmerald = new ItemArmorAA("itemPantsEmerald", InitArmorMaterials.armorMaterialEmerald, 2, new ItemStack(Items.emerald), "armorEmerald"); - itemBootsEmerald = new ItemArmorAA("itemBootsEmerald", InitArmorMaterials.armorMaterialEmerald, 3, new ItemStack(Items.emerald), "armorEmerald"); - itemHelmObsidian = new ItemArmorAA("itemHelmObsidian", InitArmorMaterials.armorMaterialObsidian, 0, new ItemStack(Blocks.obsidian), "armorObsidian"); - itemChestObsidian = new ItemArmorAA("itemChestObsidian", InitArmorMaterials.armorMaterialObsidian, 1, new ItemStack(Blocks.obsidian), "armorObsidian"); - itemPantsObsidian = new ItemArmorAA("itemPantsObsidian", InitArmorMaterials.armorMaterialObsidian, 2, new ItemStack(Blocks.obsidian), "armorObsidian"); - itemBootsObsidian = new ItemArmorAA("itemBootsObsidian", InitArmorMaterials.armorMaterialObsidian, 3, new ItemStack(Blocks.obsidian), "armorObsidian"); - itemHelmQuartz = new ItemArmorAA("itemHelmQuartz", InitArmorMaterials.armorMaterialQuartz, 0, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz"); - itemChestQuartz = new ItemArmorAA("itemChestQuartz", InitArmorMaterials.armorMaterialQuartz, 1, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz"); - itemPantsQuartz = new ItemArmorAA("itemPantsQuartz", InitArmorMaterials.armorMaterialQuartz, 2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz"); - itemBootsQuartz = new ItemArmorAA("itemBootsQuartz", InitArmorMaterials.armorMaterialQuartz, 3, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "armorQuartz"); + itemHelmEmerald = new ItemArmorAA("itemHelmEmerald", InitArmorMaterials.armorMaterialEmerald, 0, new ItemStack(Items.emerald)); + itemChestEmerald = new ItemArmorAA("itemChestEmerald", InitArmorMaterials.armorMaterialEmerald, 1, new ItemStack(Items.emerald)); + itemPantsEmerald = new ItemArmorAA("itemPantsEmerald", InitArmorMaterials.armorMaterialEmerald, 2, new ItemStack(Items.emerald)); + itemBootsEmerald = new ItemArmorAA("itemBootsEmerald", InitArmorMaterials.armorMaterialEmerald, 3, new ItemStack(Items.emerald)); + itemHelmObsidian = new ItemArmorAA("itemHelmObsidian", InitArmorMaterials.armorMaterialObsidian, 0, new ItemStack(Blocks.obsidian)); + itemChestObsidian = new ItemArmorAA("itemChestObsidian", InitArmorMaterials.armorMaterialObsidian, 1, new ItemStack(Blocks.obsidian)); + itemPantsObsidian = new ItemArmorAA("itemPantsObsidian", InitArmorMaterials.armorMaterialObsidian, 2, new ItemStack(Blocks.obsidian)); + itemBootsObsidian = new ItemArmorAA("itemBootsObsidian", InitArmorMaterials.armorMaterialObsidian, 3, new ItemStack(Blocks.obsidian)); + itemHelmQuartz = new ItemArmorAA("itemHelmQuartz", InitArmorMaterials.armorMaterialQuartz, 0, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())); + itemChestQuartz = new ItemArmorAA("itemChestQuartz", InitArmorMaterials.armorMaterialQuartz, 1, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())); + itemPantsQuartz = new ItemArmorAA("itemPantsQuartz", InitArmorMaterials.armorMaterialQuartz, 2, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())); + itemBootsQuartz = new ItemArmorAA("itemBootsQuartz", InitArmorMaterials.armorMaterialQuartz, 3, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal())); itemTeleStaff = new ItemTeleStaff("itemTeleStaff"); itemWingsOfTheBats = new ItemWingsOfTheBats("itemWingsOfTheBats"); itemDrill = new ItemDrill("itemDrill"); @@ -296,7 +296,7 @@ public class InitItems{ stonePaxel = new ItemAllToolAA(Item.ToolMaterial.STONE, new ItemStack(Blocks.cobblestone), "stonePaxel", EnumRarity.UNCOMMON, 7040621); ironPaxel = new ItemAllToolAA(Item.ToolMaterial.IRON, new ItemStack(Items.iron_ingot), "ironPaxel", EnumRarity.RARE, 10920613); goldPaxel = new ItemAllToolAA(Item.ToolMaterial.GOLD, new ItemStack(Items.gold_ingot), "goldPaxel", EnumRarity.RARE, 16770048); - diamondPaxel = new ItemAllToolAA(Item.ToolMaterial.EMERALD, new ItemStack(Items.diamond), "diamondPaxel", EnumRarity.EPIC, 3250376); + diamondPaxel = new ItemAllToolAA(Item.ToolMaterial.DIAMOND, new ItemStack(Items.diamond), "diamondPaxel", EnumRarity.EPIC, 3250376); emeraldPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialEmerald, new ItemStack(Items.emerald), "emeraldPaxel", EnumRarity.EPIC, 7723338); obsidianPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialObsidian, new ItemStack(Blocks.obsidian), "obsidianPaxel", EnumRarity.EPIC, 4166); quartzPaxel = new ItemAllToolAA(InitToolMaterials.toolMaterialQuartz, new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), "quartzPaxel", EnumRarity.RARE, 1710103); @@ -306,10 +306,10 @@ public class InitItems{ itemShovelCrystalRed = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemShovelCrystalRed", Util.CRYSTAL_RED_RARITY); itemSwordCrystalRed = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemSwordCrystalRed", Util.CRYSTAL_RED_RARITY); itemHoeCrystalRed = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemHoeCrystalRed", Util.CRYSTAL_RED_RARITY); - itemHelmCrystalRed = new ItemArmorAA("itemHelmCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "armorCrystalRed", Util.CRYSTAL_RED_RARITY); - itemChestCrystalRed = new ItemArmorAA("itemChestCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "armorCrystalRed", Util.CRYSTAL_RED_RARITY); - itemPantsCrystalRed = new ItemArmorAA("itemPantsCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "armorCrystalRed", Util.CRYSTAL_RED_RARITY); - itemBootsCrystalRed = new ItemArmorAA("itemBootsCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "armorCrystalRed", Util.CRYSTAL_RED_RARITY); + itemHelmCrystalRed = new ItemArmorAA("itemHelmCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), Util.CRYSTAL_RED_RARITY); + itemChestCrystalRed = new ItemArmorAA("itemChestCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), Util.CRYSTAL_RED_RARITY); + itemPantsCrystalRed = new ItemArmorAA("itemPantsCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), Util.CRYSTAL_RED_RARITY); + itemBootsCrystalRed = new ItemArmorAA("itemBootsCrystalRed", InitArmorMaterials.armorMaterialCrystalRed, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), Util.CRYSTAL_RED_RARITY); itemPaxelCrystalRed = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalRed, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.REDSTONE.ordinal()), "itemPaxelCrystalRed", Util.CRYSTAL_RED_RARITY, 16711689); itemPickaxeCrystalBlue = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemPickaxeCrystalBlue", Util.CRYSTAL_BLUE_RARITY); @@ -317,10 +317,10 @@ public class InitItems{ itemShovelCrystalBlue = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemShovelCrystalBlue", Util.CRYSTAL_BLUE_RARITY); itemSwordCrystalBlue = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemSwordCrystalBlue", Util.CRYSTAL_BLUE_RARITY); itemHoeCrystalBlue = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemHoeCrystalBlue", Util.CRYSTAL_BLUE_RARITY); - itemHelmCrystalBlue = new ItemArmorAA("itemHelmCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "armorCrystalBlue", Util.CRYSTAL_BLUE_RARITY); - itemChestCrystalBlue = new ItemArmorAA("itemChestCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "armorCrystalBlue", Util.CRYSTAL_BLUE_RARITY); - itemPantsCrystalBlue = new ItemArmorAA("itemPantsCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "armorCrystalBlue", Util.CRYSTAL_BLUE_RARITY); - itemBootsCrystalBlue = new ItemArmorAA("itemBootsCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "armorCrystalBlue", Util.CRYSTAL_BLUE_RARITY); + itemHelmCrystalBlue = new ItemArmorAA("itemHelmCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), Util.CRYSTAL_BLUE_RARITY); + itemChestCrystalBlue = new ItemArmorAA("itemChestCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), Util.CRYSTAL_BLUE_RARITY); + itemPantsCrystalBlue = new ItemArmorAA("itemPantsCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), Util.CRYSTAL_BLUE_RARITY); + itemBootsCrystalBlue = new ItemArmorAA("itemBootsCrystalBlue", InitArmorMaterials.armorMaterialCrystalBlue, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), Util.CRYSTAL_BLUE_RARITY); itemPaxelCrystalBlue = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.LAPIS.ordinal()), "itemPaxelCrystalBlue", Util.CRYSTAL_BLUE_RARITY, 3014911); itemPickaxeCrystalLightBlue = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemPickaxeCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); @@ -328,10 +328,10 @@ public class InitItems{ itemShovelCrystalLightBlue = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemShovelCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); itemSwordCrystalLightBlue = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemSwordCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); itemHoeCrystalLightBlue = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemHoeCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); - itemHelmCrystalLightBlue = new ItemArmorAA("itemHelmCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "armorCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); - itemChestCrystalLightBlue = new ItemArmorAA("itemChestCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "armorCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); - itemPantsCrystalLightBlue = new ItemArmorAA("itemPantsCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "armorCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); - itemBootsCrystalLightBlue = new ItemArmorAA("itemBootsCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "armorCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY); + itemHelmCrystalLightBlue = new ItemArmorAA("itemHelmCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), Util.CRYSTAL_LIGHT_BLUE_RARITY); + itemChestCrystalLightBlue = new ItemArmorAA("itemChestCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), Util.CRYSTAL_LIGHT_BLUE_RARITY); + itemPantsCrystalLightBlue = new ItemArmorAA("itemPantsCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), Util.CRYSTAL_LIGHT_BLUE_RARITY); + itemBootsCrystalLightBlue = new ItemArmorAA("itemBootsCrystalLightBlue", InitArmorMaterials.armorMaterialCrystalLightBlue, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), Util.CRYSTAL_LIGHT_BLUE_RARITY); itemPaxelCrystalLightBlue = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalLightBlue, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.DIAMOND.ordinal()), "itemPaxelCrystalLightBlue", Util.CRYSTAL_LIGHT_BLUE_RARITY, 4093108); itemPickaxeCrystalBlack = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemPickaxeCrystalBlack", Util.CRYSTAL_BLACK_RARITY); @@ -339,10 +339,10 @@ public class InitItems{ itemShovelCrystalBlack = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemShovelCrystalBlack", Util.CRYSTAL_BLACK_RARITY); itemSwordCrystalBlack = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemSwordCrystalBlack", Util.CRYSTAL_BLACK_RARITY); itemHoeCrystalBlack = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemHoeCrystalBlack", Util.CRYSTAL_BLACK_RARITY); - itemHelmCrystalBlack = new ItemArmorAA("itemHelmCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "armorCrystalBlack", Util.CRYSTAL_BLACK_RARITY); - itemChestCrystalBlack = new ItemArmorAA("itemChestCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "armorCrystalBlack", Util.CRYSTAL_BLACK_RARITY); - itemPantsCrystalBlack = new ItemArmorAA("itemPantsCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "armorCrystalBlack", Util.CRYSTAL_BLACK_RARITY); - itemBootsCrystalBlack = new ItemArmorAA("itemBootsCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "armorCrystalBlack", Util.CRYSTAL_BLACK_RARITY); + itemHelmCrystalBlack = new ItemArmorAA("itemHelmCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), Util.CRYSTAL_BLACK_RARITY); + itemChestCrystalBlack = new ItemArmorAA("itemChestCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), Util.CRYSTAL_BLACK_RARITY); + itemPantsCrystalBlack = new ItemArmorAA("itemPantsCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), Util.CRYSTAL_BLACK_RARITY); + itemBootsCrystalBlack = new ItemArmorAA("itemBootsCrystalBlack", InitArmorMaterials.armorMaterialCrystalBlack, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), Util.CRYSTAL_BLACK_RARITY); itemPaxelCrystalBlack = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalBlack, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.COAL.ordinal()), "itemPaxelCrystalBlack", Util.CRYSTAL_BLACK_RARITY, 2631982); itemPickaxeCrystalGreen = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemPickaxeCrystalGreen", Util.CRYSTAL_GREEN_RARITY); @@ -350,10 +350,10 @@ public class InitItems{ itemShovelCrystalGreen = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemShovelCrystalGreen", Util.CRYSTAL_GREEN_RARITY); itemSwordCrystalGreen = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemSwordCrystalGreen", Util.CRYSTAL_GREEN_RARITY); itemHoeCrystalGreen = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemHoeCrystalGreen", Util.CRYSTAL_GREEN_RARITY); - itemHelmCrystalGreen = new ItemArmorAA("itemHelmCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "armorCrystalGreen", Util.CRYSTAL_GREEN_RARITY); - itemChestCrystalGreen = new ItemArmorAA("itemChestCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "armorCrystalGreen", Util.CRYSTAL_GREEN_RARITY); - itemPantsCrystalGreen = new ItemArmorAA("itemPantsCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "armorCrystalGreen", Util.CRYSTAL_GREEN_RARITY); - itemBootsCrystalGreen = new ItemArmorAA("itemBootsCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "armorCrystalGreen", Util.CRYSTAL_GREEN_RARITY); + itemHelmCrystalGreen = new ItemArmorAA("itemHelmCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), Util.CRYSTAL_GREEN_RARITY); + itemChestCrystalGreen = new ItemArmorAA("itemChestCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), Util.CRYSTAL_GREEN_RARITY); + itemPantsCrystalGreen = new ItemArmorAA("itemPantsCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), Util.CRYSTAL_GREEN_RARITY); + itemBootsCrystalGreen = new ItemArmorAA("itemBootsCrystalGreen", InitArmorMaterials.armorMaterialCrystalGreen, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), Util.CRYSTAL_GREEN_RARITY); itemPaxelCrystalGreen = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalGreen, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.EMERALD.ordinal()), "itemPaxelCrystalGreen", Util.CRYSTAL_GREEN_RARITY, 46848); itemPickaxeCrystalWhite = new ItemPickaxeAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemPickaxeCrystalWhite", Util.CRYSTAL_WHITE_RARITY); @@ -361,10 +361,10 @@ public class InitItems{ itemShovelCrystalWhite = new ItemShovelAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemShovelCrystalWhite", Util.CRYSTAL_WHITE_RARITY); itemSwordCrystalWhite = new ItemSwordAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemSwordCrystalWhite", Util.CRYSTAL_WHITE_RARITY); itemHoeCrystalWhite = new ItemHoeAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemHoeCrystalWhite", Util.CRYSTAL_WHITE_RARITY); - itemHelmCrystalWhite = new ItemArmorAA("itemHelmCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "armorCrystalWhite", Util.CRYSTAL_WHITE_RARITY); - itemChestCrystalWhite = new ItemArmorAA("itemChestCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "armorCrystalWhite", Util.CRYSTAL_WHITE_RARITY); - itemPantsCrystalWhite = new ItemArmorAA("itemPantsCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "armorCrystalWhite", Util.CRYSTAL_WHITE_RARITY); - itemBootsCrystalWhite = new ItemArmorAA("itemBootsCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "armorCrystalWhite", Util.CRYSTAL_WHITE_RARITY); + itemHelmCrystalWhite = new ItemArmorAA("itemHelmCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 0, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()),Util.CRYSTAL_WHITE_RARITY); + itemChestCrystalWhite = new ItemArmorAA("itemChestCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 1, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), Util.CRYSTAL_WHITE_RARITY); + itemPantsCrystalWhite = new ItemArmorAA("itemPantsCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 2, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), Util.CRYSTAL_WHITE_RARITY); + itemBootsCrystalWhite = new ItemArmorAA("itemBootsCrystalWhite", InitArmorMaterials.armorMaterialCrystalWhite, 3, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), Util.CRYSTAL_WHITE_RARITY); itemPaxelCrystalWhite = new ItemAllToolAA(InitToolMaterials.toolMaterialCrystalWhite, new ItemStack(InitItems.itemCrystal, 1, TheCrystals.IRON.ordinal()), "itemPaxelCrystalWhite", Util.CRYSTAL_WHITE_RARITY, 14606302); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java index f805811d6..c11872f8f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemBooklet.java @@ -31,10 +31,13 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.profiler.Profiler; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -53,7 +56,7 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{ } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing face, float hitX, float hitY, float hitZ){ + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing face, float hitX, float hitY, float hitZ){ if(player.isSneaking()){ Block block = PosUtil.getBlock(pos, world); ItemStack blockStack = new ItemStack(block, 1, PosUtil.getMetadata(pos, world)); @@ -63,22 +66,22 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{ if(world.isRemote){ forcedEntry = new EntrySet(page, page.getChapter(), page.getChapter().getEntry(), ActuallyAdditionsAPI.bookletEntries.indexOf(page.getChapter().getEntry())/GuiBooklet.CHAPTER_BUTTONS_AMOUNT+1); } - this.onItemRightClick(stack, world, player); - return true; + this.onItemRightClick(stack, world, player, hand); + return EnumActionResult.SUCCESS; } } } - return false; + return EnumActionResult.FAIL; } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ + public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){ player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.BOOK.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ); if(!world.isRemote){ - player.triggerAchievement(TheAchievements.OPEN_BOOKLET.ach); + player.addStat(TheAchievements.OPEN_BOOKLET.ach); } - return stack; + return new ActionResult<>(EnumActionResult.SUCCESS, stack); } @SuppressWarnings("unchecked") @@ -93,10 +96,10 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{ } @Override - public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, MovingObjectPosition posHit, Profiler profiler, ScaledResolution resolution){ + public void displayHud(Minecraft minecraft, EntityPlayer player, ItemStack stack, RayTraceResult posHit, Profiler profiler, ScaledResolution resolution){ if(posHit != null){ Block block = PosUtil.getBlock(posHit.getBlockPos(), minecraft.theWorld); - if(block != null && !block.isAir(minecraft.theWorld, posHit.getBlockPos())){ + if(block != null && !block.isAir(minecraft.theWorld.getBlockState(posHit.getBlockPos()), minecraft.theWorld, posHit.getBlockPos())){ ItemStack blockStack = new ItemStack(block, 1, PosUtil.getMetadata(posHit.getBlockPos(), minecraft.theWorld)); if(blockStack != null){ int height = resolution.getScaledHeight()/5*3; @@ -108,17 +111,17 @@ public class ItemBooklet extends ItemBase implements IHudDisplay{ String strg3 = "Right-Click to open..."; AssetUtil.renderStackToGui(page.getChapter().getDisplayItemStack() != null ? page.getChapter().getDisplayItemStack() : new ItemStack(InitItems.itemBooklet), resolution.getScaledWidth()/2-10, height+41, 1F); - minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg1, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg1)/2, height+20, StringUtil.DECIMAL_COLOR_WHITE); - minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.YELLOW+""+EnumChatFormatting.ITALIC+strg2, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg2)/2, height+30, StringUtil.DECIMAL_COLOR_WHITE); - minecraft.fontRendererObj.drawStringWithShadow(EnumChatFormatting.GOLD+strg3, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg3)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg1, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg1)/2, height+20, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.YELLOW+""+TextFormatting.ITALIC+strg2, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg2)/2, height+30, StringUtil.DECIMAL_COLOR_WHITE); + minecraft.fontRendererObj.drawStringWithShadow(TextFormatting.GOLD+strg3, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg3)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE); } else{ - String strg = EnumChatFormatting.DARK_RED+"No Info available! Sorry :("; + String strg = TextFormatting.DARK_RED+"No Info available! Sorry :("; minecraft.fontRendererObj.drawStringWithShadow(strg, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE); } } else{ - String strg = EnumChatFormatting.DARK_GREEN+""+EnumChatFormatting.ITALIC+"Sneak!"; + String strg = TextFormatting.DARK_GREEN+""+TextFormatting.ITALIC+"Sneak!"; minecraft.fontRendererObj.drawStringWithShadow(strg, resolution.getScaledWidth()/2-minecraft.fontRendererObj.getStringWidth(strg)/2, height+60, StringUtil.DECIMAL_COLOR_WHITE); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java index 41ee8bbe8..a2b0467d6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemChestToCrateUpgrade.java @@ -22,8 +22,10 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntityChest; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ItemChestToCrateUpgrade extends ItemBase{ @@ -33,7 +35,7 @@ public class ItemChestToCrateUpgrade extends ItemBase{ } @Override - public boolean onItemUse(ItemStack heldStack, EntityPlayer player, World world, BlockPos pos, EnumFacing facing, float par8, float par9, float par10){ + public EnumActionResult onItemUse(ItemStack heldStack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing facing, float par8, float par9, float par10){ if(player.isSneaking()){ TileEntity tileHit = world.getTileEntity(pos); Block block = PosUtil.getBlock(pos, world); @@ -74,11 +76,11 @@ public class ItemChestToCrateUpgrade extends ItemBase{ heldStack.stackSize--; } } - return true; + return EnumActionResult.SUCCESS; } } - return super.onItemUse(heldStack, player, world, pos, facing, par8, par9, par10); + return super.onItemUse(heldStack, player, world, pos, hand, facing, par8, par9, par10); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java index 492f9f6d1..5c33595cd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCoffee.java @@ -18,8 +18,10 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; +import net.minecraft.init.MobEffects; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; @@ -54,13 +56,13 @@ public class ItemCoffee extends ItemFoodBase{ } } - ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.sugar), new PotionEffect[]{new PotionEffect(Potion.moveSpeed.getId(), 30, 0)}, 4)); - ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.magma_cream), new PotionEffect[]{new PotionEffect(Potion.fireResistance.getId(), 20, 0)}, 2)); - ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.fish, 1, 3), new PotionEffect[]{new PotionEffect(Potion.waterBreathing.getId(), 10, 0)}, 2)); - ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.golden_carrot), new PotionEffect[]{new PotionEffect(Potion.nightVision.getId(), 30, 0)}, 2)); - ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.ghast_tear), new PotionEffect[]{new PotionEffect(Potion.regeneration.getId(), 5, 0)}, 3)); - ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.blaze_powder), new PotionEffect[]{new PotionEffect(Potion.damageBoost.getId(), 15, 0)}, 4)); - ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.fermented_spider_eye), new PotionEffect[]{new PotionEffect(Potion.invisibility.getId(), 25, 0)}, 2)); + ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.sugar), new PotionEffect[]{new PotionEffect(MobEffects.moveSpeed, 30, 0)}, 4)); + ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.magma_cream), new PotionEffect[]{new PotionEffect(MobEffects.fireResistance, 20, 0)}, 2)); + ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.fish, 1, 3), new PotionEffect[]{new PotionEffect(MobEffects.waterBreathing, 10, 0)}, 2)); + ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.golden_carrot), new PotionEffect[]{new PotionEffect(MobEffects.nightVision, 30, 0)}, 2)); + ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.ghast_tear), new PotionEffect[]{new PotionEffect(MobEffects.regeneration, 5, 0)}, 3)); + ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.blaze_powder), new PotionEffect[]{new PotionEffect(MobEffects.damageBoost, 15, 0)}, 4)); + ActuallyAdditionsAPI.addCoffeeMachineIngredient(new CoffeeIngredient(new ItemStack(Items.fermented_spider_eye), new PotionEffect[]{new PotionEffect(MobEffects.invisibility, 25, 0)}, 2)); } public static CoffeeIngredient getIngredientFromStack(ItemStack stack){ @@ -72,17 +74,17 @@ public class ItemCoffee extends ItemFoodBase{ return null; } - public static void applyPotionEffectsFromStack(ItemStack stack, EntityPlayer player){ + public static void applyPotionEffectsFromStack(ItemStack stack, EntityLivingBase player){ PotionEffect[] effects = CoffeeBrewing.getEffectsFromStack(stack); if(effects != null && effects.length > 0){ for(PotionEffect effect : effects){ - player.addPotionEffect(new PotionEffect(effect.getPotionID(), effect.getDuration()*20, effect.getAmplifier())); + player.addPotionEffect(new PotionEffect(effect.getPotion(), effect.getDuration()*20, effect.getAmplifier())); } } } @Override - public ItemStack onItemUseFinish(ItemStack stack, World world, EntityPlayer player){ + public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player){ ItemStack theStack = stack.copy(); super.onItemUseFinish(stack, world, player); applyPotionEffectsFromStack(stack, player); @@ -142,7 +144,7 @@ public class ItemCoffee extends ItemFoodBase{ if(effects != null && effects.length > 0){ for(PotionEffect effect : effects){ if(effect.getAmplifier() > 0){ - effectsNew.add(new PotionEffect(effect.getPotionID(), effect.getDuration()+120, effect.getAmplifier()-1)); + effectsNew.add(new PotionEffect(effect.getPotion(), effect.getDuration()+120, effect.getAmplifier()-1)); } } stack.setTagCompound(new NBTTagCompound()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java index 5fd23d1d7..ae6e6f355 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemCrafterOnAStick.java @@ -16,6 +16,9 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; public class ItemCrafterOnAStick extends ItemBase{ @@ -26,11 +29,11 @@ public class ItemCrafterOnAStick extends ItemBase{ } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ + public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){ if(!world.isRemote){ player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.CRAFTER.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ); } - return stack; + return new ActionResult(EnumActionResult.SUCCESS, stack); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java index 6421dda39..23798c1bb 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrill.java @@ -33,12 +33,17 @@ import net.minecraft.entity.ai.attributes.AttributeModifier; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.init.Blocks; +import net.minecraft.init.Enchantments; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.text.TextComponentString; import net.minecraft.world.World; import net.minecraftforge.common.ForgeHooks; import net.minecraftforge.fml.relauncher.Side; @@ -71,7 +76,7 @@ public class ItemDrill extends ItemEnergy{ @Override //Places Blocks if the Placing Upgrade is installed - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){ + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ){ ItemStack upgrade = this.getHasUpgradeAsStack(stack, ItemDrillUpgrade.UpgradeType.PLACER); if(upgrade != null){ int slot = ItemDrillUpgrade.getSlotToPlaceFrom(upgrade); @@ -83,28 +88,28 @@ public class ItemDrill extends ItemEnergy{ //tryPlaceItemIntoWorld could throw an Exception try{ //Places the Block into the World - if(equip.onItemUse(player, world, pos, side, hitX, hitY, hitZ)){ + if(equip.onItemUse(player, world, pos, hand, side, hitX, hitY, hitZ) != EnumActionResult.FAIL){ if(!player.capabilities.isCreativeMode){ player.inventory.setInventorySlotContents(slot, equip.stackSize <= 0 ? null : equip.copy()); } //Synchronizes the Client player.inventoryContainer.detectAndSendChanges(); - return true; + return EnumActionResult.SUCCESS; } } //Notify the Player and log the Exception catch(Exception e){ - player.addChatComponentMessage(new ChatComponentText("Ouch! That really hurt! You must have done something wrong, don't do that again please!")); - ModUtil.LOGGER.error("Player "+player.getName()+" who should place a Block using a Drill at "+player.posX+", "+player.posY+", "+player.posZ+" in World "+world.provider.getDimensionId()+" threw an Exception! Don't let that happen again!"); + player.addChatComponentMessage(new TextComponentString("Ouch! That really hurt! You must have done something wrong, don't do that again please!")); + ModUtil.LOGGER.error("Player "+player.getName()+" who should place a Block using a Drill at "+player.posX+", "+player.posY+", "+player.posZ+" in World "+world.provider.getDimension()+" threw an Exception! Don't let that happen again!"); } } else{ - return true; + return EnumActionResult.SUCCESS; } } } } - return false; + return EnumActionResult.FAIL; } /** @@ -162,11 +167,11 @@ public class ItemDrill extends ItemEnergy{ } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ - if(!world.isRemote && player.isSneaking() && stack == player.getCurrentEquippedItem()){ + public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){ + if(!world.isRemote && player.isSneaking() && stack == player.getActiveItemStack()){ player.openGui(ActuallyAdditions.instance, GuiHandler.GuiTypes.DRILL.ordinal(), world, (int)player.posX, (int)player.posY, (int)player.posZ); } - return stack; + return new ActionResult(EnumActionResult.PASS, stack); } @Override @@ -211,14 +216,14 @@ public class ItemDrill extends ItemEnergy{ } @Override - public Multimap getAttributeModifiers(ItemStack stack){ - Multimap map = super.getAttributeModifiers(stack); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Drill Modifier", this.getEnergyStored(stack) >= ENERGY_USE ? 8.0F : 0.1F, 0)); + public Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack){ + Multimap map = super.getAttributeModifiers(slot, stack); + map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Drill Modifier", this.getEnergyStored(stack) >= ENERGY_USE ? 8.0F : 0.1F, 0)); return map; } @Override - public float getDigSpeed(ItemStack stack, IBlockState state){ + public float getStrVsBlock(ItemStack stack, IBlockState state){ return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) ? (this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) ? this.getEfficiencyFromUpgrade(stack) : 1.0F) : 0.1F; } @@ -229,11 +234,11 @@ public class ItemDrill extends ItemEnergy{ if(this.getEnergyStored(stack) >= use){ //Enchants the Drill depending on the Upgrades it has if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.SILK_TOUCH)){ - ItemUtil.addEnchantment(stack, Enchantment.silkTouch, 1); + ItemUtil.addEnchantment(stack, Enchantments.silkTouch, 1); } else{ if(this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE)){ - ItemUtil.addEnchantment(stack, Enchantment.fortune, this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) ? 3 : 1); + ItemUtil.addEnchantment(stack, Enchantments.fortune, this.getHasUpgrade(stack, ItemDrillUpgrade.UpgradeType.FORTUNE_II) ? 3 : 1); } } @@ -251,16 +256,17 @@ public class ItemDrill extends ItemEnergy{ } //Removes Enchantments added above - ItemUtil.removeEnchantment(stack, Enchantment.silkTouch); - ItemUtil.removeEnchantment(stack, Enchantment.fortune); + ItemUtil.removeEnchantment(stack, Enchantments.silkTouch); + ItemUtil.removeEnchantment(stack, Enchantments.fortune); } return toReturn; } @Override - public boolean canHarvestBlock(Block block, ItemStack stack){ + public boolean canHarvestBlock(IBlockState state, ItemStack stack){ int harvestLevel = this.getHarvestLevel(stack, ""); - return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || block.getMaterial().isToolNotRequired() || (block == Blocks.snow_layer || block == Blocks.snow || (block == Blocks.obsidian ? harvestLevel >= 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial() == Material.rock || (block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil)) : harvestLevel >= 2) : harvestLevel >= 1) : harvestLevel >= 1) : harvestLevel >= 2) : harvestLevel >= 2) : harvestLevel >= 2)))); + Block block = state.getBlock(); + return this.getEnergyStored(stack) >= this.getEnergyUsePerBlock(stack) && (this.hasExtraWhitelist(block) || block.getMaterial(state).isToolNotRequired() || (block == Blocks.snow_layer || block == Blocks.snow || (block == Blocks.obsidian ? harvestLevel >= 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial(state) == Material.rock || (block.getMaterial(state) == Material.iron || block.getMaterial(state) == Material.anvil)) : harvestLevel >= 2) : harvestLevel >= 1) : harvestLevel >= 1) : harvestLevel >= 2) : harvestLevel >= 2) : harvestLevel >= 2)))); } @Override @@ -428,7 +434,7 @@ public class ItemDrill extends ItemEnergy{ int zRange = 0; //Block hit - MovingObjectPosition pos = WorldUtil.getNearestBlockWithDefaultReachDistance(world, player); + RayTraceResult pos = WorldUtil.getNearestBlockWithDefaultReachDistance(world, player); if(pos == null){ return false; } @@ -445,7 +451,7 @@ public class ItemDrill extends ItemEnergy{ } //Not defined later because main Block is getting broken below - float mainHardness = PosUtil.getBlock(aPos, world).getBlockHardness(world, aPos); + float mainHardness = PosUtil.getBlock(aPos, world).getBlockHardness(world.getBlockState(aPos), world, aPos); //Break Middle Block first int use = this.getEnergyUsePerBlock(stack); @@ -467,7 +473,7 @@ public class ItemDrill extends ItemEnergy{ if(this.getEnergyStored(stack) >= use){ //Only break Blocks around that are (about) as hard or softer BlockPos thePos = new BlockPos(xPos, yPos, zPos); - if(PosUtil.getBlock(thePos, world).getBlockHardness(world, thePos) <= mainHardness+5.0F){ + if(PosUtil.getBlock(thePos, world).getBlockHardness(world.getBlockState(thePos), world, thePos) <= mainHardness+5.0F){ this.tryHarvestBlock(world, thePos, true, stack, player, use); } } @@ -495,8 +501,9 @@ public class ItemDrill extends ItemEnergy{ */ private boolean tryHarvestBlock(World world, BlockPos pos, boolean isExtra, ItemStack stack, EntityPlayer player, int use){ Block block = PosUtil.getBlock(pos, world); - float hardness = block.getBlockHardness(world, pos); - boolean canHarvest = (ForgeHooks.canHarvestBlock(block, player, world, pos) || this.canHarvestBlock(block, stack)) && (!isExtra || this.getDigSpeed(stack, world.getBlockState(pos)) > 1.0F); + IBlockState state = world.getBlockState(pos); + float hardness = block.getBlockHardness(state, world, pos); + boolean canHarvest = (ForgeHooks.canHarvestBlock(block, player, world, pos) || this.canHarvestBlock(state, stack)) && (!isExtra || this.getStrVsBlock(stack, world.getBlockState(pos)) > 1.0F); if(hardness >= 0.0F && (!isExtra || (canHarvest && !block.hasTileEntity(world.getBlockState(pos))))){ this.extractEnergy(stack, use, false); //Break the Block diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java index 54088ca7b..a3899da8a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDrillUpgrade.java @@ -14,6 +14,9 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; public class ItemDrillUpgrade extends ItemBase{ @@ -35,11 +38,12 @@ public class ItemDrillUpgrade extends ItemBase{ } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ + public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){ if(!world.isRemote && this.type == UpgradeType.PLACER){ this.setSlotToPlaceFrom(stack, player.inventory.currentItem); + return new ActionResult(EnumActionResult.SUCCESS, stack); } - return stack; + return new ActionResult(EnumActionResult.FAIL, stack); } public void setSlotToPlaceFrom(ItemStack stack, int slot){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java index 1ba612d18..7a5617caf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemDust.java @@ -44,11 +44,12 @@ public class ItemDust extends ItemBase{ return stack.getItemDamage() >= allDusts.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allDusts[stack.getItemDamage()].name; } - @Override + //TODO Figure out item colors + /*@Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack stack, int pass){ return stack.getItemDamage() >= allDusts.length ? 0 : allDusts[stack.getItemDamage()].color; - } + }*/ @Override public EnumRarity getRarity(ItemStack stack){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java index 0a43ead28..15e0f0d0e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFertilizer.java @@ -15,8 +15,10 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class ItemFertilizer extends ItemBase{ @@ -26,14 +28,14 @@ public class ItemFertilizer extends ItemBase{ } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side, float par8, float par9, float par10){ + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing side, float par8, float par9, float par10){ if(ItemDye.applyBonemeal(stack, world, pos, player)){ if(!world.isRemote){ world.playAuxSFX(2005, pos, 0); } - return true; + return EnumActionResult.SUCCESS; } - return super.onItemUse(stack, player, world, pos, side, par8, par9, par10); + return super.onItemUse(stack, player, world, pos, hand, side, par8, par9, par10); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java index 43448210e..6429ad523 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemFoods.java @@ -16,12 +16,14 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheFoods; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -41,11 +43,11 @@ public class ItemFoods extends ItemFoodBase{ } @Override - public ItemStack onItemUseFinish(ItemStack stack, World world, EntityPlayer player){ + public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player){ ItemStack stackToReturn = super.onItemUseFinish(stack, world, player); ItemStack returnItem = stack.getItemDamage() >= allFoods.length ? null : allFoods[stack.getItemDamage()].returnItem; - if(returnItem != null){ - if(!player.inventory.addItemStackToInventory(returnItem.copy())){ + if(returnItem != null && player instanceof EntityPlayer){ + if(!((EntityPlayer)player).inventory.addItemStackToInventory(returnItem.copy())){ if(!world.isRemote){ EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem.copy()); entityItem.setPickupDelay(0); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java index f4b1922a1..d80ced6df 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemGrowthRing.java @@ -21,12 +21,13 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import net.minecraftforge.common.IPlantable; import java.util.ArrayList; +import java.util.List; public class ItemGrowthRing extends ItemEnergy{ @@ -41,11 +42,11 @@ public class ItemGrowthRing extends ItemEnergy{ } EntityPlayer player = (EntityPlayer)entity; - ItemStack equipped = player.getCurrentEquippedItem(); + ItemStack equipped = player.getActiveItemStack(); int energyUse = 300; if(equipped != null && equipped == stack && this.getEnergyStored(stack) >= energyUse){ - ArrayList blocks = new ArrayList(); + List blocks = new ArrayList(); if(stack.getTagCompound() == null){ stack.setTagCompound(new NBTTagCompound()); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java index 0d4785dc2..a2cbe312d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemHairyBall.java @@ -18,6 +18,9 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.util.WeightedRandom; import net.minecraft.world.World; @@ -28,7 +31,7 @@ public class ItemHairyBall extends ItemBase{ } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ + public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){ if(!world.isRemote){ ItemStack returnItem = this.getRandomReturnItem(); if(!player.inventory.addItemStackToInventory(returnItem)){ @@ -37,13 +40,15 @@ public class ItemHairyBall extends ItemBase{ player.worldObj.spawnEntityInWorld(entityItem); } stack.stackSize--; - world.playSoundAtEntity(player, "random.pop", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F); + + //TODO Sound + //world.playSoundAtEntity(player, "random.pop", 0.2F, Util.RANDOM.nextFloat()*0.1F+0.9F); } - return stack; + return new ActionResult(EnumActionResult.SUCCESS, stack); } public ItemStack getRandomReturnItem(){ - return ((BallOfFurReturn)WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.ballOfFurReturnItems)).returnItem.copy(); + return WeightedRandom.getRandomItem(Util.RANDOM, ActuallyAdditionsAPI.ballOfFurReturnItems).returnItem.copy(); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java index f64c2eea5..685695fb3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemJams.java @@ -16,12 +16,14 @@ import de.ellpeck.actuallyadditions.mod.items.metalists.TheJams; import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Items; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -51,11 +53,12 @@ public class ItemJams extends ItemFoodBase{ return stack.getItemDamage() >= allJams.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allJams[stack.getItemDamage()].name; } - @Override + //TODO Color + /*@Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack stack, int pass){ return pass > 0 ? (stack.getItemDamage() >= allJams.length ? 0 : allJams[stack.getItemDamage()].color) : super.getColorFromItemStack(stack, pass); - } + }*/ @Override public EnumRarity getRarity(ItemStack stack){ @@ -71,18 +74,18 @@ public class ItemJams extends ItemFoodBase{ } @Override - public ItemStack onItemUseFinish(ItemStack stack, World world, EntityPlayer player){ + public ItemStack onItemUseFinish(ItemStack stack, World world, EntityLivingBase player){ ItemStack stackToReturn = super.onItemUseFinish(stack, world, player); - if(!world.isRemote && stack.getItemDamage() < allJams.length){ - PotionEffect firstEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].firstEffectToGet, 200); + if(player instanceof EntityPlayer && !world.isRemote && stack.getItemDamage() < allJams.length){ + PotionEffect firstEffectToGet = new PotionEffect(Potion.getPotionById(allJams[stack.getItemDamage()].firstEffectToGet), 200); player.addPotionEffect(firstEffectToGet); - PotionEffect secondEffectToGet = new PotionEffect(allJams[stack.getItemDamage()].secondEffectToGet, 600); + PotionEffect secondEffectToGet = new PotionEffect(Potion.getPotionById(allJams[stack.getItemDamage()].secondEffectToGet), 600); player.addPotionEffect(secondEffectToGet); ItemStack returnItem = new ItemStack(Items.glass_bottle); - if(!player.inventory.addItemStackToInventory(returnItem.copy())){ + if(!((EntityPlayer)player).inventory.addItemStackToInventory(returnItem.copy())){ EntityItem entityItem = new EntityItem(player.worldObj, player.posX, player.posY, player.posZ, returnItem.copy()); entityItem.setPickupDelay(0); player.worldObj.spawnEntityInWorld(entityItem); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java index ecaad022b..a7660d160 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemKnife.java @@ -14,6 +14,7 @@ import com.google.common.collect.Multimap; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import net.minecraft.entity.SharedMonsterAttributes; import net.minecraft.entity.ai.attributes.AttributeModifier; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; @@ -39,9 +40,9 @@ public class ItemKnife extends ItemBase{ @SuppressWarnings("unchecked") @Override - public Multimap getAttributeModifiers(ItemStack stack){ - Multimap map = super.getAttributeModifiers(stack); - map.put(SharedMonsterAttributes.attackDamage.getAttributeUnlocalizedName(), new AttributeModifier(itemModifierUUID, "Knife Modifier", 3, 0)); + public Multimap getAttributeModifiers(EntityEquipmentSlot slot, ItemStack stack){ + Multimap map = super.getAttributeModifiers(slot, stack); + map.put(SharedMonsterAttributes.ATTACK_DAMAGE.getAttributeUnlocalizedName(), new AttributeModifier(ATTACK_DAMAGE_MODIFIER, "Knife Modifier", 3, 0)); return map; } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java index 18f914a88..d15bc65b5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLaserWrench.java @@ -20,10 +20,12 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -38,13 +40,13 @@ public class ItemLaserWrench extends ItemBase{ } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing par7, float par8, float par9, float par10){ + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing par7, float par8, float par9, float par10){ if(!world.isRemote){ TileEntity tile = world.getTileEntity(pos); if(tile instanceof TileEntityLaserRelay){ if(ItemPhantomConnector.getStoredPosition(stack) == null){ ItemPhantomConnector.storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), world); - player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.stored.desc"))); + player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.stored.desc"))); } else{ BlockPos savedPos = ItemPhantomConnector.getStoredPosition(stack); @@ -54,16 +56,17 @@ public class ItemLaserWrench extends ItemBase{ ((TileEntityLaserRelay)world.getTileEntity(savedPos)).sendUpdate(); ((TileEntityLaserRelay)world.getTileEntity(pos)).sendUpdate(); - player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.connected.desc"))); + player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.connected.desc"))); } else{ - player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.cantConnect.desc"))); + player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".laser.cantConnect.desc"))); ItemPhantomConnector.clearStorage(stack); } } + return EnumActionResult.SUCCESS; } } - return false; + return EnumActionResult.FAIL; } @Override @@ -88,7 +91,7 @@ public class ItemLaserWrench extends ItemBase{ list.add("X: "+coords.getX()); list.add("Y: "+coords.getY()); list.add("Z: "+coords.getZ()); - list.add(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc")); + list.add(TextFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc")); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java index 82ac810a9..32f9a300a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemLeafBlower.java @@ -15,13 +15,17 @@ import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockBush; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumAction; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MathHelper; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; import java.util.ArrayList; @@ -38,9 +42,9 @@ public class ItemLeafBlower extends ItemBase{ } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ - player.setItemInUse(stack, this.getMaxItemUseDuration(stack)); - return stack; + public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){ + player.setActiveHand(hand); + return new ActionResult(EnumActionResult.SUCCESS, stack); } @Override @@ -60,14 +64,15 @@ public class ItemLeafBlower extends ItemBase{ } @Override - public void onUsingTick(ItemStack stack, EntityPlayer player, int time){ + public void onUsingTick(ItemStack stack, EntityLivingBase player, int time){ if(!player.worldObj.isRemote){ if(time <= getMaxItemUseDuration(stack) && (this.isAdvanced || time%3 == 0)){ //Breaks the Blocks this.breakStuff(player.worldObj, MathHelper.floor_double(player.posX), MathHelper.floor_double(player.posY), MathHelper.floor_double(player.posZ)); //Plays a Minecart sounds (It really sounds like a Leaf Blower!) if(!ConfigValues.lessSound){ - player.worldObj.playSoundAtEntity(player, "minecart.base", 0.3F, 0.001F); + //TODO Fix sound + //player.worldObj.playSoundAtEntity(player, "minecart.base", 0.3F, 0.001F); } } } @@ -92,7 +97,7 @@ public class ItemLeafBlower extends ItemBase{ //The current Block to break BlockPos pos = new BlockPos(x+reachX, y+reachY, z+reachZ); Block block = PosUtil.getBlock(pos, world); - if(block != null && (block instanceof BlockBush || (this.isAdvanced && block.isLeaves(world, pos)))){ + if(block != null && (block instanceof BlockBush || (this.isAdvanced && block.isLeaves(world.getBlockState(pos), world, pos)))){ breakPositions.add(pos); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java index 0f4422e89..6bf7110ae 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemMagnetRing.java @@ -16,8 +16,8 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import java.util.ArrayList; @@ -35,13 +35,13 @@ public class ItemMagnetRing extends ItemEnergy{ if(!entity.isSneaking()){ //Get all the Items in the area int range = 5; - ArrayList items = (ArrayList)world.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.fromBounds(entity.posX-range, entity.posY-range, entity.posZ-range, entity.posX+range, entity.posY+range, entity.posZ+range)); + ArrayList items = (ArrayList)world.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(entity.posX-range, entity.posY-range, entity.posZ-range, entity.posX+range, entity.posY+range, entity.posZ+range)); if(!items.isEmpty()){ for(EntityItem item : items){ if(this.getEnergyStored(stack) >= energyUse){ //If the Item is near enough to get picked up //(So it doesn't bounce around until it notices itself..) - if(new Vec3(entity.posX, entity.posY, entity.posZ).distanceTo(new Vec3(item.posX, item.posY, item.posZ)) <= 1.5){ + if(new Vec3d(entity.posX, entity.posY, entity.posZ).distanceTo(new Vec3d(item.posX, item.posY, item.posZ)) <= 1.5){ item.onCollideWithPlayer((EntityPlayer)entity); } else{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java index 6ae2a195e..02ee90452 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPhantomConnector.java @@ -21,10 +21,12 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; -import net.minecraft.util.ChatComponentText; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.text.TextComponentString; +import net.minecraft.util.text.TextFormatting; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.relauncher.Side; @@ -73,13 +75,13 @@ public class ItemPhantomConnector extends ItemBase{ tag.setInteger("XCoordOfTileStored", x); tag.setInteger("YCoordOfTileStored", y); tag.setInteger("ZCoordOfTileStored", z); - tag.setInteger("WorldOfTileStored", world.provider.getDimensionId()); + tag.setInteger("WorldOfTileStored", world.provider.getDimension()); stack.setTagCompound(tag); } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing par7, float par8, float par9, float par10){ + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumHand hand, EnumFacing par7, float par8, float par9, float par10){ if(!world.isRemote){ //Passing Data to Phantoms TileEntity tile = world.getTileEntity(pos); @@ -92,17 +94,17 @@ public class ItemPhantomConnector extends ItemBase{ ((TileEntityBase)tile).sendUpdate(); } clearStorage(stack); - player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc"))); - return true; + player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.connected.desc"))); + return EnumActionResult.SUCCESS; } - return false; + return EnumActionResult.FAIL; } } //Storing Connections storeConnection(stack, pos.getX(), pos.getY(), pos.getZ(), world); - player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.stored.desc"))); + player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.stored.desc"))); } - return true; + return EnumActionResult.SUCCESS; } public boolean checkHasConnection(ItemStack stack, EntityPlayer player, TileEntity tile){ @@ -113,7 +115,7 @@ public class ItemPhantomConnector extends ItemBase{ if(tile instanceof IPhantomTile){ ((IPhantomTile)tile).setBoundPosition(null); } - player.addChatComponentMessage(new ChatComponentText(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.unbound.desc"))); + player.addChatComponentMessage(new TextComponentString(StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".phantom.unbound.desc"))); return false; } } @@ -140,7 +142,7 @@ public class ItemPhantomConnector extends ItemBase{ list.add("X: "+coords.getX()); list.add("Y: "+coords.getY()); list.add("Z: "+coords.getZ()); - list.add(EnumChatFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc")); + list.add(TextFormatting.ITALIC+StringUtil.localize("tooltip."+ModUtil.MOD_ID_LOWER+".clearStorage.desc")); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java index 5728b0a3b..abd721f01 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemPotionRing.java @@ -21,6 +21,7 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; +import net.minecraft.potion.Potion; import net.minecraft.potion.PotionEffect; import net.minecraft.util.ResourceLocation; import net.minecraft.world.World; @@ -52,11 +53,12 @@ public class ItemPotionRing extends ItemBase{ return stack.getItemDamage() >= allRings.length ? StringUtil.BUGGED_ITEM_NAME : this.getUnlocalizedName()+allRings[stack.getItemDamage()].name; } - @Override + //TODO Color + /*@Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack stack, int pass){ return stack.getItemDamage() >= allRings.length ? 0 : allRings[stack.getItemDamage()].color; - } + }*/ @Override @SuppressWarnings("unchecked") @@ -66,17 +68,18 @@ public class ItemPotionRing extends ItemBase{ if(!world.isRemote && stack.getItemDamage() < allRings.length){ if(player instanceof EntityPlayer){ EntityPlayer thePlayer = (EntityPlayer)player; - ItemStack equippedStack = ((EntityPlayer)player).getCurrentEquippedItem(); + ItemStack equippedStack = ((EntityPlayer)player).getActiveItemStack(); ThePotionRings effect = ThePotionRings.values()[stack.getItemDamage()]; - if(!effect.needsWaitBeforeActivating || !thePlayer.isPotionActive(effect.effectID)){ + Potion potion = Potion.getPotionById(effect.effectID); + if(!effect.needsWaitBeforeActivating || !thePlayer.isPotionActive(potion)){ if(!((ItemPotionRing)stack.getItem()).isAdvanced){ if(equippedStack != null && stack == equippedStack){ - thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.normalAmplifier, true, false)); + thePlayer.addPotionEffect(new PotionEffect(potion, effect.activeTime, effect.normalAmplifier, true, false)); } } else{ - thePlayer.addPotionEffect(new PotionEffect(effect.effectID, effect.activeTime, effect.advancedAmplifier, true, false)); + thePlayer.addPotionEffect(new PotionEffect(potion, effect.activeTime, effect.advancedAmplifier, true, false)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java index 91f7f35a9..6b74c1b3a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemResonantRice.java @@ -11,9 +11,13 @@ package de.ellpeck.actuallyadditions.mod.items; import de.ellpeck.actuallyadditions.mod.items.base.ItemBase; +import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; public class ItemResonantRice extends ItemBase{ @@ -23,12 +27,12 @@ public class ItemResonantRice extends ItemBase{ } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ + public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){ if(!world.isRemote){ stack.stackSize--; world.createExplosion(null, player.posX, player.posY, player.posZ, 0.5F, true); } - return stack; + return new ActionResult<>(EnumActionResult.SUCCESS, stack); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java index 22ff464e0..3faa54230 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemSolidifiedExperience.java @@ -15,6 +15,9 @@ import net.minecraft.entity.item.EntityXPOrb; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; import net.minecraft.world.World; public class ItemSolidifiedExperience extends ItemBase{ @@ -26,7 +29,7 @@ public class ItemSolidifiedExperience extends ItemBase{ } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ + public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){ if(!world.isRemote){ if(!player.isSneaking()){ world.spawnEntityInWorld(new EntityXPOrb(world, player.posX+0.5, player.posY+0.5, player.posZ+0.5, SOLID_XP_AMOUNT)); @@ -41,7 +44,7 @@ public class ItemSolidifiedExperience extends ItemBase{ } } } - return stack; + return new ActionResult(EnumActionResult.SUCCESS, stack); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java index f22a94cca..043d24e97 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemTeleStaff.java @@ -18,8 +18,11 @@ import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.util.Vec3; +import net.minecraft.util.ActionResult; +import net.minecraft.util.EnumActionResult; +import net.minecraft.util.EnumHand; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; public class ItemTeleStaff extends ItemEnergy{ @@ -29,33 +32,35 @@ public class ItemTeleStaff extends ItemEnergy{ } @Override - public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player){ + public ActionResult onItemRightClick(ItemStack stack, World world, EntityPlayer player, EnumHand hand){ if(!world.isRemote){ if(this.getWaitTime(stack) <= 0){ - MovingObjectPosition pos = WorldUtil.getNearestPositionWithAir(world, player, 100); - if(pos != null && (pos.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK || player.rotationPitch >= -5)){ + RayTraceResult pos = WorldUtil.getNearestPositionWithAir(world, player, 100); + if(pos != null && (pos.typeOfHit == RayTraceResult.Type.BLOCK || player.rotationPitch >= -5)){ int side = pos.sideHit.ordinal(); if(side != -1){ double x = pos.hitVec.xCoord-(side == 4 ? 0.5 : 0)+(side == 5 ? 0.5 : 0); double y = pos.hitVec.yCoord-(side == 0 ? 2.0 : 0)+(side == 1 ? 0.5 : 0); double z = pos.hitVec.zCoord-(side == 2 ? 0.5 : 0)+(side == 3 ? 0.5 : 0); int baseUse = 200; - int use = baseUse+(int)(baseUse*pos.hitVec.distanceTo(new Vec3(player.posX, player.posY+(player.getEyeHeight()-player.getDefaultEyeHeight()), player.posZ))); + int use = baseUse+(int)(baseUse*pos.hitVec.distanceTo(new Vec3d(player.posX, player.posY+(player.getEyeHeight()-player.getDefaultEyeHeight()), player.posZ))); if(this.getEnergyStored(stack) >= use){ ((EntityPlayerMP)player).playerNetServerHandler.setPlayerLocation(x, y, z, player.rotationYaw, player.rotationPitch); - player.mountEntity(null); - world.playSoundAtEntity(player, "mob.endermen.portal", 1.0F, 1.0F); + player.dismountRidingEntity(); + //TODO Fix sound + //world.playSound(player, "mob.endermen.portal", 1.0F, 1.0F); if(!player.capabilities.isCreativeMode){ this.extractEnergy(stack, use, false); this.setWaitTime(stack, 50); } + return ActionResult.newResult(EnumActionResult.SUCCESS, stack); } } } } } - player.swingItem(); - return stack; + player.swingArm(hand); + return ActionResult.newResult(EnumActionResult.FAIL, stack); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java index 4609a552b..a2bc98d16 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/ItemWaterRemovalRing.java @@ -19,8 +19,8 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; import net.minecraft.world.World; public class ItemWaterRemovalRing extends ItemEnergy{ @@ -36,7 +36,7 @@ public class ItemWaterRemovalRing extends ItemEnergy{ } EntityPlayer player = (EntityPlayer)entity; - ItemStack equipped = player.getCurrentEquippedItem(); + ItemStack equipped = player.getActiveItemStack(); int energyUse = 350; if(equipped != null && equipped == stack && this.getEnergyStored(stack) >= energyUse){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAllToolAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAllToolAA.java index 1ecddacd8..28e98caa4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAllToolAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemAllToolAA.java @@ -23,9 +23,11 @@ import net.minecraft.init.Items; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.item.ItemTool; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumFacing; +import net.minecraft.util.EnumHand; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -50,7 +52,7 @@ public class ItemAllToolAA extends ItemTool{ } public ItemAllToolAA(ToolMaterial toolMat, ItemStack repairItem, String unlocalizedName, EnumRarity rarity, int color){ - super(4.0F, toolMat, new HashSet()); + super(4.0F, -2F, toolMat, new HashSet()); this.repairItem = repairItem; this.name = unlocalizedName; @@ -82,15 +84,16 @@ public class ItemAllToolAA extends ItemTool{ } @Override - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumFacing side, float hitX, float hitY, float hitZ){ - return Items.iron_hoe.onItemUse(stack, playerIn, worldIn, pos, side, hitX, hitY, hitZ); + public EnumActionResult onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, EnumHand hand, EnumFacing side, float hitX, float hitY, float hitZ){ + return Items.iron_hoe.onItemUse(stack, playerIn, worldIn, pos, hand, side, hitX, hitY, hitZ); } - @Override + //TODO Fix ItemStack color + /*@Override @SideOnly(Side.CLIENT) public int getColorFromItemStack(ItemStack stack, int pass){ - return pass > 0 ? this.color : super.getColorFromItemStack(stack, pass); - } + return pass > 0 ? this.color : super.(stack, pass); + }*/ @Override public EnumRarity getRarity(ItemStack stack){ @@ -98,8 +101,9 @@ public class ItemAllToolAA extends ItemTool{ } @Override - public boolean canHarvestBlock(Block block, ItemStack stack){ - return this.hasExtraWhitelist(block) || block.getMaterial().isToolNotRequired() || (block == Blocks.snow_layer || block == Blocks.snow || (block == Blocks.obsidian ? this.toolMaterial.getHarvestLevel() >= 3 : (block != Blocks.diamond_block && block != Blocks.diamond_ore ? (block != Blocks.emerald_ore && block != Blocks.emerald_block ? (block != Blocks.gold_block && block != Blocks.gold_ore ? (block != Blocks.iron_block && block != Blocks.iron_ore ? (block != Blocks.lapis_block && block != Blocks.lapis_ore ? (block != Blocks.redstone_ore && block != Blocks.lit_redstone_ore ? (block.getMaterial() == Material.rock || (block.getMaterial() == Material.iron || block.getMaterial() == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2))); + public boolean canHarvestBlock(IBlockState state, ItemStack stack){ + + return this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getMaterial(state).isToolNotRequired() || (state.getBlock() == Blocks.snow_layer || state.getBlock()== Blocks.snow || (state.getBlock()== Blocks.obsidian ? this.toolMaterial.getHarvestLevel() >= 3 : (state.getBlock()!= Blocks.diamond_block && state.getBlock()!= Blocks.diamond_ore ? (state.getBlock()!= Blocks.emerald_ore && state.getBlock()!= Blocks.emerald_block? (state.getBlock()!= Blocks.gold_block&& state.getBlock()!= Blocks.gold_ore ? (state.getBlock()!= Blocks.iron_block&& state.getBlock()!= Blocks.iron_ore ? (state.getBlock()!= Blocks.lapis_block&& state.getBlock()!= Blocks.lapis_ore ? (state.getBlock()!= Blocks.redstone_ore && state.getBlock()!= Blocks.lit_redstone_ore ? (state.getBlock().getMaterial(state) == Material.rock || (state.getBlock().getMaterial(state) == Material.iron || state.getBlock().getMaterial(state) == Material.anvil)) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 1) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2) : this.toolMaterial.getHarvestLevel() >= 2))); } private boolean hasExtraWhitelist(Block block){ @@ -140,7 +144,7 @@ public class ItemAllToolAA extends ItemTool{ } @Override - public float getDigSpeed(ItemStack stack, IBlockState state){ + public float getStrVsBlock(ItemStack stack, IBlockState state){ return this.hasExtraWhitelist(state.getBlock()) || state.getBlock().getHarvestTool(state) == null || state.getBlock().getHarvestTool(state).isEmpty() || this.getToolClasses(stack).contains(state.getBlock().getHarvestTool(state)) ? this.efficiencyOnProperMaterial : 1.0F; } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java index fe671e19e..abeda73f7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemArmorAA.java @@ -11,8 +11,10 @@ package de.ellpeck.actuallyadditions.mod.items.base; import de.ellpeck.actuallyadditions.mod.ActuallyAdditions; +import de.ellpeck.actuallyadditions.mod.inventory.ContainerEnervator; import de.ellpeck.actuallyadditions.mod.util.ItemUtil; import de.ellpeck.actuallyadditions.mod.util.ModUtil; +import net.minecraft.inventory.EntityEquipmentSlot; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemArmor; import net.minecraft.item.ItemStack; @@ -24,12 +26,12 @@ public class ItemArmorAA extends ItemArmor{ private String name; private EnumRarity rarity; - public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, String textureBase){ - this(name, material, type, repairItem, textureBase, EnumRarity.RARE); + public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem){ + this(name, material, type, repairItem, EnumRarity.RARE); } - public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, String textureBase, EnumRarity rarity){ - super(material, 0, type); + public ItemArmorAA(String name, ArmorMaterial material, int type, ItemStack repairItem, EnumRarity rarity){ + super(material, 0, ContainerEnervator.ARMOR_SLOTS[type]); this.repairItem = repairItem; this.name = name; this.rarity = rarity; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java index 75ce76adc..5c663ecc5 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/base/ItemSeed.java @@ -21,8 +21,8 @@ import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; import net.minecraft.item.ItemSeeds; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.ResourceLocation; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; public class ItemSeed extends ItemSeeds{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java index 5bab22e1e..df637be67 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensColor.java @@ -17,12 +17,13 @@ import de.ellpeck.actuallyadditions.mod.blocks.InitBlocks; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import java.util.ArrayList; @@ -57,7 +58,7 @@ public class LensColor extends Lens{ @SuppressWarnings("unchecked") @Override - public boolean invoke(BlockPos hitBlock, IAtomicReconstructor tile){ + public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){ if(hitBlock != null){ if(Util.arrayContains(CONVERTABLE_BLOCKS, PosUtil.getBlock(hitBlock, tile.getWorldObject())) >= 0 && tile.getEnergy() >= ENERGY_USE){ int meta = PosUtil.getMetadata(hitBlock, tile.getWorldObject()); @@ -70,7 +71,7 @@ public class LensColor extends Lens{ tile.extractEnergy(ENERGY_USE); } - ArrayList items = (ArrayList)tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.fromBounds(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1)); + ArrayList items = (ArrayList)tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1)); for(EntityItem item : items){ if(!item.isDead && item.getEntityItem() != null && tile.getEnergy() >= ENERGY_USE){ if(Util.arrayContains(CONVERTABLE_BLOCKS, item.getEntityItem().getItem()) >= 0 || Util.arrayContains(CONVERTABLE_BLOCKS, Block.getBlockFromItem(item.getEntityItem().getItem())) >= 0){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java index 35e3166b2..e7151d65e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDeath.java @@ -14,9 +14,10 @@ import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.mod.misc.DamageSources; import de.ellpeck.actuallyadditions.mod.util.PosUtil; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import java.util.ArrayList; @@ -24,18 +25,18 @@ public class LensDeath extends Lens{ @SuppressWarnings("unchecked") @Override - public boolean invoke(BlockPos hitBlock, IAtomicReconstructor tile){ + public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){ int use = 150; //Per Block (because it doesn't only activate when something is hit like the other lenses!) if(tile.getEnergy() >= use){ tile.extractEnergy(use); - ArrayList entities = (ArrayList)tile.getWorldObject().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.fromBounds(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1)); + ArrayList entities = (ArrayList)tile.getWorldObject().getEntitiesWithinAABB(EntityLivingBase.class, new AxisAlignedBB(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), hitBlock.getX()+1, hitBlock.getY()+1, hitBlock.getZ()+1)); for(EntityLivingBase entity : entities){ entity.attackEntityFrom(DamageSources.DAMAGE_ATOMIC_RECONSTRUCTOR, 20F); } } - return hitBlock != null && !PosUtil.getBlock(hitBlock, tile.getWorldObject()).isAir(tile.getWorldObject(), hitBlock); + return hitBlock != null && !PosUtil.getBlock(hitBlock, tile.getWorldObject()).isAir(hitState, tile.getWorldObject(), hitBlock); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java index 83b556617..96cccebea 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensDetonation.java @@ -13,13 +13,14 @@ package de.ellpeck.actuallyadditions.mod.items.lens; import de.ellpeck.actuallyadditions.api.internal.IAtomicReconstructor; import de.ellpeck.actuallyadditions.api.lens.Lens; import de.ellpeck.actuallyadditions.mod.util.PosUtil; -import net.minecraft.util.BlockPos; +import net.minecraft.block.state.IBlockState; +import net.minecraft.util.math.BlockPos; public class LensDetonation extends Lens{ @Override - public boolean invoke(BlockPos hitBlock, IAtomicReconstructor tile){ - if(hitBlock != null && !PosUtil.getBlock(hitBlock, tile.getWorldObject()).isAir(tile.getWorldObject(), hitBlock)){ + public boolean invoke(IBlockState state, BlockPos hitBlock, IAtomicReconstructor tile){ + if(hitBlock != null && !PosUtil.getBlock(hitBlock, tile.getWorldObject()).isAir(state, tile.getWorldObject(), hitBlock)){ int use = 250000; if(tile.getEnergy() >= use){ tile.getWorldObject().newExplosion(null, hitBlock.getX()+0.5, hitBlock.getY()+0.5, hitBlock.getZ()+0.5, 10F, true, true); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java index c3c277920..e751cb020 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/lens/LensNone.java @@ -17,11 +17,12 @@ import de.ellpeck.actuallyadditions.api.recipe.LensNoneRecipe; import de.ellpeck.actuallyadditions.mod.config.ConfigValues; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import net.minecraft.block.Block; +import net.minecraft.block.state.IBlockState; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; import java.util.ArrayList; import java.util.List; @@ -30,8 +31,8 @@ public class LensNone extends Lens{ @SuppressWarnings("unchecked") @Override - public boolean invoke(BlockPos hitBlock, IAtomicReconstructor tile){ - if(hitBlock != null && !PosUtil.getBlock(hitBlock, tile.getWorldObject()).isAir(tile.getWorldObject(), hitBlock)){ + public boolean invoke(IBlockState hitState, BlockPos hitBlock, IAtomicReconstructor tile){ + if(hitBlock != null && !PosUtil.getBlock(hitBlock, tile.getWorldObject()).isAir(hitState, tile.getWorldObject(), hitBlock)){ int range = 2; //Converting the Blocks @@ -65,7 +66,7 @@ public class LensNone extends Lens{ } //Converting the Items - ArrayList items = (ArrayList)tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.fromBounds(hitBlock.getX()-range, hitBlock.getY()-range, hitBlock.getZ()-range, hitBlock.getX()+range, hitBlock.getY()+range, hitBlock.getZ()+range)); + ArrayList items = (ArrayList)tile.getWorldObject().getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(hitBlock.getX()-range, hitBlock.getY()-range, hitBlock.getZ()-range, hitBlock.getX()+range, hitBlock.getY()+range, hitBlock.getZ()+range)); for(EntityItem item : items){ ItemStack stack = item.getEntityItem(); if(!item.isDead && stack != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/ThePotionRings.java b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/ThePotionRings.java index e134e8a90..e1998c342 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/ThePotionRings.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/items/metalists/ThePotionRings.java @@ -12,28 +12,29 @@ package de.ellpeck.actuallyadditions.mod.items.metalists; import net.minecraft.init.Blocks; import net.minecraft.init.Items; +import net.minecraft.init.MobEffects; import net.minecraft.item.EnumRarity; import net.minecraft.item.ItemStack; import net.minecraft.potion.Potion; public enum ThePotionRings{ - SPEED(Potion.moveSpeed.getName(), 8171462, Potion.moveSpeed.getId(), 0, 1, 10, false, EnumRarity.UNCOMMON, new ItemStack(Items.sugar)), + SPEED(MobEffects.moveSpeed.getName(), 8171462, MobEffects.moveSpeed, 0, 1, 10, false, EnumRarity.UNCOMMON, new ItemStack(Items.sugar)), //Slowness - HASTE(Potion.digSpeed.getName(), 14270531, Potion.digSpeed.getId(), 0, 1, 10, false, EnumRarity.EPIC, new ItemStack(Items.repeater)), + HASTE(MobEffects.digSpeed.getName(), 14270531, MobEffects.digSpeed, 0, 1, 10, false, EnumRarity.EPIC, new ItemStack(Items.repeater)), //Mining Fatigue - STRENGTH(Potion.damageBoost.getName(), 9643043, Potion.damageBoost.getId(), 0, 1, 10, false, EnumRarity.RARE, new ItemStack(Items.blaze_powder)), + STRENGTH(MobEffects.damageBoost.getName(), 9643043, MobEffects.damageBoost, 0, 1, 10, false, EnumRarity.RARE, new ItemStack(Items.blaze_powder)), //Health (Not Happening) //Damage - JUMP_BOOST(Potion.jump.getName(), 7889559, Potion.jump.getId(), 0, 1, 10, false, EnumRarity.RARE, new ItemStack(Blocks.piston)), + JUMP_BOOST(MobEffects.jump.getName(), 7889559, MobEffects.jump, 0, 1, 10, false, EnumRarity.RARE, new ItemStack(Blocks.piston)), //Nausea - REGEN(Potion.regeneration.getName(), 13458603, Potion.regeneration.getId(), 0, 1, 50, true, EnumRarity.RARE, new ItemStack(Items.ghast_tear)), - RESISTANCE(Potion.resistance.getName(), 10044730, Potion.resistance.getId(), 0, 1, 10, false, EnumRarity.EPIC, new ItemStack(Items.slime_ball)), - FIRE_RESISTANCE(Potion.fireResistance.getName(), 14981690, Potion.fireResistance.getId(), 0, 0, 10, false, EnumRarity.UNCOMMON, new ItemStack(Items.magma_cream)), - WATER_BREATHING(Potion.waterBreathing.getName(), 3035801, Potion.waterBreathing.getId(), 0, 0, 10, false, EnumRarity.RARE, new ItemStack(Items.fish, 1, 3)), - INVISIBILITY(Potion.invisibility.getName(), 8356754, Potion.invisibility.getId(), 0, 0, 10, false, EnumRarity.EPIC, new ItemStack(Items.fermented_spider_eye)), + REGEN(MobEffects.regeneration.getName(), 13458603, MobEffects.regeneration, 0, 1, 50, true, EnumRarity.RARE, new ItemStack(Items.ghast_tear)), + RESISTANCE(MobEffects.resistance.getName(), 10044730, MobEffects.resistance, 0, 1, 10, false, EnumRarity.EPIC, new ItemStack(Items.slime_ball)), + FIRE_RESISTANCE(MobEffects.fireResistance.getName(), 14981690, MobEffects.fireResistance, 0, 0, 10, false, EnumRarity.UNCOMMON, new ItemStack(Items.magma_cream)), + WATER_BREATHING(MobEffects.waterBreathing.getName(), 3035801, MobEffects.waterBreathing, 0, 0, 10, false, EnumRarity.RARE, new ItemStack(Items.fish, 1, 3)), + INVISIBILITY(MobEffects.invisibility.getName(), 8356754, MobEffects.invisibility, 0, 0, 10, false, EnumRarity.EPIC, new ItemStack(Items.fermented_spider_eye)), //Blindness - NIGHT_VISION(Potion.nightVision.getName(), 2039713, Potion.nightVision.getId(), 0, 0, 300, false, EnumRarity.RARE, new ItemStack(Items.golden_carrot)); + NIGHT_VISION(MobEffects.nightVision.getName(), 2039713, MobEffects.nightVision, 0, 0, 300, false, EnumRarity.RARE, new ItemStack(Items.golden_carrot)); //Hunger //Weakness //Poison @@ -51,11 +52,11 @@ public enum ThePotionRings{ public final boolean needsWaitBeforeActivating; public final ItemStack craftingItem; - ThePotionRings(String name, int color, int effectID, int normalAmplifier, int advancedAmplifier, int activeTime, boolean needsWaitBeforeActivating, EnumRarity rarity, ItemStack craftingItem){ + ThePotionRings(String name, int color, Potion effect, int normalAmplifier, int advancedAmplifier, int activeTime, boolean needsWaitBeforeActivating, EnumRarity rarity, ItemStack craftingItem){ this.name = name; this.color = color; this.rarity = rarity; - this.effectID = effectID; + this.effectID = Potion.getIdFromPotion(effect); this.normalAmplifier = normalAmplifier; this.advancedAmplifier = advancedAmplifier; this.activeTime = activeTime; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java index 8c7f099c3..bdba5998f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/jei/booklet/BookletRecipeWrapper.java @@ -18,7 +18,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import mezz.jei.api.recipe.IRecipeWrapper; import net.minecraft.client.Minecraft; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.fluids.FluidStack; import javax.annotation.Nonnull; @@ -62,7 +62,7 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRe @Override public void drawInfo(@Nonnull Minecraft minecraft, int recipeWidth, int recipeHeight, int mouseX, int mouseY){ - List header = minecraft.fontRendererObj.listFormattedStringToWidth(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".booklet.header").replaceAll("", EnumChatFormatting.BLUE+"").replaceAll("", EnumChatFormatting.BLACK+""), 150); + List header = minecraft.fontRendererObj.listFormattedStringToWidth(StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".booklet.header").replaceAll("", TextFormatting.BLUE+"").replaceAll("", TextFormatting.BLACK+""), 150); for(int i = 0; i < header.size(); i++){ minecraft.fontRendererObj.drawString((String)header.get(i), 0, 17+i*(minecraft.fontRendererObj.FONT_HEIGHT+1), 0, false); } @@ -70,12 +70,12 @@ public class BookletRecipeWrapper extends RecipeWrapperWithButton implements IRe int maxLines = 4; IBookletChapter chapter = this.thePage.getChapter(); String aText = (chapter.getPages()[0] instanceof PagePicture && chapter.getPages().length > 1 ? chapter.getPages()[1] : chapter.getPages()[0]).getText(); - List text = minecraft.fontRendererObj.listFormattedStringToWidth(aText != null ? aText : EnumChatFormatting.DARK_RED+StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".booklet.noText"), 150); + List text = minecraft.fontRendererObj.listFormattedStringToWidth(aText != null ? aText : TextFormatting.DARK_RED+StringUtil.localize("container.nei."+ModUtil.MOD_ID_LOWER+".booklet.noText"), 150); for(int i = 0; i < Math.min(maxLines, text.size()); i++){ - minecraft.fontRendererObj.drawString(text.get(i)+(i == maxLines-1 && text.size() > maxLines ? EnumChatFormatting.RESET+""+EnumChatFormatting.BLACK+"..." : ""), 0, 16+25+i*(minecraft.fontRendererObj.FONT_HEIGHT+1), 0, false); + minecraft.fontRendererObj.drawString(text.get(i)+(i == maxLines-1 && text.size() > maxLines ? TextFormatting.RESET+""+TextFormatting.BLACK+"..." : ""), 0, 16+25+i*(minecraft.fontRendererObj.FONT_HEIGHT+1), 0, false); } - minecraft.fontRendererObj.drawString(EnumChatFormatting.ITALIC+chapter.getLocalizedName(), 25, 85, 0, false); - minecraft.fontRendererObj.drawString(EnumChatFormatting.ITALIC+"Page "+this.thePage.getID(), 25, 95, 0, false); + minecraft.fontRendererObj.drawString(TextFormatting.ITALIC+chapter.getLocalizedName(), 25, 85, 0, false); + minecraft.fontRendererObj.drawString(TextFormatting.ITALIC+"Page "+this.thePage.getID(), 25, 95, 0, false); this.updateButton(minecraft, mouseX, mouseY); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/material/InitArmorMaterials.java b/src/main/java/de/ellpeck/actuallyadditions/mod/material/InitArmorMaterials.java index 9a30f371d..eedb4beb6 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/material/InitArmorMaterials.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/material/InitArmorMaterials.java @@ -11,7 +11,9 @@ package de.ellpeck.actuallyadditions.mod.material; import de.ellpeck.actuallyadditions.mod.util.ModUtil; +import net.minecraft.init.SoundEvents; import net.minecraft.item.ItemArmor.ArmorMaterial; +import net.minecraft.util.SoundEvent; import net.minecraftforge.common.util.EnumHelper; public class InitArmorMaterials{ @@ -30,15 +32,15 @@ public class InitArmorMaterials{ public static void init(){ ModUtil.LOGGER.info("Initializing Armor Materials..."); - armorMaterialEmerald = EnumHelper.addArmorMaterial("armorMaterialEmerald", ModUtil.MOD_ID_LOWER+":armorEmerald", 50, new int[]{5, 9, 8, 5}, 15); - armorMaterialObsidian = EnumHelper.addArmorMaterial("armorMaterialObsidian", ModUtil.MOD_ID_LOWER+":armorObsidian", 120, new int[]{3, 4, 3, 1}, 10); - armorMaterialQuartz = EnumHelper.addArmorMaterial("armorMaterialQuartz", ModUtil.MOD_ID_LOWER+":armorQuartz", 20, new int[]{3, 6, 5, 3}, 8); + armorMaterialEmerald = EnumHelper.addArmorMaterial("armorMaterialEmerald", ModUtil.MOD_ID_LOWER+":armorEmerald", 50, new int[]{5, 9, 8, 5}, 15, SoundEvents.item_armor_equip_generic); + armorMaterialObsidian = EnumHelper.addArmorMaterial("armorMaterialObsidian", ModUtil.MOD_ID_LOWER+":armorObsidian", 120, new int[]{3, 4, 3, 1}, 10, SoundEvents.item_armor_equip_generic); + armorMaterialQuartz = EnumHelper.addArmorMaterial("armorMaterialQuartz", ModUtil.MOD_ID_LOWER+":armorQuartz", 20, new int[]{3, 6, 5, 3}, 8, SoundEvents.item_armor_equip_generic); - armorMaterialCrystalRed = EnumHelper.addArmorMaterial("armorMaterialCrystalRed", ModUtil.MOD_ID_LOWER+":armorCrystalRed", 18, new int[]{3, 7, 6, 3}, 9); - armorMaterialCrystalBlue = EnumHelper.addArmorMaterial("armorMaterialCrystalBlue", ModUtil.MOD_ID_LOWER+":armorCrystalBlue", 18, new int[]{3, 7, 6, 3}, 10); - armorMaterialCrystalLightBlue = EnumHelper.addArmorMaterial("armorMaterialCrystalLightBlue", ModUtil.MOD_ID_LOWER+":armorCrystalLightBlue", 35, new int[]{7, 9, 7, 5}, 12); - armorMaterialCrystalBlack = EnumHelper.addArmorMaterial("armorMaterialCrystalBlack", ModUtil.MOD_ID_LOWER+":armorCrystalBlack", 12, new int[]{1, 4, 3, 1}, 13); - armorMaterialCrystalGreen = EnumHelper.addArmorMaterial("armorMaterialCrystalGreen", ModUtil.MOD_ID_LOWER+":armorCrystalGreen", 60, new int[]{7, 10, 9, 6}, 18); - armorMaterialCrystalWhite = EnumHelper.addArmorMaterial("armorMaterialCrystalWhite", ModUtil.MOD_ID_LOWER+":armorCrystalWhite", 18, new int[]{4, 7, 6, 4}, 11); + armorMaterialCrystalRed = EnumHelper.addArmorMaterial("armorMaterialCrystalRed", ModUtil.MOD_ID_LOWER+":armorCrystalRed", 18, new int[]{3, 7, 6, 3}, 9, SoundEvents.item_armor_equip_generic); + armorMaterialCrystalBlue = EnumHelper.addArmorMaterial("armorMaterialCrystalBlue", ModUtil.MOD_ID_LOWER+":armorCrystalBlue", 18, new int[]{3, 7, 6, 3}, 10, SoundEvents.item_armor_equip_generic); + armorMaterialCrystalLightBlue = EnumHelper.addArmorMaterial("armorMaterialCrystalLightBlue", ModUtil.MOD_ID_LOWER+":armorCrystalLightBlue", 35, new int[]{7, 9, 7, 5}, 12, SoundEvents.item_armor_equip_generic); + armorMaterialCrystalBlack = EnumHelper.addArmorMaterial("armorMaterialCrystalBlack", ModUtil.MOD_ID_LOWER+":armorCrystalBlack", 12, new int[]{1, 4, 3, 1}, 13, SoundEvents.item_armor_equip_generic); + armorMaterialCrystalGreen = EnumHelper.addArmorMaterial("armorMaterialCrystalGreen", ModUtil.MOD_ID_LOWER+":armorCrystalGreen", 60, new int[]{7, 10, 9, 6}, 18, SoundEvents.item_armor_equip_generic); + armorMaterialCrystalWhite = EnumHelper.addArmorMaterial("armorMaterialCrystalWhite", ModUtil.MOD_ID_LOWER+":armorCrystalWhite", 18, new int[]{4, 7, 6, 4}, 11, SoundEvents.item_armor_equip_generic); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java index 1b06219c2..01158553b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DamageSources.java @@ -14,9 +14,9 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.entity.EntityLivingBase; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.DamageSource; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; public class DamageSources extends DamageSource{ @@ -30,8 +30,8 @@ public class DamageSources extends DamageSource{ } @Override - public IChatComponent getDeathMessage(EntityLivingBase entity){ + public ITextComponent getDeathMessage(EntityLivingBase entity){ String locTag = "death."+ModUtil.MOD_ID_LOWER+"."+this.damageType+"."+(Util.RANDOM.nextInt(this.messageCount)+1); - return new ChatComponentText(StringUtil.localizeFormatted(locTag, entity.getName())); + return new TextComponentString(StringUtil.localizeFormatted(locTag, entity.getName())); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerEmptyBucket.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerEmptyBucket.java index 7d45c1066..68d948301 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerEmptyBucket.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerEmptyBucket.java @@ -11,6 +11,7 @@ package de.ellpeck.actuallyadditions.mod.misc; +import de.ellpeck.actuallyadditions.mod.util.FakePlayerUtil; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import net.minecraft.block.BlockDispenser; import net.minecraft.dispenser.BehaviorDefaultDispenseItem; @@ -18,8 +19,8 @@ import net.minecraft.dispenser.IBlockSource; import net.minecraft.init.Items; import net.minecraft.item.ItemBucket; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; public class DispenserHandlerEmptyBucket extends BehaviorDefaultDispenseItem{ @@ -31,7 +32,7 @@ public class DispenserHandlerEmptyBucket extends BehaviorDefaultDispenseItem{ int z = source.getBlockTileEntity().getPos().getZ()+facing.getFrontOffsetZ(); BlockPos pos = new BlockPos(x, y, z); - if(source.getWorld().isAirBlock(pos) && !PosUtil.getMaterial(pos, source.getWorld()).isSolid() && ((ItemBucket)bucket.getItem()).tryPlaceContainedLiquid(source.getWorld(), pos)){ + if(source.getWorld().isAirBlock(pos) && !PosUtil.getMaterial(pos, source.getWorld()).isSolid() && ((ItemBucket)bucket.getItem()).tryPlaceContainedLiquid(FakePlayerUtil.getFakePlayer(source.getWorld()), source.getWorld(), pos)){ return new ItemStack(Items.bucket); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFertilize.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFertilize.java index 09b36adb5..31f093b83 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFertilize.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFertilize.java @@ -16,8 +16,8 @@ import net.minecraft.dispenser.BehaviorDefaultDispenseItem; import net.minecraft.dispenser.IBlockSource; import net.minecraft.item.ItemDye; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; public class DispenserHandlerFertilize extends BehaviorDefaultDispenseItem{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFillBucket.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFillBucket.java index daf0fad2e..b13040b75 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFillBucket.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DispenserHandlerFillBucket.java @@ -20,8 +20,8 @@ import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntityDispenser; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fluids.FluidContainerRegistry; import net.minecraftforge.fluids.IFluidBlock; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DungeonLoot.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DungeonLoot.java index 6a181d2fb..50699a25f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DungeonLoot.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/DungeonLoot.java @@ -16,36 +16,37 @@ import de.ellpeck.actuallyadditions.mod.items.InitItems; import de.ellpeck.actuallyadditions.mod.items.metalists.TheCrystals; import de.ellpeck.actuallyadditions.mod.items.metalists.TheMiscItems; import de.ellpeck.actuallyadditions.mod.util.ModUtil; +import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.util.WeightedRandomChestContent; -import net.minecraftforge.common.ChestGenHooks; +//TODO Fix dungeon loot (oh god) public class DungeonLoot{ public static void init(){ if(ConfigBoolValues.DUNGEON_LOOT.isEnabled()){ ModUtil.LOGGER.info("Initializing Dungeon Loot..."); - ChestGenHooks dungeon = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); + /*ChestGenHooks dungeon = ChestGenHooks.getInfo(ChestGenHooks.DUNGEON_CHEST); ChestGenHooks mineshaft = ChestGenHooks.getInfo(ChestGenHooks.MINESHAFT_CORRIDOR); ChestGenHooks blacksmith = ChestGenHooks.getInfo(ChestGenHooks.VILLAGE_BLACKSMITH); for(int i = 0; i < TheCrystals.values().length; i++){ - WeightedRandomChestContent item = new WeightedRandomChestContent(new ItemStack(InitItems.itemCrystal, 1, i), 2, 4, 5); - WeightedRandomChestContent block = new WeightedRandomChestContent(new ItemStack(InitBlocks.blockCrystal, 1, i), 1, 3, 1); + WeightedRandomChestContent item = new WeightedRandomChestContent(InitItems.itemCrystal, i, 2, 4, 5); + WeightedRandomChestContent block = new WeightedRandomChestContent(Item.getItemFromBlock(InitBlocks.blockCrystal), i, 1, 3, 1); dungeon.addItem(item); dungeon.addItem(block); mineshaft.addItem(item); mineshaft.addItem(block); } - WeightedRandomChestContent drillCore = new WeightedRandomChestContent(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.DRILL_CORE.ordinal()), 1, 1, 3); + WeightedRandomChestContent drillCore = new WeightedRandomChestContent(InitItems.itemMisc, TheMiscItems.DRILL_CORE.ordinal(), 1, 1, 3); dungeon.addItem(drillCore); mineshaft.addItem(drillCore); blacksmith.addItem(drillCore); - WeightedRandomChestContent quartz = new WeightedRandomChestContent(new ItemStack(InitItems.itemMisc, 1, TheMiscItems.QUARTZ.ordinal()), 3, 4, 30); + WeightedRandomChestContent quartz = new WeightedRandomChestContent(InitItems.itemMisc, TheMiscItems.QUARTZ.ordinal(), 3, 4, 30); dungeon.addItem(quartz); - blacksmith.addItem(quartz); + blacksmith.addItem(quartz);*/ } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/LaserRelayConnectionHandler.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/LaserRelayConnectionHandler.java index fec5a2ad4..60bb021d3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/LaserRelayConnectionHandler.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/LaserRelayConnectionHandler.java @@ -19,8 +19,8 @@ import io.netty.util.internal.ConcurrentSet; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class LaserRelayConnectionHandler{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/WorldData.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/WorldData.java index 95a7cb4f2..b551acbb7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/WorldData.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/WorldData.java @@ -33,8 +33,7 @@ public class WorldData extends WorldSavedData{ } } - public static void init(){ - MinecraftServer server = MinecraftServer.getServer(); + public static void init(MinecraftServer server){ if(server != null){ World world = server.getEntityWorld(); if(!world.isRemote){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java index 7b4909c58..01c2d75f9 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/misc/special/RenderSpecial.java @@ -20,7 +20,7 @@ import net.minecraft.entity.player.EnumPlayerModelParts; import net.minecraft.init.Blocks; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.Vec3d; import java.util.Calendar; @@ -50,8 +50,8 @@ public class RenderSpecial{ GlStateManager.pushMatrix(); - Vec3 currentPos = Minecraft.getMinecraft().thePlayer.getPositionEyes(partialTicks); - Vec3 playerPos = player.getPositionEyes(partialTicks); + Vec3d currentPos = Minecraft.getMinecraft().thePlayer.getPositionEyes(partialTicks); + Vec3d playerPos = player.getPositionEyes(partialTicks); GlStateManager.translate(playerPos.xCoord-currentPos.xCoord, playerPos.yCoord-currentPos.yCoord-(player.isSneaking() || Minecraft.getMinecraft().thePlayer.isSneaking() ? 0.125D : 0D), playerPos.zCoord-currentPos.zCoord); GlStateManager.translate(0D, 2.435D+offsetUp, 0D); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketParticle.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketParticle.java index f61ebfe3b..a31c86df7 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketParticle.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketParticle.java @@ -13,7 +13,7 @@ package de.ellpeck.actuallyadditions.mod.network; import de.ellpeck.actuallyadditions.mod.misc.EntityColoredParticleFX; import io.netty.buffer.ByteBuf; import net.minecraft.client.Minecraft; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; @@ -58,7 +58,7 @@ public class PacketParticle implements IMessage{ int difX = startX-endX; int difY = startY-endY; int difZ = startZ-endZ; - double distance = new Vec3(startX, startY, startZ).distanceTo(new Vec3(endX, endY, endZ)); + double distance = new Vec3d(startX, startY, startZ).distanceTo(new Vec3d(endX, endY, endZ)); for(int times = 0; times < particleAmount/2; times++){ for(double i = 0; i <= 1; i += 1/(distance*particleAmount)){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketUpdateTileEntity.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketUpdateTileEntity.java index d515af4ba..b3cab5ce3 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketUpdateTileEntity.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/PacketUpdateTileEntity.java @@ -17,7 +17,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.PacketBuffer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; import net.minecraftforge.fml.common.network.simpleimpl.IMessageHandler; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/PacketGuiButton.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/PacketGuiButton.java index bbe43d312..017310db8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/PacketGuiButton.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/PacketGuiButton.java @@ -14,7 +14,7 @@ package de.ellpeck.actuallyadditions.mod.network.gui; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; @@ -39,7 +39,7 @@ public class PacketGuiButton implements IMessage{ this.tileX = x; this.tileY = y; this.tileZ = z; - this.worldID = world.provider.getDimensionId(); + this.worldID = world.provider.getDimension(); this.buttonID = buttonID; this.playerID = player.getEntityId(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/PacketGuiNumber.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/PacketGuiNumber.java index 1be9ea5a8..37f9d162f 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/PacketGuiNumber.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/PacketGuiNumber.java @@ -14,7 +14,7 @@ package de.ellpeck.actuallyadditions.mod.network.gui; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; @@ -40,7 +40,7 @@ public class PacketGuiNumber implements IMessage{ this.tileX = x; this.tileY = y; this.tileZ = z; - this.worldID = world.provider.getDimensionId(); + this.worldID = world.provider.getDimension(); this.text = text; this.textID = textID; this.playerID = player.getEntityId(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/PacketGuiString.java b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/PacketGuiString.java index d48071826..5db75eb07 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/PacketGuiString.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/network/gui/PacketGuiString.java @@ -14,7 +14,7 @@ package de.ellpeck.actuallyadditions.mod.network.gui; import io.netty.buffer.ByteBuf; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.common.DimensionManager; import net.minecraftforge.fml.common.network.simpleimpl.IMessage; @@ -40,7 +40,7 @@ public class PacketGuiString implements IMessage{ this.tileX = x; this.tileY = y; this.tileZ = z; - this.worldID = world.provider.getDimensionId(); + this.worldID = world.provider.getDimension(); this.text = text; this.textID = textID; this.playerID = player.getEntityId(); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java index 856d74729..9166a2e12 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/proxy/ClientProxy.java @@ -31,11 +31,11 @@ import de.ellpeck.actuallyadditions.mod.util.StringUtil; import de.ellpeck.actuallyadditions.mod.util.playerdata.PersistentClientData; import net.minecraft.block.Block; import net.minecraft.client.Minecraft; +import net.minecraft.client.renderer.block.model.ModelBakery; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.resources.IReloadableResourceManager; import net.minecraft.client.resources.IResourceManager; import net.minecraft.client.resources.IResourceManagerReloadListener; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.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/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java index c6bf6c649..9eb93775d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityAtomicReconstructor.java @@ -24,8 +24,8 @@ import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.relauncher.Side; @@ -98,7 +98,7 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple for(int i = 0; i < distance; i++){ BlockPos hitBlock = WorldUtil.getCoordsFromSide(sideToManipulate, this.pos, i); - if(currentLens.invoke(hitBlock, this)){ + if(currentLens.invoke(this.worldObj.getBlockState(hitBlock), hitBlock, this)){ this.shootLaser(hitBlock.getX(), hitBlock.getY(), hitBlock.getZ(), currentLens); break; } @@ -120,9 +120,10 @@ public class TileEntityAtomicReconstructor extends TileEntityInventoryBase imple private void shootLaser(int endX, int endY, int endZ, Lens currentLens){ if(!ConfigValues.lessSound){ - this.worldObj.playSoundEffect(this.getX(), this.getY(), this.getZ(), ModUtil.MOD_ID_LOWER+":reconstructor", 0.35F, 1.0F); + //TODO Fix sound + //this.worldObj.playSoundEffect(this.getX(), this.getY(), this.getZ(), ModUtil.MOD_ID_LOWER+":reconstructor", 0.35F, 1.0F); } - PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getX(), this.getY(), this.getZ(), endX, endY, endZ, currentLens.getColor(), ConfigValues.lessParticles ? 2 : 8, 2F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimensionId(), this.getX(), this.getY(), this.getZ(), 64)); + PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getX(), this.getY(), this.getZ(), endX, endY, endZ, currentLens.getColor(), ConfigValues.lessParticles ? 2 : 8, 2F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimension(), this.getX(), this.getY(), this.getZ(), 64)); } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java index 5ee48df56..90f22ba4a 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBase.java @@ -18,10 +18,10 @@ import net.minecraft.block.state.IBlockState; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; import net.minecraft.network.Packet; -import net.minecraft.network.play.server.S35PacketUpdateTileEntity; +import net.minecraft.network.play.server.SPacketUpdateTileEntity; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.ITickable; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.common.registry.GameRegistry; @@ -95,7 +95,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ public final Packet getDescriptionPacket(){ NBTTagCompound compound = this.getSyncCompound(); if(compound != null){ - return new S35PacketUpdateTileEntity(this.pos, 3, compound); + return new SPacketUpdateTileEntity(this.pos, 3, compound); } else{ return null; @@ -103,7 +103,7 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ } @Override - public final void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt){ + public final void onDataPacket(NetworkManager net, SPacketUpdateTileEntity pkt){ if(pkt != null){ this.receiveSyncCompound(pkt.getNbtCompound()); } @@ -161,6 +161,6 @@ public abstract class TileEntityBase extends TileEntity implements ITickable{ } public final void sendUpdate(){ - PacketHandler.theNetwork.sendToAllAround(new PacketUpdateTileEntity(this), new NetworkRegistry.TargetPoint(this.worldObj.provider.getDimensionId(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 64)); + PacketHandler.theNetwork.sendToAllAround(new PacketUpdateTileEntity(this), new NetworkRegistry.TargetPoint(this.worldObj.provider.getDimension(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 64)); } } \ No newline at end of file diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java index 56ece8b7c..29020d186 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityBreaker.java @@ -16,10 +16,11 @@ import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.block.BlockAir; +import net.minecraft.block.state.IBlockState; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import java.util.ArrayList; @@ -80,14 +81,14 @@ public class TileEntityBreaker extends TileEntityInventoryBase implements IRedst BlockPos coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, this.pos, 0); if(coordsBlock != null){ Block blockToBreak = PosUtil.getBlock(coordsBlock, worldObj); - if(!this.isPlacer && blockToBreak != null && !(blockToBreak instanceof BlockAir) && blockToBreak.getBlockHardness(worldObj, coordsBlock) > -1.0F){ + IBlockState stateToBreak = worldObj.getBlockState(coordsBlock); + if(!this.isPlacer && blockToBreak != null && !(blockToBreak instanceof BlockAir) && blockToBreak.getBlockHardness(stateToBreak, worldObj, coordsBlock) > -1.0F){ ArrayList drops = new ArrayList(); - int meta = PosUtil.getMetadata(coordsBlock, worldObj); - drops.addAll(blockToBreak.getDrops(worldObj, coordsBlock, worldObj.getBlockState(coordsBlock), 0)); + drops.addAll(blockToBreak.getDrops(worldObj, coordsBlock, stateToBreak, 0)); if(WorldUtil.addToInventory(this, drops, false, true)){ if(!ConfigValues.lessBlockBreakingEffects){ - worldObj.playAuxSFX(2001, coordsBlock, Block.getStateId(worldObj.getBlockState(coordsBlock))); + worldObj.playAuxSFX(2001, coordsBlock, Block.getStateId(stateToBreak)); } WorldUtil.breakBlockAtSide(sideToManipulate, worldObj, this.pos); WorldUtil.addToInventory(this, drops, true, true); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java index 82652e39c..a751666b0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityCoffeeMachine.java @@ -135,7 +135,8 @@ public class TileEntityCoffeeMachine extends TileEntityInventoryBase implements if(this.slots[SLOT_INPUT] != null && this.slots[SLOT_INPUT].getItem() == InitItems.itemMisc && this.slots[SLOT_INPUT].getItemDamage() == TheMiscItems.CUP.ordinal() && this.slots[SLOT_OUTPUT] == null && this.coffeeCacheAmount >= CACHE_USE && this.tank.getFluid() != null && this.tank.getFluid().getFluid() == FluidRegistry.WATER && this.tank.getFluidAmount() >= WATER_USE){ if(this.storage.getEnergyStored() >= ENERGY_USED){ if(this.brewTime%30 == 0 && !ConfigValues.lessSound){ - this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), ModUtil.MOD_ID_LOWER+":coffeeMachine", 0.35F, 1.0F); + //TODO Fix sound + //this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), ModUtil.MOD_ID_LOWER+":coffeeMachine", 0.35F, 1.0F); } this.brewTime++; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java index ebd6d63f2..9217ad965 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityDirectionalBreaker.java @@ -19,8 +19,8 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockAir; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -85,8 +85,8 @@ public class TileEntityDirectionalBreaker extends TileEntityInventoryBase implem BlockPos coordsBlock = WorldUtil.getCoordsFromSide(sideToManipulate, pos, i); if(coordsBlock != null){ Block blockToBreak = PosUtil.getBlock(coordsBlock, worldObj); - if(blockToBreak != null && !(blockToBreak instanceof BlockAir) && blockToBreak.getBlockHardness(worldObj, pos) > -1.0F){ - ArrayList drops = new ArrayList(); + if(blockToBreak != null && !(blockToBreak instanceof BlockAir) && blockToBreak.getBlockHardness(worldObj.getBlockState(coordsBlock), worldObj, pos) > -1.0F){ + ArrayList drops = new ArrayList(); drops.addAll(blockToBreak.getDrops(worldObj, coordsBlock, worldObj.getBlockState(coordsBlock), 0)); if(WorldUtil.addToInventory(this, drops, false, true)){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java index 3b42009d9..6530c4481 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFeeder.java @@ -14,9 +14,9 @@ import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.entity.passive.EntityAnimal; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.math.AxisAlignedBB; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -65,7 +65,7 @@ public class TileEntityFeeder extends TileEntityInventoryBase{ if(!worldObj.isRemote){ boolean theFlag = this.currentTimer > 0; int range = 5; - List animals = worldObj.getEntitiesWithinAABB(EntityAnimal.class, AxisAlignedBB.fromBounds(this.pos.getX()-range, this.pos.getY()-range, this.pos.getZ()-range, this.pos.getX()+range, this.pos.getY()+range, this.pos.getZ()+range)); + List animals = worldObj.getEntitiesWithinAABB(EntityAnimal.class, new AxisAlignedBB(this.pos.getX()-range, this.pos.getY()-range, this.pos.getZ()-range, this.pos.getX()+range, this.pos.getY()+range, this.pos.getZ()+range)); if(animals != null){ this.currentAnimalAmount = animals.size(); if(this.currentAnimalAmount >= 2){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java index 57707f626..ad28167ae 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFireworkBox.java @@ -20,7 +20,7 @@ import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MathHelper; +import net.minecraft.util.math.MathHelper; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java index e8cbcec01..96880d93d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFishingNet.java @@ -17,13 +17,17 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.material.Material; import net.minecraft.entity.item.EntityItem; import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemFishingRod; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumFacing; -import net.minecraftforge.common.FishingHooks; +import net.minecraft.world.WorldServer; +import net.minecraft.world.storage.loot.LootContext; +import net.minecraft.world.storage.loot.LootTableList; import java.util.ArrayList; +import java.util.List; public class TileEntityFishingNet extends TileEntityBase{ @@ -50,17 +54,20 @@ public class TileEntityFishingNet extends TileEntityBase{ if(this.timeUntilNextDrop > 0){ this.timeUntilNextDrop--; if(timeUntilNextDrop <= 0){ - ItemStack fishable = FishingHooks.getRandomFishable(Util.RANDOM, Util.RANDOM.nextFloat()); - TileEntity tile = worldObj.getTileEntity(PosUtil.offset(pos, 0, 1, 0)); - if(tile != null && tile instanceof IInventory){ - ArrayList list = new ArrayList(); - list.add(fishable); - WorldUtil.addToInventory((IInventory)tile, list, EnumFacing.DOWN, true, false); - } - else{ - EntityItem item = new EntityItem(worldObj, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, fishable); - item.lifespan = 2000; - worldObj.spawnEntityInWorld(item); + LootContext.Builder builder = new LootContext.Builder((WorldServer)this.worldObj); + List fishables = this.worldObj.getLootTableManager().getLootTableFromLocation(LootTableList.GAMEPLAY_FISHING).generateLootForPools(Util.RANDOM, builder.build()); + for(ItemStack fishable : fishables){ + TileEntity tile = worldObj.getTileEntity(PosUtil.offset(pos, 0, 1, 0)); + if(tile != null && tile instanceof IInventory){ + ArrayList list = new ArrayList(); + list.add(fishable); + WorldUtil.addToInventory((IInventory)tile, list, EnumFacing.DOWN, true, false); + } + else{ + EntityItem item = new EntityItem(worldObj, pos.getX()+0.5, pos.getY()+0.5, pos.getZ()+0.5, fishable); + item.lifespan = 2000; + worldObj.spawnEntityInWorld(item); + } } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java index ca810aac3..f43a1fff0 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFluidCollector.java @@ -17,8 +17,8 @@ import net.minecraft.block.Block; import net.minecraft.init.Blocks; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fluids.*; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java index 213ec304e..2bc007c45 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityFurnaceSolar.java @@ -15,8 +15,8 @@ import cofh.api.energy.IEnergyProvider; import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -82,7 +82,7 @@ public class TileEntityFurnaceSolar extends TileEntityBase implements IEnergyPro public boolean hasBlockAbove(){ for(int y = 1; y <= worldObj.getHeight(); y++){ BlockPos offset = PosUtil.offset(this.pos, 0, y, 0); - if(!PosUtil.getBlock(offset, worldObj).isAir(worldObj, offset)){ + if(!PosUtil.getBlock(offset, worldObj).isAir(worldObj.getBlockState(offset), worldObj, offset)){ return true; } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGreenhouseGlass.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGreenhouseGlass.java index 5d0cb8ace..108bec22c 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGreenhouseGlass.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGreenhouseGlass.java @@ -17,7 +17,7 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockGrass; import net.minecraft.block.IGrowable; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.common.IPlantable; public class TileEntityGreenhouseGlass extends TileEntityBase{ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java index 90d944eeb..1ed649db8 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityGrinder.java @@ -164,7 +164,8 @@ public class TileEntityGrinder extends TileEntityInventoryBase implements IEnerg } if(shouldPlaySound && !ConfigValues.lessSound){ - this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), ModUtil.MOD_ID_LOWER+":crusher", 0.25F, 1.0F); + //TODO Fix sound + //this.worldObj.playSoundEffect(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), ModUtil.MOD_ID_LOWER+":crusher", 0.25F, 1.0F); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java index 7f99db7ab..892bad291 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityHeatCollector.java @@ -18,8 +18,8 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.block.material.Material; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -54,7 +54,7 @@ public class TileEntityHeatCollector extends TileEntityBase implements IEnergyPr BlockPos coords = WorldUtil.getCoordsFromSide(WorldUtil.getDirectionBySidesInOrder(i), this.pos, 0); if(coords != null){ Block block = PosUtil.getBlock(coords, worldObj); - if(block != null && block.getMaterial() == Material.lava && PosUtil.getMetadata(coords, worldObj) == 0){ + if(block != null && block.getMaterial(worldObj.getBlockState(coords)) == Material.lava && PosUtil.getMetadata(coords, worldObj) == 0){ blocksAround.add(i); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java index 31fef578f..eaeb8c2b4 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityInventoryBase.java @@ -17,9 +17,9 @@ import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.ChatComponentText; import net.minecraft.util.EnumFacing; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; +import net.minecraft.util.text.TextComponentString; public abstract class TileEntityInventoryBase extends TileEntityBase implements ISidedInventory{ @@ -199,8 +199,8 @@ public abstract class TileEntityInventoryBase extends TileEntityBase implements } @Override - public IChatComponent getDisplayName(){ - return new ChatComponentText(StringUtil.localize(this.getName())); + public ITextComponent getDisplayName(){ + return new TextComponentString(StringUtil.localize(this.getName())); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java index 976991cc0..aea665406 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLaserRelay.java @@ -21,8 +21,8 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import io.netty.util.internal.ConcurrentSet; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagList; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java index b0ff839a3..f86e972ba 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLavaFactoryController.java @@ -18,8 +18,8 @@ import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.init.Blocks; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java index ed5a5bf1d..a6be2af3e 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityLeafGenerator.java @@ -19,14 +19,15 @@ import de.ellpeck.actuallyadditions.mod.util.PosUtil; import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; import java.util.ArrayList; import java.util.Collections; +import java.util.List; public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyProvider, IEnergySaver, IEnergyDisplay{ @@ -59,14 +60,14 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr this.nextUseCounter = 0; if(ENERGY_PRODUCED <= this.storage.getMaxEnergyStored()-this.storage.getEnergyStored()){ - ArrayList breakPositions = new ArrayList(); + List breakPositions = new ArrayList(); for(int reachX = -RANGE; reachX < RANGE+1; reachX++){ for(int reachZ = -RANGE; reachZ < RANGE+1; reachZ++){ for(int reachY = -RANGE; reachY < RANGE+1; reachY++){ BlockPos pos = PosUtil.offset(this.pos, reachX, reachY, reachZ); Block block = PosUtil.getBlock(pos, worldObj); - if(block != null && block.isLeaves(this.worldObj, pos)){ + if(block != null && block.isLeaves(this.worldObj.getBlockState(pos), this.worldObj, pos)){ breakPositions.add(pos); } } @@ -86,7 +87,7 @@ public class TileEntityLeafGenerator extends TileEntityBase implements IEnergyPr this.storage.receiveEnergy(ENERGY_PRODUCED, false); if(!ConfigValues.lessParticles){ - PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimensionId(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), 64)); + PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), theCoord.getX(), theCoord.getY(), theCoord.getZ(), new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimension(), this.pos.getX(), this.pos.getY(), this.pos.getZ(), 64)); } } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java index efd6d6737..8e6d93d7b 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityMiner.java @@ -23,8 +23,8 @@ import net.minecraft.block.BlockLiquid; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraftforge.fluids.IFluidBlock; import net.minecraftforge.fml.common.network.NetworkRegistry; import net.minecraftforge.fml.relauncher.Side; @@ -96,8 +96,8 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR Block block = PosUtil.getBlock(pos, worldObj); int meta = PosUtil.getMetadata(pos, worldObj); - if(block != null && !block.isAir(this.worldObj, pos)){ - if(block.getHarvestLevel(worldObj.getBlockState(pos)) <= 3F && block.getBlockHardness(this.worldObj, pos) >= 0F && !(block instanceof BlockLiquid) && !(block instanceof IFluidBlock) && this.isMinable(block, meta)){ + if(block != null && !block.isAir(this.worldObj.getBlockState(pos), this.worldObj, pos)){ + if(block.getHarvestLevel(worldObj.getBlockState(pos)) <= 3F && block.getBlockHardness(this.worldObj.getBlockState(pos), this.worldObj, pos) >= 0F && !(block instanceof BlockLiquid) && !(block instanceof IFluidBlock) && this.isMinable(block, meta)){ ArrayList drops = new ArrayList(); drops.addAll(block.getDrops(worldObj, pos, worldObj.getBlockState(pos), 0)); @@ -157,7 +157,7 @@ public class TileEntityMiner extends TileEntityInventoryBase implements IEnergyR private void shootParticles(int endX, int endY, int endZ){ if(!ConfigValues.lessParticles){ - PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimensionId(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 96)); + PacketHandler.theNetwork.sendToAllAround(new PacketParticle(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), endX, endY, endZ, new float[]{62F/255F, 163F/255F, 74F/255F}, 5, 1.0F), new NetworkRegistry.TargetPoint(worldObj.provider.getDimension(), this.getPos().getX(), this.getPos().getY(), this.getPos().getZ(), 96)); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java index 07bc698f8..8e2ef7d00 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomPlacer.java @@ -20,10 +20,10 @@ import de.ellpeck.actuallyadditions.mod.util.WorldUtil; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -112,11 +112,11 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements @Override public boolean hasBoundPosition(){ if(this.boundPosition != null){ - if(this.worldObj.getTileEntity(boundPosition) instanceof IPhantomTile || (this.getPos().getX() == this.boundPosition.getX() && this.getPos().getY() == this.boundPosition.getY() && this.getPos().getZ() == this.boundPosition.getZ() && this.worldObj.provider.getDimensionId() == this.worldObj.provider.getDimensionId())){ + if(this.worldObj.getTileEntity(boundPosition) instanceof IPhantomTile || (this.getPos().getX() == this.boundPosition.getX() && this.getPos().getY() == this.boundPosition.getY() && this.getPos().getZ() == this.boundPosition.getZ() && this.worldObj.provider.getDimension() == this.worldObj.provider.getDimension())){ this.boundPosition = null; return false; } - return this.worldObj.provider.getDimensionId() == this.worldObj.provider.getDimensionId(); + return this.worldObj.provider.getDimension() == this.worldObj.provider.getDimension(); } return false; } @@ -124,7 +124,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements private void doWork(){ if(this.isBreaker){ Block blockToBreak = PosUtil.getBlock(boundPosition, worldObj); - if(blockToBreak != null && blockToBreak.getBlockHardness(worldObj, boundPosition) > -1.0F){ + if(blockToBreak != null && blockToBreak.getBlockHardness(worldObj.getBlockState(boundPosition), worldObj, boundPosition) > -1.0F){ ArrayList drops = new ArrayList(); drops.addAll(blockToBreak.getDrops(worldObj, boundPosition, worldObj.getBlockState(boundPosition), 0)); @@ -168,7 +168,7 @@ public class TileEntityPhantomPlacer extends TileEntityInventoryBase implements @Override public boolean isBoundThingInRange(){ - return this.hasBoundPosition() && PosUtil.toVec(this.boundPosition).distanceTo(new Vec3(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ())) <= this.range; + return this.hasBoundPosition() && PosUtil.toVec(this.boundPosition).distanceTo(new Vec3d(this.getPos().getX(), this.getPos().getY(), this.getPos().getZ())) <= this.range; } @Override diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java index 929ba1f2e..9e5db3260 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityPhantomface.java @@ -19,9 +19,9 @@ import de.ellpeck.actuallyadditions.mod.util.Util; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumParticleTypes; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -94,12 +94,13 @@ public class TileEntityPhantomface extends TileEntityInventoryBase implements IP this.boundPosBefore = this.boundPosition; this.boundBlockBefore = this.boundPosition == null ? null : PosUtil.getBlock(this.boundPosition, this.worldObj); - this.worldObj.markBlockForUpdate(PosUtil.offset(this.pos, 1, 0, 0)); + //TODO Find a replacement for markBlockForUpdate() + /*this.worldObj.markBlockForUpdate(PosUtil.offset(this.pos, 1, 0, 0)); this.worldObj.markBlockForUpdate(PosUtil.offset(this.pos, -1, 0, 0)); this.worldObj.markBlockForUpdate(PosUtil.offset(this.pos, 0, 1, 0)); this.worldObj.markBlockForUpdate(PosUtil.offset(this.pos, 0, -1, 0)); this.worldObj.markBlockForUpdate(PosUtil.offset(this.pos, 0, 0, 1)); - this.worldObj.markBlockForUpdate(PosUtil.offset(this.pos, 0, 0, -1)); + this.worldObj.markBlockForUpdate(PosUtil.offset(this.pos, 0, 0, -1));*/ this.sendUpdate(); this.markDirty(); } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java index bad0d1d95..dcb4df0cd 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/tile/TileEntityRangedCollector.java @@ -16,8 +16,8 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.AxisAlignedBB; import java.util.ArrayList; @@ -50,7 +50,7 @@ public class TileEntityRangedCollector extends TileEntityInventoryBase implement super.updateEntity(); if(!worldObj.isRemote){ if(!this.isRedstonePowered){ - ArrayList items = (ArrayList)this.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.fromBounds(this.pos.getX()-RANGE, this.pos.getY()-RANGE, this.pos.getZ()-RANGE, this.pos.getX()+RANGE, this.pos.getY()+RANGE, this.pos.getZ()+RANGE)); + ArrayList items = (ArrayList)this.worldObj.getEntitiesWithinAABB(EntityItem.class, new AxisAlignedBB(this.pos.getX()-RANGE, this.pos.getY()-RANGE, this.pos.getZ()-RANGE, this.pos.getX()+RANGE, this.pos.getY()+RANGE, this.pos.getZ()+RANGE)); if(!items.isEmpty()){ for(EntityItem item : items){ if(!item.isDead && item.getEntityItem() != null){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateCheckerClientNotificationEvent.java b/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateCheckerClientNotificationEvent.java index 372f29bd5..f55689435 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateCheckerClientNotificationEvent.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/update/UpdateCheckerClientNotificationEvent.java @@ -14,7 +14,7 @@ import de.ellpeck.actuallyadditions.mod.util.ModUtil; import de.ellpeck.actuallyadditions.mod.util.StringUtil; import net.minecraft.client.Minecraft; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.util.IChatComponent; +import net.minecraft.util.text.ITextComponent; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; import net.minecraftforge.fml.common.gameevent.TickEvent; @@ -31,13 +31,13 @@ public class UpdateCheckerClientNotificationEvent{ if(ticksElapsedBeforeInfo >= 800){ EntityPlayer player = Minecraft.getMinecraft().thePlayer; if(UpdateChecker.checkFailed){ - player.addChatComponentMessage(IChatComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.failed"))); + player.addChatComponentMessage(ITextComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.failed"))); notified = true; } else if(UpdateChecker.needsUpdateNotify){ - player.addChatComponentMessage(IChatComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.generic"))); - player.addChatComponentMessage(IChatComponent.Serializer.jsonToComponent(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".update.versionCompare", ModUtil.VERSION, UpdateChecker.updateVersionString))); - player.addChatComponentMessage(IChatComponent.Serializer.jsonToComponent(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".update.buttons", UpdateChecker.CHANGELOG_LINK, UpdateChecker.DOWNLOAD_LINK))); + player.addChatComponentMessage(ITextComponent.Serializer.jsonToComponent(StringUtil.localize("info."+ModUtil.MOD_ID_LOWER+".update.generic"))); + player.addChatComponentMessage(ITextComponent.Serializer.jsonToComponent(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".update.versionCompare", ModUtil.VERSION, UpdateChecker.updateVersionString))); + player.addChatComponentMessage(ITextComponent.Serializer.jsonToComponent(StringUtil.localizeFormatted("info."+ModUtil.MOD_ID_LOWER+".update.buttons", UpdateChecker.CHANGELOG_LINK, UpdateChecker.DOWNLOAD_LINK))); notified = true; } ticksElapsedBeforeInfo = 0; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java index f7171625d..a9633bb38 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/AssetUtil.java @@ -17,7 +17,7 @@ import net.minecraft.client.gui.FontRenderer; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.RenderHelper; import net.minecraft.client.renderer.Tessellator; -import net.minecraft.client.renderer.WorldRenderer; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.block.model.ItemCameraTransforms.TransformType; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; import net.minecraft.item.ItemStack; @@ -103,12 +103,12 @@ public class AssetUtil{ GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); GlStateManager.shadeModel(7425); Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); - worldrenderer.pos((double)left, (double)top, (double)zLevel).color(f1, f2, f3, f).endVertex(); - worldrenderer.pos((double)left, (double)bottom, (double)zLevel).color(f1, f2, f3, f).endVertex(); - worldrenderer.pos((double)right, (double)bottom, (double)zLevel).color(f5, f6, f7, f4).endVertex(); - worldrenderer.pos((double)right, (double)top, (double)zLevel).color(f5, f6, f7, f4).endVertex(); + VertexBuffer renderer = tessellator.getBuffer(); + renderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + renderer.pos((double)left, (double)top, (double)zLevel).color(f1, f2, f3, f).endVertex(); + renderer.pos((double)left, (double)bottom, (double)zLevel).color(f1, f2, f3, f).endVertex(); + renderer.pos((double)right, (double)bottom, (double)zLevel).color(f5, f6, f7, f4).endVertex(); + renderer.pos((double)right, (double)top, (double)zLevel).color(f5, f6, f7, f4).endVertex(); tessellator.draw(); GlStateManager.shadeModel(7424); GlStateManager.disableBlend(); @@ -132,15 +132,15 @@ public class AssetUtil{ GlStateManager.enableBlend(); GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0); Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldrenderer = tessellator.getWorldRenderer(); + VertexBuffer renderer = tessellator.getBuffer(); int i = 0; int j = fontrenderer.getStringWidth(tag)/2; GlStateManager.disableTexture2D(); - worldrenderer.begin(7, DefaultVertexFormats.POSITION_COLOR); - worldrenderer.pos((double)(-j-1), (double)(-1+i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - worldrenderer.pos((double)(-j-1), (double)(8+i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - worldrenderer.pos((double)(j+1), (double)(8+i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); - worldrenderer.pos((double)(j+1), (double)(-1+i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + renderer.begin(7, DefaultVertexFormats.POSITION_COLOR); + renderer.pos((double)(-j-1), (double)(-1+i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + renderer.pos((double)(-j-1), (double)(8+i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + renderer.pos((double)(j+1), (double)(8+i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); + renderer.pos((double)(j+1), (double)(-1+i), 0.0D).color(0.0F, 0.0F, 0.0F, 0.25F).endVertex(); tessellator.draw(); GlStateManager.enableTexture2D(); fontrenderer.drawString(tag, -fontrenderer.getStringWidth(tag)/2, i, 553648127); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/FluidStateMapper.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/FluidStateMapper.java index cc0bd4652..8c1d9e551 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/FluidStateMapper.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/FluidStateMapper.java @@ -12,8 +12,8 @@ package de.ellpeck.actuallyadditions.mod.util; import net.minecraft.block.state.IBlockState; import net.minecraft.client.renderer.ItemMeshDefinition; +import net.minecraft.client.renderer.block.model.ModelResourceLocation; import net.minecraft.client.renderer.block.statemap.StateMapperBase; -import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.ItemStack; import net.minecraft.util.ResourceLocation; import net.minecraftforge.fluids.Fluid; diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java index 305c9cb7c..123c38405 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/ItemUtil.java @@ -94,7 +94,7 @@ public class ItemUtil{ if(ench != null){ for(int i = 0; i < ench.tagCount(); i++){ short id = ench.getCompoundTagAt(i).getShort("id"); - if(id == e.effectId){ + if(id == Enchantment.getEnchantmentID(e)){ return true; } } @@ -107,7 +107,7 @@ public class ItemUtil{ if(ench != null){ for(int i = 0; i < ench.tagCount(); i++){ short id = ench.getCompoundTagAt(i).getShort("id"); - if(id == e.effectId){ + if(id == Enchantment.getEnchantmentID(e)){ ench.removeTag(i); } } diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/PosUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/PosUtil.java index 5ac8cf905..b84b4d060 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/PosUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/PosUtil.java @@ -15,15 +15,15 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; import net.minecraft.item.ItemBlock; -import net.minecraft.util.BlockPos; -import net.minecraft.util.Vec3; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; public class PosUtil{ public static Material getMaterial(BlockPos pos, IBlockAccess world){ - return getBlock(pos, world).getMaterial(); + return getBlock(pos, world).getMaterial(world.getBlockState(pos)); } public static Block getBlock(BlockPos pos, IBlockAccess world){ @@ -54,8 +54,8 @@ public class PosUtil{ return world.setBlockState(pos, block.getStateFromMeta(meta), flag); } - public static Vec3 toVec(BlockPos pos){ - return new Vec3(pos.getX(), pos.getY(), pos.getZ()); + public static Vec3d toVec(BlockPos pos){ + return new Vec3d(pos.getX(), pos.getY(), pos.getZ()); } public static BlockPos copyPos(BlockPos pos){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java index 1086099db..fd6196f4d 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/StringUtil.java @@ -11,7 +11,7 @@ package de.ellpeck.actuallyadditions.mod.util; import net.minecraft.client.gui.FontRenderer; -import net.minecraft.util.StatCollector; +import net.minecraft.util.text.translation.I18n; import net.minecraftforge.fluids.FluidTank; import java.util.List; @@ -29,14 +29,14 @@ public class StringUtil{ * Localizes a given String via StatCollector */ public static String localize(String text){ - return StatCollector.translateToLocal(text); + return I18n.translateToLocal(text); } /** * Localizes a given formatted String with the given Replacements */ public static String localizeFormatted(String text, Object... replace){ - return StatCollector.translateToLocalFormatted(text, replace); + return I18n.translateToLocalFormatted(text, replace); } public static boolean equalsToLowerCase(String one, String two){ diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/Util.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/Util.java index 14618ebcf..c38866eaf 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/Util.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/Util.java @@ -14,7 +14,7 @@ import net.minecraft.block.BlockDispenser; import net.minecraft.dispenser.BehaviorDefaultDispenseItem; import net.minecraft.item.EnumRarity; import net.minecraft.item.Item; -import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.text.TextFormatting; import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.util.EnumHelper; import net.minecraftforge.oredict.OreDictionary; @@ -27,14 +27,14 @@ public class Util{ public static final Random RANDOM = new Random(); public static final int WILDCARD = OreDictionary.WILDCARD_VALUE; - public static final EnumRarity CRYSTAL_RED_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+"crystalRed", EnumChatFormatting.DARK_RED, ModUtil.NAME+" Red Crystal"); - public static final EnumRarity CRYSTAL_BLUE_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+"crystalBlue", EnumChatFormatting.DARK_BLUE, ModUtil.NAME+" Blue Crystal"); - public static final EnumRarity CRYSTAL_LIGHT_BLUE_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+"crystalLightBlue", EnumChatFormatting.BLUE, ModUtil.NAME+" Light Blue Crystal"); - public static final EnumRarity CRYSTAL_BLACK_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+"crystalBlack", EnumChatFormatting.DARK_GRAY, ModUtil.NAME+" Black Crystal"); - public static final EnumRarity CRYSTAL_GREEN_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+"crystalGreen", EnumChatFormatting.DARK_GREEN, ModUtil.NAME+" Green Crystal"); - public static final EnumRarity CRYSTAL_WHITE_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+"crystalWhite", EnumChatFormatting.GRAY, ModUtil.NAME+" White Crystal"); + public static final EnumRarity CRYSTAL_RED_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+"crystalRed", TextFormatting.DARK_RED, ModUtil.NAME+" Red Crystal"); + public static final EnumRarity CRYSTAL_BLUE_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+"crystalBlue", TextFormatting.DARK_BLUE, ModUtil.NAME+" Blue Crystal"); + public static final EnumRarity CRYSTAL_LIGHT_BLUE_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+"crystalLightBlue", TextFormatting.BLUE, ModUtil.NAME+" Light Blue Crystal"); + public static final EnumRarity CRYSTAL_BLACK_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+"crystalBlack", TextFormatting.DARK_GRAY, ModUtil.NAME+" Black Crystal"); + public static final EnumRarity CRYSTAL_GREEN_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+"crystalGreen", TextFormatting.DARK_GREEN, ModUtil.NAME+" Green Crystal"); + public static final EnumRarity CRYSTAL_WHITE_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+"crystalWhite", TextFormatting.GRAY, ModUtil.NAME+" White Crystal"); - public static final EnumRarity FALLBACK_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+".fallback", EnumChatFormatting.STRIKETHROUGH, ModUtil.NAME+" Fallback"); + public static final EnumRarity FALLBACK_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID_LOWER+".fallback", TextFormatting.STRIKETHROUGH, ModUtil.NAME+" Fallback"); public static void registerEvent(Object o){ MinecraftForge.EVENT_BUS.register(o); diff --git a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java index 72fe91876..aaeee1086 100644 --- a/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java +++ b/src/main/java/de/ellpeck/actuallyadditions/mod/util/WorldUtil.java @@ -22,14 +22,19 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayerMP; import net.minecraft.init.Blocks; +import net.minecraft.init.Enchantments; import net.minecraft.init.Items; import net.minecraft.inventory.IInventory; import net.minecraft.inventory.ISidedInventory; import net.minecraft.item.ItemStack; -import net.minecraft.network.play.client.C07PacketPlayerDigging; -import net.minecraft.network.play.server.S23PacketBlockChange; +import net.minecraft.network.play.client.CPacketPlayerDigging; +import net.minecraft.network.play.server.SPacketBlockChange; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; +import net.minecraft.util.math.BlockPos; +import net.minecraft.util.math.MathHelper; +import net.minecraft.util.math.RayTraceResult; +import net.minecraft.util.math.Vec3d; import net.minecraft.world.World; import net.minecraft.world.WorldServer; import net.minecraftforge.common.ForgeHooks; @@ -144,11 +149,12 @@ public class WorldUtil{ //Everything else else{ try{ - stack.onItemUse(FakePlayerUtil.getFakePlayer(world), world, offsetPos, side.getOpposite(), 0.5F, 0.5F, 0.5F); + EntityPlayer fake = FakePlayerUtil.getFakePlayer(world); + stack.onItemUse(fake, world, offsetPos, fake.getActiveHand(), side.getOpposite(), 0.5F, 0.5F, 0.5F); return stack; } catch(Exception e){ - ModUtil.LOGGER.error("Something that places Blocks at "+offsetPos.getX()+", "+offsetPos.getY()+", "+offsetPos.getZ()+" in World "+world.provider.getDimensionId()+" threw an Exception! Don't let that happen again!", e); + ModUtil.LOGGER.error("Something that places Blocks at "+offsetPos.getX()+", "+offsetPos.getY()+", "+offsetPos.getZ()+" in World "+world.provider.getDimension()+" threw an Exception! Don't let that happen again!", e); } } } @@ -315,29 +321,29 @@ public class WorldUtil{ return 0; } - public static MovingObjectPosition getNearestPositionWithAir(World world, EntityPlayer player, int reach){ + public static RayTraceResult getNearestPositionWithAir(World world, EntityPlayer player, int reach){ return getMovingObjectPosWithReachDistance(world, player, reach, false, false, true); } - private static MovingObjectPosition getMovingObjectPosWithReachDistance(World world, EntityPlayer player, double distance, boolean p1, boolean p2, boolean p3){ + private static RayTraceResult getMovingObjectPosWithReachDistance(World world, EntityPlayer player, double distance, boolean p1, boolean p2, boolean p3){ float f = player.rotationPitch; float f1 = player.rotationYaw; double d0 = player.posX; double d1 = player.posY+(double)player.getEyeHeight(); double d2 = player.posZ; - Vec3 vec3 = new Vec3(d0, d1, d2); + Vec3d vec3 = new Vec3d(d0, d1, d2); float f2 = MathHelper.cos(-f1*0.017453292F-(float)Math.PI); float f3 = MathHelper.sin(-f1*0.017453292F-(float)Math.PI); float f4 = -MathHelper.cos(-f*0.017453292F); float f5 = MathHelper.sin(-f*0.017453292F); float f6 = f3*f4; float f7 = f2*f4; - Vec3 vec31 = vec3.addVector((double)f6*distance, (double)f5*distance, (double)f7*distance); + Vec3d vec31 = vec3.addVector((double)f6*distance, (double)f5*distance, (double)f7*distance); return world.rayTraceBlocks(vec3, vec31, p1, p2, p3); } - public static MovingObjectPosition getNearestBlockWithDefaultReachDistance(World world, EntityPlayer player){ - return getMovingObjectPosWithReachDistance(world, player, player instanceof EntityPlayerMP ? ((EntityPlayerMP)player).theItemInWorldManager.getBlockReachDistance() : 5.0D, false, true, false); + public static RayTraceResult getNearestBlockWithDefaultReachDistance(World world, EntityPlayer player){ + return getMovingObjectPosWithReachDistance(world, player, player instanceof EntityPlayerMP ? ((EntityPlayerMP)player).interactionManager.getBlockReachDistance() : 5.0D, false, true, false); } /** @@ -350,15 +356,15 @@ public class WorldUtil{ public static boolean playerHarvestBlock(World world, BlockPos pos, EntityPlayer player){ Block block = PosUtil.getBlock(pos, world); IBlockState state = world.getBlockState(pos); - int meta = PosUtil.getMetadata(pos, world); TileEntity tile = world.getTileEntity(pos); + ItemStack stack = player.getActiveItemStack(); + //If the Block can be harvested or not boolean canHarvest = block.canHarvestBlock(world, pos, player); //Send Block Breaking Event if(player instanceof EntityPlayerMP){ - int event = ForgeHooks.onBlockBreakEvent(world, ((EntityPlayerMP)player).theItemInWorldManager.getGameType(), (EntityPlayerMP)player, pos); - if(event == -1){ + if(ForgeHooks.onBlockBreakEvent(world, ((EntityPlayerMP)player).interactionManager.getGameType(), (EntityPlayerMP)player, pos) == -1){ return false; } } @@ -373,7 +379,7 @@ public class WorldUtil{ } //If the Block was actually "removed", meaning it will drop an Item - boolean removed = block.removedByPlayer(world, pos, player, canHarvest); + boolean removed = block.removedByPlayer(state, world, pos, player, canHarvest); //Actually removes the Block from the World if(removed){ //Before the Block is destroyed, special cases @@ -382,12 +388,12 @@ public class WorldUtil{ if(!world.isRemote && !player.capabilities.isCreativeMode){ //Actually drops the Block's Items etc. if(canHarvest){ - block.harvestBlock(world, player, pos, state, tile); + block.harvestBlock(world, player, pos, state, tile, stack); } //Only drop XP when no Silk Touch is applied - if(!EnchantmentHelper.getSilkTouchModifier(player)){ + if(EnchantmentHelper.getEnchantmentLevel(Enchantments.silkTouch, stack) <= 0){ //Drop XP depending on Fortune Level - block.dropXpOnBlockBreak(world, pos, block.getExpDrop(world, pos, EnchantmentHelper.getFortuneModifier(player))); + block.dropXpOnBlockBreak(world, pos, block.getExpDrop(state, world, pos, EnchantmentHelper.getEnchantmentLevel(Enchantments.fortune, stack))); } } } @@ -395,12 +401,12 @@ public class WorldUtil{ if(!world.isRemote){ //Update the Client of a Block Change if(player instanceof EntityPlayerMP){ - ((EntityPlayerMP)player).playerNetServerHandler.sendPacket(new S23PacketBlockChange(world, pos)); + ((EntityPlayerMP)player).playerNetServerHandler.sendPacket(new SPacketBlockChange(world, pos)); } } else{ //Check the Server if a Block that changed on the Client really changed, if not, revert the change - Minecraft.getMinecraft().getNetHandler().addToSendQueue(new C07PacketPlayerDigging(C07PacketPlayerDigging.Action.STOP_DESTROY_BLOCK, pos, Minecraft.getMinecraft().objectMouseOver.sideHit)); + Minecraft.getMinecraft().getNetHandler().addToSendQueue(new CPacketPlayerDigging(CPacketPlayerDigging.Action.STOP_DESTROY_BLOCK, pos, Minecraft.getMinecraft().objectMouseOver.sideHit)); } return removed; }