Finished ItemQuartzDoor.
This commit is contained in:
parent
3d38ee1c08
commit
1fd82190b5
3 changed files with 33 additions and 35 deletions
|
@ -2,11 +2,11 @@ package com.zixiken.dimdoors.items;
|
||||||
|
|
||||||
import com.zixiken.dimdoors.DimDoors;
|
import com.zixiken.dimdoors.DimDoors;
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.item.ItemDoor;
|
import net.minecraft.item.ItemDoor;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.util.MathHelper;
|
import net.minecraft.util.BlockPos;
|
||||||
|
import net.minecraft.util.EnumFacing;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class ItemQuartzDoor extends ItemDoor {
|
public class ItemQuartzDoor extends ItemDoor {
|
||||||
|
@ -18,41 +18,20 @@ public class ItemQuartzDoor extends ItemDoor {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void registerIcons(IIconRegister par1IconRegister)
|
public boolean onItemUse(ItemStack stack, EntityPlayer playerIn, World worldIn, BlockPos pos,
|
||||||
{
|
EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||||
this.itemIcon = par1IconRegister.registerIcon(DimDoors.modid + ":" + this.getUnlocalizedName().replace("item.", ""));
|
if (side == EnumFacing.UP) {
|
||||||
}
|
Block doorBlock = DimDoors.quartzDoor;
|
||||||
|
if(!worldIn.getBlockState(pos).getBlock().isReplaceable(worldIn, pos)) pos = pos.up();
|
||||||
|
|
||||||
@Override
|
if (playerIn.canPlayerEdit(pos, side, stack) &&
|
||||||
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10)
|
playerIn.canPlayerEdit(pos.up(), side, stack) &&
|
||||||
{
|
doorBlock.canPlaceBlockAt(worldIn, pos)) {
|
||||||
if (par7 != 1)
|
placeDoor(worldIn, pos, EnumFacing.fromAngle(playerIn.rotationYaw), doorBlock);
|
||||||
{
|
--stack.stackSize;
|
||||||
return false;
|
return true;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
++par5;
|
|
||||||
Block block = DimDoors.quartzDoor;
|
|
||||||
|
|
||||||
if (par2EntityPlayer.canPlayerEdit(par4, par5, par6, par7, par1ItemStack) && par2EntityPlayer.canPlayerEdit(par4, par5 + 1, par6, par7, par1ItemStack))
|
|
||||||
{
|
|
||||||
if (!block.canPlaceBlockAt(par3World, par4, par5, par6))
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int i1 = MathHelper.floor_double((par2EntityPlayer.rotationYaw + 180.0F) * 4.0F / 360.0F - 0.5D) & 3;
|
|
||||||
placeDoorBlock(par3World, par4, par5, par6, i1, block);
|
|
||||||
--par1ItemStack.stackSize;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,6 +28,7 @@ public class ItemRenderManager {
|
||||||
register(DimDoors.itemGoldenDimensionalDoor);
|
register(DimDoors.itemGoldenDimensionalDoor);
|
||||||
register(DimDoors.itemGoldenDoor);
|
register(DimDoors.itemGoldenDoor);
|
||||||
register(DimDoors.itemPersonalDoor);
|
register(DimDoors.itemPersonalDoor);
|
||||||
|
register(DimDoors.itemQuartzDoor);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void addModelVariants() {
|
public static void addModelVariants() {
|
||||||
|
|
|
@ -0,0 +1,18 @@
|
||||||
|
{
|
||||||
|
"parent": "builtin/generated",
|
||||||
|
"textures": {
|
||||||
|
"layer0": "dimdoors:items/itemQuartzDoor"
|
||||||
|
},
|
||||||
|
"display": {
|
||||||
|
"thirdperson": {
|
||||||
|
"rotation": [ -90, 0, 0 ],
|
||||||
|
"translation": [ 0, 1, -3 ],
|
||||||
|
"scale": [ 0.55, 0.55, 0.55 ]
|
||||||
|
},
|
||||||
|
"firstperson": {
|
||||||
|
"rotation": [ 0, -135, 25 ],
|
||||||
|
"translation": [ 0, 4, 2 ],
|
||||||
|
"scale": [ 1.7, 1.7, 1.7 ]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue