fixed rendering issue with placing crucible again aslo it wont change color

This commit is contained in:
Mohammad-Ali Minaie
2018-02-25 16:20:26 -05:00
parent ebad0995ef
commit 4bb3b25286
5 changed files with 28 additions and 21 deletions

View File

@@ -120,7 +120,7 @@ public class ModBlocks {
public static void init() { public static void init() {
//FISH_TRAP = RegistryHelper.addBlock("fish_trap", new FishTrap(), ItemFishTraps::new, "fishtrap"); //FISH_TRAP = RegistryHelper.addBlock("fish_trap", new FishTrap(), ItemFishTraps::new, "fishtrap");
nbtCrucible = new NBTCrucible(Material.ROCK, "nbtCrucible"); nbtCrucible = new NBTCrucible(Material.ROCK, "nbtcrucible");
forge_brick = new Forge(Material.ROCK, "forge_brick", 5000); forge_brick = new Forge(Material.ROCK, "forge_brick", 5000);
forge_adobe = new Forge(Material.ROCK, "forge_adobe", 5000); forge_adobe = new Forge(Material.ROCK, "forge_adobe", 5000);
bloomery_brick = new BloomeryBase(Material.ROCK, "bloomery_brick", 5000); bloomery_brick = new BloomeryBase(Material.ROCK, "bloomery_brick", 5000);
@@ -513,7 +513,7 @@ public class ModBlocks {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public static void registerRenders() { public static void registerRenders() {
registerRender(nbtCrucible); //registerRender(nbtCrucible);
registerRender(forge_brick); registerRender(forge_brick);
registerRender(forge_adobe); registerRender(forge_adobe);
registerRender(castingform); registerRender(castingform);

View File

@@ -5,6 +5,8 @@ import net.minecraft.entity.Entity;
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.item.IItemPropertyGetter; import net.minecraft.item.IItemPropertyGetter;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
@@ -20,14 +22,15 @@ import javax.annotation.Nullable;
/** /**
* Created by mminaie on 2/7/18. * Created by mminaie on 2/7/18.
*/ */
public class ItemNBTCrucible extends AbstractItemBlock { public class ItemNBTCrucible extends ItemBlock {
public ItemNBTCrucible(String name, Block block) { public ItemNBTCrucible(String name, Block block) {
super(block); super(block);
//super();
this.setUnlocalizedName(name); this.setUnlocalizedName(name);
this.setRegistryName(name); this.setRegistryName(name);
this.setCreativeTab(ModInfo.TAB_FORGECRAFT); this.setCreativeTab(ModInfo.TAB_FORGECRAFT);
/*this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() { this.addPropertyOverride(new ResourceLocation("type"), new IItemPropertyGetter() {
@SideOnly(Side.CLIENT) @SideOnly(Side.CLIENT)
public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn) public float apply(ItemStack item, @Nullable World worldIn, @Nullable EntityLivingBase entityIn)
@@ -37,24 +40,23 @@ public class ItemNBTCrucible extends AbstractItemBlock {
if (getStatus(item)){ if (getStatus(item)){
return 0.1f; return 0.1f;
} }
} else if (item.hasTagCompound()) {
if (!getStatus(item)){
return 0.0f;
}
}
else {
return 0.0F;
} }
return 0.0F; return 0.0F;
} }
}); });
"overrides": [
{"predicate": {"type": 0.0},"model": "forgecraft:item/nbtcrucible/nbtcrucible_0"},
{"predicate": {"type": 0.1},"model": "forgecraft:item/nbtcrucible/nbtcrucible_1"}
]
*/
} }
public boolean getStatus(ItemStack stack) { public boolean getStatus(ItemStack stack) {
if(!stack.isEmpty()) { if(!stack.isEmpty()) {
if (stack.hasTagCompound()) { if (stack.hasTagCompound()) {
if (stack.getSubCompound("tags") != null) { return stack.getSubCompound("BlockEntityTag").getBoolean("hot");
return stack.getSubCompound("BlockEntityTag").getBoolean("status");
}
} }
} }
return false; return false;
@@ -63,13 +65,13 @@ public class ItemNBTCrucible extends AbstractItemBlock {
@Override @Override
public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) { public void onUpdate(ItemStack item, World world, Entity player, int itemSlot, boolean isSelected) {
if(!world.isRemote) { if(!world.isRemote) {
System.out.println("We doin it?"); //System.out.println("We doin it?");
if (!item.hasTagCompound()) { if (item.hasTagCompound()) {
//item.setTagCompound(new NBTTagCompound()); //item.setTagCompound(new NBTTagCompound());
NBTTagCompound tag = item.getSubCompound("BlockEntityTag"); NBTTagCompound tag = item.getSubCompound("BlockEntityTag");
//item.getTagCompound().setTag("BlockEntityTag", tags); //item.getTagCompound().setTag("BlockEntityTag", tags);
System.out.println(tag); System.out.println(tag.getBoolean("hot"));
} }

View File

@@ -84,6 +84,7 @@ public class TileNBTCrucible extends BaseTile implements ITickable {
this.setHot(false); this.setHot(false);
CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4)); CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));
this.setDrops(recipe.getDropsCooked()); this.setDrops(recipe.getDropsCooked());
this.setStatus(false);
System.out.println("Ready to harvest: " + this.getDrops()); System.out.println("Ready to harvest: " + this.getDrops());
} }
//CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4)); //CrucibleCrafting recipe = CrucibleCrafting.getRecipe(ingList.get(0), ingList.get(1), ingList.get(2), ingList.get(3), ingList.get(4));

View File

@@ -7,7 +7,6 @@
} }
}, },
"variants": { "variants": {
"normal": { "model": "forgecraft:crucibleshut" }, "normal": { "model": "forgecraft:crucibleshut" }
"inventory": { "model": "forgecraft:item/itemnbtcrucible" }
} }
} }

View File

@@ -1,8 +1,13 @@
{ {
"forge_marker":1, "parent": "forgecraft:block/crucibleshut",
"textures": { "textures": {
"particle": "forgecraft:blocks/stone_slab", "particle": "forgecraft:blocks/stone_slab",
"texture": "forgecraft:blocks/stone_slab" "texture": "forgecraft:blocks/stone_slab"
}, },
"parent": "forgecraft:block/crucibleshut" "overrides": [
{"predicate": {"type": 0.0},"model": "forgecraft:item/nbtcrucible/nbtcrucible_0"},
{"predicate": {"type": 0.1},"model": "forgecraft:item/nbtcrucible/nbtcrucible_1"}
]
} }