mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-25 14:24:42 +00:00
Fix item and block localization. This is a world breaking change!
This commit is contained in:
1 parent
5fcc76a2fa
commit
83789ae8f7
78 files changed
+1119
-1120
No files matched your search
@@ -30,10 +30,10 @@ public class EventHandlerFarming {
|
||||
return;
|
||||
|
||||
Block block = event.world.getBlock(event.x, event.y, event.z);
|
||||
if (block != ForestryBlock.mushroom)
|
||||
if (!ForestryBlock.mushroom.isBlockEqual(block))
|
||||
return;
|
||||
|
||||
((BlockMushroom) ForestryBlock.mushroom).func_149878_d(event.world, event.x, event.y, event.z, event.world.rand);
|
||||
((BlockMushroom) ForestryBlock.mushroom.block()).func_149878_d(event.world, event.x, event.y, event.z, event.world.rand);
|
||||
event.setResult(Result.ALLOW);
|
||||
}
|
||||
}
|
||||
@@ -18,10 +18,10 @@ import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.core.gadgets.IStructureBlockItem;
|
||||
import forestry.core.utils.StringUtil;
|
||||
import forestry.farming.gadgets.TileFarm.EnumFarmBlock;
|
||||
|
||||
public class ItemFarmBlock extends ItemBlock implements IStructureBlockItem {
|
||||
|
||||
public ItemFarmBlock(Block block) {
|
||||
super(block);
|
||||
setHasSubtypes(true);
|
||||
@@ -32,7 +32,7 @@ public class ItemFarmBlock extends ItemBlock implements IStructureBlockItem {
|
||||
return i;
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "rawtypes", "unchecked" })
|
||||
@SuppressWarnings({"rawtypes", "unchecked"})
|
||||
@Override
|
||||
public void addInformation(ItemStack itemstack, EntityPlayer player, List info, boolean par4) {
|
||||
if (!itemstack.hasTagCompound())
|
||||
@@ -41,13 +41,8 @@ public class ItemFarmBlock extends ItemBlock implements IStructureBlockItem {
|
||||
info.add(EnumFarmBlock.getFromCompound(itemstack.getTagCompound()).getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack itemstack) {
|
||||
return StringUtil.localize(getUnlocalizedName(itemstack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack itemstack) {
|
||||
return "tile.ffarm." + itemstack.getItemDamage();
|
||||
return super.getUnlocalizedName(itemstack) + "." + itemstack.getItemDamage();
|
||||
}
|
||||
}
|
||||
@@ -30,7 +30,7 @@ public class CropPeat extends Crop {
|
||||
|
||||
@Override
|
||||
protected boolean isCrop(Vect pos) {
|
||||
return getBlock(pos) == ForestryBlock.soil && (getBlockMeta(pos) & 0x03) == 1;
|
||||
return ForestryBlock.soil.isBlockEqual(getBlock(pos)) && (getBlockMeta(pos) & 0x03) == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,9 +46,9 @@ public class FarmLogicArboreal extends FarmLogicHomogenous {
|
||||
}
|
||||
|
||||
public FarmLogicArboreal(IFarmHousing housing) {
|
||||
super(housing, new ItemStack[] { new ItemStack(Blocks.dirt) }, new ItemStack[] { new ItemStack(ForestryBlock.soil, 1, 0),
|
||||
new ItemStack(ForestryBlock.soil, 1, Defaults.WILDCARD) }, new ItemStack[] { new ItemStack(Blocks.sand) }, Farmables.farmables.get(
|
||||
"farmArboreal").toArray(new IFarmable[0]));
|
||||
super(housing, new ItemStack[]{new ItemStack(Blocks.dirt)},
|
||||
new ItemStack[]{ForestryBlock.soil.getItemStack(), ForestryBlock.soil.getItemStack(1, Defaults.WILDCARD)},
|
||||
new ItemStack[]{new ItemStack(Blocks.sand)}, Farmables.farmables.get("farmArboreal").toArray(new IFarmable[0]));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -222,10 +222,9 @@ public class FarmLogicArboreal extends FarmLogicHomogenous {
|
||||
//ForgeDirection reverse = direction.getOpposite();
|
||||
Vect soilBelow = new Vect(position.x, position.y - 1, position.z);
|
||||
//Vect soilPrevious = new Vect(position.x * reverse.offsetX, position.y - 1, position.z * reverse.offsetZ);
|
||||
for (ItemStack grnd : ground) {
|
||||
if(StackUtils.isIdenticalItem(grnd, getAsItemStack(soilBelow)))
|
||||
for (ItemStack grnd : ground)
|
||||
if (StackUtils.isIdenticalItem(grnd, getAsItemStack(soilBelow)))
|
||||
return plantSapling(position);
|
||||
}
|
||||
//if (!ground[0].itemID == getAsItemStack(soilPrevious).itemID && ground[0].itemID == getAsItemStack(soilBelow).itemID)
|
||||
|
||||
//if (ground[0].isItemEqual(getAsItemStack(soilBelow)))
|
||||
|
||||
@@ -32,8 +32,9 @@ import forestry.core.utils.Vect;
|
||||
public class FarmLogicPeat extends FarmLogicWatered {
|
||||
|
||||
public FarmLogicPeat(IFarmHousing housing) {
|
||||
super(housing, new ItemStack[] { new ItemStack(ForestryBlock.soil, 1, 1) },
|
||||
new ItemStack[] { new ItemStack(ForestryBlock.soil, 1, 1) }, new ItemStack[] { new ItemStack(Blocks.dirt), new ItemStack(Blocks.grass) });
|
||||
super(housing, new ItemStack[]{ForestryBlock.soil.getItemStack(1, 1)},
|
||||
new ItemStack[]{ForestryBlock.soil.getItemStack(1, 1)},
|
||||
new ItemStack[]{new ItemStack(Blocks.dirt), new ItemStack(Blocks.grass)});
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -64,16 +65,16 @@ public class FarmLogicPeat extends FarmLogicWatered {
|
||||
Vect position = translateWithOffset(x, y, z, direction, i);
|
||||
ItemStack occupant = getAsItemStack(position);
|
||||
|
||||
if (StackUtils.getBlock(occupant) != ForestryBlock.soil)
|
||||
if (!ForestryBlock.soil.isBlockEqual(StackUtils.getBlock(occupant)))
|
||||
continue;
|
||||
int type = occupant.getItemDamage() & 0x03;
|
||||
int maturity = occupant.getItemDamage() >> 2;
|
||||
|
||||
if (type != 1)
|
||||
continue;
|
||||
if (type != 1)
|
||||
continue;
|
||||
|
||||
if (maturity >= 3)
|
||||
crops.push(new CropPeat(world, position));
|
||||
if (maturity >= 3)
|
||||
crops.push(new CropPeat(world, position));
|
||||
|
||||
}
|
||||
return crops;
|
||||
|
||||
@@ -30,7 +30,7 @@ public class FarmableGE implements IFarmable {
|
||||
if (world.isAirBlock(x, y, z))
|
||||
return false;
|
||||
|
||||
return world.getBlock(x, y, z) == ForestryBlock.saplingGE;
|
||||
return ForestryBlock.saplingGE.isBlockEqual(world, x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -45,7 +45,7 @@ public class FarmableVanillaShroom extends FarmableGenericSapling {
|
||||
meta = 1;
|
||||
|
||||
Proxies.common.addBlockPlaceEffects(world, x, y, z, Blocks.brown_mushroom, 0);
|
||||
return world.setBlock(x, y, z, ForestryBlock.mushroom, meta, Defaults.FLAG_BLOCK_SYNCH);
|
||||
return ForestryBlock.mushroom.setBlock(world, x, y, z, meta, Defaults.FLAG_BLOCK_SYNCH);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,7 +10,6 @@
|
||||
******************************************************************************/
|
||||
package forestry.farming.proxy;
|
||||
|
||||
import net.minecraft.item.Item;
|
||||
|
||||
import cpw.mods.fml.client.registry.RenderingRegistry;
|
||||
|
||||
@@ -28,6 +27,6 @@ public class ClientProxyFarming extends ProxyFarming {
|
||||
PluginFarming.modelIdFarmBlock = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
RenderingRegistry.registerBlockHandler(new FarmRenderingHandler());
|
||||
MinecraftForgeClient.registerItemRenderer(Item.getItemFromBlock(ForestryBlock.farm), new FarmItemRenderer());
|
||||
MinecraftForgeClient.registerItemRenderer(ForestryBlock.farm.item(), new FarmItemRenderer());
|
||||
}
|
||||
}
|
||||
@@ -31,7 +31,7 @@ public class FarmRenderingHandler extends OverlayRenderingHandler {
|
||||
|
||||
// Render the plain block.
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
renderFarmOverlay(world, (BlockFarm) ForestryBlock.farm, x, y, z, renderer, 0xffffff);
|
||||
renderFarmOverlay(world, (BlockFarm) ForestryBlock.farm.block(), x, y, z, renderer, 0xffffff);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user