diff --git a/src/main/java/com/zixiken/dimdoors/CommonProxy.java b/src/main/java/com/zixiken/dimdoors/CommonProxy.java index 8479b876..1e438db9 100644 --- a/src/main/java/com/zixiken/dimdoors/CommonProxy.java +++ b/src/main/java/com/zixiken/dimdoors/CommonProxy.java @@ -12,7 +12,7 @@ import com.zixiken.dimdoors.tileentities.TileEntityTransTrapdoor; import net.minecraft.block.BlockDoor; import net.minecraft.block.state.IBlockState; 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.MinecraftForge; import net.minecraftforge.fml.common.event.FMLInitializationEvent; diff --git a/src/main/java/com/zixiken/dimdoors/CraftingManager.java b/src/main/java/com/zixiken/dimdoors/CraftingManager.java index 2f675f93..ef8df533 100644 --- a/src/main/java/com/zixiken/dimdoors/CraftingManager.java +++ b/src/main/java/com/zixiken/dimdoors/CraftingManager.java @@ -11,25 +11,25 @@ import net.minecraftforge.oredict.ShapedOreRecipe; public class CraftingManager { public static void registerRecipes() { GameRegistry.addRecipe(new ItemStack(ModItems.itemStableFabric, 1), - "yxy", 'x', Items.ender_pearl, 'y', ModItems.itemWorldThread); + "yxy", 'x', Items.ENDER_PEARL, 'y', ModItems.itemWorldThread); GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoor, 1), - "yxy", 'x', ModItems.itemStableFabric, 'y', Items.iron_door); + "yxy", 'x', ModItems.itemStableFabric, 'y', Items.IRON_DOOR); GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoorChaos, 1), - "yxy", 'x', Items.ender_eye, 'y', ModItems.itemDimDoor); + "yxy", 'x', Items.ENDER_EYE, 'y', ModItems.itemDimDoor); GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoorWarp, 1), - "yxy", 'x', Items.ender_pearl, 'y', Items.oak_door); + "yxy", 'x', Items.ENDER_PEARL, 'y', Items.OAK_DOOR); GameRegistry.addRecipe(new ItemStack(ModBlocks.blockDimHatch, 1), - "y", "x", "y", 'x', Items.ender_pearl, 'y', Blocks.trapdoor); + "y", "x", "y", 'x', Items.ENDER_PEARL, 'y', Blocks.TRAPDOOR); GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoorGold, 1), "yxy", 'x', ModItems.itemStableFabric, 'y', ModItems.itemDoorGold); GameRegistry.addRecipe(new ItemStack(ModItems.itemDoorGold, 1), - "yy", "yy", "yy", 'y', Items.gold_ingot); + "yy", "yy", "yy", 'y', Items.GOLD_INGOT); GameRegistry.addRecipe(new ItemStack(ModItems.itemDimDoorPersonal,1), "yxy", 'y', ModItems.itemDoorQuartz, 'x', ModItems.itemStableFabric); diff --git a/src/main/java/com/zixiken/dimdoors/EventHookContainer.java b/src/main/java/com/zixiken/dimdoors/EventHookContainer.java index c5d655cb..d4ea363d 100644 --- a/src/main/java/com/zixiken/dimdoors/EventHookContainer.java +++ b/src/main/java/com/zixiken/dimdoors/EventHookContainer.java @@ -4,18 +4,16 @@ import com.zixiken.dimdoors.items.ItemDoorBase; import net.minecraft.item.ItemStack; import net.minecraft.world.World; import net.minecraftforge.event.entity.player.PlayerInteractEvent; -import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action; import net.minecraftforge.fml.common.eventhandler.SubscribeEvent; public class EventHookContainer { @SubscribeEvent public void onPlayerEvent(PlayerInteractEvent event) { // Handle all door placement here - if (event.action == Action.LEFT_CLICK_BLOCK) return; - World world = event.entity.worldObj; - ItemStack stack = event.entityPlayer.inventory.getCurrentItem(); - if (stack != null && ItemDoorBase.tryToPlaceDoor(stack, event.entityPlayer, world, event.pos, event.face)) + World world = event.getEntity().worldObj; + ItemStack stack = event.getEntityPlayer().inventory.getCurrentItem(); + if (stack != null && ItemDoorBase.tryToPlaceDoor(stack, event.getEntityPlayer(), world, event.getPos(), event.getFace())) // Cancel the event so that we don't get two doors from vanilla doors event.setCanceled(true); } diff --git a/src/main/java/com/zixiken/dimdoors/ModelManager.java b/src/main/java/com/zixiken/dimdoors/ModelManager.java index 94275192..b7b939f8 100644 --- a/src/main/java/com/zixiken/dimdoors/ModelManager.java +++ b/src/main/java/com/zixiken/dimdoors/ModelManager.java @@ -4,15 +4,16 @@ import com.zixiken.dimdoors.blocks.ModBlocks; import com.zixiken.dimdoors.items.ModItems; import net.minecraft.block.BlockDoor; 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.renderer.block.statemap.StateMap; -import net.minecraft.client.resources.model.ModelBakery; -import net.minecraft.client.resources.model.ModelResourceLocation; import net.minecraft.item.Item; import net.minecraft.util.ResourceLocation; import net.minecraftforge.client.model.ModelLoader; import static net.minecraft.item.Item.getItemFromBlock; +@SuppressWarnings({"MethodCallSideOnly", "NewExpressionSideOnly"}) public class ModelManager { private static final String ID = DimDoors.MODID; @@ -55,6 +56,7 @@ public class ModelManager { new ModelResourceLocation(ID + ':' + item.getUnlocalizedName().substring(5) + name, "inventory")); } + @SuppressWarnings("LocalVariableDeclarationSideOnly") public static void addCustomStateMappers() { StateMap map = new StateMap.Builder().ignore(BlockDoor.POWERED).build(); diff --git a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoor.java b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoor.java index 32f66c9b..dec5c712 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoor.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoor.java @@ -3,14 +3,14 @@ package com.zixiken.dimdoors.blocks; import com.zixiken.dimdoors.items.ModItems; import net.minecraft.block.material.Material; import net.minecraft.item.Item; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockDimDoor extends BlockDimDoorBase { public static final String ID = "blockDimDoor"; public BlockDimDoor() { - super(Material.iron); + super(Material.IRON); setHardness(1.0F); setResistance(2000.0F); setUnlocalizedName(ID); diff --git a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorBase.java b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorBase.java index 1b54344a..e4e6d5d7 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorBase.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorBase.java @@ -16,14 +16,16 @@ import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.IBlockAccess; +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; +import javax.annotation.Nullable; + public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, ITileEntityProvider { public BlockDimDoorBase(Material material) {super(material);} @@ -34,8 +36,7 @@ public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, IT } @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, @Nullable ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) { if(!checkCanOpen(world, pos, player)) {return false;} if(state.getValue(BlockDoor.HALF) == EnumDoorHalf.UPPER) { @@ -78,93 +79,12 @@ public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, IT updateAttachedTile(par1World, pos); } - @Override - public void setBlockBoundsBasedOnState(IBlockAccess worldIn, BlockPos pos) { - IBlockState downState = worldIn.getBlockState(pos.down()); - if(downState.getBlock() == this) setDoorRotation(downState); - else setDoorRotation(worldIn.getBlockState(pos)); - } - - private void setDoorRotation(IBlockState state) { - float var2 = 0.1875F; - setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 2.0F, 1.0F); - int var3 = state.getValue(BlockDoor.FACING).rotateY().getHorizontalIndex(); - boolean var4 = state.getValue(BlockDoor.OPEN); - boolean var5 = state.getValue(BlockDoor.HINGE) == EnumHingePosition.LEFT; - - if (var3 == 0) { - if (var4) { - if (!var5) { - setBlockBounds(0.001F, 0.0F, 0.0F, 1.0F, 1.0F, var2); - } else { - setBlockBounds(0.001F, 0.0F, 1.0F - var2, 1.0F, 1.0F, 1.0F); - } - } else { - setBlockBounds(0.0F, 0.0F, 0.0F, var2, 1.0F, 1.0F); - } - } else if (var3 == 1) { - if (var4) { - if (!var5) { - setBlockBounds(1.0F - var2, 0.0F, 0.001F, 1.0F, 1.0F, 1.0F); - } else { - setBlockBounds(0.0F, 0.0F, 0.001F, var2, 1.0F, 1.0F); - } - } else { - setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, var2); - } - } else if (var3 == 2) { - if (var4) { - if (!var5) { - setBlockBounds(0.0F, 0.0F, 1.0F - var2, .99F, 1.0F, 1.0F); - } else { - setBlockBounds(0.0F, 0.0F, 0.0F, .99F, 1.0F, var2); - } - } else { - setBlockBounds(1.0F - var2, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F); - } - } else if (var3 == 3) { - if (var4) { - if (!var5) { - setBlockBounds(0.0F, 0.0F, 0.0F, var2, 1.0F, 0.99F); - } else { - setBlockBounds(1.0F - var2, 0.0F, 0.0F, 1.0F, 1.0F, 0.99F); - } - } else { - setBlockBounds(0.0F, 0.0F, 1.0F - var2, 1.0F, 1.0F, 1.0F); - } - } - } - - /** - * Lets the block know when one of its neighbor changes. Doesn't know which neighbor changed (coordinates passed are - * their own) Args: x, y, z, neighbor blockID - */ - @Override - public void onNeighborBlockChange(World world, BlockPos pos, IBlockState state, Block neighbor) { - if (isUpperDoorBlock(state)) { - BlockPos downPos = pos.down(); - IBlockState downState = world.getBlockState(downPos); - if (downState.getBlock() != this) world.setBlockToAir(pos); - else if (neighbor != this) onNeighborBlockChange(world, downPos, downState, neighbor); - } else { - BlockPos upPos = pos.up(); - if (world.getBlockState(upPos).getBlock() != this) { - world.setBlockToAir(pos); - if (!world.isRemote) dropBlockAsItem(world, pos, state, 0); - } else { - boolean powered = world.isBlockPowered(pos) || world.isBlockPowered(upPos); - if ((powered || !neighbor.isAir(world, pos) && neighbor.canProvidePower()) && neighbor != this) - toggleDoor(world, pos, powered); - } - } - } - /** * only called by clickMiddleMouseButton , and passed to inventory.setCurrentItem (along with isCreative) */ @Override @SideOnly(Side.CLIENT) - public ItemStack getPickBlock(MovingObjectPosition target, World world, BlockPos pos, EntityPlayer player) { + public ItemStack getPickBlock(IBlockState state, RayTraceResult target, World world, BlockPos pos, EntityPlayer player) { return new ItemStack(this.getItemDoor(), 1, 0); } @@ -178,7 +98,7 @@ public abstract class BlockDimDoorBase extends BlockDoor implements IDimDoor, IT @Override @SideOnly(Side.CLIENT) - public Item getItem(World world, BlockPos pos) {return this.getItemDoor();} + public ItemStack getItem(World world, BlockPos pos, IBlockState state) { return new ItemStack(this.getItemDoor(), 1, 0) } @Override public TileEntity createNewTileEntity(World world, int metadata) {return new TileEntityDimDoor();} diff --git a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorGold.java b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorGold.java index ee885948..6d173a7b 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorGold.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorGold.java @@ -6,14 +6,14 @@ import com.zixiken.dimdoors.tileentities.TileEntityDimDoorGold; import net.minecraft.block.material.Material; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockDimDoorGold extends BlockDimDoorBase { public static final String ID = "blockDimDoorGold"; public BlockDimDoorGold() { - super(Material.iron); + super(Material.IRON); setHardness(1.0F); setUnlocalizedName(ID); } @@ -21,7 +21,7 @@ public class BlockDimDoorGold extends BlockDimDoorBase { @Override public void placeLink(World world, BlockPos pos) { } - + @Override public Item getItemDoor() {return ModItems.itemDimDoorGold;} diff --git a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorPersonal.java b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorPersonal.java index b65ee3ad..fb06d71b 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorPersonal.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorPersonal.java @@ -3,14 +3,14 @@ package com.zixiken.dimdoors.blocks; import com.zixiken.dimdoors.items.ModItems; import net.minecraft.block.material.Material; import net.minecraft.item.Item; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockDimDoorPersonal extends BlockDimDoorBase { public static final String ID = "blockDimDoorPersonal"; public BlockDimDoorPersonal() { - super(Material.rock); + super(Material.ROCK); setHardness(0.1F); setUnlocalizedName(ID); } diff --git a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorTransient.java b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorTransient.java index 94e84731..d190c6d7 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorTransient.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorTransient.java @@ -6,14 +6,15 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; -import net.minecraft.util.BlockPos; +import net.minecraft.util.EnumBlockRenderType; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockDimDoorTransient extends BlockDimDoorBase { public static final String ID = "blockDimDoorTransient"; public BlockDimDoorTransient() { - super(Material.iron); + super(Material.IRON); setHardness(1.0F); setUnlocalizedName(ID); } @@ -44,10 +45,4 @@ public class BlockDimDoorTransient extends BlockDimDoorBase { @Override public boolean isCollidable() {return false;} - - @Override - public int getRenderType() {return 2;} - - @Override - public boolean isOpaqueCube() {return false;} } \ No newline at end of file diff --git a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorUnstable.java b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorUnstable.java index 51edc4db..b48713c2 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorUnstable.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorUnstable.java @@ -5,7 +5,7 @@ import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.init.Items; import net.minecraft.item.Item; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import java.util.Random; @@ -14,7 +14,7 @@ public class BlockDimDoorUnstable extends BlockDimDoorBase { public static final String ID = "blockDimDoorChaos"; public BlockDimDoorUnstable() { - super(Material.iron); + super(Material.IRON); setHardness(.2F); setUnlocalizedName(ID); setLightLevel(.0F); @@ -28,5 +28,5 @@ public class BlockDimDoorUnstable extends BlockDimDoorBase { public Item getItemDoor() {return ModItems.itemDimDoorChaos;} @Override - public Item getItemDropped(IBlockState state, Random random, int fortune) {return Items.iron_door;} + public Item getItemDropped(IBlockState state, Random random, int fortune) {return Items.IRON_DOOR;} } \ No newline at end of file diff --git a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorWarp.java b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorWarp.java index 97ac65ef..10f3eb6b 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorWarp.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimDoorWarp.java @@ -3,14 +3,14 @@ package com.zixiken.dimdoors.blocks; import com.zixiken.dimdoors.items.ModItems; import net.minecraft.block.material.Material; import net.minecraft.item.Item; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public class BlockDimDoorWarp extends BlockDimDoorBase { public static final String ID = "blockDimDoorWarp"; public BlockDimDoorWarp() { - super(Material.wood); + super(Material.WOOD); setHardness(1.0F); setUnlocalizedName(ID); } diff --git a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimWall.java b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimWall.java index 68e57582..cab209b2 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/BlockDimWall.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/BlockDimWall.java @@ -8,16 +8,15 @@ import net.minecraft.block.Block; import net.minecraft.block.BlockContainer; 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.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.Explosion; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; @@ -31,7 +30,7 @@ public class BlockDimWall extends Block { private static final float SUPER_EXPLOSION_RESISTANCE = 18000000F; public BlockDimWall() { - super(Material.iron); + super(Material.IRON); this.setCreativeTab(DimDoors.dimDoorsCreativeTab); setLightLevel(1.0F); setHardness(0.1F); @@ -49,11 +48,11 @@ public class BlockDimWall extends Block { public int getMetaFromState(IBlockState state) {return state.getValue(TYPE);} @Override - protected BlockState createBlockState() {return new BlockState(this, TYPE);} + protected BlockStateContainer createBlockState() {return new BlockStateContainer(this, TYPE);} @Override - public float getBlockHardness(World world, BlockPos pos) { - if (world.getBlockState(pos).getValue(TYPE) != 1) return this.blockHardness; + public float getBlockHardness(IBlockState state, World world, BlockPos pos) { + if (state.getValue(TYPE) != 1) return this.blockHardness; else return SUPER_HIGH_HARDNESS; } diff --git a/src/main/java/com/zixiken/dimdoors/blocks/BlockDoorGold.java b/src/main/java/com/zixiken/dimdoors/blocks/BlockDoorGold.java index dc19f9ba..df0a28d2 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/BlockDoorGold.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/BlockDoorGold.java @@ -7,7 +7,8 @@ import net.minecraft.block.BlockDoor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; -import net.minecraft.util.BlockPos; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -16,7 +17,7 @@ public class BlockDoorGold extends BlockDoor { public static final String ID = "blockDoorGold"; public BlockDoorGold() { - super(Material.iron); + super(Material.IRON); setHardness(0.1F); setUnlocalizedName(ID); } @@ -28,5 +29,7 @@ public class BlockDoorGold extends BlockDoor { @Override @SideOnly(Side.CLIENT) - public Item getItem(World worldIn, BlockPos pos) {return ModItems.itemDoorGold;} + public ItemStack getItem(World worldIn, BlockPos pos, IBlockState state) { + return new ItemStack(ModItems.itemDoorGold); + } } diff --git a/src/main/java/com/zixiken/dimdoors/blocks/BlockDoorQuartz.java b/src/main/java/com/zixiken/dimdoors/blocks/BlockDoorQuartz.java index 557a9684..5463687d 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/BlockDoorQuartz.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/BlockDoorQuartz.java @@ -7,7 +7,8 @@ import net.minecraft.block.BlockDoor; import net.minecraft.block.material.Material; import net.minecraft.block.state.IBlockState; import net.minecraft.item.Item; -import net.minecraft.util.BlockPos; +import net.minecraft.item.ItemStack; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -16,7 +17,7 @@ public class BlockDoorQuartz extends BlockDoor { public static final String ID = "blockDoorQuartz"; public BlockDoorQuartz() { - super(Material.rock); + super(Material.ROCK); setHardness(0.1F); setUnlocalizedName(ID); } @@ -28,5 +29,7 @@ public class BlockDoorQuartz extends BlockDoor { @Override @SideOnly(Side.CLIENT) - public Item getItem(World worldIn, BlockPos pos) {return ModItems.itemDoorQuartz;} + public ItemStack getItem(World world, BlockPos pos, IBlockState state) { + return new ItemStack(ModItems.itemDoorQuartz); + } } diff --git a/src/main/java/com/zixiken/dimdoors/blocks/BlockTransTrapdoor.java b/src/main/java/com/zixiken/dimdoors/blocks/BlockTransTrapdoor.java index 3e307ba2..b85ec0b8 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/BlockTransTrapdoor.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/BlockTransTrapdoor.java @@ -14,9 +14,8 @@ import net.minecraft.init.Blocks; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; import net.minecraft.util.EnumFacing; -import net.minecraft.util.MovingObjectPosition; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import com.zixiken.dimdoors.tileentities.TileEntityTransTrapdoor; import net.minecraftforge.fml.relauncher.Side; diff --git a/src/main/java/com/zixiken/dimdoors/blocks/IDimDoor.java b/src/main/java/com/zixiken/dimdoors/blocks/IDimDoor.java index 269eae4c..c0c528f2 100644 --- a/src/main/java/com/zixiken/dimdoors/blocks/IDimDoor.java +++ b/src/main/java/com/zixiken/dimdoors/blocks/IDimDoor.java @@ -3,7 +3,7 @@ package com.zixiken.dimdoors.blocks; import net.minecraft.entity.Entity; import net.minecraft.item.Item; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public interface IDimDoor diff --git a/src/main/java/com/zixiken/dimdoors/client/ClosingRiftFX.java b/src/main/java/com/zixiken/dimdoors/client/ClosingRiftFX.java index a39642d1..d01a190c 100644 --- a/src/main/java/com/zixiken/dimdoors/client/ClosingRiftFX.java +++ b/src/main/java/com/zixiken/dimdoors/client/ClosingRiftFX.java @@ -4,7 +4,6 @@ import net.minecraft.client.particle.EffectRenderer; import net.minecraft.client.particle.EntityFX; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.entity.Entity; -import net.minecraft.util.AxisAlignedBB; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; diff --git a/src/main/java/com/zixiken/dimdoors/client/RenderDimDoor.java b/src/main/java/com/zixiken/dimdoors/client/RenderDimDoor.java index fc343f8e..d059a625 100644 --- a/src/main/java/com/zixiken/dimdoors/client/RenderDimDoor.java +++ b/src/main/java/com/zixiken/dimdoors/client/RenderDimDoor.java @@ -9,9 +9,10 @@ import com.zixiken.dimdoors.DimDoors; import com.zixiken.dimdoors.blocks.BlockDimDoorBase; import com.zixiken.dimdoors.tileentities.TileEntityDimDoor; import net.minecraft.client.renderer.*; -import net.minecraft.client.renderer.vertex.DefaultVertexFormats; -import net.minecraft.util.BlockPos; +import net.minecraft.client.renderer.VertexBuffer; +import net.minecraft.client.renderer.vertex.*; import net.minecraft.util.EnumFacing; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; @@ -116,7 +117,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer GlStateManager.translate(0.5F, 0.5F, 0.5F); Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldRenderer = tessellator.getWorldRenderer(); + VertexBuffer worldRenderer = tessellator.getBuffer(); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION); float[] color = tile.getRenderColor(rand); @@ -243,7 +244,7 @@ public class RenderDimDoor extends TileEntitySpecialRenderer GlStateManager.translate(-65.0F, -107.0F, -3.0F); Tessellator tessellator = Tessellator.getInstance(); - WorldRenderer worldRenderer = tessellator.getWorldRenderer(); + VertexBuffer worldRenderer = tessellator.getBuffer(); worldRenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL); byte b0 = 7; diff --git a/src/main/java/com/zixiken/dimdoors/client/RenderTransTrapdoor.java b/src/main/java/com/zixiken/dimdoors/client/RenderTransTrapdoor.java index 681f5d8d..6d3cefad 100644 --- a/src/main/java/com/zixiken/dimdoors/client/RenderTransTrapdoor.java +++ b/src/main/java/com/zixiken/dimdoors/client/RenderTransTrapdoor.java @@ -12,6 +12,7 @@ import net.minecraft.client.Minecraft; import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.GlStateManager; import net.minecraft.client.renderer.Tessellator; +import net.minecraft.client.renderer.VertexBuffer; import net.minecraft.client.renderer.WorldRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.vertex.DefaultVertexFormats; @@ -99,7 +100,7 @@ public class RenderTransTrapdoor extends TileEntitySpecialRenderer tooltip, boolean advanced) { - tooltip.add(StatCollector.translateToLocal("info.chaosDoor")); + //tooltip.add(StatCollector.translateToLocal("info.chaosDoor")); } @Override diff --git a/src/main/java/com/zixiken/dimdoors/items/ItemDimDoorWarp.java b/src/main/java/com/zixiken/dimdoors/items/ItemDimDoorWarp.java index aa6c6fcb..9f940cb0 100644 --- a/src/main/java/com/zixiken/dimdoors/items/ItemDimDoorWarp.java +++ b/src/main/java/com/zixiken/dimdoors/items/ItemDimDoorWarp.java @@ -14,7 +14,7 @@ public class ItemDimDoorWarp extends ItemDoorBase { public static final String ID = "itemDimDoorWarp"; public ItemDimDoorWarp() { - super(ModBlocks.blockDimDoorWarp, (ItemDoor)Items.oak_door); + super(ModBlocks.blockDimDoorWarp, (ItemDoor)Items.OAK_DOOR ); setUnlocalizedName(ID); } diff --git a/src/main/java/com/zixiken/dimdoors/items/ItemDoorGold.java b/src/main/java/com/zixiken/dimdoors/items/ItemDoorGold.java index 28d4ffc0..777ea456 100644 --- a/src/main/java/com/zixiken/dimdoors/items/ItemDoorGold.java +++ b/src/main/java/com/zixiken/dimdoors/items/ItemDoorGold.java @@ -1,13 +1,7 @@ package com.zixiken.dimdoors.items; import com.zixiken.dimdoors.blocks.ModBlocks; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemDoor; -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; public class ItemDoorGold extends ItemDoor { public static final String ID = "itemDoorGold"; @@ -17,22 +11,4 @@ public class ItemDoorGold extends ItemDoor { setMaxStackSize(16); setUnlocalizedName(ID); } - - @Override - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, - EnumFacing side, float hitX, float hitY, float hitZ) { - if (side == EnumFacing.UP) { - Block doorBlock = ModBlocks.blockDoorGold; - if(!worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos)) pos = pos.up(); - - if (playerIn.canPlayerEdit(pos, side, stack) && - playerIn.canPlayerEdit(pos.up(), side, stack) && - doorBlock.canPlaceBlockAt(worldIn, pos)) { - placeDoor(worldIn, pos, EnumFacing.fromAngle(playerIn.rotationYaw), doorBlock); - --stack.stackSize; - return true; - } - } - return false; - } } diff --git a/src/main/java/com/zixiken/dimdoors/items/ItemDoorQuartz.java b/src/main/java/com/zixiken/dimdoors/items/ItemDoorQuartz.java index aace3afd..89ddb2a3 100644 --- a/src/main/java/com/zixiken/dimdoors/items/ItemDoorQuartz.java +++ b/src/main/java/com/zixiken/dimdoors/items/ItemDoorQuartz.java @@ -1,13 +1,7 @@ package com.zixiken.dimdoors.items; import com.zixiken.dimdoors.blocks.ModBlocks; -import net.minecraft.block.Block; -import net.minecraft.entity.player.EntityPlayer; import net.minecraft.item.ItemDoor; -import net.minecraft.item.ItemStack; -import net.minecraft.util.BlockPos; -import net.minecraft.util.EnumFacing; -import net.minecraft.world.World; public class ItemDoorQuartz extends ItemDoor { public static final String ID = "itemDoorQuartz"; @@ -16,22 +10,4 @@ public class ItemDoorQuartz extends ItemDoor { super(ModBlocks.blockDoorQuartz); setUnlocalizedName(ID); } - - @Override - public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos, - EnumFacing side, float hitX, float hitY, float hitZ) { - if (side == EnumFacing.UP) { - Block doorBlock = ModBlocks.blockDoorQuartz; - if(!worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos)) pos = pos.up(); - - if (playerIn.canPlayerEdit(pos, side, stack) && - playerIn.canPlayerEdit(pos.up(), side, stack) && - doorBlock.canPlaceBlockAt(worldIn, pos)) { - placeDoor(worldIn, pos, EnumFacing.fromAngle(playerIn.rotationYaw), doorBlock); - --stack.stackSize; - return true; - } - } - return false; - } } diff --git a/src/main/java/com/zixiken/dimdoors/tileentities/DDTileEntityBase.java b/src/main/java/com/zixiken/dimdoors/tileentities/DDTileEntityBase.java index 9fed540a..3bb5e1af 100644 --- a/src/main/java/com/zixiken/dimdoors/tileentities/DDTileEntityBase.java +++ b/src/main/java/com/zixiken/dimdoors/tileentities/DDTileEntityBase.java @@ -4,7 +4,7 @@ import java.util.Random; import net.minecraft.block.state.IBlockState; import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.BlockPos; +import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; public abstract class DDTileEntityBase extends TileEntity diff --git a/src/main/java/com/zixiken/dimdoors/tileentities/TileEntityDimDoor.java b/src/main/java/com/zixiken/dimdoors/tileentities/TileEntityDimDoor.java index b1037e4c..38da9f69 100644 --- a/src/main/java/com/zixiken/dimdoors/tileentities/TileEntityDimDoor.java +++ b/src/main/java/com/zixiken/dimdoors/tileentities/TileEntityDimDoor.java @@ -29,7 +29,7 @@ public class TileEntityDimDoor extends DDTileEntityBase } @Override - public void writeToNBT(NBTTagCompound nbt) { + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setBoolean("openOrClosed", this.openOrClosed); @@ -37,12 +37,13 @@ public class TileEntityDimDoor extends DDTileEntityBase nbt.setInteger("orientation", this.orientation.getIndex()); nbt.setBoolean("isDungeonChainLink", isDungeonChainLink); nbt.setBoolean("hasGennedPair", hasGennedPair); + return nbt; } @Override public float[] getRenderColor(Random rand) { float[] rgbaColor = {1,1,1,1}; - if (this.worldObj.provider.getDimensionId() == -1) { + if (this.worldObj.provider.getDimension() == -1) { rgbaColor[0] = rand.nextFloat() * 0.5F + 0.4F; rgbaColor[1] = rand.nextFloat() * 0.05F; rgbaColor[2] = rand.nextFloat() * 0.05F; diff --git a/src/main/java/com/zixiken/dimdoors/tileentities/TileEntityRift.java b/src/main/java/com/zixiken/dimdoors/tileentities/TileEntityRift.java index ca2b729d..12006263 100644 --- a/src/main/java/com/zixiken/dimdoors/tileentities/TileEntityRift.java +++ b/src/main/java/com/zixiken/dimdoors/tileentities/TileEntityRift.java @@ -8,9 +8,9 @@ import net.minecraft.entity.Entity; import net.minecraft.entity.monster.EntityEnderman; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.util.AxisAlignedBB; -import net.minecraft.util.BlockPos; import net.minecraft.util.ITickable; +import net.minecraft.util.math.AxisAlignedBB; +import net.minecraft.util.math.BlockPos; public class TileEntityRift extends DDTileEntityBase implements ITickable { private static final int ENDERMAN_SPAWNING_CHANCE = 1; @@ -73,7 +73,7 @@ public class TileEntityRift extends DDTileEntityBase implements ITickable { // Endermen will only spawn from groups of rifts if (updateNearestRift()) { List list = worldObj.getEntitiesWithinAABB(EntityEnderman.class, - AxisAlignedBB.fromBounds(pos.getX() - 9, pos.getY() - 3, pos.getZ() - 9, pos.getX() + 9, pos.getY() + 3, pos.getZ() + 9)); + new AxisAlignedBB(pos.getX() - 9, pos.getY() - 3, pos.getZ() - 9, pos.getX() + 9, pos.getY() + 3, pos.getZ() + 9)); if (list.isEmpty()) { EntityEnderman enderman = new EntityEnderman(worldObj); @@ -114,11 +114,10 @@ public class TileEntityRift extends DDTileEntityBase implements ITickable { this.spawnedEndermenID = nbt.getInteger("spawnedEndermenID"); this.riftRotation = nbt.getInteger("riftRotation"); this.growth = nbt.getFloat("growth"); - } @Override - public void writeToNBT(NBTTagCompound nbt) + public NBTTagCompound writeToNBT(NBTTagCompound nbt) { super.writeToNBT(nbt); nbt.setInteger("updateTimer", this.updateTimer); @@ -130,6 +129,7 @@ public class TileEntityRift extends DDTileEntityBase implements ITickable { nbt.setInteger("riftRotation", this.riftRotation); nbt.setFloat("growth", this.growth); + return nbt; } @Override diff --git a/src/main/java/com/zixiken/dimdoors/tileentities/TileEntityTransTrapdoor.java b/src/main/java/com/zixiken/dimdoors/tileentities/TileEntityTransTrapdoor.java index cfbfac00..c5dc9929 100644 --- a/src/main/java/com/zixiken/dimdoors/tileentities/TileEntityTransTrapdoor.java +++ b/src/main/java/com/zixiken/dimdoors/tileentities/TileEntityTransTrapdoor.java @@ -7,7 +7,7 @@ public class TileEntityTransTrapdoor extends DDTileEntityBase { @Override public float[] getRenderColor(Random rand) { float[] rgbaColor = {1,1,1,1}; - if (this.worldObj.provider.getDimensionId() == -1) { + if (this.worldObj.provider.getDimension() == -1) { rgbaColor[0] = worldObj.rand.nextFloat() * 0.5F + 0.4F; rgbaColor[1] = worldObj.rand.nextFloat() * 0.05F; rgbaColor[2] = worldObj.rand.nextFloat() * 0.05F; diff --git a/src/main/java/com/zixiken/dimdoors/world/PocketProvider.java b/src/main/java/com/zixiken/dimdoors/world/PocketProvider.java index 54f653e7..ca458fc0 100644 --- a/src/main/java/com/zixiken/dimdoors/world/PocketProvider.java +++ b/src/main/java/com/zixiken/dimdoors/world/PocketProvider.java @@ -1,9 +1,10 @@ package com.zixiken.dimdoors.world; +import net.minecraft.world.DimensionType; import net.minecraft.world.WorldProvider; public class PocketProvider extends WorldProvider { - @Override + /*@Override public String getDimensionName() { return "Pocket Dimension"; } @@ -11,5 +12,10 @@ public class PocketProvider extends WorldProvider { @Override public String getInternalNameSuffix() { return "_pocket"; + }*/ + + @Override + public DimensionType getDimensionType() { + return DimensionType.OVERWORLD; } }