diff --git a/1.11/To-Dos b/1.11/To-Dos index 36dfd346..f6d28e7f 100644 --- a/1.11/To-Dos +++ b/1.11/To-Dos @@ -27,3 +27,8 @@ To-Dos - [ ] Crafting recipes - [ ] Casting Bloomery + +- [ ] Sounds + - [ ] Bellows Sounds + - [ ] Bloomery Sound? + - [ ] Forge Sound? diff --git a/1.11/src/main/java/nmd/primal/forgecraft/blocks/Bloomery.java b/1.11/src/main/java/nmd/primal/forgecraft/blocks/Bloomery.java index 471d59e1..5e944b21 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/blocks/Bloomery.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/blocks/Bloomery.java @@ -1,13 +1,11 @@ package nmd.primal.forgecraft.blocks; -import net.minecraft.block.BlockLog; import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; @@ -18,7 +16,6 @@ import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.tileentity.TileEntity; import net.minecraft.util.*; -import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.util.text.ITextComponent; import net.minecraft.util.text.TextComponentString; @@ -26,11 +23,8 @@ import net.minecraft.world.IBlockAccess; import net.minecraft.world.World; import net.minecraftforge.fml.relauncher.Side; import net.minecraftforge.fml.relauncher.SideOnly; -import nmd.primal.forgecraft.CommonUtils; import nmd.primal.forgecraft.ModInfo; -import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.tiles.TileBloomery; -import nmd.primal.forgecraft.tiles.TileFirebox; import java.util.Random; import java.util.concurrent.ThreadLocalRandom; @@ -143,53 +137,6 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid return false; } - /*@Override - public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent) - { - if (!world.isRemote) - { - if(ent instanceof EntityItem){ - //System.out.println("collision"); - EntityItem itemEnt = (EntityItem) ent; - ItemStack stack = itemEnt.getEntityItem(); - //System.out.println(stack); - TileFirebox tile = (TileFirebox)world.getTileEntity(pos); - if (tile != null) { - if(!tile.getSlotStack(0).isEmpty()) { - if(tile.getSlotStack(0).getItem() == stack.getItem()) { - int entStackSize = stack.getCount(); - int tileStackSize = tile.getSlotStack(0).getCount(); - int tileSizeRemaining = 64 - tileStackSize; - if (tileStackSize < 64) { - if (entStackSize <= tileSizeRemaining) { - tile.incrementStackSize(tile.getSlotList(), 0, entStackSize); - //tile.setSlotStack(0, new ItemStack(stack.getItem(), tileStackSize + entStackSize, stack.getItemDamage())); - ent.setDead(); - world.notifyBlockUpdate(pos, state, state, 3); - tile.updateBlock(); - } - if (entStackSize > tileSizeRemaining) { - tile.getSlotStack(0).setCount(64); - stack.setCount(64 - entStackSize); - } - } - } - } - if (tile.getSlotStack(0).isEmpty()) { - //int entStackSize = stack.getCount(); - tile.setSlotStack(0, itemEnt.getEntityItem()); - itemEnt.setDead(); - world.notifyBlockUpdate(pos, state, state, 3); - tile.updateBlock(); - } - } - } - } - } -*/ - public void onBlockClicked(World world, BlockPos pos, EntityPlayer player) { - - } @Override public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) diff --git a/1.11/src/main/java/nmd/primal/forgecraft/blocks/Crucible.java b/1.11/src/main/java/nmd/primal/forgecraft/blocks/Crucible.java index 8ad2eb65..2fd9eeb1 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/blocks/Crucible.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/blocks/Crucible.java @@ -1,21 +1,13 @@ package nmd.primal.forgecraft.blocks; import net.minecraft.block.Block; -import net.minecraft.block.ITileEntityProvider; import net.minecraft.block.material.Material; -import net.minecraft.block.properties.IProperty; -import net.minecraft.block.properties.PropertyDirection; -import net.minecraft.block.properties.PropertyInteger; -import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; -import net.minecraft.entity.EntityLivingBase; -import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; -import net.minecraft.tileentity.TileEntity; import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumHand; @@ -28,13 +20,8 @@ import net.minecraftforge.fml.relauncher.SideOnly; import nmd.primal.forgecraft.CommonUtils; import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.init.ModBlocks; -import nmd.primal.forgecraft.tiles.TileBaseCrucible; -import nmd.primal.forgecraft.tiles.TileFirebox; import org.apache.commons.lang3.StringUtils; -import javax.annotation.CheckForNull; -import javax.annotation.Nullable; -import java.util.List; import java.util.Random; import static nmd.primal.forgecraft.CommonUtils.spawnItemEntityFromWorld; diff --git a/1.11/src/main/java/nmd/primal/forgecraft/blocks/Firebox.java b/1.11/src/main/java/nmd/primal/forgecraft/blocks/Forge.java similarity index 94% rename from 1.11/src/main/java/nmd/primal/forgecraft/blocks/Firebox.java rename to 1.11/src/main/java/nmd/primal/forgecraft/blocks/Forge.java index 259e2c1e..cb363d26 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/blocks/Firebox.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/blocks/Forge.java @@ -28,7 +28,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; //import nmd.primal.core.api.PrimalBlocks; import nmd.primal.forgecraft.CommonUtils; import nmd.primal.forgecraft.ModInfo; -import nmd.primal.forgecraft.tiles.TileFirebox; +import nmd.primal.forgecraft.tiles.TileForge; import javax.annotation.Nullable; import java.util.Random; @@ -38,13 +38,13 @@ import java.util.Random; /** * Created by kitsu on 11/26/2016. */ -public class Firebox extends CustomContainerFacing implements ITileEntityProvider/*, ITextComponent*/ { +public class Forge extends CustomContainerFacing implements ITileEntityProvider/*, ITextComponent*/ { public static final PropertyBool ACTIVE = PropertyBool.create("active"); protected static final AxisAlignedBB collideBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.99D, 1.0D); protected static final AxisAlignedBB boundBox = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); - public Firebox(Material material) { + public Forge(Material material) { super(material); setUnlocalizedName(ModInfo.ForgecraftBlocks.FIREBOX.getUnlocalizedName()); setRegistryName(ModInfo.ForgecraftBlocks.FIREBOX.getRegistryName()); @@ -56,7 +56,7 @@ public class Firebox extends CustomContainerFacing implements ITileEntityProvide @Override public TileEntity createNewTileEntity(World worldIn, int meta) { - return new TileFirebox(); + return new TileForge(); } @Nullable @@ -75,7 +75,7 @@ public class Firebox extends CustomContainerFacing implements ITileEntityProvide public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitX, float hitY, float hitZ) { if (!world.isRemote) { - TileFirebox tile = (TileFirebox) world.getTileEntity(pos); + TileForge tile = (TileForge) world.getTileEntity(pos); if (tile != null) { ItemStack pItem = player.inventory.getCurrentItem(); ItemStack tileItem = tile.getSlotStack(0); @@ -102,11 +102,6 @@ public class Firebox extends CustomContainerFacing implements ITileEntityProvide } if((pItem.getItem() == Items.FLINT_AND_STEEL) /*|| (pItem.getItem() == PrimalItems.FIRE_BOW)*/ || pItem.getItem() == Item.getItemFromBlock(Blocks.TORCH)) { world.setBlockState(pos, state.withProperty(ACTIVE, true), 2); - BlockPos tempPos = new BlockPos(pos.getX(), pos.getY() + 1, pos.getZ()); - if(world.getBlockState(tempPos).getBlock() == Blocks.AIR) { - world.setBlockState(tempPos, Blocks.FIRE.getDefaultState(), 2); - } - tile.markDirty(); tile.updateBlock(); return true; @@ -153,7 +148,7 @@ public class Firebox extends CustomContainerFacing implements ITileEntityProvide EntityItem itemEnt = (EntityItem) ent; ItemStack stack = itemEnt.getEntityItem(); //System.out.println(stack); - TileFirebox tile = (TileFirebox)world.getTileEntity(pos); + TileForge tile = (TileForge)world.getTileEntity(pos); if (tile != null) { if(!tile.getSlotStack(0).isEmpty()) { if(tile.getSlotStack(0).getItem() == stack.getItem()) { @@ -216,7 +211,7 @@ public class Firebox extends CustomContainerFacing implements ITileEntityProvide if (side == EnumFacing.UP) { if(!world.isRemote){ - TileFirebox tile = (TileFirebox) world.getTileEntity(pos); + TileForge tile = (TileForge) world.getTileEntity(pos); if(tile.getSlotStack(0) != ItemStack.EMPTY){ if(world.getBlockState(pos).getValue(ACTIVE)==true){ return true; @@ -235,7 +230,7 @@ public class Firebox extends CustomContainerFacing implements ITileEntityProvide { if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops")) { - TileFirebox tile = (TileFirebox) world.getTileEntity(pos); + TileForge tile = (TileForge) world.getTileEntity(pos); if (tile !=null) { for (ItemStack stack : tile.getSlotList()) @@ -397,7 +392,7 @@ public class Firebox extends CustomContainerFacing implements ITileEntityProvide @SuppressWarnings("incomplete-switch") public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) { - if(state.getValue(Firebox.ACTIVE) == true) + if(state.getValue(Forge.ACTIVE) == true) { double d0 = (double)pos.getX() + 0.5D; double d1 = (double)pos.getY() + 0.96D; diff --git a/1.11/src/main/java/nmd/primal/forgecraft/blocks/IngotBall.java b/1.11/src/main/java/nmd/primal/forgecraft/blocks/IngotBall.java index 812393f4..3668fb98 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/blocks/IngotBall.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/blocks/IngotBall.java @@ -1,10 +1,17 @@ package nmd.primal.forgecraft.blocks; import net.minecraft.block.material.Material; +import net.minecraft.block.properties.IProperty; +import net.minecraft.block.properties.PropertyBool; +import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.IBlockState; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumFacing; import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos; import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; import nmd.primal.forgecraft.ModInfo; /** @@ -13,9 +20,11 @@ import nmd.primal.forgecraft.ModInfo; public class IngotBall extends BlockCustomBase { protected static final AxisAlignedBB boundBox = new AxisAlignedBB(7/16D, 0.0D, 7/16D, 9/16D, 2/16D, 9/16D); + public static final PropertyBool ACTIVE = PropertyBool.create("active"); public IngotBall(Material material, String registryName, Float hardness){ super(material, registryName, hardness); + } @Override @@ -24,4 +33,45 @@ public class IngotBall extends BlockCustomBase { return boundBox; } + + @Override + public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) + { + worldIn.setBlockState(pos, state.withProperty(ACTIVE, Boolean.valueOf(false)), 2); + } + + @Override + public int getMetaFromState(IBlockState state) { + int i = 0; + + if( state.getValue(ACTIVE) == false) { + i = 0; + return i; + } + if( state.getValue(ACTIVE) == true) { + i = 1; + return i; + } + return i; + } + + @Override + public IBlockState getStateFromMeta(int meta) + { + IBlockState iblockstate = this.getDefaultState(); + + if (meta == 0){ + iblockstate = iblockstate.withProperty(ACTIVE, Boolean.valueOf(false)); + } + if (meta == 1) { + iblockstate = iblockstate.withProperty(ACTIVE, Boolean.valueOf(true)); + } + return iblockstate; + } + + @Override + protected BlockStateContainer createBlockState() { + return new BlockStateContainer(this, new IProperty[] {ACTIVE}); + } + } diff --git a/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java b/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java index c7c7168d..8cf67eca 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/blocks/PistonBellows.java @@ -1,6 +1,5 @@ package nmd.primal.forgecraft.blocks; -import javafx.scene.effect.Bloom; import net.minecraft.block.material.Material; import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.PropertyBool; @@ -23,7 +22,7 @@ import net.minecraftforge.fml.relauncher.SideOnly; import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.init.ModBlocks; import nmd.primal.forgecraft.tiles.TileBloomery; -import nmd.primal.forgecraft.tiles.TileFirebox; +import nmd.primal.forgecraft.tiles.TileForge; import nmd.primal.forgecraft.tiles.TilePistonBellows; import java.util.Random; @@ -78,10 +77,10 @@ public class PistonBellows extends CustomContainerFacing { if (state.getValue(PistonBellows.FACING) == EnumFacing.NORTH) { BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ()); if (world.getBlockState(tempPos).getBlock() == ModBlocks.firebox) { - TileFirebox tile = (TileFirebox) world.getTileEntity(tempPos); - if ((world.getBlockState(tempPos).getValue(Firebox.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Firebox.FACING) == EnumFacing.EAST)) { + TileForge tile = (TileForge) world.getTileEntity(tempPos); + if ((world.getBlockState(tempPos).getValue(Forge.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) { if (tile != null) { - //System.out.println(world.getBlockState(tempPos).getValue(Firebox.FACING)); + //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); tile.setHeat(tile.getHeat() + 25); tile.updateBlock(); tile.markDirty(); @@ -94,7 +93,7 @@ public class PistonBellows extends CustomContainerFacing { if ((world.getBlockState(tempPos).getValue(Bloomery.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.EAST)) { if (tile != null) { - //System.out.println(world.getBlockState(tempPos).getValue(Firebox.FACING)); + //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); tile.setHeat(tile.getHeat() + 25); if(world.getBlockState(tempPos).getValue(Bloomery.COVERED) == true){ tile.setHeat(tile.getHeat() + 25); @@ -109,10 +108,10 @@ public class PistonBellows extends CustomContainerFacing { if (state.getValue(PistonBellows.FACING) == EnumFacing.SOUTH) { BlockPos tempPos = new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ()); if (world.getBlockState(tempPos).getBlock() == ModBlocks.firebox) { - TileFirebox tile = (TileFirebox) world.getTileEntity(tempPos); - if ((world.getBlockState(tempPos).getValue(Firebox.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Firebox.FACING) == EnumFacing.WEST)) { + TileForge tile = (TileForge) world.getTileEntity(tempPos); + if ((world.getBlockState(tempPos).getValue(Forge.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) { if (tile != null) { - //System.out.println(world.getBlockState(tempPos).getValue(Firebox.FACING)); + //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); tile.setHeat(tile.getHeat() + 25); tile.updateBlock(); tile.markDirty(); @@ -125,7 +124,7 @@ public class PistonBellows extends CustomContainerFacing { if ((world.getBlockState(tempPos).getValue(Bloomery.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.WEST)) { if (tile != null) { - //System.out.println(world.getBlockState(tempPos).getValue(Firebox.FACING)); + //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); tile.setHeat(tile.getHeat() + 25); if(world.getBlockState(tempPos).getValue(Bloomery.COVERED) == true){ tile.setHeat(tile.getHeat() + 25); @@ -140,10 +139,10 @@ public class PistonBellows extends CustomContainerFacing { if (state.getValue(PistonBellows.FACING) == EnumFacing.EAST) { BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1); if (world.getBlockState(tempPos).getBlock() == ModBlocks.firebox) { - TileFirebox tile = (TileFirebox) world.getTileEntity(tempPos); - if ((world.getBlockState(tempPos).getValue(Firebox.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Firebox.FACING) == EnumFacing.SOUTH)) { + TileForge tile = (TileForge) world.getTileEntity(tempPos); + if ((world.getBlockState(tempPos).getValue(Forge.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) { if (tile != null) { - //System.out.println(world.getBlockState(tempPos).getValue(Firebox.FACING)); + //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); tile.setHeat(tile.getHeat() + 25); tile.updateBlock(); tile.markDirty(); @@ -156,7 +155,7 @@ public class PistonBellows extends CustomContainerFacing { if ((world.getBlockState(tempPos).getValue(Bloomery.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.SOUTH)) { if (tile != null) { - //System.out.println(world.getBlockState(tempPos).getValue(Firebox.FACING)); + //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); tile.setHeat(tile.getHeat() + 25); if(world.getBlockState(tempPos).getValue(Bloomery.COVERED) == true){ tile.setHeat(tile.getHeat() + 25); @@ -171,10 +170,10 @@ public class PistonBellows extends CustomContainerFacing { if (state.getValue(PistonBellows.FACING) == EnumFacing.WEST) { BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1); if (world.getBlockState(tempPos).getBlock() == ModBlocks.firebox) { - TileFirebox tile = (TileFirebox) world.getTileEntity(tempPos); - if ((world.getBlockState(tempPos).getValue(Firebox.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Firebox.FACING) == EnumFacing.NORTH)) { + TileForge tile = (TileForge) world.getTileEntity(tempPos); + if ((world.getBlockState(tempPos).getValue(Forge.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) { if (tile != null) { - //System.out.println(world.getBlockState(tempPos).getValue(Firebox.FACING)); + //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); tile.setHeat(tile.getHeat() + 25); tile.updateBlock(); tile.markDirty(); @@ -187,7 +186,7 @@ public class PistonBellows extends CustomContainerFacing { if ((world.getBlockState(tempPos).getValue(Bloomery.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.NORTH)) { if (tile != null) { - //System.out.println(world.getBlockState(tempPos).getValue(Firebox.FACING)); + //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); tile.setHeat(tile.getHeat() + 25); if(world.getBlockState(tempPos).getValue(Bloomery.COVERED) == true){ tile.setHeat(tile.getHeat() + 25); @@ -386,8 +385,8 @@ public class PistonBellows extends CustomContainerFacing { if (state.getValue(PistonBellows.FACING) == EnumFacing.NORTH) { BlockPos tempPos = new BlockPos(pos.getX() + 1, pos.getY(), pos.getZ()); if (world.getBlockState(tempPos).getBlock() == ModBlocks.firebox) { - TileFirebox tile = (TileFirebox) world.getTileEntity(tempPos); - if ((world.getBlockState(tempPos).getValue(Firebox.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Firebox.FACING) == EnumFacing.EAST)) { + TileForge tile = (TileForge) world.getTileEntity(tempPos); + if ((world.getBlockState(tempPos).getValue(Forge.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) { makeEmbers(world, tempPos, world.rand); } } @@ -403,8 +402,8 @@ public class PistonBellows extends CustomContainerFacing { if (state.getValue(PistonBellows.FACING) == EnumFacing.SOUTH) { BlockPos tempPos = new BlockPos(pos.getX() - 1, pos.getY(), pos.getZ()); if (world.getBlockState(tempPos).getBlock() == ModBlocks.firebox) { - TileFirebox tile = (TileFirebox) world.getTileEntity(tempPos); - if ((world.getBlockState(tempPos).getValue(Firebox.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Firebox.FACING) == EnumFacing.WEST)) { + TileForge tile = (TileForge) world.getTileEntity(tempPos); + if ((world.getBlockState(tempPos).getValue(Forge.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) { makeEmbers(world, tempPos, world.rand); } } @@ -420,8 +419,8 @@ public class PistonBellows extends CustomContainerFacing { if (state.getValue(PistonBellows.FACING) == EnumFacing.EAST) { BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() + 1); if (world.getBlockState(tempPos).getBlock() == ModBlocks.firebox) { - TileFirebox tile = (TileFirebox) world.getTileEntity(tempPos); - if ((world.getBlockState(tempPos).getValue(Firebox.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Firebox.FACING) == EnumFacing.SOUTH)) { + TileForge tile = (TileForge) world.getTileEntity(tempPos); + if ((world.getBlockState(tempPos).getValue(Forge.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) { makeEmbers(world, tempPos, world.rand); } } @@ -437,8 +436,8 @@ public class PistonBellows extends CustomContainerFacing { if (state.getValue(PistonBellows.FACING) == EnumFacing.WEST) { BlockPos tempPos = new BlockPos(pos.getX(), pos.getY(), pos.getZ() - 1); if (world.getBlockState(tempPos).getBlock() == ModBlocks.firebox) { - TileFirebox tile = (TileFirebox) world.getTileEntity(tempPos); - if ((world.getBlockState(tempPos).getValue(Firebox.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Firebox.FACING) == EnumFacing.NORTH)) { + TileForge tile = (TileForge) world.getTileEntity(tempPos); + if ((world.getBlockState(tempPos).getValue(Forge.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) { makeEmbers(world, tempPos, world.rand); } } diff --git a/1.11/src/main/java/nmd/primal/forgecraft/crafting/ForgeCrafting.java b/1.11/src/main/java/nmd/primal/forgecraft/crafting/ForgeCrafting.java new file mode 100644 index 00000000..86c12f1c --- /dev/null +++ b/1.11/src/main/java/nmd/primal/forgecraft/crafting/ForgeCrafting.java @@ -0,0 +1,130 @@ +package nmd.primal.forgecraft.crafting; + +import net.minecraft.item.ItemStack; + +import java.util.ArrayList; + +/** + * Created by mminaie on 2/11/17. + */ +public class ForgeCrafting { + + // ***************************************************************************** // + // Recipe Handler ForgeCrafting + // ***************************************************************************** // + private static ArrayList forgeRecipes = new ArrayList<>(); + + private ItemStack input; + private ItemStack output; + private ItemStack output_failed; + private ItemStack cool_output; + + private int heat_threshold; + private int ideal_time; + private int cooldown; + + public ForgeCrafting(ItemStack input, ItemStack output, ItemStack output_failed, ItemStack cool_output, int heat_threshold, int ideal_time, int cooldown,float heat_variance, float time_variance) + { + this.input = input; + this.output = output; + this.output_failed = output_failed; + this.cool_output = cool_output; + this.heat_threshold = heat_threshold; + this.ideal_time = ideal_time; + this.cooldown = cooldown; + + } + + // ***************************************************************************** // + // Recipe Methods + // ***************************************************************************** // + public static void addRecipe(ItemStack input, ItemStack output, ItemStack failed, ItemStack cool, int heat_threshold, int ideal_time, int cooldown, float heat_variance, float time_variance) + { + forgeRecipes.add(new ForgeCrafting(input, output, failed, cool, heat_threshold, ideal_time, cooldown, heat_variance, time_variance)); + } + + public static boolean isRecipeItem(ItemStack stack) + { + for(ForgeCrafting recipe : forgeRecipes) { + if (stack.isItemEqual(recipe.input)) + return true; + } + return false; + } + + public static boolean isOutputItem(ItemStack stack) + { + for(ForgeCrafting recipe : forgeRecipes) { + if (stack.isItemEqual(recipe.output)) + return true; + } + return false; + } + + public static boolean isCoolItem(ItemStack stack) + { + for(ForgeCrafting recipe : forgeRecipes) { + if (stack.isItemEqual(recipe.cool_output)) + return true; + } + return false; + } + + public static ForgeCrafting getRecipe(ItemStack stack) + { + for(ForgeCrafting recipe : forgeRecipes) { + if (stack.isItemEqual(recipe.input)) + return recipe; + } + return null; + } + + public static ForgeCrafting getRecipeFromOutput(ItemStack stack) + { + for(ForgeCrafting recipe : forgeRecipes) { + if (stack.isItemEqual(recipe.output)) + return recipe; + } + return null; + } + + public ItemStack getInput() + { + return this.input; + } + + public ItemStack getOutput() + { + return this.output; + } + + public ItemStack getOutputFailed() + { + return this.output_failed; + } + + public ItemStack getCoolOutput() + { + return this.cool_output; + } + + public int getHeatThreshold() + { + return this.heat_threshold; + } + + public int getIdealTime() + { + return this.ideal_time; + } + + public int getCooldown(){ return this.cooldown;} + + /// + // end + /// + + + + +} diff --git a/1.11/src/main/java/nmd/primal/forgecraft/init/ModBlocks.java b/1.11/src/main/java/nmd/primal/forgecraft/init/ModBlocks.java index 7032c703..9cfbc0e3 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/init/ModBlocks.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/init/ModBlocks.java @@ -39,7 +39,7 @@ public class ModBlocks { public static void init() { - firebox = new Firebox(Material.ROCK); + firebox = new Forge(Material.ROCK); bloomery = new Bloomery(Material.ROCK, "bloomery"); diff --git a/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java b/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java index 53642f45..9a2f3910 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/init/ModCrafting.java @@ -14,7 +14,7 @@ import nmd.primal.forgecraft.crafting.BloomeryCrafting; public class ModCrafting { public static void register() { - /***Firebox***/ + /***Forge***/ GameRegistry.addShapedRecipe(new ItemStack(ModBlocks.firebox), "X X", "XYX", "X X", 'X', Items.BRICK, 'Y', Blocks.FURNACE); /***Wooden PistonBellows***/ diff --git a/1.11/src/main/java/nmd/primal/forgecraft/init/ModTiles.java b/1.11/src/main/java/nmd/primal/forgecraft/init/ModTiles.java index 23caa6ea..2b21db79 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/init/ModTiles.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/init/ModTiles.java @@ -4,7 +4,7 @@ import net.minecraft.tileentity.TileEntity; import net.minecraftforge.fml.common.registry.GameRegistry; import nmd.primal.forgecraft.tiles.TileBaseCrucible; import nmd.primal.forgecraft.tiles.TileBloomery; -import nmd.primal.forgecraft.tiles.TileFirebox; +import nmd.primal.forgecraft.tiles.TileForge; import nmd.primal.forgecraft.tiles.TilePistonBellows; /** @@ -13,7 +13,7 @@ import nmd.primal.forgecraft.tiles.TilePistonBellows; public class ModTiles { public static void registerTileEntities () { - registerTileEntity(TileFirebox.class, "firebox"); + registerTileEntity(TileForge.class, "firebox"); registerTileEntity(TilePistonBellows.class, "pistonbellows"); registerTileEntity(TileBloomery.class, "bloomery"); registerTileEntity(TileBaseCrucible.class, "basecrucible"); diff --git a/1.11/src/main/java/nmd/primal/forgecraft/proxy/ClientProxy.java b/1.11/src/main/java/nmd/primal/forgecraft/proxy/ClientProxy.java index db4892da..fd95b6a2 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/proxy/ClientProxy.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/proxy/ClientProxy.java @@ -1,23 +1,13 @@ package nmd.primal.forgecraft.proxy; -import net.minecraft.client.Minecraft; -import net.minecraft.client.renderer.block.model.ModelBakery; -import net.minecraft.client.renderer.block.model.ModelResourceLocation; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.NonNullList; -import net.minecraft.util.ResourceLocation; -import net.minecraftforge.client.model.ModelLoader; -import net.minecraftforge.client.model.obj.OBJLoader; import net.minecraftforge.fml.client.registry.ClientRegistry; -import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.init.ModBlocks; import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.renders.TileBloomeryRender; -import nmd.primal.forgecraft.renders.TileFireboxRender; +import nmd.primal.forgecraft.renders.TileForgeRender; import nmd.primal.forgecraft.renders.TilePistonBellowsRender; import nmd.primal.forgecraft.tiles.TileBloomery; -import nmd.primal.forgecraft.tiles.TileFirebox; +import nmd.primal.forgecraft.tiles.TileForge; import nmd.primal.forgecraft.tiles.TilePistonBellows; /** @@ -43,7 +33,7 @@ public class ClientProxy implements CommonProxy { //@Override public void registerTileRendering() { - ClientRegistry.bindTileEntitySpecialRenderer(TileFirebox.class, new TileFireboxRender()); + ClientRegistry.bindTileEntitySpecialRenderer(TileForge.class, new TileForgeRender()); ClientRegistry.bindTileEntitySpecialRenderer(TilePistonBellows.class, new TilePistonBellowsRender()); ClientRegistry.bindTileEntitySpecialRenderer(TileBloomery.class, new TileBloomeryRender()); } diff --git a/1.11/src/main/java/nmd/primal/forgecraft/renders/TileBloomeryRender.java b/1.11/src/main/java/nmd/primal/forgecraft/renders/TileBloomeryRender.java index cd6c9a42..329f71ad 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/renders/TileBloomeryRender.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/renders/TileBloomeryRender.java @@ -9,7 +9,6 @@ import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; import nmd.primal.forgecraft.tiles.TileBloomery; -import nmd.primal.forgecraft.tiles.TileFirebox; import org.lwjgl.opengl.GL11; /** diff --git a/1.11/src/main/java/nmd/primal/forgecraft/renders/TileFireboxRender.java b/1.11/src/main/java/nmd/primal/forgecraft/renders/TileForgeRender.java similarity index 90% rename from 1.11/src/main/java/nmd/primal/forgecraft/renders/TileFireboxRender.java rename to 1.11/src/main/java/nmd/primal/forgecraft/renders/TileForgeRender.java index b452df5a..9f19a0ff 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/renders/TileFireboxRender.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/renders/TileForgeRender.java @@ -8,18 +8,18 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemStack; import net.minecraft.util.math.BlockPos; -import nmd.primal.forgecraft.tiles.TileFirebox; +import nmd.primal.forgecraft.tiles.TileForge; import org.lwjgl.opengl.GL11; /** * Created by kitsu on 12/4/2016. */ -public class TileFireboxRender extends TileEntitySpecialRenderer +public class TileForgeRender extends TileEntitySpecialRenderer { private RenderItem renderItem = Minecraft.getMinecraft().getRenderItem(); @Override - public void renderTileEntityAt(TileFirebox tile, double x, double y, double z, float partialTicks, int destroyStage) + public void renderTileEntityAt(TileForge tile, double x, double y, double z, float partialTicks, int destroyStage) { GL11.glPushMatrix(); GL11.glTranslated(x + 0.5D, y + 0.95D, z + 0.5D); diff --git a/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileBloomery.java b/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileBloomery.java index b290aa8b..385f9b3a 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileBloomery.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileBloomery.java @@ -1,19 +1,16 @@ package nmd.primal.forgecraft.tiles; -import net.minecraft.block.BlockFurnace; import net.minecraft.block.state.IBlockState; -import net.minecraft.init.Blocks; import net.minecraft.init.Items; import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; -import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.util.ITickable; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; import nmd.primal.forgecraft.blocks.Bloomery; -import nmd.primal.forgecraft.blocks.Firebox; +import nmd.primal.forgecraft.blocks.Forge; import nmd.primal.forgecraft.crafting.BloomeryCrafting; import nmd.primal.forgecraft.init.ModBlocks; import nmd.primal.forgecraft.init.ModItems; @@ -47,7 +44,7 @@ public class TileBloomery extends TileBaseSlot implements ITickable { BlockPos abovePos = new BlockPos(this.getPos().getX(), this.getPos().getY()+1, this.getPos().getZ()); if (world.getBlockState(this.getPos()).getValue(Bloomery.ACTIVE)) { if (this.getSlotStack(0) == ItemStack.EMPTY) { - world.setBlockState(this.getPos(), state.withProperty(Firebox.ACTIVE, false), 2); + world.setBlockState(this.getPos(), state.withProperty(Forge.ACTIVE, false), 2); this.markDirty(); world.notifyBlockUpdate(pos, state, state, 2); } diff --git a/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileFirebox.java b/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileForge.java similarity index 73% rename from 1.11/src/main/java/nmd/primal/forgecraft/tiles/TileFirebox.java rename to 1.11/src/main/java/nmd/primal/forgecraft/tiles/TileForge.java index 42d18262..53c5ed0a 100644 --- a/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileFirebox.java +++ b/1.11/src/main/java/nmd/primal/forgecraft/tiles/TileForge.java @@ -11,14 +11,14 @@ import net.minecraft.util.ITickable; import net.minecraft.util.NonNullList; import net.minecraft.util.math.BlockPos; import net.minecraft.world.World; -import nmd.primal.forgecraft.blocks.Firebox; +import nmd.primal.forgecraft.blocks.Forge; import static nmd.primal.forgecraft.CommonUtils.getVanillaItemBurnTime; /** * Created by mminaie on 11/30/16. */ -public class TileFirebox extends TileBaseSlot implements ITickable { +public class TileForge extends TileBaseSlot implements ITickable { private NonNullList slotList = NonNullList.withSize(1, ItemStack.EMPTY); //private ItemStack[] inventory = new ItemStack [0]; @@ -35,10 +35,10 @@ public class TileFirebox extends TileBaseSlot implements ITickable { this.iteration = 0; IBlockState state = world.getBlockState(this.pos); BlockPos abovePos = new BlockPos(this.getPos().getX(), this.getPos().getY()+1, this.getPos().getZ()); - IBlockState aboveState = world.getBlockState(abovePos); - if (world.getBlockState(this.getPos()).getValue(Firebox.ACTIVE)) { + + if (world.getBlockState(this.getPos()).getValue(Forge.ACTIVE)) { if (this.getSlotStack(0) == ItemStack.EMPTY) { - world.setBlockState(this.getPos(), state.withProperty(Firebox.ACTIVE, false), 2); + world.setBlockState(this.getPos(), state.withProperty(Forge.ACTIVE, false), 2); this.markDirty(); world.notifyBlockUpdate(pos, state, state, 2); } @@ -52,20 +52,7 @@ public class TileFirebox extends TileBaseSlot implements ITickable { this.markDirty(); this.updateBlock(); } - if(world.getBlockState(abovePos).getBlock() instanceof BlockFurnace){ - //System.out.println("Trying to set Block Furnace State active"); - IBlockState iblockstate = world.getBlockState(abovePos); - TileEntityFurnace tileFurnace = (TileEntityFurnace) world.getTileEntity(abovePos); - - if(world.getBlockState(abovePos).getBlock() == Blocks.LIT_FURNACE){ - tileFurnace.setField(0,1000); - } - if(world.getBlockState(abovePos).getBlock() == Blocks.FURNACE){ - BlockFurnace.setState(true, world, abovePos); - //world.setBlockState(abovePos, Blocks.LIT_FURNACE.getDefaultState().withProperty(FACING, iblockstate.getValue(FACING)), 3); - tileFurnace.setField(0,1000); - } - } + this.furnaceManager(abovePos); } } this.heatManager(this.getHeat(), state, this.getSlotStack(0), world, pos); @@ -73,6 +60,49 @@ public class TileFirebox extends TileBaseSlot implements ITickable { } } + private void forgeRecipeManager(){ + + } + + private void furnaceManager(BlockPos abovePos){ + if(world.getBlockState(abovePos).getBlock() instanceof BlockFurnace){ + TileEntityFurnace tileFurnace = (TileEntityFurnace) world.getTileEntity(abovePos); + if(world.getBlockState(abovePos).getBlock() == Blocks.LIT_FURNACE){ + tileFurnace.setField(0,1000); + } + if(world.getBlockState(abovePos).getBlock() == Blocks.FURNACE){ + BlockFurnace.setState(true, world, abovePos); + tileFurnace.setField(0,1000); + } + } + } + + private void heatManager(Integer h, IBlockState state, ItemStack stack, World world, BlockPos pos){ + if(state.getValue(Forge.ACTIVE) == true){ + if(!stack.isEmpty()) { + if(h > 0) { + this.setHeat(h - 25); + } + if(h < 10 ){ + world.setBlockState(pos, state.withProperty(Forge.ACTIVE, false), 2); + } + } + if(stack.isEmpty()){ + world.setBlockState(pos, state.withProperty(Forge.ACTIVE, false), 2); + } + } + if(state.getValue(Forge.ACTIVE) == false){ + if(h > 50){ + this.setHeat(h - 50); + } + if(h < 0){ + this.setHeat(0); + } + } + this.updateBlock(); + this.markDirty(); + } + public int getHeat(){ return this.heat; } @@ -85,32 +115,6 @@ public class TileFirebox extends TileBaseSlot implements ITickable { return 1; } - private void heatManager(Integer h, IBlockState state, ItemStack stack, World world, BlockPos pos){ - if(state.getValue(Firebox.ACTIVE) == true){ - if(!stack.isEmpty()) { - if(h > 0) { - this.setHeat(h - 25); - } - if(h < 10 ){ - world.setBlockState(pos, state.withProperty(Firebox.ACTIVE, false), 2); - } - } - if(stack.isEmpty()){ - world.setBlockState(pos, state.withProperty(Firebox.ACTIVE, false), 2); - } - } - if(state.getValue(Firebox.ACTIVE) == false){ - if(h > 50){ - this.setHeat(h - 50); - } - if(h < 0){ - this.setHeat(0); - } - } - this.updateBlock(); - this.markDirty(); - } - public ItemStack removeStackFromSlot(int index) { ItemStack stack = this.getSlotStack(index); this.setSlotStack(index, ItemStack.EMPTY); diff --git a/1.11/src/main/resources/assets/forgecraft/blockstates/ironball.json b/1.11/src/main/resources/assets/forgecraft/blockstates/ironball.json index 93632e8c..28eb34c0 100644 --- a/1.11/src/main/resources/assets/forgecraft/blockstates/ironball.json +++ b/1.11/src/main/resources/assets/forgecraft/blockstates/ironball.json @@ -1,5 +1,29 @@ + + + { + "forge_marker":1, + "defaults": { + "textures": { + "particle": "forgecraft:blocks/iron_ingot", + "texture": "forgecraft:blocks/iron_ingot" + }, + "parent": "forgecraft:ironball" + }, "variants": { - "normal": { "model": "forgecraft:ironball" } + "active=false": { + "model": "forgecraft:ironball", + "textures": { + "particle": "forgecraft:blocks/iron_ingot", + "texture": "forgecraft:blocks/iron_ingot" + } + }, + "active=true": { + "model": "forgecraft:ironball", + "textures": { + "particle": "forgecraft:blocks/iron_ingot_hot", + "texture": "forgecraft:blocks/iron_ingot_hot" + } + } } } \ No newline at end of file diff --git a/1.11/src/main/resources/assets/forgecraft/textures/blocks/iron_ingot_hot.png b/1.11/src/main/resources/assets/forgecraft/textures/blocks/iron_ingot_hot.png new file mode 100644 index 00000000..650f935d Binary files /dev/null and b/1.11/src/main/resources/assets/forgecraft/textures/blocks/iron_ingot_hot.png differ