add all the crucible blocks

This commit is contained in:
Mohammad-Ali Minaie
2017-04-12 22:49:25 -04:00
parent b0fd0590f9
commit 87f3fa4a2f
6 changed files with 80 additions and 62 deletions

View File

@@ -6,13 +6,13 @@ To-Dos
*** Priority *** *** Priority ***
- [ ] Move Ingot break into chunks logic out of the block and into the ForgeHammer - [ ] Move Ingot break into chunks logic out of the block and into the ForgeHammer
- [x] Make an Iron Anvil - [x] Make an Iron Anvil
- [ ] Check Iron Anvil creation logic - [x] Check Iron Anvil creation logic
- [ ] Make New Ore Tool, Tool Part, Ingot, and Chunk Assets - [x] Make New Ore Tool, Tool Part, Ingot, and Chunk Assets
- [ ] Make New Ore Recipes - [ ] Make New Ore Recipes
- [ ] Make Steel Recipes and Tools - [x] Make Steel Recipes and Tools
- [ ] Make Wootz Recipes and Tools - [x] Make Wootz Recipes and Tools
- [ ] Add Yew - [ ] Add Yew
- [ ] Update tool parts and tool textures - [x] Update tool parts and tool textures
*** Feature Musket *** *** Feature Musket ***
- [ ] Create powder charge item (copper, charcoal, gunpowder) - [ ] Create powder charge item (copper, charcoal, gunpowder)

View File

@@ -56,6 +56,52 @@ public class Breaker extends CustomContainerFacing {
setHardness(hardness); setHardness(hardness);
} }
private void doWork (World world, IBlockState state, BlockPos pos, TileBreaker tile){
if (state.getValue(FACING) == EnumFacing.EAST) {
if(tile.getCharge() > world.getBlockState(pos.east()).getBlockHardness(world, pos.east())) {
if (world.getBlockState(pos.east()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.east());
CommonUtils.spawnItemEntityFromWorld(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, ThreadLocalRandom.current().nextInt(1, 2)));
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()-1);
}
} else {
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()-10);
}
}
if (state.getValue(FACING) == EnumFacing.WEST) {
if(tile.getCharge() > world.getBlockState(pos.west()).getBlockHardness(world, pos.west())) {
if (world.getBlockState(pos.west()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.west());
CommonUtils.spawnItemEntityFromWorld(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, ThreadLocalRandom.current().nextInt(1, 2)));
}
} else {
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()-10);
}
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
if(tile.getCharge() > world.getBlockState(pos.south()).getBlockHardness(world, pos.south())) {
if (world.getBlockState(pos.south()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.south());
CommonUtils.spawnItemEntityFromWorld(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, ThreadLocalRandom.current().nextInt(1, 2)));
}
} else {
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()-10);
}
}
if (state.getValue(FACING) == EnumFacing.NORTH) {
if(tile.getCharge() > world.getBlockState(pos.north()).getBlockHardness(world, pos.north())) {
if (world.getBlockState(pos.north()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.north());
CommonUtils.spawnItemEntityFromWorld(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, ThreadLocalRandom.current().nextInt(1, 2)));
}
} else {
//tile.getSlotStack(0).damageItem(10, (EntityPlayer) null);
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()-10);
}
}
tile.setCharge(0.0f);
}
@Override @Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) { public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
@@ -65,66 +111,16 @@ public class Breaker extends CustomContainerFacing {
if(state.getValue(ACTIVE) == true && player.isSneaking() && pItem.isEmpty()){ if(state.getValue(ACTIVE) == true && player.isSneaking() && pItem.isEmpty()){
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(ACTIVE, false)); world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(ACTIVE, false));
tile.charge = 0.0f;
if (state.getValue(FACING) == EnumFacing.EAST) {
if(tile.charge > world.getBlockState(pos.east()).getBlockHardness(world, pos.east())) {
if (world.getBlockState(pos.east()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.east());
CommonUtils.spawnItemEntityFromWorld(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, ThreadLocalRandom.current().nextInt(1, 2)));
return true;
}
} else {
tile.getSlotStack(0).damageItem(10, null);
return true;
}
}
if (state.getValue(FACING) == EnumFacing.WEST) {
if(tile.charge > world.getBlockState(pos.west()).getBlockHardness(world, pos.west())) {
if (world.getBlockState(pos.west()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.west());
CommonUtils.spawnItemEntityFromWorld(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, ThreadLocalRandom.current().nextInt(1, 2)));
return true;
}
} else {
tile.getSlotStack(0).damageItem(10, null);
return true;
}
}
if (state.getValue(FACING) == EnumFacing.SOUTH) {
if(tile.charge > world.getBlockState(pos.south()).getBlockHardness(world, pos.south())) {
if (world.getBlockState(pos.south()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.south());
CommonUtils.spawnItemEntityFromWorld(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, ThreadLocalRandom.current().nextInt(1, 2)));
return true;
}
} else {
tile.getSlotStack(0).damageItem(10, null);
return true;
}
} doWork(world, state, pos, tile);
if (state.getValue(FACING) == EnumFacing.NORTH) {
System.out.println(tile.charge + ":" + world.getBlockState(pos.north()).getBlockHardness(world, pos.north()));
if(tile.charge > world.getBlockState(pos.north()).getBlockHardness(world, pos.north())) {
if (world.getBlockState(pos.north()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.north());
CommonUtils.spawnItemEntityFromWorld(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, ThreadLocalRandom.current().nextInt(1, 2)));
return true;
}
} else {
//tile.getSlotStack(0).damageItem(10, (EntityPlayer) null);
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()-10);
return true;
}
}
} }
if(!player.isSneaking() && pItem.isEmpty()) { if(!player.isSneaking() && pItem.isEmpty()) {
if (!state.getValue(ACTIVE)) { if (!state.getValue(ACTIVE)) {
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(ACTIVE, true), 2); world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(ACTIVE, true), 2);
} }
tile.charge = tile.charge + 2.0f; tile.setCharge(tile.getCharge() + 2.0f);
tile.updateBlock(); tile.updateBlock();
System.out.println(tile.charge); //System.out.println(tile.charge);
return true; return true;
} }
/*if(state.getValue(ACTIVE) == true && !player.isSneaking() && pItem.isEmpty()){ /*if(state.getValue(ACTIVE) == true && !player.isSneaking() && pItem.isEmpty()){

View File

@@ -17,6 +17,7 @@ import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly; import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.core.api.PrimalItems;
import nmd.primal.forgecraft.CommonUtils; import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModBlocks; import nmd.primal.forgecraft.init.ModBlocks;
@@ -99,6 +100,12 @@ public class Crucible extends Block {
if(name.equals("tile.rawironcrucible")){ if(name.equals("tile.rawironcrucible")){
string = this.getUnlocalizedName(); string = this.getUnlocalizedName();
} }
if(name.equals("tile.coolcleanironcrucible")){
string = this.getUnlocalizedName();
}
if(name.equals("tile.rawcleanironcrucible")){
string = this.getUnlocalizedName();
}
return string; return string;
} }
@@ -108,6 +115,10 @@ public class Crucible extends Block {
return Item.getItemFromBlock(ModBlocks.ironball); return Item.getItemFromBlock(ModBlocks.ironball);
} else if (name.equals("tile.rawironcrucible")){ } else if (name.equals("tile.rawironcrucible")){
return Item.getItemFromBlock(Blocks.IRON_ORE); return Item.getItemFromBlock(Blocks.IRON_ORE);
} else if (name.equals("tile.coolcleanironcrucible")){
return Item.getItemFromBlock(ModBlocks.ironcleanball);
} else if (name.equals("tile.rawcleanironcrucible")){
return PrimalItems.IRON_DUST;
} }
else return Items.AIR; else return Items.AIR;
} }

View File

@@ -56,6 +56,13 @@ public class ModBlocks {
public static Block failedironcrucible; public static Block failedironcrucible;
public static Block failedironcruciblehot; public static Block failedironcruciblehot;
public static Block rawcleanironcrucible;
public static Block hotcleanironcrucible;
public static Block hotcookedcleanironcrucible;
public static Block coolcleanironcrucible;
public static Block failedcleanironcrucible;
public static Block failedcleanironcruciblehot;
public static Block ironball; public static Block ironball;
public static Block ironchunk; public static Block ironchunk;
public static Block ironcleanball; public static Block ironcleanball;
@@ -91,6 +98,9 @@ public class ModBlocks {
hotironcrucible = new CrucibleHot(Material.ROCK, "hotironcrucible"); hotironcrucible = new CrucibleHot(Material.ROCK, "hotironcrucible");
hotcookedironcrucible = new CrucibleHot(Material.ROCK, "hotcookedironcrucible"); hotcookedironcrucible = new CrucibleHot(Material.ROCK, "hotcookedironcrucible");
coolironcrucible = new Crucible(Material.ROCK, "coolironcrucible"); coolironcrucible = new Crucible(Material.ROCK, "coolironcrucible");
rawcleanironcrucible;
failedironcrucible = new Crucible(Material.ROCK, "failedironcrucible"); failedironcrucible = new Crucible(Material.ROCK, "failedironcrucible");
failedironcruciblehot = new CrucibleHot(Material.ROCK, "failedironcruciblehot"); failedironcruciblehot = new CrucibleHot(Material.ROCK, "failedironcruciblehot");

View File

@@ -40,7 +40,7 @@ public class ModCrafting {
/***Bloomery***/ /***Bloomery***/
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.bloomery), GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.bloomery),
"X X", "X X", "XXX", 'X', Items.BRICK); "X X", "X X", "XXX", 'X', Items.BRICK);
/***Block Breaker***/
GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.blockbreaker), GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.blockbreaker),
"L ", "BSB", "BBB", 'L', Blocks.LEVER, 'B', new ItemStack(Blocks.PLANKS, 1, OreDictionary.WILDCARD_VALUE), 'S', PrimalItems.SILK_CORDAGE_COILED); "L ", "BSB", "BBB", 'L', Blocks.LEVER, 'B', new ItemStack(Blocks.PLANKS, 1, OreDictionary.WILDCARD_VALUE), 'S', PrimalItems.SILK_CORDAGE_COILED);
@@ -77,6 +77,7 @@ public class ModCrafting {
/***Iron Crucible***/ /***Iron Crucible***/
ItemStack iron0 = new ItemStack(ModBlocks.rawironcrucible, 1); ItemStack iron0 = new ItemStack(ModBlocks.rawironcrucible, 1);
//ItemStack cleanIron = new ItemStack(ModBlocks.cleanironcrucible, 1);
//Regular Iron Ore //Regular Iron Ore
GameRegistry.addShapedRecipe(iron0, GameRegistry.addShapedRecipe(iron0,

View File

@@ -15,16 +15,16 @@ import java.util.List;
*/ */
public class TileBreaker extends TileBaseSlot { public class TileBreaker extends TileBaseSlot {
public float charge = 0.0f; private float charge = 0.0f;
/*public float getCharge() { public float getCharge() {
return charge; return charge;
} }
public void setCharge(float a) { public void setCharge(float a) {
this.charge = a; this.charge = a;
this.updateBlock(); this.updateBlock();
}*/ }
public NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY); public NonNullList<ItemStack> slotList = NonNullList.<ItemStack>withSize(1, ItemStack.EMPTY);