Fixed StoneTongs and anvil cooperation, iron ingots can now be cooked

This commit is contained in:
Mohammad-Ali Minaie
2017-03-26 12:52:18 -04:00
parent a8235c01d1
commit 0b1ea6d95e
14 changed files with 104 additions and 61 deletions

View File

@@ -5,7 +5,7 @@ org.gradle.jvmargs=-Xmx3G
mod_group=nmd.primal.forgecraft
mod_name=ForgeCraft
mod_version=1.2.02
mod_version=1.2.03
forge_version=13.20.0.2226
mcp_mappings=snapshot_20161220
mc_version=1.11.2

View File

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

View File

@@ -301,19 +301,19 @@ public class Anvil extends CustomContainerFacing {
}
if (tile.getSlotStack(counter).isEmpty()) {
System.out.println("Activating");
//System.out.println("Activating");
if (pItem.getTagCompound().getInteger("type") == 6) {
System.out.println("Tongs meta = 6");
//System.out.println("Tongs meta = 6");
tile.setSlotStack((counter), new ItemStack(ModItems.ironingotballhot, 1));
pItem.getTagCompound().setInteger("type", 0);
//return true;
}
if (pItem.getTagCompound().getInteger("type") == 7) {
System.out.println("Tongs meta = 7");
//System.out.println("Tongs meta = 7");
tile.setSlotStack((counter), new ItemStack(ModItems.ironchunkhot, 1));
pItem.getTagCompound().setInteger("type", 0);
System.out.println(counter);
System.out.println(tile.getSlotStack(counter));
///System.out.println(counter);
//System.out.println(tile.getSlotStack(counter));
//return true;
}
if (pItem.getTagCompound().getInteger("type") == 8) {
@@ -454,9 +454,9 @@ public class Anvil extends CustomContainerFacing {
}
if (pItem.getItem().equals(Items.DIAMOND)) {
System.out.println("It Is Diamond");
//System.out.println("It Is Diamond");
if (tile.getSlotStack(counter).isEmpty()) {
System.out.println("Slot is empty");
//System.out.println("Slot is empty");
tile.setSlotStack(counter, new ItemStack(pItem.getItem(), 1));
pItem.shrink(1);
return true;
@@ -542,9 +542,9 @@ public class Anvil extends CustomContainerFacing {
@Override
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()), 2);
}
//}
}
@Override

View File

@@ -25,6 +25,7 @@ import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import nmd.primal.forgecraft.CommonUtils;
import nmd.primal.forgecraft.ModInfo;
import nmd.primal.forgecraft.crafting.BloomeryCrafting;
import nmd.primal.forgecraft.tiles.TileBloomery;
import java.util.Random;
@@ -77,9 +78,27 @@ public class Bloomery extends CustomContainerFacing implements ITileEntityProvid
}
if(!player.isSneaking()){
if(world.getBlockState(pos).getValue(ACTIVE) == true){
Integer tempInt = tile.getHeat();
String tempString = tempInt.toString();
ITextComponent itextcomponent = new TextComponentString(tempString);
Integer bloomeryHeat = tile.getHeat();
Integer idealTemp = null;
Integer cookCounter = tile.getCookCounter();
Integer idealCookTime = null;
Integer remainingTime = null;
String stringBloomeryHeat = bloomeryHeat.toString();
String stringIdealTemp = "";
String stringRemainingTime = "";
BloomeryCrafting recipe = BloomeryCrafting.getRecipe(tile.getSlotStack(1));
if(recipe != null) {
idealTemp = recipe.getHeatThreshold();
idealCookTime = recipe.getIdealTime();
stringIdealTemp = idealTemp.toString();
remainingTime = idealCookTime - cookCounter;
stringRemainingTime = remainingTime.toString();
}
ITextComponent itextcomponent = new TextComponentString("Current Temp: " + stringBloomeryHeat + " Ideal Temp: " + stringIdealTemp + " Ticks Remaining: " + stringRemainingTime);
player.sendStatusMessage(itextcomponent, true);
//System.out.println(pos);
return true;

View File

@@ -199,6 +199,16 @@ public class Forge extends CustomContainerFacing implements ITileEntityProvider/
}
}
}
//Needs Ore Dictionary Compat
if (pItem.getItem().equals(new ItemStack(Items.IRON_INGOT).getItem())) {
for (int i = 2; i < 7; i++) {
if (tile.getSlotStack(i).isEmpty()) {
tile.setSlotStack(i, new ItemStack(Items.IRON_INGOT, 1));
pItem.shrink(1);
return true;
}
}
}
if(pItem.getItem() instanceof ToolPart){
if(tile.getSlotStack(4).isEmpty()){

View File

@@ -86,7 +86,7 @@ public class PistonBellows extends CustomContainerFacing {
if ((world.getBlockState(tempPos).getValue(Forge.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.EAST)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 25);
tile.setHeat(tile.getHeat() + 50);
tile.updateBlock();
tile.markDirty();
return true;
@@ -99,9 +99,9 @@ public class PistonBellows extends CustomContainerFacing {
&& (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.EAST)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 25);
tile.setHeat(tile.getHeat() + 50);
if(world.getBlockState(tempPos).getValue(Bloomery.COVERED) == true){
tile.setHeat(tile.getHeat() + 25);
tile.setHeat(tile.getHeat() + 50);
}
tile.updateBlock();
tile.markDirty();
@@ -117,7 +117,7 @@ public class PistonBellows extends CustomContainerFacing {
if ((world.getBlockState(tempPos).getValue(Forge.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.WEST)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 25);
tile.setHeat(tile.getHeat() + 50);
tile.updateBlock();
tile.markDirty();
return true;
@@ -130,9 +130,9 @@ public class PistonBellows extends CustomContainerFacing {
&& (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.WEST)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 25);
tile.setHeat(tile.getHeat() + 50);
if(world.getBlockState(tempPos).getValue(Bloomery.COVERED) == true){
tile.setHeat(tile.getHeat() + 25);
tile.setHeat(tile.getHeat() + 50);
}
tile.updateBlock();
tile.markDirty();
@@ -148,7 +148,7 @@ public class PistonBellows extends CustomContainerFacing {
if ((world.getBlockState(tempPos).getValue(Forge.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.SOUTH)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 25);
tile.setHeat(tile.getHeat() + 50);
tile.updateBlock();
tile.markDirty();
return true;
@@ -161,9 +161,9 @@ public class PistonBellows extends CustomContainerFacing {
&& (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.SOUTH)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 25);
tile.setHeat(tile.getHeat() + 50);
if(world.getBlockState(tempPos).getValue(Bloomery.COVERED) == true){
tile.setHeat(tile.getHeat() + 25);
tile.setHeat(tile.getHeat() + 50);
}
tile.updateBlock();
tile.markDirty();
@@ -179,7 +179,7 @@ public class PistonBellows extends CustomContainerFacing {
if ((world.getBlockState(tempPos).getValue(Forge.ACTIVE) == true) && (world.getBlockState(tempPos).getValue(Forge.FACING) == EnumFacing.NORTH)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 25);
tile.setHeat(tile.getHeat() + 50);
tile.updateBlock();
tile.markDirty();
return true;
@@ -192,9 +192,9 @@ public class PistonBellows extends CustomContainerFacing {
&& (world.getBlockState(tempPos).getValue(Bloomery.FACING) == EnumFacing.NORTH)) {
if (tile != null) {
//System.out.println(world.getBlockState(tempPos).getValue(Forge.FACING));
tile.setHeat(tile.getHeat() + 25);
tile.setHeat(tile.getHeat() + 50);
if(world.getBlockState(tempPos).getValue(Bloomery.COVERED) == true){
tile.setHeat(tile.getHeat() + 25);
tile.setHeat(tile.getHeat() + 50);
}
tile.updateBlock();
tile.markDirty();

View File

@@ -311,8 +311,8 @@ public class ItemStoneTongs extends Item {
else return EnumActionResult.FAIL;
//System.out.println(itemstack.getTagCompound().getInteger("type"));
}
System.out.println(player.getHeldItem(hand).getTagCompound().getInteger("type"));
return EnumActionResult.FAIL;
//System.out.println(player.getHeldItem(hand).getTagCompound().getInteger("type"));
return EnumActionResult.SUCCESS;
}
@@ -320,8 +320,8 @@ public class ItemStoneTongs extends Item {
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack item, EntityPlayer player, List<String> tooltip, boolean advanced)
{
tooltip.add(ChatFormatting.BLUE + "NBT: " + item.getSubCompound("tags"));
tooltip.add(ChatFormatting.RED + "NBT: " + item.getTagCompound().getInteger("type"));
//tooltip.add(ChatFormatting.BLUE + "NBT: " + item.getSubCompound("tags"));
//tooltip.add(ChatFormatting.RED + "NBT: " + item.getTagCompound().getInteger("type"));
}
}

View File

@@ -93,7 +93,9 @@ public class TileAnvilRender extends TileEntitySpecialRenderer<TileAnvil>
if(tile.getSlotStack(counter).getItem().equals(Items.REDSTONE) ||
(tile.getSlotStack(counter).getItem().equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) ||
tile.getSlotStack(counter).getItem().equals(PrimalItems.EMERALD_KNAPP) ||
tile.getSlotStack(counter).getItem().equals(PrimalItems.DIAMOND_KNAPP)
tile.getSlotStack(counter).getItem().equals(PrimalItems.DIAMOND_KNAPP) ||
tile.getSlotStack(counter).getItem().equals(Items.DIAMOND) ||
tile.getSlotStack(counter).getItem().equals(Items.EMERALD)
){
GL11.glPushMatrix();
@@ -169,7 +171,9 @@ public class TileAnvilRender extends TileEntitySpecialRenderer<TileAnvil>
if(tile.getSlotStack(counter).getItem().equals(Items.REDSTONE) ||
(tile.getSlotStack(counter).getItem().equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) ||
tile.getSlotStack(counter).getItem().equals(PrimalItems.EMERALD_KNAPP) ||
tile.getSlotStack(counter).getItem().equals(PrimalItems.DIAMOND_KNAPP)
tile.getSlotStack(counter).getItem().equals(PrimalItems.DIAMOND_KNAPP) ||
tile.getSlotStack(counter).getItem().equals(Items.DIAMOND) ||
tile.getSlotStack(counter).getItem().equals(Items.EMERALD)
){
GL11.glPushMatrix();
GL11.glTranslated( tile.getReverseX(a), -0.49D, tile.getReverseZ(i) );
@@ -244,7 +248,9 @@ public class TileAnvilRender extends TileEntitySpecialRenderer<TileAnvil>
if(tile.getSlotStack(counter).getItem().equals(Items.REDSTONE) ||
(tile.getSlotStack(counter).getItem().equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) ||
tile.getSlotStack(counter).getItem().equals(PrimalItems.EMERALD_KNAPP) ||
tile.getSlotStack(counter).getItem().equals(PrimalItems.DIAMOND_KNAPP)
tile.getSlotStack(counter).getItem().equals(PrimalItems.DIAMOND_KNAPP) ||
tile.getSlotStack(counter).getItem().equals(Items.DIAMOND) ||
tile.getSlotStack(counter).getItem().equals(Items.EMERALD)
){
GL11.glPushMatrix();
GL11.glTranslated( tile.getNormalX(a), -0.49D, tile.getReverseZ(i) );
@@ -322,7 +328,9 @@ public class TileAnvilRender extends TileEntitySpecialRenderer<TileAnvil>
if(tile.getSlotStack(counter).getItem().equals(Items.REDSTONE) ||
(tile.getSlotStack(counter).getItem().equals(Items.DYE) && tile.getSlotStack(counter).getItemDamage() == EnumDyeColor.BLUE.getDyeDamage()) ||
tile.getSlotStack(counter).getItem().equals(PrimalItems.EMERALD_KNAPP) ||
tile.getSlotStack(counter).getItem().equals(PrimalItems.DIAMOND_KNAPP)
tile.getSlotStack(counter).getItem().equals(PrimalItems.DIAMOND_KNAPP) ||
tile.getSlotStack(counter).getItem().equals(Items.DIAMOND) ||
tile.getSlotStack(counter).getItem().equals(Items.EMERALD)
){
GL11.glPushMatrix();
GL11.glTranslated( tile.getReverseX(a), -0.49D, tile.getNormalZ(i) );

View File

@@ -6,6 +6,7 @@ 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.tileentity.TileEntitySpecialRenderer;
import net.minecraft.init.Items;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.math.BlockPos;
@@ -66,11 +67,23 @@ public class TileForgeRender extends TileEntitySpecialRenderer<TileForge>
GL11.glTranslated(0.0F, 0.1D, 0.0F);
if(i == 2){
GL11.glTranslated(-0.3, -0.05D, -0.3D);
if(tile.getSlotStack(i).getItem() == Items.IRON_INGOT){
GL11.glScalef(0.5f, 0.5f, 0.5f);
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
}
}
if(i == 3){
GL11.glTranslated(-0.3, -0.05D, 0.3D);
if(tile.getSlotStack(i).getItem() == Items.IRON_INGOT){
GL11.glScalef(0.5f, 0.5f, 0.5f);
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
}
}
if(i == 4){
if(tile.getSlotStack(i).getItem() == Items.IRON_INGOT){
GL11.glScalef(0.5f, 0.5f, 0.5f);
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
}
//GL11.glScalef(0.6F, 0.6F, 0.6F);
if(tile.getSlotStack(i).getItem() == ModItems.pickaxehead) {
GL11.glRotated(180.0F, 0.0F, 1.0F, 0.0F);
@@ -89,9 +102,17 @@ public class TileForgeRender extends TileEntitySpecialRenderer<TileForge>
}
if(i == 5){
GL11.glTranslated(0.3, -0.05D, -0.3D);
if(tile.getSlotStack(i).getItem() == Items.IRON_INGOT){
GL11.glScalef(0.5f, 0.5f, 0.5f);
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
}
}
if(i == 6){
GL11.glTranslated(0.3, -0.05D, 0.3D);
if(tile.getSlotStack(i).getItem() == Items.IRON_INGOT){
GL11.glScalef(0.5f, 0.5f, 0.5f);
GL11.glRotated(90.0F, 1.0f, 0.0f, 0.0f);
}
}
renderItem.renderItem(tile.getSlotStack(i), ItemCameraTransforms.TransformType.FIXED);
@@ -100,24 +121,6 @@ public class TileForgeRender extends TileEntitySpecialRenderer<TileForge>
}
}
/*if (!stack1.isEmpty()) {
int stackRotation = stack1.getCount();
GL11.glPushMatrix();
GL11.glScalef(scale, scale, scale);
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
renderItem.renderItem(stack1, renderItem.getItemModelMesher().getItemModel(stack1));
GL11.glPopMatrix();
for(int i = 0; i < Math.ceil(stackRotation/8) + 1; i++){
GL11.glPushMatrix();
GL11.glScalef(scale, scale, scale);
GL11.glRotated(45.0F * i, 0.0F, 1.0F, 0.0F);
GL11.glRotated(90.0F, 1.0F, 0.0F, 0.0F);
GL11.glTranslated(xTrans, yTrans, 0.0D);
renderItem.renderItem(stack1, renderItem.getItemModelMesher().getItemModel(stack1));
GL11.glPopMatrix();
}
}*/
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, prevLGTX, prevLGTY);
GL11.glPopMatrix();
}

View File

@@ -40,7 +40,7 @@ public class TilePistonBellowsRender extends TileEntitySpecialRenderer<TilePisto
GL11.glRotated(0, 0.0F, 1.0F, 0.0F);
if(state.getValue(PistonBellows.ACTIVE) == Boolean.TRUE){
//System.out.println(tile.getAnimation());
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation()/75);
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation()/25);
}
ItemStack stackToRender = new ItemStack(ModItems.pistonbellows, 1);
renderItem.renderItem(stackToRender, renderItem.getItemModelMesher().getItemModel(stackToRender));
@@ -50,7 +50,7 @@ public class TilePistonBellowsRender extends TileEntitySpecialRenderer<TilePisto
GL11.glRotated(180, 0.0F, 1.0F, 0.0F);
if(state.getValue(PistonBellows.ACTIVE) == Boolean.TRUE){
//System.out.println(tile.getAnimation());
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation()/80);
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation()/25);
}
ItemStack stackToRender = new ItemStack(ModItems.pistonbellows, 1);
renderItem.renderItem(stackToRender, renderItem.getItemModelMesher().getItemModel(stackToRender));
@@ -61,7 +61,7 @@ public class TilePistonBellowsRender extends TileEntitySpecialRenderer<TilePisto
GL11.glRotated(270, 0.0F, 1.0F, 0.0F);
if(state.getValue(PistonBellows.ACTIVE) == Boolean.TRUE){
//System.out.println(tile.getAnimation());
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation()/80);
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation()/25);
}
ItemStack stackToRender = new ItemStack(ModItems.pistonbellows, 1);
renderItem.renderItem(stackToRender, renderItem.getItemModelMesher().getItemModel(stackToRender));
@@ -72,7 +72,7 @@ public class TilePistonBellowsRender extends TileEntitySpecialRenderer<TilePisto
GL11.glRotated(90, 0.0F, 1.0F, 0.0F);
if(state.getValue(PistonBellows.ACTIVE) == Boolean.TRUE){
//System.out.println(tile.getAnimation());
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation()/80);
GL11.glTranslated(0.0D, 0, (double) tile.getAnimation()/25);
}
ItemStack stackToRender = new ItemStack(ModItems.pistonbellows, 1);
renderItem.renderItem(stackToRender, renderItem.getItemModelMesher().getItemModel(stackToRender));

View File

@@ -124,6 +124,9 @@ public class TileBloomery extends TileBaseSlot implements ITickable {
public void setHeat(int newHeat){
this.heat = newHeat;
}
public int getCookCounter() {return this.cookCounter; }
@Override
public int getSlotLimit() {
return 1;

View File

@@ -23,18 +23,18 @@ public class TilePistonBellows extends BaseTile implements ITickable{
IBlockState state = world.getBlockState(this.pos);
if (world.getBlockState(this.getPos()).getValue(PistonBellows.ACTIVE)) {
iteration++;
if(iteration <= 30){
if(iteration <= 15){
animateIteration++;
//
}
if(iteration > 30){
animateIteration = 30 - (iteration - 30);
if(iteration > 15){
animateIteration = 15 - (iteration - 15);
if(animateIteration < 0){
animateIteration = 0;
}
//
}
if(iteration > 61){
if(iteration > 31){
iteration = 0;
animateIteration = 0;
world.setBlockState(this.getPos(), state.withProperty(PistonBellows.ACTIVE, false), 3);

View File

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