Ported all the mod specific crafting logic
parent
cdb70c2521
commit
0f6f37dffe
|
@ -0,0 +1,53 @@
|
|||
--- src/ContainerWorkbench.java.bak 2025-04-11 18:43:26.890089061 +0300
|
||||
+++ src/ContainerWorkbench.java 2025-04-12 00:23:15.720541808 +0300
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
||||
-import java.util.List;
|
||||
+import net.minecraft.src.finalbeta.ModConfig;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// Container, InventoryCrafting, InventoryCraftResult, SlotCrafting,
|
||||
@@ -51,6 +51,41 @@
|
||||
|
||||
public void onCraftMatrixChanged(IInventory iinventory)
|
||||
{
|
||||
+ if (ModConfig.ENABLE_REPAIR.get()) {
|
||||
+ ItemStack resultItem = null;
|
||||
+ int defaultDamage = 0;
|
||||
+ int damage = 0;
|
||||
+
|
||||
+ for (int i = 0; i < iinventory.getSizeInventory(); i++) {
|
||||
+ ItemStack itemStack = iinventory.getStackInSlot(i);
|
||||
+ if ((itemStack != null && itemStack.getMaxDamage() <= 0) || (itemStack != null && resultItem != null && itemStack.itemID != resultItem.itemID)) {
|
||||
+ resultItem = null;
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
+ if (itemStack != null && itemStack.getMaxDamage() > 0) {
|
||||
+ if (resultItem == null) {
|
||||
+ resultItem = new ItemStack(itemStack.itemID, 1, itemStack.getItemDamage());
|
||||
+ defaultDamage = itemStack.getMaxDamage() - itemStack.getItemDamage();
|
||||
+ }
|
||||
+ else if (itemStack.itemID == resultItem.itemID) {
|
||||
+ damage += itemStack.getMaxDamage() - itemStack.getItemDamage();
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (resultItem != null && damage > 0) {
|
||||
+ int newDurability = (int) (defaultDamage + damage + Math.floor(resultItem.getMaxDamage() / 20));
|
||||
+ newDurability = Math.min(newDurability, resultItem.getMaxDamage());
|
||||
+
|
||||
+ if (newDurability != defaultDamage) {
|
||||
+ resultItem.setItemDamage(resultItem.getMaxDamage() - newDurability);
|
||||
+ this.craftResult.setInventorySlotContents(0, resultItem);
|
||||
+ return;
|
||||
+ }
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
craftResult.setInventorySlotContents(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix));
|
||||
}
|
||||
|
|
@ -0,0 +1,31 @@
|
|||
--- src/PlayerController.java.bak 2025-04-11 18:43:30.677039594 +0300
|
||||
+++ src/PlayerController.java 2025-04-11 23:53:11.890475046 +0300
|
||||
@@ -5,6 +5,7 @@
|
||||
package net.minecraft.src;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
+import net.minecraft.src.finalbeta.ModConfig;
|
||||
|
||||
// Referenced classes of package net.minecraft.src:
|
||||
// World, Block, ItemStack, EntityPlayer,
|
||||
@@ -99,6 +100,20 @@
|
||||
public boolean sendPlaceBlock(EntityPlayer entityplayer, World world, ItemStack itemstack, int i, int j, int k, int l)
|
||||
{
|
||||
int i1 = world.getBlockId(i, j, k);
|
||||
+
|
||||
+ if (ModConfig.EDIT_SIGNS.get()) {
|
||||
+ boolean isSign = i1 == Block.signPost.blockID || i1 == Block.signWall.blockID;
|
||||
+ if (isSign && entityplayer.isSneaking()) {
|
||||
+ TileEntitySign signTile = (TileEntitySign) world.getBlockTileEntity(i, j, k);
|
||||
+ entityplayer.displayGUIEditSign(signTile);
|
||||
+ return true;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ if (itemstack != null && itemstack.itemID == Item.sign.shiftedIndex && i1 == Block.chest.blockID) {
|
||||
+ return itemstack.useItem(entityplayer, world, i, j, k, l);
|
||||
+ }
|
||||
+
|
||||
if(i1 > 0 && Block.blocksList[i1].blockActivated(world, i, j, k, entityplayer))
|
||||
{
|
||||
return true;
|
|
@ -1,5 +1,5 @@
|
|||
--- src/TileEntityFurnace.java.bak 2025-04-11 18:43:32.031021908 +0300
|
||||
+++ src/TileEntityFurnace.java 2025-04-11 21:05:29.546392660 +0300
|
||||
+++ src/TileEntityFurnace.java 2025-04-12 00:37:21.771766954 +0300
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
package net.minecraft.src;
|
||||
|
@ -23,7 +23,25 @@
|
|||
public void readFromNBT(NBTTagCompound nbttagcompound)
|
||||
{
|
||||
super.readFromNBT(nbttagcompound);
|
||||
@@ -135,6 +144,14 @@
|
||||
@@ -87,6 +96,8 @@
|
||||
furnaceBurnTime = nbttagcompound.getShort("BurnTime");
|
||||
furnaceCookTime = nbttagcompound.getShort("CookTime");
|
||||
currentItemBurnTime = getItemBurnTime(furnaceItemStacks[1]);
|
||||
+
|
||||
+ this.currentItemBurnTime = nbttagcompound.getInteger("FuelTime");
|
||||
}
|
||||
|
||||
public void writeToNBT(NBTTagCompound nbttagcompound)
|
||||
@@ -107,6 +118,8 @@
|
||||
}
|
||||
|
||||
nbttagcompound.setTag("Items", nbttaglist);
|
||||
+
|
||||
+ nbttagcompound.setInteger("FuelTime", this.currentItemBurnTime);
|
||||
}
|
||||
|
||||
public int getInventoryStackLimit()
|
||||
@@ -135,6 +148,14 @@
|
||||
|
||||
public void updateEntity()
|
||||
{
|
||||
|
@ -38,7 +56,7 @@
|
|||
boolean flag = furnaceBurnTime > 0;
|
||||
boolean flag1 = false;
|
||||
if(furnaceBurnTime > 0)
|
||||
@@ -151,6 +168,13 @@
|
||||
@@ -151,6 +172,13 @@
|
||||
flag1 = true;
|
||||
if(furnaceItemStacks[1] != null)
|
||||
{
|
||||
|
@ -52,7 +70,7 @@
|
|||
if(furnaceItemStacks[1].getItem().hasContainerItem())
|
||||
{
|
||||
furnaceItemStacks[1] = new ItemStack(furnaceItemStacks[1].getItem().getContainerItem());
|
||||
@@ -250,6 +274,11 @@
|
||||
@@ -250,6 +278,11 @@
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
@ -64,7 +82,7 @@
|
|||
int i = itemstack.getItem().shiftedIndex;
|
||||
if(i < 256 && Block.blocksList[i].blockMaterial == Material.wood)
|
||||
{
|
||||
@@ -289,4 +318,5 @@
|
||||
@@ -289,4 +322,5 @@
|
||||
public int furnaceBurnTime;
|
||||
public int currentItemBurnTime;
|
||||
public int furnaceCookTime;
|
||||
|
|
|
@ -52,30 +52,38 @@ public class mod_FinalBeta extends BaseMod {
|
|||
if (ModConfig.FIX_SHOVEL_EFFECTIVENESS.get()) {
|
||||
this.addEffectiveTool(SHOVEL_BLOCKS, Item.shovelDiamond, Item.shovelGold, Item.shovelSteel, Item.shovelStone, Item.shovelWood);
|
||||
}
|
||||
|
||||
if (ModConfig.ENABLE_WHITE_WOOL_RECIPE.get()) {
|
||||
for (int colorId = 0; colorId < 16; ++colorId) {
|
||||
ModLoader.AddShapelessRecipe(new ItemStack(Block.cloth, 1, 0), new Object[] {new ItemStack(Block.cloth, 1, BlockCloth.func_21034_c(colorId)), new ItemStack(Item.dyePowder, 1, 15)});
|
||||
}
|
||||
}
|
||||
|
||||
if (ModConfig.ENABLE_COAL_AND_REDSTONE_BLOCKS_RECIPE.get()) {
|
||||
ModLoader.AddRecipe(new ItemStack(ModBlock.COAL_BLOCK, 1, 0), new Object[] {"###", "###", "###", '#', Item.coal});
|
||||
ModLoader.AddShapelessRecipe(new ItemStack(Item.coal, 9), new Object[] {new ItemStack(ModBlock.COAL_BLOCK, 1)});
|
||||
ModLoader.AddRecipe(new ItemStack(ModBlock.REDSTONE_BLOCK, 1, 0), new Object[] {"###", "###", "###", '#', Item.redstone});
|
||||
ModLoader.AddShapelessRecipe(new ItemStack(Item.redstone, 9), new Object[] {new ItemStack(ModBlock.REDSTONE_BLOCK, 1)});
|
||||
}
|
||||
|
||||
if (ModConfig.FIX_SLABS_RECIPE.get()) {
|
||||
for (Object recipeObj : CraftingManager.getInstance().getRecipeList()) {
|
||||
IRecipe recipe = (IRecipe) recipeObj;
|
||||
ItemStack itemStack = recipe.getRecipeOutput();
|
||||
if (itemStack.getItem() instanceof ItemSlab) {
|
||||
itemStack.stackSize = 6;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean OnTickInGame(Minecraft minecraft) {
|
||||
|
||||
// DEBUG stuff
|
||||
if (this.canPressKey(Keyboard.KEY_O)) {
|
||||
// minecraft.thePlayer.dropItem(Item.coal.shiftedIndex, 64);
|
||||
// minecraft.thePlayer.dropItem(Item.bucketLava.shiftedIndex, 1);
|
||||
// minecraft.thePlayer.dropItem(Block.oreGold.blockID, 64);
|
||||
// minecraft.thePlayer.dropItem(Block.stoneOvenIdle.blockID, 1);
|
||||
// minecraft.thePlayer.dropItem(ModBlock.COAL_BLOCK.blockID, 1);
|
||||
|
||||
minecraft.thePlayer.dropItem(Block.ladder.blockID, 64);
|
||||
|
||||
// minecraft.thePlayer.dropItem(Block.grass.blockID, 2);
|
||||
// minecraft.thePlayer.dropItem(Block.fence.blockID, 64);
|
||||
|
||||
// minecraft.thePlayer.dropItem(Item.boat.shiftedIndex, 1);
|
||||
// minecraft.thePlayer.dropItem(Item.helmetDiamond.shiftedIndex, 1);
|
||||
// minecraft.thePlayer.dropItem(Item.legsDiamond.shiftedIndex, 1);
|
||||
// minecraft.thePlayer.dropItem(Item.plateDiamond.shiftedIndex, 1);
|
||||
// minecraft.thePlayer.dropItem(Item.bootsDiamond.shiftedIndex, 1);
|
||||
|
||||
minecraft.theWorld.setWorldTime(0);
|
||||
// minecraft.thePlayer.dropItem(Item.coal.shiftedIndex, 64);
|
||||
// minecraft.theWorld.setWorldTime(0);
|
||||
}
|
||||
else {
|
||||
if (keyTimer > 0) {
|
||||
|
|
Loading…
Reference in New Issue