need to use state with executing state
This commit is contained in:
@@ -3,6 +3,7 @@ package nmd.primal.forgecraft.blocks.Crucibles;
|
|||||||
import net.minecraft.block.BlockContainer;
|
import net.minecraft.block.BlockContainer;
|
||||||
import net.minecraft.block.ITileEntityProvider;
|
import net.minecraft.block.ITileEntityProvider;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
|
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;
|
||||||
@@ -18,7 +19,10 @@ 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.PrimalAPI;
|
||||||
import nmd.primal.core.api.interfaces.IPickup;
|
import nmd.primal.core.api.interfaces.IPickup;
|
||||||
|
import nmd.primal.core.api.interfaces.types.ITypeNBT;
|
||||||
|
import nmd.primal.core.api.interfaces.types.ITypeWood;
|
||||||
import nmd.primal.core.common.helper.NBTHelper;
|
import nmd.primal.core.common.helper.NBTHelper;
|
||||||
import nmd.primal.core.common.helper.PlayerHelper;
|
import nmd.primal.core.common.helper.PlayerHelper;
|
||||||
import nmd.primal.forgecraft.ModInfo;
|
import nmd.primal.forgecraft.ModInfo;
|
||||||
@@ -54,6 +58,18 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider,
|
|||||||
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
|
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
|
||||||
ItemStack pItem = player.inventory.getCurrentItem();
|
ItemStack pItem = player.inventory.getCurrentItem();
|
||||||
ItemStack pItem1 = new ItemStack(pItem.getItem(), 1);
|
ItemStack pItem1 = new ItemStack(pItem.getItem(), 1);
|
||||||
|
/**CLEARS THE INVENTORY**/
|
||||||
|
if(player.isSneaking()){
|
||||||
|
for(int i=0; i<tile.ingList.size(); i++){
|
||||||
|
//if(!tile.ingList.get(i).isEmpty()) {
|
||||||
|
PlayerHelper.spawnItemOnPlayer(world, player, tile.ingList.get(i));
|
||||||
|
tile.ingList.set(i, ItemStack.EMPTY);
|
||||||
|
//}
|
||||||
|
}
|
||||||
|
tile.update();
|
||||||
|
tile.markDirty();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
/**PICKS UP THE CRUCIBLE**/
|
/**PICKS UP THE CRUCIBLE**/
|
||||||
if(pItem.isEmpty()){
|
if(pItem.isEmpty()){
|
||||||
if(!player.isSneaking()) {
|
if(!player.isSneaking()) {
|
||||||
@@ -82,18 +98,7 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/**CLEARS THE INVENTORY**/
|
|
||||||
if(player.isSneaking()){
|
|
||||||
for(int i=0; i<tile.ingList.size(); i++){
|
|
||||||
//if(!tile.ingList.get(i).isEmpty()) {
|
|
||||||
PlayerHelper.spawnItemOnPlayer(world, player, tile.ingList.get(i));
|
|
||||||
tile.ingList.set(i, ItemStack.EMPTY);
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
tile.update();
|
|
||||||
tile.markDirty();
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -152,57 +157,30 @@ public class NBTCrucible extends BlockContainer implements ITileEntityProvider,
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
public void onBlockPlacedBy(World world, BlockPos pos, IBlockState state, EntityLivingBase placer, ItemStack stack)
|
||||||
{
|
|
||||||
if (stack.hasDisplayName())
|
|
||||||
{
|
{
|
||||||
TileEntity tileentity = world.getTileEntity(pos);
|
TileEntity tileentity = world.getTileEntity(pos);
|
||||||
//world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
|
//world.setBlockState(pos, state.withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(false)), 2);
|
||||||
if (tileentity instanceof TileNBTCrucible)
|
if (tileentity instanceof TileNBTCrucible)
|
||||||
{
|
{
|
||||||
//((TileStorageCrate)tileentity).setCustomName(stack.getDisplayName());
|
getActualState(state, world, pos);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*@Override
|
|
||||||
public int getMetaFromState(IBlockState state) {
|
|
||||||
int i = 0;
|
|
||||||
|
|
||||||
if( (state.getValue(PrimalAPI.States.ACTIVE) == false)) {
|
|
||||||
i = 0;
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
if ( (state.getValue(PrimalAPI.States.ACTIVE) == true)) {
|
|
||||||
i = 14;
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
return i;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IBlockState getStateFromMeta(int meta) {
|
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos)
|
||||||
EnumFacing enumfacing;
|
|
||||||
Boolean active;
|
|
||||||
switch (meta & 7)
|
|
||||||
{
|
{
|
||||||
case 0:
|
TileNBTCrucible tile = (TileNBTCrucible) world.getTileEntity(pos);
|
||||||
active = false;
|
if (tile != null && tile instanceof TileNBTCrucible) {
|
||||||
break;
|
System.out.println("Hot:" + tile.getHot() + " Status: " + tile.getStatus());
|
||||||
case 1:
|
if(tile.getHot()){
|
||||||
active = true;
|
return state.withProperty(PrimalAPI.States.ACTIVE, true);
|
||||||
break;
|
|
||||||
default:
|
|
||||||
active = false;
|
|
||||||
}
|
}
|
||||||
|
if(!tile.getHot()){
|
||||||
return this.getDefaultState().withProperty(PrimalAPI.States.ACTIVE, Boolean.valueOf(active));
|
return state.withProperty(PrimalAPI.States.ACTIVE, true);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return state;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected BlockStateContainer createBlockState() {
|
|
||||||
return new BlockStateContainer(this, new IProperty[] {PrimalAPI.States.ACTIVE});
|
|
||||||
}*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int quantityDropped(Random random)
|
public int quantityDropped(Random random)
|
||||||
|
|||||||
@@ -32,8 +32,8 @@ public class ModCrafting{
|
|||||||
new ItemStack(Blocks.IRON_ORE, 1),
|
new ItemStack(Blocks.IRON_ORE, 1),
|
||||||
new ItemStack(ModBlocks.ironball, 1),
|
new ItemStack(ModBlocks.ironball, 1),
|
||||||
100,
|
100,
|
||||||
200,
|
100,
|
||||||
100);
|
1000);
|
||||||
|
|
||||||
/***CASTING BLOCK***/
|
/***CASTING BLOCK***/
|
||||||
RecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.castingblock),
|
RecipeHandler.addShapedOreRecipe(new ItemStack(ModBlocks.castingblock),
|
||||||
|
|||||||
@@ -37,23 +37,23 @@ public class ItemNBTCrucible extends ItemBlock {
|
|||||||
{
|
{
|
||||||
//TODO get the item name
|
//TODO get the item name
|
||||||
if (item.hasTagCompound()) {
|
if (item.hasTagCompound()) {
|
||||||
if (getStatus(item)){
|
if (getHot(item)){
|
||||||
|
//System.out.println("Should be Red");
|
||||||
return 0.1f;
|
return 0.1f;
|
||||||
}
|
}
|
||||||
} else if (item.hasTagCompound()) {
|
}
|
||||||
if (!getStatus(item)){
|
if (item.hasTagCompound()) {
|
||||||
|
if (!getHot(item)){
|
||||||
|
//System.out.println("Should be Brown");
|
||||||
return 0.0f;
|
return 0.0f;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
return 0.0F;
|
|
||||||
}
|
|
||||||
return 0.0F;
|
return 0.0F;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean getStatus(ItemStack stack) {
|
public boolean getHot(ItemStack stack) {
|
||||||
if(!stack.isEmpty()) {
|
if(!stack.isEmpty()) {
|
||||||
if (stack.hasTagCompound()) {
|
if (stack.hasTagCompound()) {
|
||||||
return stack.getSubCompound("BlockEntityTag").getBoolean("hot");
|
return stack.getSubCompound("BlockEntityTag").getBoolean("hot");
|
||||||
@@ -71,11 +71,13 @@ public class ItemNBTCrucible extends ItemBlock {
|
|||||||
NBTTagCompound tag = item.getSubCompound("BlockEntityTag");
|
NBTTagCompound tag = item.getSubCompound("BlockEntityTag");
|
||||||
|
|
||||||
//item.getTagCompound().setTag("BlockEntityTag", tags);
|
//item.getTagCompound().setTag("BlockEntityTag", tags);
|
||||||
System.out.println(tag.getBoolean("hot"));
|
//System.out.println(tag.getBoolean("hot"));
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import net.minecraft.block.state.IBlockState;
|
|||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.OpenGlHelper;
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
import net.minecraft.client.renderer.RenderItem;
|
import net.minecraft.client.renderer.RenderItem;
|
||||||
|
import net.minecraft.client.renderer.block.model.ItemCameraTransforms;
|
||||||
import net.minecraft.client.renderer.texture.TextureMap;
|
import net.minecraft.client.renderer.texture.TextureMap;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||||
import net.minecraft.item.ItemBlock;
|
import net.minecraft.item.ItemBlock;
|
||||||
@@ -68,7 +69,8 @@ public class TileBloomeryRender extends TileEntitySpecialRenderer<TileBloomery>
|
|||||||
if (!stack1.isEmpty()) {
|
if (!stack1.isEmpty()) {
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslated(0, 0.50D, 0);
|
GL11.glTranslated(0, 0.50D, 0);
|
||||||
renderItem.renderItem(stack1, renderItem.getItemModelMesher().getItemModel(stack1));
|
//renderItem.renderItem(stack1, renderItem.getItemModelMesher().getItemModel(stack1));
|
||||||
|
renderItem.renderItem(stack1, ItemCameraTransforms.TransformType.FIXED);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -93,11 +93,17 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
|
|||||||
if (this.getHeat() >= recipe.getCookTemp() &&
|
if (this.getHeat() >= recipe.getCookTemp() &&
|
||||||
!this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")) {
|
!this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")) {
|
||||||
cookCounter++;
|
cookCounter++;
|
||||||
this.getSlotStack(1).getSubCompound("BlockEntityTag").setBoolean("hot", true);
|
//this.getSlotStack(1).getSubCompound("BlockEntityTag").setBoolean("hot", true);
|
||||||
System.out.println("Cooking");
|
System.out.println("Cooking");
|
||||||
this.updateBlock();
|
this.updateBlock();
|
||||||
this.markDirty();
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
if (cookCounter >= (recipe.getCookTime()/4) && !this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")) {
|
||||||
|
this.getSlotStack(1).getSubCompound("BlockEntityTag").setBoolean("hot", true);
|
||||||
|
System.out.println("hot");
|
||||||
|
this.updateBlock();
|
||||||
|
this.markDirty();
|
||||||
|
}
|
||||||
if (cookCounter >= recipe.getCookTime() && !this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")) {
|
if (cookCounter >= recipe.getCookTime() && !this.getSlotStack(1).getSubCompound("BlockEntityTag").getBoolean("status")) {
|
||||||
this.getSlotStack(1).getSubCompound("BlockEntityTag").setBoolean("status", true);
|
this.getSlotStack(1).getSubCompound("BlockEntityTag").setBoolean("status", true);
|
||||||
this.getSlotStack(1).getSubCompound("BlockEntityTag").setInteger("heat", this.getHeat());
|
this.getSlotStack(1).getSubCompound("BlockEntityTag").setInteger("heat", this.getHeat());
|
||||||
|
|||||||
@@ -66,16 +66,17 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
|
|||||||
@Override
|
@Override
|
||||||
public void update () {
|
public void update () {
|
||||||
if (!world.isRemote) {
|
if (!world.isRemote) {
|
||||||
World world = this.getWorld();
|
//World world = this.getWorld();
|
||||||
IBlockState state = world.getBlockState(this.pos);
|
//IBlockState state = world.getBlockState(this.pos);
|
||||||
|
|
||||||
coolManager();
|
coolManager();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void coolManager() {
|
private void coolManager() {
|
||||||
System.out.println(this.getHeat() + " " + this.getStatus() + " " + this.getDrops());
|
System.out.println(this.getHeat() + " " + this.getHot() + " " + this.getDrops());
|
||||||
if(this.getHot()){
|
if(this.getHot()){
|
||||||
System.out.println("Still Hot");
|
//System.out.println("Still Hot");
|
||||||
if(this.getHeat() > 0){
|
if(this.getHeat() > 0){
|
||||||
this.setHeat( this.getHeat() - 1);
|
this.setHeat( this.getHeat() - 1);
|
||||||
System.out.println(this.getHeat());
|
System.out.println(this.getHeat());
|
||||||
|
|||||||
@@ -1,12 +1,19 @@
|
|||||||
{
|
{
|
||||||
"forge_marker":1,
|
"forge_marker":1,
|
||||||
"defaults": {
|
|
||||||
|
"variants": {
|
||||||
|
"normal": { "model": "forgecraft:crucibleshut" },
|
||||||
|
"active=false": {
|
||||||
"textures": {
|
"textures": {
|
||||||
"particle": "forgecraft:blocks/stone_slab",
|
"particle": "forgecraft:blocks/stone_slab",
|
||||||
"texture": "forgecraft:blocks/stone_slab"
|
"texture": "forgecraft:blocks/stone_slab"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"variants": {
|
"active=true": {
|
||||||
"normal": { "model": "forgecraft:crucibleshut" }
|
"textures": {
|
||||||
|
"particle": "forgecraft:blocks/stone_slab_hot",
|
||||||
|
"texture": "forgecraft:blocks/stone_slab_hot"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2,11 +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",
|
||||||
<<<<<<< HEAD
|
|
||||||
"version": "1.4.01",
|
|
||||||
=======
|
|
||||||
"version": "1.4.06",
|
"version": "1.4.06",
|
||||||
>>>>>>> master-1.12
|
|
||||||
"mcversion": "1.12.2",
|
"mcversion": "1.12.2",
|
||||||
"url": "",
|
"url": "",
|
||||||
"updateUrl": "",
|
"updateUrl": "",
|
||||||
|
|||||||
Reference in New Issue
Block a user