Its gets to main menu

This commit is contained in:
modmuss50 2016-03-13 18:38:41 +00:00
parent cc0b762b56
commit 32f25a0141
35 changed files with 221 additions and 215 deletions

View file

@ -48,9 +48,9 @@ public class BlockMachineCasing extends BlockMultiblockBase implements ITextured
return (Integer) state.getValue(METADATA);
}
protected BlockStateContainer createBlockStateContainer() {
protected BlockStateContainer createBlockState() {
METADATA = PropertyInteger.create("Type", 0, types.length);
METADATA = PropertyInteger.create("type", 0, types.length);
return new BlockStateContainer(this, METADATA);
}

View file

@ -71,9 +71,9 @@ public class BlockMachineFrame extends BaseBlock implements ITexturedBlock {
return state.getValue(METADATA);
}
protected BlockStateContainer createBlockStateContainer() {
protected BlockStateContainer createBlockState() {
METADATA = PropertyInteger.create("Type", 0, types.length -1);
METADATA = PropertyInteger.create("type", 0, types.length -1);
return new BlockStateContainer(this, METADATA);
}

View file

@ -186,9 +186,9 @@ public class BlockOre extends BaseBlock implements ITexturedBlock, IOreNameProvi
return state.getValue(METADATA);
}
protected BlockStateContainer createBlockStateContainer() {
protected BlockStateContainer createBlockState() {
METADATA = PropertyInteger.create("Type", 0, types.length -1);
METADATA = PropertyInteger.create("type", 0, types.length -1);
return new BlockStateContainer(this, METADATA);
}

View file

@ -110,9 +110,9 @@ public class BlockOre2 extends BaseBlock implements ITexturedBlock, IOreNameProv
return state.getValue(METADATA);
}
protected BlockStateContainer createBlockStateContainer() {
protected BlockStateContainer createBlockState() {
METADATA = PropertyInteger.create("Type", 0, types.length -1);
METADATA = PropertyInteger.create("type", 0, types.length -1);
return new BlockStateContainer(this, METADATA);
}

View file

@ -138,9 +138,9 @@ public class BlockPlayerDetector extends BaseTileBlock implements ITexturedBlock
return (Integer) state.getValue(METADATA);
}
protected BlockStateContainer createBlockStateContainer() {
protected BlockStateContainer createBlockState() {
METADATA = PropertyInteger.create("Type", 0, types.length -1);
METADATA = PropertyInteger.create("type", 0, types.length -1);
return new BlockStateContainer(this, METADATA);
}

View file

@ -2,7 +2,9 @@ package techreborn.blocks;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.World;
@ -28,14 +30,13 @@ public class BlockQuantumChest extends BlockMachineBase implements IAdvancedRota
}
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) {
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
if (!playerIn.isSneaking())
playerIn.openGui(Core.INSTANCE, GuiHandler.quantumChestID, worldIn, pos.getX(),
pos.getY(), pos.getZ());
return true;
}
private final String prefix = "techreborn:blocks/machine/";
@Override

View file

@ -18,9 +18,9 @@ public class BlockReinforcedGlass extends BaseBlock implements ITexturedBlock {
setCreativeTab(TechRebornCreativeTabMisc.instance);
setHardness(4.0F);
}
@Override
public boolean isOpaqueCube() {
public boolean isOpaqueCube(IBlockState state) {
return true;
}

View file

@ -10,9 +10,9 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.world.IBlockAccess;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
@ -49,16 +49,15 @@ public class BlockRubberLeaves extends BlockLeaves implements ITexturedBlock, IO
}
@Override
@SideOnly(Side.CLIENT)
public EnumWorldBlockLayer getBlockLayer()
public BlockRenderLayer getBlockLayer()
{
return Blocks.leaves.getBlockLayer();
return this.leavesFancy ? BlockRenderLayer.CUTOUT_MIPPED : BlockRenderLayer.SOLID;
}
@Override
public boolean isOpaqueCube()
public boolean isOpaqueCube(IBlockState state)
{
return Blocks.leaves.isOpaqueCube();
return Blocks.leaves.isOpaqueCube(state);
}
public boolean isFullCube()
@ -87,7 +86,7 @@ public class BlockRubberLeaves extends BlockLeaves implements ITexturedBlock, IO
}
@Override
protected BlockStateContainer createBlockStateContainer()
protected BlockStateContainer createBlockState()
{
return new BlockStateContainer(this, new IProperty[] { CHECK_DECAY, DECAYABLE});
}

View file

@ -10,6 +10,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.world.IBlockAccess;
@ -28,21 +29,20 @@ import java.util.Random;
*/
public class BlockRubberLog extends Block implements ITexturedBlock {
public static PropertyDirection SAP_SIDE = PropertyDirection.create("sapSide", EnumFacing.Plane.HORIZONTAL);
public static PropertyBool HAS_SAP = PropertyBool.create("hasSap");
public static PropertyDirection SAP_SIDE = PropertyDirection.create("sapside", EnumFacing.Plane.HORIZONTAL);
public static PropertyBool HAS_SAP = PropertyBool.create("hassap");
public BlockRubberLog() {
super(Material.wood);
setUnlocalizedName("techreborn.rubberlog");
setCreativeTab(TechRebornCreativeTabMisc.instance);
this.setHardness(2.0F);
this.setStepSound(soundTypeWood);
RebornCore.jsonDestroyer.registerObject(this);
this.setDefaultState(this.getDefaultState().withProperty(SAP_SIDE, EnumFacing.NORTH).withProperty(HAS_SAP, false));
this.setTickRandomly(true);
}
protected BlockStateContainer createBlockStateContainer() {
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, SAP_SIDE, HAS_SAP);
}
@ -100,7 +100,7 @@ public class BlockRubberLog extends Block implements ITexturedBlock {
}
@Override
public boolean canSustainLeaves(net.minecraft.world.IBlockAccess world, BlockPos pos) {
public boolean canSustainLeaves(IBlockState state, IBlockAccess world, BlockPos pos) {
return true;
}
@ -114,9 +114,9 @@ public class BlockRubberLog extends Block implements ITexturedBlock {
int j = i + 1;
if (worldIn.isAreaLoaded(pos.add(-j, -j, -j), pos.add(j, j, j))) {
for (BlockPos blockpos : BlockPos.getAllInBox(pos.add(-i, -i, -i), pos.add(i, i, i))) {
IBlockState IBlockState = worldIn.getBlockState(blockpos);
if (IBlockState.getBlock().isLeaves(worldIn, blockpos)) {
IBlockState.getBlock().beginLeavesDecay(worldIn, blockpos);
IBlockState state1 = worldIn.getBlockState(blockpos);
if (state1.getBlock().isLeaves(state1, worldIn, blockpos)) {
state1.getBlock().beginLeavesDecay(state1,worldIn, blockpos);
}
}
}
@ -136,19 +136,20 @@ public class BlockRubberLog extends Block implements ITexturedBlock {
}
@Override
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) {
super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ);
if(playerIn.getCurrentEquippedItem() != null && playerIn.getCurrentEquippedItem().getItem() instanceof ItemTreeTap)
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
super.onBlockActivated(worldIn, pos, state, playerIn, hand, heldItem, side, hitX, hitY, hitZ);
if(playerIn.getHeldItem(EnumHand.MAIN_HAND) != null && playerIn.getHeldItem(EnumHand.MAIN_HAND).getItem() instanceof ItemTreeTap)
if(state.getValue(HAS_SAP)){
if(state.getValue(SAP_SIDE) == side){
worldIn.setBlockState(pos, state.withProperty(HAS_SAP, false).withProperty(SAP_SIDE, EnumFacing.getHorizontal(0)));
worldIn.playSoundAtEntity(playerIn, "techreborn:sap_extract", 0.8F, 1F);
//TODO 1.9 sounds
//worldIn.playSoundAtEntity(playerIn, "techreborn:sap_extract", 0.8F, 1F);
if(!worldIn.isRemote){
Random rand = new Random();
BlockPos itemPos = pos.offset(side);
EntityItem item = new EntityItem(worldIn, itemPos.getX(), itemPos.getY(), itemPos.getZ(), ItemParts.getPartByName("rubberSap").copy());
float factor = 0.05F;
playerIn.getCurrentEquippedItem().damageItem(1, playerIn);
playerIn.getHeldItem(EnumHand.MAIN_HAND).damageItem(1, playerIn);
item.motionX = rand.nextGaussian() * factor;
item.motionY = rand.nextGaussian() * factor + 0.2F;
item.motionZ = rand.nextGaussian() * factor;

View file

@ -19,7 +19,6 @@ public class BlockRubberPlank extends Block implements ITexturedBlock {
setUnlocalizedName("techreborn.rubberplank");
setCreativeTab(TechRebornCreativeTabMisc.instance);
this.setHardness(2.0F);
this.setStepSound(soundTypeWood);
}
@Override

View file

@ -86,9 +86,9 @@ public class BlockStorage extends BaseBlock implements ITexturedBlock {
return state.getValue(METADATA);
}
protected BlockStateContainer createBlockStateContainer() {
protected BlockStateContainer createBlockState() {
METADATA = PropertyInteger.create("Type", 0, types.length -1);
METADATA = PropertyInteger.create("type", 0, types.length -1);
return new BlockStateContainer(this, METADATA);
}

View file

@ -84,9 +84,9 @@ public class BlockStorage2 extends BaseBlock implements ITexturedBlock {
return (Integer) state.getValue(METADATA);
}
protected BlockStateContainer createBlockStateContainer() {
protected BlockStateContainer createBlockState() {
METADATA = PropertyInteger.create("Type", 0, types.length -1);
METADATA = PropertyInteger.create("type", 0, types.length -1);
return new BlockStateContainer(this, METADATA);
}

View file

@ -26,7 +26,7 @@ public class BlockSolarPanel extends BaseTileBlock implements ITexturedBlock {
this.setDefaultState(this.getDefaultState().withProperty(ACTIVE, false));
}
protected BlockStateContainer createBlockStateContainer() {
protected BlockStateContainer createBlockState() {
ACTIVE = PropertyBool.create("active");
return new BlockStateContainer(this, ACTIVE);
}