mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-27 23:33:00 +00:00
Compiles for 1.9! Very buggy, some things are missing.
This commit is contained in:
1 parent
5d74c1254b
commit
7bf554b024
135 files changed
+1710
-1919
No files matched your search
@@ -38,18 +38,12 @@ public class ArmorApiaristHelper implements IArmorApiaristHelper {
|
||||
public int wearsItems(EntityLivingBase entity, String cause, boolean doProtect) {
|
||||
int count = 0;
|
||||
|
||||
for (int i = 1; i <= 4; i++) {
|
||||
ItemStack armorItem = entity.getEquipmentInSlot(i);
|
||||
for (ItemStack armorItem : entity.getEquipmentAndArmor()) {
|
||||
if (isArmorApiarist(armorItem, entity, cause, doProtect)) {
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
ItemStack heldItem = entity.getHeldItem();
|
||||
if (isArmorApiarist(heldItem, entity, cause, doProtect)) {
|
||||
count++;
|
||||
}
|
||||
|
||||
return count;
|
||||
}
|
||||
}
|
||||
@@ -199,10 +199,11 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
PluginCore.rootCommand.addChildCommand(new CommandBee());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTriggers() {
|
||||
ApicultureTriggers.initialize();
|
||||
}
|
||||
// TODO: Buildcraft for 1.9
|
||||
// @Override
|
||||
// public void registerTriggers() {
|
||||
// ApicultureTriggers.initialize();
|
||||
// }
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
|
||||
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.ArrayList;
|
||||
import java.util.EnumMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
@@ -63,7 +64,7 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase();
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -72,7 +73,7 @@ public abstract class BlockAlveary extends BlockStructure implements IStateMappe
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name().toLowerCase();
|
||||
return name().toLowerCase(Locale.ENGLISH);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -17,6 +17,7 @@ import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import java.util.Set;
|
||||
@@ -65,11 +66,17 @@ public class BlockCandle extends BlockTorch implements IItemModelRegister, ITile
|
||||
private static final PropertyEnum<State> STATE = PropertyEnum.create("state", State.class);
|
||||
|
||||
private enum State implements IStringSerializable {
|
||||
ON, OFF;
|
||||
ON("on"), OFF("off");
|
||||
|
||||
private final String name;
|
||||
|
||||
State(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name();
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ import forestry.core.tiles.TileForestry;
|
||||
|
||||
public enum BlockTypeApiculture implements IBlockType {
|
||||
APIARY(0, TileApiary.class, "apiary"),
|
||||
BEE_HOUSE(1, TileBeeHouse.class, "bee.house");
|
||||
BEE_HOUSE(1, TileBeeHouse.class, "bee_house");
|
||||
|
||||
public static final BlockTypeApiculture[] VALUES = values();
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import forestry.core.tiles.TileForestry;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
|
||||
public enum BlockTypeApicultureTesr implements IBlockTypeTesr {
|
||||
APIARIST_CHEST(0, TileApiaristChest.class, "api.chest", Proxies.render.getRenderChest("apiaristchest"), TileNaturalistChest.chestBoundingBox);
|
||||
APIARIST_CHEST(0, TileApiaristChest.class, "api_chest", Proxies.render.getRenderChest("apiaristchest"), TileNaturalistChest.chestBoundingBox);
|
||||
|
||||
public static final BlockTypeApicultureTesr[] VALUES = values();
|
||||
|
||||
|
||||
@@ -71,7 +71,7 @@ public class GrowthRuleFlowerPot implements IFlowerGrowthRule {
|
||||
flowerPotTile.markDirty();
|
||||
|
||||
if (!world.setBlockState(pos, world.getBlockState(pos).getBlock().getStateFromMeta(1), 2)) {
|
||||
world.markBlockForUpdate(pos);
|
||||
world.markBlockRangeForRenderUpdate(pos, pos);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
@@ -13,6 +13,9 @@ package forestry.apiculture.genetics.alleles;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.SoundEvents;
|
||||
import net.minecraft.util.SoundCategory;
|
||||
import net.minecraft.util.SoundEvent;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@@ -82,8 +85,8 @@ public class AlleleEffectCreeper extends AlleleEffectThrottled {
|
||||
continue;
|
||||
}
|
||||
|
||||
world.playSoundEffect(housingCoords.getX(), housingCoords.getY(), housingCoords.getZ(), "mob.creeper", 4F,
|
||||
(1.0F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F);
|
||||
float pitch = (1.0F + (world.rand.nextFloat() - world.rand.nextFloat()) * 0.2F) * 0.7F;
|
||||
world.playSound((EntityPlayer)null, housingCoords.getX(), housingCoords.getY(), housingCoords.getZ(), SoundEvents.ENTITY_GENERIC_EXPLODE, SoundCategory.BLOCKS, 4.0F, pitch);
|
||||
storedData.setInteger(indexExplosionTimer, 2); // Set explosion timer
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.DamageSource;
|
||||
@@ -85,7 +86,8 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
continue;
|
||||
}
|
||||
|
||||
Block block = world.getBlockState(posBlock).getBlock();
|
||||
IBlockState blockState = world.getBlockState(posBlock);
|
||||
Block block = blockState.getBlock();
|
||||
|
||||
if (block instanceof BlockAlveary) {
|
||||
continue;
|
||||
@@ -96,7 +98,7 @@ public class AlleleEffectRadioactive extends AlleleEffectThrottled {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (block.getBlockHardness(world, posBlock) < 0) {
|
||||
if (block.getBlockHardness(blockState, world, posBlock) < 0) {
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
package forestry.apiculture.items;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.color.IItemColor;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
|
||||
@@ -20,7 +21,7 @@ import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
import forestry.apiculture.blocks.BlockCandle;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
|
||||
public class ItemBlockCandle extends ItemBlockForestry<BlockCandle> {
|
||||
public class ItemBlockCandle extends ItemBlockForestry<BlockCandle> implements IItemColor {
|
||||
|
||||
public ItemBlockCandle(Block block) {
|
||||
super(block);
|
||||
@@ -28,7 +29,7 @@ public class ItemBlockCandle extends ItemBlockForestry<BlockCandle> {
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getColorFromItemStack(ItemStack stack, int pass) {
|
||||
public int getColorFromItemstack(ItemStack stack, int pass) {
|
||||
int value = 0xffffff;
|
||||
if (pass == 1 && stack.hasTagCompound()) {
|
||||
NBTTagCompound tag = stack.getTagCompound();
|
||||
|
||||
@@ -177,7 +177,7 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
BlockPos pos = new BlockPos(slabX, slabY, slabZ);
|
||||
IBlockState state = worldObj.getBlockState(pos);
|
||||
Block block = state.getBlock();
|
||||
if (!BlockUtil.isWoodSlabBlock(block, worldObj, pos)) {
|
||||
if (!BlockUtil.isWoodSlabBlock(state, block, worldObj, pos)) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocal("for.multiblock.alveary.error.needSlabs"));
|
||||
}
|
||||
|
||||
@@ -196,8 +196,9 @@ public class AlvearyController extends RectangularMultiblockControllerBase imple
|
||||
if (isCoordInMultiblock(airX, airY, airZ)) {
|
||||
continue;
|
||||
}
|
||||
Block block = BlockUtil.getBlock(worldObj, new BlockPos(airX, airY, airZ));
|
||||
if (block.isOpaqueCube()) {
|
||||
IBlockState blockState = worldObj.getBlockState(new BlockPos(airX, airY, airZ));
|
||||
Block block = blockState.getBlock();
|
||||
if (block.isOpaqueCube(blockState)) {
|
||||
throw new MultiblockValidationException(Translator.translateToLocal("for.multiblock.alveary.error.needSpace"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -10,23 +10,8 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.multiblock;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import forestry.apiculture.trigger.ApicultureTriggers;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
import buildcraft.api.statements.ITriggerInternal;
|
||||
import buildcraft.api.statements.ITriggerProvider;
|
||||
|
||||
@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = "BuildCraftAPI|statements")
|
||||
public class TileAlvearyPlain extends TileAlveary implements ITriggerProvider {
|
||||
//@Optional.Interface(iface = "buildcraft.api.statements.ITriggerProvider", modid = "BuildCraftAPI|statements")
|
||||
public class TileAlvearyPlain extends TileAlveary {//implements ITriggerProvider {
|
||||
|
||||
@Override
|
||||
public boolean allowsAutomation() {
|
||||
@@ -34,18 +19,19 @@ public class TileAlvearyPlain extends TileAlveary implements ITriggerProvider {
|
||||
}
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
@Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
@Override
|
||||
public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
@Override
|
||||
public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
Collection<ITriggerExternal> res = new ArrayList<>();
|
||||
res.add(ApicultureTriggers.missingQueen);
|
||||
res.add(ApicultureTriggers.missingDrone);
|
||||
return res;
|
||||
}
|
||||
// TODO: buildcraft for 1.9
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerInternal> getInternalTriggers(IStatementContainer container) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
// Collection<ITriggerExternal> res = new ArrayList<>();
|
||||
// res.add(ApicultureTriggers.missingQueen);
|
||||
// res.add(ApicultureTriggers.missingDrone);
|
||||
// return res;
|
||||
// }
|
||||
}
|
||||
@@ -13,14 +13,9 @@ package forestry.apiculture.tiles;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import net.minecraftforge.fml.common.Optional;
|
||||
|
||||
import forestry.api.apiculture.IBeeHousingInventory;
|
||||
import forestry.api.apiculture.IBeeListener;
|
||||
@@ -33,9 +28,6 @@ import forestry.apiculture.gui.ContainerBeeHousing;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
import forestry.apiculture.inventory.IApiaryInventory;
|
||||
import forestry.apiculture.inventory.InventoryApiary;
|
||||
import forestry.apiculture.trigger.ApicultureTriggers;
|
||||
|
||||
import buildcraft.api.statements.ITriggerExternal;
|
||||
|
||||
public class TileApiary extends TileBeeHousingBase implements IApiary {
|
||||
private final IBeeModifier beeModifier = new ApiaryBeeModifier();
|
||||
@@ -76,15 +68,16 @@ public class TileApiary extends TileBeeHousingBase implements IApiary {
|
||||
}
|
||||
|
||||
/* ITRIGGERPROVIDER */
|
||||
@Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
@Override
|
||||
public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
LinkedList<ITriggerExternal> res = new LinkedList<>();
|
||||
res.add(ApicultureTriggers.missingQueen);
|
||||
res.add(ApicultureTriggers.missingDrone);
|
||||
res.add(ApicultureTriggers.noFrames);
|
||||
return res;
|
||||
}
|
||||
// TODO: buildcraft for 1.9
|
||||
// @Optional.Method(modid = "BuildCraftAPI|statements")
|
||||
// @Override
|
||||
// public Collection<ITriggerExternal> getExternalTriggers(EnumFacing side, TileEntity tile) {
|
||||
// LinkedList<ITriggerExternal> res = new LinkedList<>();
|
||||
// res.add(ApicultureTriggers.missingQueen);
|
||||
// res.add(ApicultureTriggers.missingDrone);
|
||||
// res.add(ApicultureTriggers.noFrames);
|
||||
// return res;
|
||||
// }
|
||||
|
||||
@Override
|
||||
public Object getGui(EntityPlayer player, int data) {
|
||||
|
||||
@@ -12,15 +12,16 @@ package forestry.apiculture.trigger;
|
||||
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
public class ApicultureTriggers {
|
||||
public static Trigger noFrames;
|
||||
public static Trigger missingQueen;
|
||||
public static Trigger missingDrone;
|
||||
|
||||
public static void initialize() {
|
||||
noFrames = new TriggerNoFrames();
|
||||
|
||||
missingQueen = new TriggerMissingQueen();
|
||||
missingDrone = new TriggerMissingDrone();
|
||||
}
|
||||
// public static Trigger noFrames;
|
||||
// public static Trigger missingQueen;
|
||||
// public static Trigger missingDrone;
|
||||
//
|
||||
// public static void initialize() {
|
||||
// noFrames = new TriggerNoFrames();
|
||||
//
|
||||
// missingQueen = new TriggerMissingQueen();
|
||||
// missingDrone = new TriggerMissingDrone();
|
||||
// }
|
||||
}
|
||||
@@ -10,34 +10,25 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.trigger;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
// TODO: Buildcraft for 1.9
|
||||
public class TriggerMissingDrone {//extends Trigger {
|
||||
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
|
||||
public class TriggerMissingDrone extends Trigger {
|
||||
|
||||
public TriggerMissingDrone() {
|
||||
super("missingDrone");
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
*/
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
|
||||
if (!(tile instanceof IErrorLogicSource)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IErrorLogicSource apiary = (IErrorLogicSource) tile;
|
||||
return apiary.getErrorLogic().contains(EnumErrorCode.NO_DRONE);
|
||||
}
|
||||
// public TriggerMissingDrone() {
|
||||
// super("missingDrone");
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
// */
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
//
|
||||
// if (!(tile instanceof IErrorLogicSource)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// IErrorLogicSource apiary = (IErrorLogicSource) tile;
|
||||
// return apiary.getErrorLogic().contains(EnumErrorCode.NO_DRONE);
|
||||
// }
|
||||
|
||||
}
|
||||
@@ -10,33 +10,24 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.trigger;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
public class TriggerMissingQueen {//extends Trigger {
|
||||
|
||||
import forestry.api.core.IErrorLogicSource;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
|
||||
public class TriggerMissingQueen extends Trigger {
|
||||
|
||||
public TriggerMissingQueen() {
|
||||
super("missingQueen");
|
||||
}
|
||||
// public TriggerMissingQueen() {
|
||||
// super("missingQueen");
|
||||
// }
|
||||
|
||||
/**
|
||||
* Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
*/
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
|
||||
if (!(tile instanceof IErrorLogicSource)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
IErrorLogicSource apiary = (IErrorLogicSource) tile;
|
||||
return apiary.getErrorLogic().contains(EnumErrorCode.NO_QUEEN);
|
||||
}
|
||||
// TODO: buildcraft for 1.9
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
//
|
||||
// if (!(tile instanceof IErrorLogicSource)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// IErrorLogicSource apiary = (IErrorLogicSource) tile;
|
||||
// return apiary.getErrorLogic().contains(EnumErrorCode.NO_QUEEN);
|
||||
// }
|
||||
}
|
||||
@@ -10,37 +10,30 @@
|
||||
******************************************************************************/
|
||||
package forestry.apiculture.trigger;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import forestry.apiculture.inventory.InventoryApiary;
|
||||
import forestry.apiculture.tiles.TileApiary;
|
||||
import forestry.core.triggers.Trigger;
|
||||
|
||||
import buildcraft.api.statements.IStatementContainer;
|
||||
import buildcraft.api.statements.IStatementParameter;
|
||||
public class TriggerNoFrames {//extends Trigger {
|
||||
|
||||
public class TriggerNoFrames extends Trigger {
|
||||
|
||||
public TriggerNoFrames() {
|
||||
super("noFrames");
|
||||
}
|
||||
// public TriggerNoFrames() {
|
||||
// super("noFrames");
|
||||
// }
|
||||
|
||||
/**
|
||||
* Return true if the tile given in parameter activates the trigger, given the parameters.
|
||||
*/
|
||||
@Override
|
||||
public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
|
||||
if (!(tile instanceof TileApiary)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
TileApiary apiary = (TileApiary) tile;
|
||||
|
||||
InventoryApiary inventory = (InventoryApiary) apiary.getInternalInventory();
|
||||
|
||||
return inventory.getFrames().isEmpty();
|
||||
}
|
||||
// TODO: buildcraft for 1.9
|
||||
// @Override
|
||||
// public boolean isTriggerActive(TileEntity tile, EnumFacing side, IStatementContainer source, IStatementParameter[] parameters) {
|
||||
//
|
||||
// if (!(tile instanceof TileApiary)) {
|
||||
// return false;
|
||||
// }
|
||||
//
|
||||
// TileApiary apiary = (TileApiary) tile;
|
||||
//
|
||||
// InventoryApiary inventory = (InventoryApiary) apiary.getInternalInventory();
|
||||
//
|
||||
// return inventory.getFrames().isEmpty();
|
||||
// }
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user