Compare commits

...
10 changed files with 104 additions and 21 deletions

No files matched your search

+1
View File
@@ -9,5 +9,6 @@ dependencies {
compileOnly('com.github.GTNewHorizons:BuildCraft:7.1.57:api')
compileOnly('net.industrial-craft:industrialcraft-2:2.2.828-experimental:dev')
compileOnly('curse.maven:craftguide-75557:2459320')
compileOnly('com.github.GTNewHorizons:Postea:1.4.0-mu:dev')
devOnlyNonPublishable('net.xonich.mc:NoHotbarNeeded:0.0.3:dev')
}
@@ -111,6 +111,14 @@ public class AlvearyController extends RectangularMultiblockControllerBase
this.readFromNBT(data);
}
@Override
public void detachBlock(IMultiblockComponent part, boolean chunkUnloading) {
if (!chunkUnloading) {
inventory.dumpInventoryIntoWorld(this.worldObj, part.getCoordinates());
}
super.detachBlock(part, chunkUnloading);
}
@Override
protected void onBlockAdded(IMultiblockComponent newPart) {
if (newPart instanceof IAlvearyComponent) {
@@ -159,8 +167,6 @@ public class AlvearyController extends RectangularMultiblockControllerBase
activeComponents.remove(oldPart);
}
}
inventory.dumpInventoryIntoWorld(this.worldObj, oldPart.getCoordinates());
}
@Override
@@ -16,8 +16,8 @@ import net.minecraft.block.material.Material;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
@@ -72,7 +72,7 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
@SideOnly(Side.CLIENT)
@Override
public IIcon getIcon(int side, int meta) {
return IconProviderWood.getPlankIcon(EnumWoodType.LARCH);
return IconProviderWood.getPlankIcon(EnumWoodType.VALUES[meta]);
}
@Override
@@ -84,7 +84,8 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
@Override
protected ItemStack createStackedBlock(int meta) {
return new ItemStack(Blocks.wooden_slab, 2, meta & 7);
Item item = Item.getItemFromBlock(this);
return item != null ? new ItemStack(item, 2, 0) : null;
}
@Override
@@ -107,6 +108,18 @@ public class BlockSlab extends net.minecraft.block.BlockSlab implements IWoodTyp
return new TileWood();
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entity, ItemStack stack) {
// Special case for double slabs placed by building mods (e.g., MatterManipulator)
if (stack == null) return;
int damage = stack.getItemDamage();
if (damage < 0 || damage >= EnumWoodType.VALUES.length) return;
TileWood tile = TileWood.getWoodTile(world, x, y, z);
if (tile != null) {
tile.setWoodType(EnumWoodType.VALUES[damage]);
}
}
/* PROPERTIES */
@Override
public final ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
@@ -202,7 +202,8 @@ public abstract class Genome implements IGenome {
private static IChromosome[] getChromosomes(NBTTagCompound genomeNBT, ISpeciesRoot speciesRoot) {
NBTTagList chromosomesNBT = genomeNBT.getTagList("Chromosomes", 10);
IChromosome[] chromosomes = new IChromosome[speciesRoot.getDefaultTemplate().length];
IAllele[] defaultTemplate = speciesRoot.getDefaultTemplate();
IChromosome[] chromosomes = new IChromosome[defaultTemplate.length];
for (int i = 0; i < chromosomesNBT.tagCount(); i++) {
NBTTagCompound chromosomeNBT = chromosomesNBT.getCompoundTagAt(i);
@@ -213,7 +214,7 @@ public abstract class Genome implements IGenome {
chromosomes[chromosomeOrdinal] = chromosome;
if (Config.clearInvalidChromosomes) {
IAllele template = speciesRoot.getDefaultTemplate()[chromosomeOrdinal];
IAllele template = defaultTemplate[chromosomeOrdinal];
Class<? extends IAllele> chromosomeClass = speciesRoot.getKaryotype()[chromosomeOrdinal]
.getAlleleClass();
if (chromosome.overrideInvalidAlleles(template, chromosomeClass)) {
@@ -32,6 +32,10 @@ public class MutationConditionRequiresResource implements IMutationCondition {
blockRequired = new ItemStack(block, 1, meta);
}
public ItemStack getBlockRequired() {
return blockRequired.copy();
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0,
IGenome genome1, IClimateProvider climate) {
@@ -39,6 +39,10 @@ public class MutationConditionRequiresResourceOreDict implements IMutationCondit
}
}
public int getOreDictId() {
return oreDictId;
}
@Override
public float getChance(World world, int x, int y, int z, IAllele allele0, IAllele allele1, IGenome genome0,
IGenome genome1, IClimateProvider climate) {
@@ -0,0 +1,41 @@
package forestry.core.utils;
import com.gtnewhorizons.postea.api.IVersionedTransformer;
import net.minecraft.nbt.NBTTagCompound;
import com.gtnewhorizons.postea.api.CustomDataReplacementManager;
import cpw.mods.fml.common.Loader;
/// Used to provide custom save data (like mail boxes) to Postea's [IVersionedTransformer]s.
///
/// These transformers allow other mods to change saved data based on their own version stamps. This compat flags,
/// to those transformers, the times they should fire. [#transform] is used before consuming data, so the transformer
/// can run, and [#stamp] is used for fresh data to ensure the transformer can add a stamp of its current version.
public final class PosteaCompat {
private static final boolean POSTEA = Loader.isModLoaded("postea");
private PosteaCompat() {}
/// Transforms a root read from disk in place; call before consuming it.
public static void transform(String storageId, NBTTagCompound root) {
if (POSTEA) Impl.transform(storageId, root);
}
/// Stamps a freshly built root about to be written to disk.
public static void stamp(NBTTagCompound root) {
if (POSTEA) Impl.stamp(root);
}
private static final class Impl {
static void transform(String storageId, NBTTagCompound root) {
CustomDataReplacementManager.transform(storageId, root);
}
static void stamp(NBTTagCompound root) {
CustomDataReplacementManager.stamp(root);
}
}
}
@@ -25,16 +25,22 @@ import forestry.plugins.PluginMail;
public class LetterProperties {
private enum State {
FRESH,
STAMPED,
OPENED,
EMPTIED
EMPTIED;
public static final State[] VALUES = values();
}
private enum Size {
EMPTY,
SMALL,
BIG
BIG;
public static final Size[] VALUES = values();
}
public static ItemStack createStampedLetterStack(ILetter letter) {
@@ -98,8 +104,8 @@ public class LetterProperties {
@SuppressWarnings("unchecked")
public static void getSubItems(Item item, CreativeTabs tab, @SuppressWarnings("rawtypes") List list) {
for (State state : State.values()) {
for (Size size : Size.values()) {
for (State state : State.VALUES) {
for (Size size : Size.VALUES) {
int meta = encodeMeta(state, size);
ItemStack letter = new ItemStack(item, 1, meta);
list.add(letter);
@@ -117,7 +123,7 @@ public class LetterProperties {
private static State getState(int meta) {
int ordinal = meta & 0x0f;
State[] values = State.values();
State[] values = State.VALUES;
if (ordinal >= values.length) {
ordinal = 0;
}
@@ -126,7 +132,7 @@ public class LetterProperties {
private static Size getSize(int meta) {
int ordinal = meta >> 4;
Size[] values = Size.values();
Size[] values = Size.VALUES;
if (ordinal >= values.length) {
ordinal = 0;
}
+3
View File
@@ -19,6 +19,7 @@ import forestry.api.mail.IMailAddress;
import forestry.api.mail.PostManager;
import forestry.core.inventory.InventoryAdapter;
import forestry.core.utils.InventoryUtil;
import forestry.core.utils.PosteaCompat;
public class POBox extends WorldSavedData implements IInventory {
@@ -42,6 +43,7 @@ public class POBox extends WorldSavedData implements IInventory {
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
PosteaCompat.transform("forestry:" + mapName, nbttagcompound);
if (nbttagcompound.hasKey("address")) {
this.address = MailAddress.loadFromNBT(nbttagcompound.getCompoundTag("address"));
}
@@ -56,6 +58,7 @@ public class POBox extends WorldSavedData implements IInventory {
nbttagcompound.setTag("address", nbt);
}
letters.writeToNBT(nbttagcompound);
PosteaCompat.stamp(nbttagcompound);
}
public boolean storeLetter(ItemStack letterstack) {
@@ -501,10 +501,10 @@ tile.for.log1=原木
tile.for.log2=原木
tile.for.log3=原木
tile.for.log4=原木
tile.for.planks=木材
tile.for.planks.name=木材
tile.for.slabs1=木材ハーフブロック
tile.for.slabs2=木材ハーフブロック
tile.for.fences=フェンス
tile.for.fences.name=フェンス
tile.harvester.0=伐採機
tile.harvester.1=収穫機
tile.harvester.2=ゴムの木収穫機
@@ -757,9 +757,11 @@ tile.candle.dyed.stump=Unlit Dyed Candle
tile.candle.lit=Lit Candle
tile.candle.dyed.lit=Lit Dyed Candle
tile.stump.0=Candle Stump
tile.for.apiculture.0=Apiary
tile.for.apiculture.1=Apiarist's Chest
tile.for.apiculture.2=Bee House
tile.for.apiculture.name=養蜂箱
tile.for.apiculture.0.name=養蜂箱
tile.for.apicultureChest.name=養蜂家のチェスト
tile.for.apicultureChest.0.name=養蜂家のチェスト
tile.for.apiculture.2.name=ビーハウス
item.for.beeQueenGE.name=Unknown Queen
####################
@@ -808,7 +810,7 @@ tile.log=Wood
tile.planks=Wood Planks
tile.slab=Wood Slab
tile.fences=Fence
tile.for.stairs=Stairs
tile.for.stairs.name=階段
wood.0=Larch
wood.1=Teak
wood.2=Acacia
@@ -833,7 +835,8 @@ wood.20=Pine
wood.21=Plum
wood.22=Maple
wood.23=Citrus
tile.for.arboriculture.0=Arborist's Chest
tile.for.arboriculture.name=樹医のチェスト
tile.for.arboriculture.0.name=樹医のチェスト
####################
# FARMING
@@ -906,7 +909,8 @@ item.butterfly=Butterfly
item.moth=Moth
item.flutterlyzer=Flutterlyzer
storage.backpack.lepidopterist=Lepidopterist's Backpack
tile.for.lepidopterology.0=Lepidopterist's Chest
tile.for.lepidopterology.name=鱗翅類学者のチェスト
tile.for.lepidopterology.0.name=鱗翅類学者のチェスト
####################
# MAIL