-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix computer bug.And add many new things.
- Loading branch information
Showing
39 changed files
with
497 additions
and
50 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
src/main/java/WdawningStudio/DawnW/science/block/BlockElectricityFurnace.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package WdawningStudio.DawnW.science.block; | ||
|
||
import WdawningStudio.DawnW.science.creativetab.CreativeTabsLoader; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.material.Material; | ||
import net.minecraft.block.properties.PropertyBool; | ||
import net.minecraft.block.properties.PropertyDirection; | ||
import net.minecraft.block.state.BlockState; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.util.BlockPos; | ||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.world.World; | ||
|
||
public class BlockElectricityFurnace extends Block | ||
{ | ||
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); | ||
public static final PropertyBool BURNING = PropertyBool.create("burning"); | ||
|
||
public BlockElectricityFurnace() | ||
{ | ||
super(Material.iron); | ||
this.setUnlocalizedName("electricityFurnace"); | ||
this.setHardness(2.5F); | ||
this.setStepSound(Block.soundTypeMetal); | ||
this.setCreativeTab(CreativeTabsLoader.tabEnergy); | ||
this.setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH) | ||
.withProperty(BURNING, Boolean.FALSE)); | ||
} | ||
|
||
@Override | ||
protected BlockState createBlockState() | ||
{ | ||
return new BlockState(this, FACING, BURNING); | ||
} | ||
|
||
@Override | ||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, | ||
int meta, EntityLivingBase placer) | ||
{ | ||
IBlockState origin = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer); | ||
return origin.withProperty(FACING, placer.getHorizontalFacing().getOpposite()); | ||
} | ||
|
||
@Override | ||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, | ||
EnumFacing side, float hitX, float hitY, float hitZ) | ||
{ | ||
worldIn.setBlockState(pos, state.cycleProperty(BURNING)); | ||
return true; | ||
} | ||
|
||
@Override | ||
public IBlockState getStateFromMeta(int meta) | ||
{ | ||
EnumFacing facing = EnumFacing.getHorizontal(meta & 3); | ||
Boolean burning = Boolean.valueOf((meta & 4) != 0); | ||
return this.getDefaultState().withProperty(FACING, facing).withProperty(BURNING, burning); | ||
} | ||
|
||
@Override | ||
public int getMetaFromState(IBlockState state) | ||
{ | ||
int facing = ((EnumFacing) state.getValue(FACING)).getHorizontalIndex(); | ||
int burning = ((Boolean) state.getValue(BURNING)).booleanValue() ? 4 : 0; | ||
return facing | burning; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
src/main/java/WdawningStudio/DawnW/science/block/BlockMachineFurnace.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
package WdawningStudio.DawnW.science.block; | ||
|
||
import WdawningStudio.DawnW.science.creativetab.CreativeTabsLoader; | ||
import net.minecraft.block.Block; | ||
import net.minecraft.block.material.Material; | ||
import net.minecraft.block.properties.PropertyBool; | ||
import net.minecraft.block.properties.PropertyDirection; | ||
import net.minecraft.block.state.BlockState; | ||
import net.minecraft.block.state.IBlockState; | ||
import net.minecraft.entity.EntityLivingBase; | ||
import net.minecraft.entity.player.EntityPlayer; | ||
import net.minecraft.util.BlockPos; | ||
import net.minecraft.util.EnumFacing; | ||
import net.minecraft.world.World; | ||
|
||
public class BlockMachineFurnace extends Block | ||
{ | ||
public static final PropertyDirection FACING = PropertyDirection.create("facing", EnumFacing.Plane.HORIZONTAL); | ||
public static final PropertyBool BURNING = PropertyBool.create("burning"); | ||
|
||
public BlockMachineFurnace() | ||
{ | ||
super(Material.iron); | ||
this.setUnlocalizedName("machineFurnace"); | ||
this.setHardness(2.5F); | ||
this.setStepSound(Block.soundTypeMetal); | ||
this.setCreativeTab(CreativeTabsLoader.tabMachine); | ||
} | ||
|
||
@Override | ||
protected BlockState createBlockState() | ||
{ | ||
return new BlockState(this, FACING, BURNING); | ||
} | ||
|
||
@Override | ||
public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing, float hitX, float hitY, float hitZ, | ||
int meta, EntityLivingBase placer) | ||
{ | ||
IBlockState origin = super.onBlockPlaced(worldIn, pos, facing, hitX, hitY, hitZ, meta, placer); | ||
return origin.withProperty(FACING, placer.getHorizontalFacing().getOpposite()); | ||
} | ||
|
||
@Override | ||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, | ||
EnumFacing side, float hitX, float hitY, float hitZ) | ||
{ | ||
worldIn.setBlockState(pos, state.cycleProperty(BURNING)); | ||
return true; | ||
} | ||
|
||
@Override | ||
public IBlockState getStateFromMeta(int meta) | ||
{ | ||
EnumFacing facing = EnumFacing.getHorizontal(meta & 3); | ||
Boolean burning = Boolean.valueOf((meta & 4) != 0); | ||
return this.getDefaultState().withProperty(FACING, facing).withProperty(BURNING, burning); | ||
} | ||
|
||
@Override | ||
public int getMetaFromState(IBlockState state) | ||
{ | ||
int facing = ((EnumFacing) state.getValue(FACING)).getHorizontalIndex(); | ||
int burning = ((Boolean) state.getValue(BURNING)).booleanValue() ? 4 : 0; | ||
return facing | burning; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.