Knocked out a chunk of updates to 1.10.2

This commit is contained in:
Waterpicker 2016-11-06 05:37:21 -06:00
parent 7bb7b54cac
commit baf6e16620
29 changed files with 84 additions and 206 deletions

View file

@ -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;

View file

@ -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);

View file

@ -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);
}

View file

@ -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();

View file

@ -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);

View file

@ -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();}

View file

@ -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;}

View file

@ -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);
}

View file

@ -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;}
}

View file

@ -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;}
}

View file

@ -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);
}

View file

@ -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;
}

View file

@ -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);
}
}

View file

@ -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);
}
}

View file

@ -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;

View file

@ -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

View file

@ -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;

View file

@ -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<TileEntityDimDoor>
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<TileEntityDimDoor>
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;

View file

@ -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<TileEntityTra
}
Tessellator tessellator = Tessellator.getInstance();
WorldRenderer worldrenderer = tessellator.getWorldRenderer();
VertexBuffer worldrenderer = tessellator.getBuffer();
worldrenderer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
if (BlockTransTrapdoor.isTrapdoorSetLow(state)) {

View file

@ -13,7 +13,7 @@ public class ItemDimDoor extends ItemDoorBase {
public static final String ID = "itemDimDoor";
public ItemDimDoor() {
super(ModBlocks.blockDimDoor, (ItemDoor)Items.iron_door);
super(ModBlocks.blockDimDoor, (ItemDoor)Items.IRON_DOOR);
setUnlocalizedName(ID);
}

View file

@ -6,7 +6,6 @@ import com.zixiken.dimdoors.blocks.BlockDimDoorBase;
import com.zixiken.dimdoors.blocks.ModBlocks;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
public class ItemDimDoorUnstable extends ItemDoorBase {
public static final String ID = "itemDimDoorChaos";
@ -18,7 +17,7 @@ public class ItemDimDoorUnstable extends ItemDoorBase {
@Override
public void addInformation(ItemStack stack, EntityPlayer playerIn, List<String> tooltip, boolean advanced) {
tooltip.add(StatCollector.translateToLocal("info.chaosDoor"));
//tooltip.add(StatCollector.translateToLocal("info.chaosDoor"));
}
@Override

View file

@ -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);
}

View file

@ -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;
}
}

View file

@ -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;
}
}

View file

@ -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

View file

@ -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;

View file

@ -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<EntityEnderman> 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

View file

@ -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;

View file

@ -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;
}
}