all the bug fixes, refactoring, and feauture upgrades

This commit is contained in:
Mohammad-Ali Minaie
2017-06-11 17:42:50 -04:00
parent b7d2b6580a
commit 8ae050bddd
22 changed files with 514 additions and 321 deletions

View File

@@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx3G
mod_group=nmd.primal.forgecraft mod_group=nmd.primal.forgecraft
mod_name=ForgeCraft mod_name=ForgeCraft
mod_version=1.2.23 mod_version=1.2.30
forge_version=13.20.0.2311 forge_version=13.20.0.2311
mcp_mappings=snapshot_20170121 mcp_mappings=snapshot_20170121
mc_version=1.11.2 mc_version=1.11.2

View File

@@ -16,7 +16,7 @@ public class ModInfo {
public static final String MOD_NAME = "Kitsu's ForgeCraft"; public static final String MOD_NAME = "Kitsu's ForgeCraft";
//public static final String MOD_PREFIX = MOD_ID + ":"; //public static final String MOD_PREFIX = MOD_ID + ":";
public static final String MOD_CHANNEL = MOD_ID; public static final String MOD_CHANNEL = MOD_ID;
public static final String MOD_VERSION = "1.2.23"; public static final String MOD_VERSION = "1.2.30";
public static final String MC_VERSIONS = "[1.11.0, 1.12.0)"; public static final String MC_VERSIONS = "[1.11.0, 1.12.0)";
public static final String DEPENDENCIES = "required-after:forge@[13.20.0.2226,);" + "required-after:primal@[0.4,);"; public static final String DEPENDENCIES = "required-after:forge@[13.20.0.2226,);" + "required-after:primal@[0.4,);";

View File

@@ -0,0 +1,147 @@
package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
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.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
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.ModInfo;
import nmd.primal.forgecraft.tiles.TileAnvil;
import nmd.primal.forgecraft.util.AnvilHandler;
/**
* Created by mminaie on 6/11/17.
*/
public abstract class AnvilBase extends CustomContainerFacing implements AnvilHandler{
private boolean anvil;
public AnvilBase(Material material, String registryName, Float hardness, Boolean anvil) {
super(material);
setUnlocalizedName(registryName);
setRegistryName(registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setHardness(hardness);
this.setIsAnvil(anvil);
}
public boolean isAnvil() {
return anvil;
}
public void setIsAnvil(boolean anvil) {
anvil = anvil;
}
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
AnvilHandler.doDrops(world, pos);
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileAnvil();
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullyOpaque(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
}

View File

@@ -1,7 +1,78 @@
package nmd.primal.forgecraft.blocks; package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
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;
import net.minecraft.util.math.BlockPos;
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.core.api.PrimalItems;
import nmd.primal.core.api.PrimalMaterials;
import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.BaseMultiItem;
import nmd.primal.forgecraft.tiles.TileAnvil;
import nmd.primal.forgecraft.util.AnvilHandler;
/** /**
* Created by mminaie on 6/10/17. * Created by mminaie on 6/10/17.
*/ */
public class AnvilIron { public class AnvilIron extends AnvilBase implements AnvilHandler {
public AnvilIron(Material material, String registryName, Float hardness, Boolean anvil) {
super(material, registryName, hardness, anvil);
}
@Override
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumHand hand, EnumFacing facing, float hitx, float hity, float hitz) {
/******************************************************************************
Crafting AnvilStone Recipes
*****************************************************************************/
if (!world.isRemote) {
ItemStack pItem = player.inventory.getCurrentItem();
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
if (tile != null) {
if ((pItem.getItem() instanceof WorkMallet) || (pItem.getItem() == ModItems.forgehammer)) {
String[] tempArray = new String[25];
for (int i = 0; i < 25; i++) {
tempArray[i] = tile.getSlotStack(i).getItem().getRegistryName().toString();
}
/*for (int i = 0; i < 25; i++) {
if (tile.getSlotStack(i).getItem() instanceof BaseMultiItem) {
if (((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_BASIC_STEEL
|| ((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_CLEAN_IRON
|| ((BaseMultiItem) tile.getSlotStack(i).getItem()).getMaterial(tile.getSlotStack(i).getItem()) != PrimalMaterials.TOOL_WROUGHT_IRON
) {
world.setBlockState(pos, Blocks.AIR.getDefaultState(), 2);
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(PrimalItems.ROCK_STONE, 3));
CommonUtils.spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.ironball, 1));
this.breakBlock(world, pos, state);
}
}
}*/
doAnvilRecipe(pItem, tempArray, world, tile, pos, player);
return true;
}
doAnvilInventoryManager(pItem, world, tile, pos, hitx, hity, hitz, state, player);
return true;
}
}
return false;
}
} }

View File

@@ -41,50 +41,15 @@ import java.util.concurrent.ThreadLocalRandom;
/** /**
* Created by mminaie on 3/4/17. * Created by mminaie on 3/4/17.
*/ */
public class AnvilStone extends CustomContainerFacing implements AnvilHandler { public class AnvilStone extends AnvilBase {
/* public AnvilStone(Material material, String registryName, Float hardness, Boolean anvil) {
double[] normalMin = {0.0625, 0.25, 0.4375, 0.625, 0.8125}; super(material, registryName, hardness, anvil);
public double getNormalMin(Integer x) {
return normalMin[x];
}
double[] normalMax = {0.1875, 0.375, 0.5625, 0.75, 0.9375};
public double getNormalMax(Integer x) {
return normalMax[x];
}
double[] reverseMin = {0.8125, 0.625, 0.4375, 0.25, 0.0625};
public double getReverseMin(Integer x) {
return reverseMin[x];
}
double[] reverseMax = {0.9375, 0.75, 0.5625, 0.375, 0.1875};
public double getReverseMax(Integer x) {
return reverseMax[x];
}
*/
public AnvilStone(Material material, String registryName, Float hardness) {
super(material);
setUnlocalizedName(registryName);
setRegistryName(registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH));
setHardness(hardness);
} }
@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) {
/*if (!player.isSwingInProgress) {
player.swingArm(hand);
}*/
/****************************************************************************** /******************************************************************************
Crafting AnvilStone Recipes Crafting AnvilStone Recipes
*****************************************************************************/ *****************************************************************************/
@@ -116,124 +81,4 @@ public class AnvilStone extends CustomContainerFacing implements AnvilHandler {
} }
return false; return false;
} }
@Override
public void breakBlock(World world, BlockPos pos, IBlockState state)
{
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops"))
{
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
if (tile !=null)
{
for (ItemStack stack : tile.getSlotList())
{
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
EntityItem item = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, stack);
item.setDefaultPickupDelay();
world.spawnEntity(item);
}
}
}
}
super.breakBlock(world, pos, state);
}
@Override
public TileEntity createNewTileEntity(World worldIn, int meta)
{
return new TileAnvil();
}
@Override
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{
//if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()), 2);
//}
}
@Override
public int getMetaFromState(IBlockState state) {
int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST) {
i = 0;
return i;
}
if( state.getValue(FACING) == EnumFacing.WEST) {
i = 1;
return i;
}
if( state.getValue(FACING) == EnumFacing.SOUTH){
i = 2;
return i;
}
if( state.getValue(FACING) == EnumFacing.NORTH){
i = 3;
return i;
}
return i;
}
@Override
public IBlockState getStateFromMeta(int meta)
{
IBlockState iblockstate = this.getDefaultState();
if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST);
}
if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST);
}
if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH);
}
if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH);
}
return iblockstate;
}
@Override
protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING});
}
@Override
public boolean isFullCube(IBlockState state)
{
return false;
}
@Override
public boolean isFullyOpaque(IBlockState state)
{
return false;
}
@Override
public boolean isOpaqueCube(IBlockState state)
{
return false;
}
@Override
@SideOnly(Side.CLIENT)
public boolean shouldSideBeRendered(IBlockState blockState, IBlockAccess blockAccess, BlockPos pos, EnumFacing side)
{
return true;
}
@Override
public EnumBlockRenderType getRenderType(IBlockState state)
{
return EnumBlockRenderType.MODEL;
}
} }

View File

@@ -12,6 +12,7 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents; import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.*;
@@ -23,6 +24,9 @@ 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.core.api.PrimalItems;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.core.common.crafting.FireSource;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.CommonUtils; import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.BloomeryCrafting; import nmd.primal.forgecraft.crafting.BloomeryCrafting;
@@ -38,7 +42,7 @@ import static nmd.primal.core.common.helper.FireHelper.makeSmoke;
*/ */
public class Bloomery extends CustomContainerFacing implements ITileEntityProvider { public class Bloomery extends CustomContainerFacing implements ITileEntityProvider {
public static final PropertyBool ACTIVE = PropertyBool.create("active"); //public static final PropertyBool PrimalStates.ACTIVE = PropertyBool.create("PrimalStates.ACTIVE");
public static final PropertyBool COVERED = PropertyBool.create("covered"); public static final PropertyBool COVERED = PropertyBool.create("covered");
public Bloomery(Material material, String registryName) { public Bloomery(Material material, String registryName) {
@@ -47,7 +51,7 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
setRegistryName(registryName); setRegistryName(registryName);
//setRegistryName(ModInfo.ForgecraftBlocks.FIREBOX.getRegistryName()); //setRegistryName(ModInfo.ForgecraftBlocks.FIREBOX.getRegistryName());
setCreativeTab(ModInfo.TAB_FORGECRAFT); setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, Boolean.valueOf(false))); setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)));
setHardness(3.0f); setHardness(3.0f);
} }
@@ -62,7 +66,7 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
{ {
this.updateTick(world, pos, state, random); this.updateTick(world, pos, state, random);
if(!world.isRemote){ if(!world.isRemote){
if(state.getValue(ACTIVE) == true) { if(state.getValue(PrimalStates.ACTIVE) == true) {
makeSmoke(world, pos); makeSmoke(world, pos);
} }
} }
@@ -79,18 +83,8 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
ItemStack tileItem1 = tile.getSlotStack(1); ItemStack tileItem1 = tile.getSlotStack(1);
if(pItem.isEmpty()) { if(pItem.isEmpty()) {
if (player.isSneaking()) {
if (!tileItem.isEmpty()) {
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(0));
tile.setSlotStack(0, ItemStack.EMPTY);
tile.markDirty();
tile.updateBlock();
return true;
}
}
if(!player.isSneaking()){ if(!player.isSneaking()){
if(world.getBlockState(pos).getValue(ACTIVE) == true){ if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE) == true){
Integer bloomeryHeat = tile.getHeat(); Integer bloomeryHeat = tile.getHeat();
Integer idealTemp = null; Integer idealTemp = null;
Integer cookCounter = tile.getCookCounter(); Integer cookCounter = tile.getCookCounter();
@@ -119,11 +113,8 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
} }
} }
if(tile.getSlotStack(0) != ItemStack.EMPTY) { if(tile.getSlotStack(0) != ItemStack.EMPTY) {
if((pItem.getItem() == Items.FLINT_AND_STEEL) || if((FireSource.useSource(world, pos, player, pItem, hand, facing, hitX, hitY, hitZ))) {
(pItem.getItem() == PrimalItems.FIRE_BOW) || world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, true), 2);
pItem.getItem() == PrimalItems.TORCH_WOOD_LIT ||
pItem.getItem() == PrimalItems.TORCH_NETHER_LIT ) {
world.setBlockState(pos, state.withProperty(ACTIVE, true), 2);
tile.setHeat(100); tile.setHeat(100);
tile.markDirty(); tile.markDirty();
tile.updateBlock(); tile.updateBlock();
@@ -169,6 +160,16 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
return true; return true;
} }
} }
if (player.isSneaking()) {
if (!tile.getSlotStack(0).isEmpty()) {
if(player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
ItemStack returnStack = tile.getSlotStack(0).copy();
PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
tile.clearSlot(0);
return true;
}
}
}
} }
} }
return false; return false;
@@ -179,7 +180,7 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos) public int getLightValue(IBlockState state, IBlockAccess world, BlockPos pos)
{ {
int lightState =0; int lightState =0;
if(state.getValue(ACTIVE) == true){ if(state.getValue(PrimalStates.ACTIVE) == true){
lightState = 10; lightState = 10;
} }
return lightState; return lightState;
@@ -199,7 +200,7 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
public boolean isFireSource(World world, BlockPos pos, EnumFacing side) public boolean isFireSource(World world, BlockPos pos, EnumFacing side)
{ {
if(!world.isRemote){ if(!world.isRemote){
if(world.getBlockState(pos).getValue(ACTIVE)==true){ if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE)==true){
return true; return true;
} }
} }
@@ -210,7 +211,7 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent) public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity ent)
{ {
if(ent instanceof EntityPlayer){ if(ent instanceof EntityPlayer){
if(state.getValue(ACTIVE) == true){ if(state.getValue(PrimalStates.ACTIVE) == true){
ent.setFire(1); ent.setFire(1);
} }
} }
@@ -248,7 +249,7 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{ {
if(!worldIn.isRemote){ if(!worldIn.isRemote){
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(false)), 2); worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(false)), 2);
} }
} }
@@ -257,67 +258,67 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
public int getMetaFromState(IBlockState state) { public int getMetaFromState(IBlockState state) {
int i = 0; int i = 0;
if( state.getValue(FACING) == EnumFacing.EAST && state.getValue(ACTIVE) == false && state.getValue(COVERED) == false){ if( state.getValue(FACING) == EnumFacing.EAST && state.getValue(PrimalStates.ACTIVE) == false && state.getValue(COVERED) == false){
i = 0; i = 0;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.WEST && state.getValue(ACTIVE) == false && state.getValue(COVERED) == false){ if( state.getValue(FACING) == EnumFacing.WEST && state.getValue(PrimalStates.ACTIVE) == false && state.getValue(COVERED) == false){
i = 1; i = 1;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.SOUTH && state.getValue(ACTIVE) == false && state.getValue(COVERED) == false){ if( state.getValue(FACING) == EnumFacing.SOUTH && state.getValue(PrimalStates.ACTIVE) == false && state.getValue(COVERED) == false){
i = 2; i = 2;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.NORTH && state.getValue(ACTIVE) == false && state.getValue(COVERED) == false){ if( state.getValue(FACING) == EnumFacing.NORTH && state.getValue(PrimalStates.ACTIVE) == false && state.getValue(COVERED) == false){
i = 3; i = 3;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.EAST && state.getValue(ACTIVE) == true && state.getValue(COVERED) == false){ if( state.getValue(FACING) == EnumFacing.EAST && state.getValue(PrimalStates.ACTIVE) == true && state.getValue(COVERED) == false){
i = 4; i = 4;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.WEST && state.getValue(ACTIVE) == true && state.getValue(COVERED) == false){ if( state.getValue(FACING) == EnumFacing.WEST && state.getValue(PrimalStates.ACTIVE) == true && state.getValue(COVERED) == false){
i = 5; i = 5;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.SOUTH && state.getValue(ACTIVE) == true && state.getValue(COVERED) == false){ if( state.getValue(FACING) == EnumFacing.SOUTH && state.getValue(PrimalStates.ACTIVE) == true && state.getValue(COVERED) == false){
i = 6; i = 6;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.NORTH && state.getValue(ACTIVE) == true && state.getValue(COVERED) == false){ if( state.getValue(FACING) == EnumFacing.NORTH && state.getValue(PrimalStates.ACTIVE) == true && state.getValue(COVERED) == false){
i = 7; i = 7;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.EAST && state.getValue(ACTIVE) == true && state.getValue(COVERED) == true){ if( state.getValue(FACING) == EnumFacing.EAST && state.getValue(PrimalStates.ACTIVE) == true && state.getValue(COVERED) == true){
i = 8; i = 8;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.WEST && state.getValue(ACTIVE) == true && state.getValue(COVERED) == true){ if( state.getValue(FACING) == EnumFacing.WEST && state.getValue(PrimalStates.ACTIVE) == true && state.getValue(COVERED) == true){
i = 9; i = 9;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.SOUTH && state.getValue(ACTIVE) == true && state.getValue(COVERED) == true){ if( state.getValue(FACING) == EnumFacing.SOUTH && state.getValue(PrimalStates.ACTIVE) == true && state.getValue(COVERED) == true){
i = 10; i = 10;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.NORTH && state.getValue(ACTIVE) == true && state.getValue(COVERED) == true){ if( state.getValue(FACING) == EnumFacing.NORTH && state.getValue(PrimalStates.ACTIVE) == true && state.getValue(COVERED) == true){
i = 11; i = 11;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.EAST && state.getValue(ACTIVE) == false && state.getValue(COVERED) == true){ if( state.getValue(FACING) == EnumFacing.EAST && state.getValue(PrimalStates.ACTIVE) == false && state.getValue(COVERED) == true){
i = 12; i = 12;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.WEST && state.getValue(ACTIVE) == false && state.getValue(COVERED) == true){ if( state.getValue(FACING) == EnumFacing.WEST && state.getValue(PrimalStates.ACTIVE) == false && state.getValue(COVERED) == true){
i = 13; i = 13;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.SOUTH && state.getValue(ACTIVE) == false && state.getValue(COVERED) == true){ if( state.getValue(FACING) == EnumFacing.SOUTH && state.getValue(PrimalStates.ACTIVE) == false && state.getValue(COVERED) == true){
i = 14; i = 14;
return i; return i;
} }
if( state.getValue(FACING) == EnumFacing.NORTH && state.getValue(ACTIVE) == false && state.getValue(COVERED) == true){ if( state.getValue(FACING) == EnumFacing.NORTH && state.getValue(PrimalStates.ACTIVE) == false && state.getValue(COVERED) == true){
i = 15; i = 15;
return i; return i;
} }
@@ -330,59 +331,59 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
IBlockState iblockstate = this.getDefaultState(); IBlockState iblockstate = this.getDefaultState();
if (meta == 0){ if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(false)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(false));
} }
if (meta == 1) { if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(false)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(false));
} }
if (meta == 2) { if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(false)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(false));
} }
if (meta == 3) { if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(false)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(false));
} }
if (meta == 4) { if (meta == 4) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(false)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(false));
} }
if (meta == 5) { if (meta == 5) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(false)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(false));
} }
if (meta == 6) { if (meta == 6) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(false)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(false));
} }
if (meta == 7) { if (meta == 7) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(false)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(false));
} }
if (meta == 8) { if (meta == 8) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(true)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(true));
} }
if (meta == 9) { if (meta == 9) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(true)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(true));
} }
if (meta == 10) { if (meta == 10) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(true)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(true));
} }
if (meta == 11) { if (meta == 11) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(true)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(true)).withProperty(COVERED, Boolean.valueOf(true));
} }
if (meta == 12) { if (meta == 12) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(true)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(true));
} }
if (meta == 13) { if (meta == 13) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(true)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(true));
} }
if (meta == 14) { if (meta == 14) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(true)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(true));
} }
if (meta == 15) { if (meta == 15) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(true)); iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)).withProperty(COVERED, Boolean.valueOf(true));
} }
return iblockstate; return iblockstate;
} }
@Override @Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {FACING, ACTIVE, COVERED}); return new BlockStateContainer(this, new IProperty[] {FACING, PrimalStates.ACTIVE, COVERED});
} }
@Override @Override
@@ -420,7 +421,7 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
@SuppressWarnings("incomplete-switch") @SuppressWarnings("incomplete-switch")
public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand) public void randomDisplayTick(IBlockState state, World world, BlockPos pos, Random rand)
{ {
if(state.getValue(Forge.ACTIVE) == true) if(state.getValue(PrimalStates.ACTIVE) == true)
{ {
double d0 = (double)pos.getX() + 0.5D; double d0 = (double)pos.getX() + 0.5D;
double d1 = (double)pos.getY() + 0.2D; double d1 = (double)pos.getY() + 0.2D;

View File

@@ -2,13 +2,11 @@ package nmd.primal.forgecraft.blocks;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool;
import net.minecraft.block.state.BlockStateContainer; import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem; import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumBlockRenderType; import net.minecraft.util.EnumBlockRenderType;
@@ -19,29 +17,23 @@ 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.core.api.PrimalStates;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.core.common.items.tools.WorkMallet; import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.tiles.TileBreaker; import nmd.primal.forgecraft.tiles.TileBreaker;
import nmd.primal.forgecraft.util.BreakerHandler; import nmd.primal.forgecraft.util.BreakerHandler;
import java.util.concurrent.ThreadLocalRandom;
/** /**
* Created by mminaie on 4/9/17. * Created by mminaie on 4/9/17.
*/ */
public class Breaker extends CustomContainerFacing implements BreakerHandler { public class Breaker extends CustomContainerFacing implements BreakerHandler {
public static final PropertyBool ACTIVE = PropertyBool.create("active");
public Breaker(Material material, String registryName, Float hardness) { public Breaker(Material material, String registryName, Float hardness) {
super(material); super(material);
setUnlocalizedName(registryName); setUnlocalizedName(registryName);
setRegistryName(registryName); setRegistryName(registryName);
setCreativeTab(ModInfo.TAB_FORGECRAFT); setCreativeTab(ModInfo.TAB_FORGECRAFT);
setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, false)); setDefaultState(this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, false));
setHardness(hardness); setHardness(hardness);
} }
@@ -63,18 +55,18 @@ public class Breaker extends CustomContainerFacing implements BreakerHandler {
} }
}*/ }*/
if(state.getValue(ACTIVE) == true && player.isSneaking() && pItem.isEmpty()){ if(state.getValue(PrimalStates.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(PrimalStates.ACTIVE, false));
doBreaking(world, state, pos, tile); doBreaking(world, state, pos, tile);
tile.setCharge(0); tile.setCharge(0);
return true; return true;
} }
if(!player.isSneaking() && pItem.isEmpty()) { if(!player.isSneaking() && pItem.isEmpty()) {
if (!state.getValue(ACTIVE)) { if (!state.getValue(PrimalStates.ACTIVE)) {
world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(ACTIVE, true), 2); world.setBlockState(pos, state.withProperty(FACING, state.getValue(FACING)).withProperty(PrimalStates.ACTIVE, true), 2);
return true; return true;
} }
if(state.getValue(ACTIVE)) { if(state.getValue(PrimalStates.ACTIVE)) {
if (tile.getCharge() < 181) { if (tile.getCharge() < 181) {
tile.setCharge(tile.getCharge() + 2.0f); tile.setCharge(tile.getCharge() + 2.0f);
tile.updateBlock(); tile.updateBlock();
@@ -133,7 +125,7 @@ public class Breaker extends CustomContainerFacing implements BreakerHandler {
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{ {
//if(!worldIn.isRemote) { //if(!worldIn.isRemote) {
worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(ACTIVE, false), 2); worldIn.setBlockState(pos, state.withProperty(FACING, placer.getHorizontalFacing()).withProperty(PrimalStates.ACTIVE, false), 2);
//} //}
} }
@@ -141,7 +133,7 @@ public class Breaker extends CustomContainerFacing implements BreakerHandler {
public int getMetaFromState(IBlockState state) { public int getMetaFromState(IBlockState state) {
int i = 0; int i = 0;
if(state.getValue(ACTIVE ) == false) { if(state.getValue(PrimalStates.ACTIVE ) == false) {
if (state.getValue(FACING) == EnumFacing.EAST) { if (state.getValue(FACING) == EnumFacing.EAST) {
i = 0; i = 0;
return i; return i;
@@ -160,7 +152,7 @@ public class Breaker extends CustomContainerFacing implements BreakerHandler {
} }
} }
if(state.getValue(ACTIVE)) { if(state.getValue(PrimalStates.ACTIVE)) {
if (state.getValue(FACING) == EnumFacing.EAST) { if (state.getValue(FACING) == EnumFacing.EAST) {
i = 4; i = 4;
return i; return i;
@@ -187,35 +179,35 @@ public class Breaker extends CustomContainerFacing implements BreakerHandler {
IBlockState iblockstate = this.getDefaultState(); IBlockState iblockstate = this.getDefaultState();
if (meta == 0){ if (meta == 0){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(ACTIVE, false); iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalStates.ACTIVE, false);
} }
if (meta == 1) { if (meta == 1) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(ACTIVE, false); iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalStates.ACTIVE, false);
} }
if (meta == 2) { if (meta == 2) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(ACTIVE, false); iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalStates.ACTIVE, false);
} }
if (meta == 3) { if (meta == 3) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, false); iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, false);
} }
if (meta == 4){ if (meta == 4){
iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(ACTIVE, true); iblockstate = iblockstate.withProperty(FACING, EnumFacing.EAST).withProperty(PrimalStates.ACTIVE, true);
} }
if (meta == 5) { if (meta == 5) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(ACTIVE, true); iblockstate = iblockstate.withProperty(FACING, EnumFacing.WEST).withProperty(PrimalStates.ACTIVE, true);
} }
if (meta == 6) { if (meta == 6) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(ACTIVE, true); iblockstate = iblockstate.withProperty(FACING, EnumFacing.SOUTH).withProperty(PrimalStates.ACTIVE, true);
} }
if (meta == 7) { if (meta == 7) {
iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(ACTIVE, true); iblockstate = iblockstate.withProperty(FACING, EnumFacing.NORTH).withProperty(PrimalStates.ACTIVE, true);
} }
return iblockstate; return iblockstate;
} }
@Override @Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {ACTIVE, FACING}); return new BlockStateContainer(this, new IProperty[] {PrimalStates.ACTIVE, FACING});
} }
@Override @Override

View File

@@ -80,7 +80,8 @@ public class Crucible extends Block {
{ {
if(!world.isRemote){ if(!world.isRemote){
spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.emptycrucible, 1)); if(this.getUnlocalizedName().equals("tile.emptycruciblecracked")){} else spawnItemEntityFromWorld(world, pos, new ItemStack(ModBlocks.emptycrucible, 1));
if(StringUtils.isEmpty(this.getUnlocalizedName()) == false) { if(StringUtils.isEmpty(this.getUnlocalizedName()) == false) {
if(checkDrops(this.getUnlocalizedName()) != null) { if(checkDrops(this.getUnlocalizedName()) != null) {
if (checkDrops(this.getUnlocalizedName()).equals(this.getUnlocalizedName())) { if (checkDrops(this.getUnlocalizedName()).equals(this.getUnlocalizedName())) {
@@ -118,6 +119,9 @@ public class Crucible extends Block {
if(name.equals("tile.rawwootzcrucible")){ if(name.equals("tile.rawwootzcrucible")){
string = this.getUnlocalizedName(); string = this.getUnlocalizedName();
} }
if(name.equals("tile.emptycruciblecracked")){
string = this.getUnlocalizedName();
}
return string; return string;
} }
@@ -139,6 +143,8 @@ public class Crucible extends Block {
return Item.getItemFromBlock(ModBlocks.wootzball); return Item.getItemFromBlock(ModBlocks.wootzball);
} else if (name.equals("tile.rawcleanironcrucible")){ } else if (name.equals("tile.rawcleanironcrucible")){
return PrimalItems.GOLDEN_STICK; return PrimalItems.GOLDEN_STICK;
}else if (name.equals("tile.emptycruciblecracked")){
return Items.CLAY_BALL;
} }
else return Items.AIR; else return Items.AIR;
} }

View File

@@ -13,6 +13,7 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.init.SoundEvents; import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemSpade;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*; import net.minecraft.util.*;
@@ -25,6 +26,8 @@ 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.core.api.PrimalItems;
import nmd.primal.core.common.crafting.FireSource;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.CommonUtils; import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.items.parts.ToolPart; import nmd.primal.forgecraft.items.parts.ToolPart;
@@ -91,19 +94,18 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider/
/*********************** /***********************
FUEL SLOT CODE FUEL SLOT CODE
***********************/ ***********************/
if(pItem.isEmpty()) {
if (player.isSneaking()) { if (player.isSneaking()) {
if (!fuelItem.isEmpty()) { if (!tile.getSlotStack(0).isEmpty()) {
if(facing == EnumFacing.NORTH || facing == EnumFacing.SOUTH || facing == EnumFacing.EAST || facing == EnumFacing.WEST ) { if(player.inventory.getCurrentItem().getItem() instanceof ItemSpade) {
//System.out.println(); ItemStack returnStack = tile.getSlotStack(0).copy();
CommonUtils.spawnItemEntity(world, player, tile.getSlotStack(0)); PlayerHelper.spawnItemOnPlayer(world, player, returnStack);
tile.setSlotStack(0, ItemStack.EMPTY); tile.clearSlot(0);
tile.markDirty();
tile.updateBlock();
return true; return true;
} }
} }
} }
if(pItem.isEmpty()) {
if(!player.isSneaking()){ if(!player.isSneaking()){
if(world.getBlockState(pos).getValue(ACTIVE) == true){ if(world.getBlockState(pos).getValue(ACTIVE) == true){
Integer tempInt = tile.getHeat(); Integer tempInt = tile.getHeat();
@@ -115,7 +117,7 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider/
} }
} }
} }
if((pItem.getItem() == Items.FLINT_AND_STEEL) || (pItem.getItem() == PrimalItems.FIRE_BOW) || pItem.getItem() == PrimalItems.TORCH_WOOD_LIT || pItem.getItem() == PrimalItems.TORCH_NETHER_LIT ) { if((FireSource.useSource(world, pos, player, pItem, hand, facing, hitX, hitY, hitZ))) {
world.setBlockState(pos, state.withProperty(ACTIVE, true), 2); world.setBlockState(pos, state.withProperty(ACTIVE, true), 2);
tile.setHeat(100); tile.setHeat(100);
tile.markDirty(); tile.markDirty();

View File

@@ -1,5 +1,6 @@
package nmd.primal.forgecraft.blocks; package nmd.primal.forgecraft.blocks;
import net.minecraft.block.BlockDynamicLiquid;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty; import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyBool; import net.minecraft.block.properties.PropertyBool;
@@ -7,6 +8,7 @@ import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.SoundEvents; import net.minecraft.init.SoundEvents;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.SoundCategory; import net.minecraft.util.SoundCategory;
@@ -14,6 +16,8 @@ import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.core.common.helper.PlayerHelper;
import java.util.Random; import java.util.Random;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
@@ -25,7 +29,7 @@ public class IngotBall extends BlockCustomBase {
protected static AxisAlignedBB boundBoxLarge = new AxisAlignedBB(6/16D, 0.0D, 6/16D, 10/16D, 4/16D, 10/16D); protected static AxisAlignedBB boundBoxLarge = new AxisAlignedBB(6/16D, 0.0D, 6/16D, 10/16D, 4/16D, 10/16D);
protected static AxisAlignedBB boundBoxSmall = new AxisAlignedBB(7/16D, 0.0D, 7/16D, 9/16D, 2/16D, 9/16D); protected static AxisAlignedBB boundBoxSmall = new AxisAlignedBB(7/16D, 0.0D, 7/16D, 9/16D, 2/16D, 9/16D);
public static final PropertyBool ACTIVE = PropertyBool.create("active"); //public static final PropertyBool ACTIVE = PropertyBool.create("active");
private String type; private String type;
public IngotBall(Material material, String registryName, Float hardness, String type){ public IngotBall(Material material, String registryName, Float hardness, String type){
@@ -49,19 +53,32 @@ public class IngotBall extends BlockCustomBase {
public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack) public void onBlockPlacedBy(World worldIn, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
{ {
//System.out.println(stack.getItemDamage()); //System.out.println(stack.getItemDamage());
worldIn.setBlockState(pos, state.withProperty(ACTIVE, Boolean.valueOf(false)), 2); worldIn.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
//System.out.println(state.getValue(ACTIVE)); //System.out.println(state.getValue(ACTIVE));
} }
public void onBlockDestroyedByPlayer(World world, BlockPos pos, IBlockState state)
{
if(!world.isRemote){
if(state.getValue(PrimalStates.ACTIVE)){
world.setBlockState(pos, Blocks.FLOWING_LAVA.getDefaultState().withProperty(BlockDynamicLiquid.LEVEL, 1), 3);
}
if(!state.getValue(PrimalStates.ACTIVE)){
PlayerHelper.spawnItemOnGround(world, pos, new ItemStack(this, 1));
}
}
}
@Override @Override
public int getMetaFromState(IBlockState state) { public int getMetaFromState(IBlockState state) {
int i = 0; int i = 0;
if( state.getValue(ACTIVE) == false) { if( state.getValue(PrimalStates.ACTIVE) == false) {
i = 0; i = 0;
return i; return i;
} }
if( state.getValue(ACTIVE) == true) { if( state.getValue(PrimalStates.ACTIVE) == true) {
i = 1; i = 1;
return i; return i;
} }
@@ -74,17 +91,17 @@ public class IngotBall extends BlockCustomBase {
IBlockState iblockstate = this.getDefaultState(); IBlockState iblockstate = this.getDefaultState();
if (meta == 0){ if (meta == 0){
iblockstate = iblockstate.withProperty(ACTIVE, Boolean.valueOf(false)); iblockstate = iblockstate.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false));
} }
if (meta == 1) { if (meta == 1) {
iblockstate = iblockstate.withProperty(ACTIVE, Boolean.valueOf(true)); iblockstate = iblockstate.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(true));
} }
return iblockstate; return iblockstate;
} }
@Override @Override
protected BlockStateContainer createBlockState() { protected BlockStateContainer createBlockState() {
return new BlockStateContainer(this, new IProperty[] {ACTIVE}); return new BlockStateContainer(this, new IProperty[] {PrimalStates.ACTIVE});
} }
@Override @Override
@@ -93,8 +110,8 @@ public class IngotBall extends BlockCustomBase {
this.updateTick(world, pos, state, random); this.updateTick(world, pos, state, random);
if(!world.isRemote){ if(!world.isRemote){
if ( ThreadLocalRandom.current().nextInt(0,4) == 0) { if ( ThreadLocalRandom.current().nextInt(0,4) == 0) {
if(state.getValue(ACTIVE) == true) { if(state.getValue(PrimalStates.ACTIVE) == true) {
world.setBlockState(pos, state.withProperty(ACTIVE, Boolean.valueOf(false)), 2); world.setBlockState(pos, state.withProperty(PrimalStates.ACTIVE, Boolean.valueOf(false)), 2);
world.playSound((EntityPlayer) null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1.0F, world.rand.nextFloat() * 0.4F + 0.8F); world.playSound((EntityPlayer) null, pos, SoundEvents.BLOCK_FIRE_EXTINGUISH, SoundCategory.BLOCKS, 1.0F, world.rand.nextFloat() * 0.4F + 0.8F);
} }
} }

View File

@@ -16,6 +16,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.PrimalStates;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.init.ModBlocks; import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModSounds; import nmd.primal.forgecraft.init.ModSounds;
@@ -94,7 +95,7 @@ public class PistonBellows extends CustomContainerFacing {
} }
if (world.getBlockState(tempPos).getBlock() == ModBlocks.bloomery) { if (world.getBlockState(tempPos).getBlock() == ModBlocks.bloomery) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(Bloomery.ACTIVE) == true) if ((world.getBlockState(tempPos).getValue(PrimalStates.ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.EAST)) { && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.EAST)) {
if (tile != null) { if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
@@ -125,7 +126,7 @@ public class PistonBellows extends CustomContainerFacing {
} }
if (world.getBlockState(tempPos).getBlock() == ModBlocks.bloomery) { if (world.getBlockState(tempPos).getBlock() == ModBlocks.bloomery) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(Bloomery.ACTIVE) == true) if ((world.getBlockState(tempPos).getValue(PrimalStates.ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.WEST)) { && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.WEST)) {
if (tile != null) { if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
@@ -156,7 +157,7 @@ public class PistonBellows extends CustomContainerFacing {
} }
if (world.getBlockState(tempPos).getBlock() == ModBlocks.bloomery) { if (world.getBlockState(tempPos).getBlock() == ModBlocks.bloomery) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(Bloomery.ACTIVE) == true) if ((world.getBlockState(tempPos).getValue(PrimalStates.ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.SOUTH)) { && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.SOUTH)) {
if (tile != null) { if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
@@ -187,7 +188,7 @@ public class PistonBellows extends CustomContainerFacing {
} }
if (world.getBlockState(tempPos).getBlock() == ModBlocks.bloomery) { if (world.getBlockState(tempPos).getBlock() == ModBlocks.bloomery) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(Bloomery.ACTIVE) == true) if ((world.getBlockState(tempPos).getValue(PrimalStates.ACTIVE) == true)
&& (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.NORTH)) { && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.NORTH)) {
if (tile != null) { if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING)); //System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
@@ -396,7 +397,7 @@ public class PistonBellows extends CustomContainerFacing {
} }
if (world.getBlockState(tempPos).getBlock() instanceof Bloomery) { if (world.getBlockState(tempPos).getBlock() instanceof Bloomery) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(Bloomery.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.EAST)) { if ((world.getBlockState(tempPos).getValue(PrimalStates.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.EAST)) {
makeEmbers(world, tempPos, world.rand); makeEmbers(world, tempPos, world.rand);
} }
} }
@@ -413,7 +414,7 @@ public class PistonBellows extends CustomContainerFacing {
} }
if (world.getBlockState(tempPos).getBlock() instanceof Bloomery) { if (world.getBlockState(tempPos).getBlock() instanceof Bloomery) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(Bloomery.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.WEST)) { if ((world.getBlockState(tempPos).getValue(PrimalStates.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.WEST)) {
makeEmbers(world, tempPos, world.rand); makeEmbers(world, tempPos, world.rand);
} }
} }
@@ -430,7 +431,7 @@ public class PistonBellows extends CustomContainerFacing {
} }
if (world.getBlockState(tempPos).getBlock() instanceof Bloomery) { if (world.getBlockState(tempPos).getBlock() instanceof Bloomery) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(Bloomery.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.SOUTH)) { if ((world.getBlockState(tempPos).getValue(PrimalStates.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.SOUTH)) {
makeEmbers(world, tempPos, world.rand); makeEmbers(world, tempPos, world.rand);
} }
} }
@@ -447,7 +448,7 @@ public class PistonBellows extends CustomContainerFacing {
} }
if (world.getBlockState(tempPos).getBlock() instanceof Bloomery) { if (world.getBlockState(tempPos).getBlock() instanceof Bloomery) {
TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos); TileBloomery tile = (TileBloomery) world.getTileEntity(tempPos);
if ((world.getBlockState(tempPos).getValue(Bloomery.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.NORTH)) { if ((world.getBlockState(tempPos).getValue(PrimalStates.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.NORTH)) {
makeEmbers(world, tempPos, world.rand); makeEmbers(world, tempPos, world.rand);
} }
} }

View File

@@ -156,7 +156,7 @@ public class ModBlocks {
return true; return true;
}*/ }*/
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) { if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock().equals(ModBlocks.stoneanvil)) { if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos); TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
@@ -209,7 +209,7 @@ public class ModBlocks {
return true; return true;
} }
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) { if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilStone) { if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos); TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
@@ -261,7 +261,7 @@ public class ModBlocks {
return true; return true;
} }
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) { if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilStone) { if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos); TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
@@ -313,7 +313,7 @@ public class ModBlocks {
return true; return true;
} }
if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) { if (pItem instanceof WorkMallet || pItem.equals(ModItems.forgehammer)) {
if(world.getBlockState(belowPos).getBlock() instanceof AnvilStone) { if(world.getBlockState(belowPos).getBlock() instanceof AnvilBase) {
TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos); TileAnvil tile = (TileAnvil) world.getTileEntity(belowPos);
@@ -354,8 +354,8 @@ public class ModBlocks {
steelchunk = new IngotBall(Material.IRON, "steelchunk", 6.0f, "chunk"); //steel_ingot steelchunk.json steelchunkhot.json - done steelchunk = new IngotBall(Material.IRON, "steelchunk", 6.0f, "chunk"); //steel_ingot steelchunk.json steelchunkhot.json - done
wootzchunk = new IngotBall(Material.IRON, "wootzchunk", 6.0f, "chunk"); //wootz_ingot wootzchunk.json wootzchunkhot.json - done wootzchunk = new IngotBall(Material.IRON, "wootzchunk", 6.0f, "chunk"); //wootz_ingot wootzchunk.json wootzchunkhot.json - done
stoneanvil = new AnvilStone(Material.ANVIL, "stoneanvil", 5.0f); stoneanvil = new AnvilStone(Material.ANVIL, "stoneanvil", 5.0f, true);
ironanvil = new AnvilStone(Material.ANVIL, "ironanvil", 6.0f); ironanvil = new AnvilIron(Material.ANVIL, "ironanvil", 6.0f, true);
//ironballitemcool = new ItemBlockIngotBall(ironball); //ironballitemcool = new ItemBlockIngotBall(ironball);
//ironballitemhot = new ItemBlockIngotBall(ironball); //ironballitemhot = new ItemBlockIngotBall(ironball);

View File

@@ -167,14 +167,14 @@ public class ModItems {
/********** /**********
INGOTS AND CHUNKS INGOTS AND CHUNKS
**********/ **********/
ironingotballhot = new BaseMultiItem("ironingothot", PrimalMaterials.TOOL_WROUGHT_IRON); ironingotballhot = new BaseMultiItem("ironingothot", PrimalMaterials.TOOL_WROUGHT_IRON, 6);
ironchunkhot = new BaseMultiItem("ironchunkhot", PrimalMaterials.TOOL_WROUGHT_IRON); ironchunkhot = new BaseMultiItem("ironchunkhot", PrimalMaterials.TOOL_WROUGHT_IRON, 7);
ironcleaningotballhot= new BaseMultiItem("ironcleaningotballhot", PrimalMaterials.TOOL_CLEAN_IRON); ironcleaningotballhot= new BaseMultiItem("ironcleaningotballhot", PrimalMaterials.TOOL_CLEAN_IRON, 15);
ironcleanchunkhot= new BaseMultiItem("ironcleanchunkhot", PrimalMaterials.TOOL_CLEAN_IRON); ironcleanchunkhot= new BaseMultiItem("ironcleanchunkhot", PrimalMaterials.TOOL_CLEAN_IRON, 16);
steelingotballhot= new BaseMultiItem("steelingotballhot", PrimalMaterials.TOOL_BASIC_STEEL); steelingotballhot= new BaseMultiItem("steelingotballhot", PrimalMaterials.TOOL_BASIC_STEEL, 24);
steelchunkhot= new BaseMultiItem("steelchunkhot", PrimalMaterials.TOOL_BASIC_STEEL); steelchunkhot= new BaseMultiItem("steelchunkhot", PrimalMaterials.TOOL_BASIC_STEEL, 25);
wootzingotballhot= new BaseMultiItem("wootzingotballhot", PrimalMaterials.TOOL_WOOTZ_STEEL); wootzingotballhot= new BaseMultiItem("wootzingotballhot", PrimalMaterials.TOOL_WOOTZ_STEEL, 33);
wootzchunkhot= new BaseMultiItem("wootzchunkhot", PrimalMaterials.TOOL_WOOTZ_STEEL); wootzchunkhot= new BaseMultiItem("wootzchunkhot", PrimalMaterials.TOOL_WOOTZ_STEEL, 34);
//forgingmanual = new ItemForgingManual(); //forgingmanual = new ItemForgingManual();
//test = new ItemTest("ironsword"); //test = new ItemTest("ironsword");

View File

@@ -8,15 +8,21 @@ import net.minecraft.item.Item;
public class BaseMultiItem extends BaseItem { public class BaseMultiItem extends BaseItem {
private Item.ToolMaterial mat; private Item.ToolMaterial mat;
private int ID;
public BaseMultiItem( String registryName, Item.ToolMaterial material) { public BaseMultiItem( String registryName, Item.ToolMaterial material, Integer ID) {
setUnlocalizedName(registryName); setUnlocalizedName(registryName);
setRegistryName(registryName); setRegistryName(registryName);
mat = material; mat = material;
this.ID = ID;
} }
public Item.ToolMaterial getMaterial(Item item){ public Item.ToolMaterial getMaterial(Item item){
return mat; return mat;
} }
public int getID() {
return ID;
}
} }

View File

@@ -14,6 +14,7 @@ import net.minecraft.util.math.BlockPos;
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.PrimalStates;
import nmd.primal.forgecraft.ModInfo; import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.blocks.Crucible; import nmd.primal.forgecraft.blocks.Crucible;
import nmd.primal.forgecraft.blocks.CrucibleHot; import nmd.primal.forgecraft.blocks.CrucibleHot;
@@ -110,6 +111,19 @@ public class ItemStoneTongs extends Item {
27 | Hot Steel Axe Head 27 | Hot Steel Axe Head
28 | Hot Steel Shovel Head 28 | Hot Steel Shovel Head
29 | Hot Steel Hoe Head 29 | Hot Steel Hoe Head
================================
30 | Hot Wootz Crucible
31 | Hot Cooked Wootz Crucible
32 | Hot Failed Wootz Crucible
33 | Hot Wootz Ingot
34 | Hot Wootz Chunk
--------------------------------
35 | Hot Wootz Pickaxe Head
36 | Hot Wootz Axe Head
37 | Hot Wootz Shovel Head
38 | Hot Wootz Hoe Head
*/ */
if(!world.isRemote) { if(!world.isRemote) {
@@ -122,7 +136,7 @@ public class ItemStoneTongs extends Item {
*****/ *****/
if (world.getBlockState(pos).getBlock() != ModBlocks.bloomery) { if (world.getBlockState(pos).getBlock() != ModBlocks.bloomery) {
if (world.getBlockState(pos).getBlock() instanceof IngotBall) { if (world.getBlockState(pos).getBlock() instanceof IngotBall) {
if(world.getBlockState(pos).getValue(IngotBall.ACTIVE) == true) { if(world.getBlockState(pos).getValue(PrimalStates.ACTIVE) == true) {
if (world.getBlockState(pos).getBlock() == ModBlocks.ironball) { if (world.getBlockState(pos).getBlock() == ModBlocks.ironball) {
itemstack.getTagCompound().setInteger("type", 6); itemstack.getTagCompound().setInteger("type", 6);
world.setBlockToAir(pos); world.setBlockToAir(pos);
@@ -296,11 +310,11 @@ public class ItemStoneTongs extends Item {
itemstack.getTagCompound().setInteger("type", 0); itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
case 6: case 6:
world.setBlockState(tempPos, ModBlocks.ironball.getDefaultState().withProperty(IngotBall.ACTIVE, true), 3); world.setBlockState(tempPos, ModBlocks.ironball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
itemstack.getTagCompound().setInteger("type", 0); itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
case 7: case 7:
world.setBlockState(tempPos, ModBlocks.ironchunk.getDefaultState().withProperty(IngotBall.ACTIVE, true), 3); world.setBlockState(tempPos, ModBlocks.ironchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
itemstack.getTagCompound().setInteger("type", 0); itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
case 8: case 8:
@@ -333,11 +347,11 @@ public class ItemStoneTongs extends Item {
itemstack.getTagCompound().setInteger("type", 0); itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
case 15: case 15:
world.setBlockState(tempPos, ModBlocks.ironcleanball.getDefaultState().withProperty(IngotBall.ACTIVE, true), 3); world.setBlockState(tempPos, ModBlocks.ironcleanball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
itemstack.getTagCompound().setInteger("type", 0); itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
case 16: case 16:
world.setBlockState(tempPos, ModBlocks.ironcleanchunk.getDefaultState().withProperty(IngotBall.ACTIVE, true), 3); world.setBlockState(tempPos, ModBlocks.ironcleanchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
itemstack.getTagCompound().setInteger("type", 0); itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
case 17: case 17:
@@ -370,11 +384,11 @@ public class ItemStoneTongs extends Item {
itemstack.getTagCompound().setInteger("type", 0); itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
case 24: case 24:
world.setBlockState(tempPos, ModBlocks.steelball.getDefaultState().withProperty(IngotBall.ACTIVE, true), 3); world.setBlockState(tempPos, ModBlocks.steelball.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
itemstack.getTagCompound().setInteger("type", 0); itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
case 25: case 25:
world.setBlockState(tempPos, ModBlocks.steelchunk.getDefaultState().withProperty(IngotBall.ACTIVE, true), 3); world.setBlockState(tempPos, ModBlocks.steelchunk.getDefaultState().withProperty(PrimalStates.ACTIVE, true), 3);
itemstack.getTagCompound().setInteger("type", 0); itemstack.getTagCompound().setInteger("type", 0);
return EnumActionResult.SUCCESS; return EnumActionResult.SUCCESS;
} }

View File

@@ -262,6 +262,8 @@ public class CustomAxe extends ItemAxe implements ToolNBT {
setRedstoneLevel(item, 0); setRedstoneLevel(item, 0);
setLapisLevel(item, 0); setLapisLevel(item, 0);
setModifiers(item, 0); setModifiers(item, 0);
}
if( this.getMaxDamage(item) - this.getDamage(item) < 5 ){
} }
} }

View File

@@ -14,6 +14,7 @@ import net.minecraft.item.Item;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import nmd.primal.core.api.PrimalItems; import nmd.primal.core.api.PrimalItems;
import nmd.primal.forgecraft.blocks.AnvilBase;
import nmd.primal.forgecraft.blocks.AnvilStone; import nmd.primal.forgecraft.blocks.AnvilStone;
import nmd.primal.forgecraft.blocks.IngotBall; import nmd.primal.forgecraft.blocks.IngotBall;
import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.init.ModItems;
@@ -40,7 +41,7 @@ public class TileAnvilRender extends TileEntitySpecialRenderer<TileAnvil>
BlockPos pos = tile.getPos(); BlockPos pos = tile.getPos();
IBlockState state = this.getWorld().getBlockState(pos); IBlockState state = this.getWorld().getBlockState(pos);
if (state.getBlock() instanceof AnvilStone) { if (state.getBlock() instanceof AnvilBase) {
GL11.glPushMatrix(); GL11.glPushMatrix();
GL11.glTranslated(x, y + 1.5D, z); GL11.glTranslated(x, y + 1.5D, z);
@@ -87,7 +88,7 @@ public class TileAnvilRender extends TileEntitySpecialRenderer<TileAnvil>
*/ */
if (state.getValue(AnvilStone.FACING) == EnumFacing.NORTH) { if (state.getValue(AnvilBase.FACING) == EnumFacing.NORTH) {
int counter = 0; int counter = 0;
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
for (int a = 0; a < 5; a++) { for (int a = 0; a < 5; a++) {

View File

@@ -74,8 +74,16 @@ public abstract class TileBaseSlot extends BaseTile {
public void clearSlots() public void clearSlots()
{ {
this.slotList.clear(); this.slotList.clear();
this.markDirty();
this.updateBlock();
} }
public void clearSlot(int index) {
this.slotList.set(index, ItemStack.EMPTY);
this.markDirty();
this.updateBlock();
}
// ***************************************************************************** // // ***************************************************************************** //
// NBT // NBT

View File

@@ -9,6 +9,7 @@ import net.minecraft.util.ITickable;
import net.minecraft.util.NonNullList; import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import nmd.primal.core.api.PrimalStates;
import nmd.primal.core.common.helper.CommonUtils; import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.core.common.helper.ParticleHelper; import nmd.primal.core.common.helper.ParticleHelper;
import nmd.primal.forgecraft.blocks.Bloomery; import nmd.primal.forgecraft.blocks.Bloomery;
@@ -35,7 +36,7 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
World world = this.getWorld(); World world = this.getWorld();
if(!world.isRemote){ if(!world.isRemote){
IBlockState state = world.getBlockState(this.pos); IBlockState state = world.getBlockState(this.pos);
if(state.getValue(Bloomery.ACTIVE) == true){ if(state.getValue(PrimalStates.ACTIVE) == true){
if(this.getHeat() < 100){ if(this.getHeat() < 100){
this.setHeat(100); this.setHeat(100);
} }
@@ -46,7 +47,7 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
//IBlockState state = world.getBlockState(this.pos); //IBlockState state = world.getBlockState(this.pos);
BlockPos abovePos = new BlockPos(this.getPos().getX(), this.getPos().getY()+1, this.getPos().getZ()); BlockPos abovePos = new BlockPos(this.getPos().getX(), this.getPos().getY()+1, this.getPos().getZ());
if (world.getBlockState(this.getPos()).getValue(Bloomery.ACTIVE)) { if (world.getBlockState(this.getPos()).getValue(PrimalStates.ACTIVE)) {
if (this.getSlotStack(0) == ItemStack.EMPTY) { if (this.getSlotStack(0) == ItemStack.EMPTY) {
world.setBlockState(this.getPos(), state.withProperty(Forge.ACTIVE, false), 2); world.setBlockState(this.getPos(), state.withProperty(Forge.ACTIVE, false), 2);
this.markDirty(); this.markDirty();
@@ -139,7 +140,7 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
} }
private void heatManager(Integer h, IBlockState state, ItemStack stack, World world, BlockPos pos){ private void heatManager(Integer h, IBlockState state, ItemStack stack, World world, BlockPos pos){
if(state.getValue(Bloomery.ACTIVE) == true){ if(state.getValue(PrimalStates.ACTIVE) == true){
if(!stack.isEmpty()) { if(!stack.isEmpty()) {
if(h > 0) { if(h > 0) {
this.setHeat(h - 25); this.setHeat(h - 25);
@@ -152,7 +153,7 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
world.setBlockState(pos, state.withProperty(Forge.ACTIVE, false), 2); world.setBlockState(pos, state.withProperty(Forge.ACTIVE, false), 2);
} }
} }
if(state.getValue(Bloomery.ACTIVE) == false){ if(state.getValue(PrimalStates.ACTIVE) == false){
if(h > 50){ if(h > 50){
this.setHeat(h - 50); this.setHeat(h - 50);
} }

View File

@@ -2,6 +2,7 @@ package nmd.primal.forgecraft.util;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor; import net.minecraft.item.EnumDyeColor;
@@ -17,7 +18,9 @@ import nmd.primal.core.common.items.tools.WorkMallet;
import nmd.primal.forgecraft.CommonUtils; import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.blocks.IngotBall; import nmd.primal.forgecraft.blocks.IngotBall;
import nmd.primal.forgecraft.crafting.AnvilCrafting; import nmd.primal.forgecraft.crafting.AnvilCrafting;
import nmd.primal.forgecraft.init.ModBlocks;
import nmd.primal.forgecraft.init.ModItems; import nmd.primal.forgecraft.init.ModItems;
import nmd.primal.forgecraft.items.BaseMultiItem;
import nmd.primal.forgecraft.items.ForgeHammer; import nmd.primal.forgecraft.items.ForgeHammer;
import nmd.primal.forgecraft.items.parts.ToolPart; import nmd.primal.forgecraft.items.parts.ToolPart;
import nmd.primal.forgecraft.tiles.TileAnvil; import nmd.primal.forgecraft.tiles.TileAnvil;
@@ -721,4 +724,56 @@ public interface AnvilHandler {
return false; return false;
} }
static void doDrops(World world, BlockPos pos) {
if (!world.isRemote && world.getGameRules().getBoolean("doTileDrops")) {
TileAnvil tile = (TileAnvil) world.getTileEntity(pos);
if (tile != null) {
for (ItemStack stack : tile.getSlotList()) {
if (stack != null) {
float offset = 0.7F;
double offsetX = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetY = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
double offsetZ = world.rand.nextFloat() * offset + (1.0F - offset) * 0.5D;
ItemStack dropStack = null;
if (stack.getItem() instanceof BaseMultiItem) {
BaseMultiItem item = (BaseMultiItem) stack.getItem();
switch (item.getID()) {
case 6:
dropStack = new ItemStack(ModBlocks.ironball, 1);
break;
case 7:
dropStack = new ItemStack(ModBlocks.ironchunk, 1);
break;
case 15:
dropStack = new ItemStack(ModBlocks.ironcleanball, 1);
break;
case 16:
dropStack = new ItemStack(ModBlocks.ironcleanchunk, 1);
break;
case 24:
dropStack = new ItemStack(ModBlocks.steelball, 1);
break;
case 25:
dropStack = new ItemStack(ModBlocks.steelchunk, 1);
break;
case 33:
dropStack = new ItemStack(ModBlocks.wootzball, 1);
break;
case 34:
dropStack = new ItemStack(ModBlocks.wootzchunk, 1);
break;
}
} else {
dropStack = stack;
}
EntityItem itemDrop = new EntityItem(world, pos.getX() + offsetX, pos.getY() + offsetY, pos.getZ() + offsetZ, dropStack);
itemDrop.setDefaultPickupDelay();
world.spawnEntity(itemDrop);
}
}
}
}
}
} }

View File

@@ -7,62 +7,86 @@ import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import nmd.primal.core.api.PrimalItems; import nmd.primal.core.api.PrimalItems;
import nmd.primal.forgecraft.CommonUtils; //import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.core.common.helper.CommonUtils;
import nmd.primal.core.common.helper.PlayerHelper;
import nmd.primal.forgecraft.blocks.CustomContainerFacing; import nmd.primal.forgecraft.blocks.CustomContainerFacing;
import nmd.primal.forgecraft.tiles.TileBreaker; import nmd.primal.forgecraft.tiles.TileBreaker;
import nmd.primal.forgecraft.blocks.CustomContainerFacing.*; import nmd.primal.forgecraft.blocks.CustomContainerFacing.*;
import java.util.concurrent.ThreadLocalRandom; import java.util.concurrent.ThreadLocalRandom;
import static nmd.primal.core.common.helper.CommonUtils.randomCheck;
/** /**
* Created by mminaie on 6/11/17. * Created by mminaie on 6/11/17.
*/ */
public interface BreakerHandler { public interface BreakerHandler {
default void doBreaking (World world, IBlockState state, BlockPos pos, TileBreaker tile){ default void doBreaking (World world, IBlockState state, BlockPos pos, TileBreaker tile){
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.EAST) { if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.EAST) {
if(tile.getCharge() > world.getBlockState(pos.east()).getBlockHardness(world, pos.east())) {
if(tile.getCharge() > getThreshold(world, pos.east())) {
if (world.getBlockState(pos.east()).getBlock() == Blocks.IRON_ORE) { if (world.getBlockState(pos.east()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.east()); world.setBlockToAir(pos.east());
CommonUtils.spawnItemEntityFromWorld(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, ThreadLocalRandom.current().nextInt(1, 2))); PlayerHelper.spawnItemOnGround(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, randomChanceReturn(9, 1, 2)));
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()-1);
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+1);
} }
} else { } else {
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()-10); tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+10);
} }
} }
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.WEST) { if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.WEST) {
if(tile.getCharge() > world.getBlockState(pos.west()).getBlockHardness(world, pos.west())) { if(tile.getCharge() > getThreshold(world, pos.west())) {
if (world.getBlockState(pos.west()).getBlock() == Blocks.IRON_ORE) { if (world.getBlockState(pos.west()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.west()); world.setBlockToAir(pos.west());
CommonUtils.spawnItemEntityFromWorld(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, ThreadLocalRandom.current().nextInt(1, 2))); PlayerHelper.spawnItemOnGround(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, randomChanceReturn(9, 1, 2)));
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+1);
} }
} else { } else {
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()-10); tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+10);
} }
} }
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.SOUTH) { if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.SOUTH) {
if(tile.getCharge() > world.getBlockState(pos.south()).getBlockHardness(world, pos.south())) { if(tile.getCharge() > getThreshold(world, pos.south())) {
if (world.getBlockState(pos.south()).getBlock() == Blocks.IRON_ORE) { if (world.getBlockState(pos.south()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.south()); world.setBlockToAir(pos.south());
CommonUtils.spawnItemEntityFromWorld(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, ThreadLocalRandom.current().nextInt(1, 2))); PlayerHelper.spawnItemOnGround(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, randomChanceReturn(9, 1, 2)));
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+1);
} }
} else { } else {
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()-10); tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+10);
} }
} }
if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.NORTH) { if (state.getValue(CustomContainerFacing.FACING) == EnumFacing.NORTH) {
if(tile.getCharge() > world.getBlockState(pos.north()).getBlockHardness(world, pos.north())) { if(tile.getCharge() > getThreshold(world, pos.north())) {
if (world.getBlockState(pos.north()).getBlock() == Blocks.IRON_ORE) { if (world.getBlockState(pos.north()).getBlock() == Blocks.IRON_ORE) {
world.setBlockToAir(pos.north()); world.setBlockToAir(pos.north());
CommonUtils.spawnItemEntityFromWorld(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, ThreadLocalRandom.current().nextInt(1, 2))); PlayerHelper.spawnItemOnGround(world, pos.east(), new ItemStack(PrimalItems.IRON_DUST, randomChanceReturn(9, 1, 2)));
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+1);
} }
} else { } else {
//tile.getSlotStack(0).damageItem(10, (EntityPlayer) null); //tile.getSlotStack(0).damageItem(10, (EntityPlayer) null);
tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()-10); tile.getSlotStack(0).setItemDamage(tile.getSlotStack(0).getItemDamage()+10);
} }
} }
tile.setCharge(0.0f); tile.setCharge(0.0f);
} }
default float getThreshold(World world, BlockPos pos){
float threshold = world.getBlockState(pos).getBlockHardness(world, pos) * (world.getBlockState(pos).getBlock().getExplosionResistance(null)*5);
if(threshold > 179){
threshold = 178;
}
return threshold;
}
public static int randomChanceReturn(int bound, int output1, int output2)
{
return randomCheck(bound) ? output2 : output1;
}
} }

View File

@@ -2,7 +2,7 @@
"modid": "forgecraft", "modid": "forgecraft",
"name": "Kitsu's Forgecraft", "name": "Kitsu's Forgecraft",
"description": "Forged with sweat and blood", "description": "Forged with sweat and blood",
"version": "1.2.23", "version": "1.2.30",
"mcversion": "1.11.2", "mcversion": "1.11.2",
"url": "", "url": "",
"updateUrl": "", "updateUrl": "",