mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-27 23:33:00 +00:00
CleanUp
This commit is contained in:
1 parent
cf23644f45
commit
c5fc804bfa
26 files changed
+178
-206
No files matched your search
@@ -82,6 +82,7 @@ import forestry.apiculture.genetics.alleles.AlleleEffect;
|
||||
import forestry.apiculture.items.EnumHoneyComb;
|
||||
import forestry.apiculture.items.EnumPollenCluster;
|
||||
import forestry.apiculture.items.EnumPropolis;
|
||||
import forestry.apiculture.items.ItemHabitatLocator;
|
||||
import forestry.apiculture.items.ItemRegistryApiculture;
|
||||
import forestry.apiculture.multiblock.TileAlvearyFan;
|
||||
import forestry.apiculture.multiblock.TileAlvearyHeater;
|
||||
@@ -937,5 +938,6 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
for (int i = 0; i < EntityFXSnow.sprites.length; i++) {
|
||||
EntityFXSnow.sprites[i] = event.map.registerSprite(new ResourceLocation("forestry:items/particles/snow." + (i + 1)));
|
||||
}
|
||||
ItemHabitatLocator.registerSprite();
|
||||
}
|
||||
}
|
||||
@@ -40,14 +40,15 @@ import forestry.api.core.Tabs;
|
||||
import forestry.apiculture.MaterialBeehive;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.tiles.TileSwarm;
|
||||
import forestry.core.blocks.IBlockWithMeta;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class BlockBeehives extends BlockContainer implements IItemModelRegister {
|
||||
private static final PropertyEnum HIVE_TYPES = PropertyEnum.create("hive", HiveType.class);
|
||||
public class BlockBeeHives extends BlockContainer implements IItemModelRegister, IBlockWithMeta {
|
||||
private static final PropertyEnum<HiveType> HIVE_TYPES = PropertyEnum.create("hive", HiveType.class);
|
||||
|
||||
public BlockBeehives() {
|
||||
public BlockBeeHives() {
|
||||
super(new MaterialBeehive(true));
|
||||
setLightLevel(0.8f);
|
||||
setHardness(1.0f);
|
||||
@@ -63,12 +64,12 @@ public class BlockBeehives extends BlockContainer implements IItemModelRegister
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return ((HiveType) state.getValue(HIVE_TYPES)).ordinal() + 1;
|
||||
return state.getValue(HIVE_TYPES).ordinal();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
return getDefaultState().withProperty(HIVE_TYPES, HiveType.values()[meta - 1]);
|
||||
return getDefaultState().withProperty(HIVE_TYPES, HiveType.VALUES[meta]);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -168,54 +169,39 @@ public class BlockBeehives extends BlockContainer implements IItemModelRegister
|
||||
}
|
||||
|
||||
private static String getHiveNameForMeta(int meta) {
|
||||
switch (meta) {
|
||||
case 1:
|
||||
return HiveType.FOREST.getHiveName();
|
||||
case 2:
|
||||
return HiveType.MEADOWS.getHiveName();
|
||||
case 3:
|
||||
return HiveType.DESERT.getHiveName();
|
||||
case 4:
|
||||
return HiveType.JUNGLE.getHiveName();
|
||||
case 5:
|
||||
return HiveType.END.getHiveName();
|
||||
case 6:
|
||||
return HiveType.SNOW.getHiveName();
|
||||
case 7:
|
||||
return HiveType.SWAMP.getHiveName();
|
||||
}
|
||||
return null;
|
||||
return HiveType.VALUES[meta].getHiveName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs par2CreativeTabs, List<ItemStack> itemList) {
|
||||
itemList.add(new ItemStack(this, 1, 0));
|
||||
itemList.add(new ItemStack(this, 1, 1));
|
||||
itemList.add(new ItemStack(this, 1, 2));
|
||||
itemList.add(new ItemStack(this, 1, 3));
|
||||
itemList.add(new ItemStack(this, 1, 4));
|
||||
if (Config.isDebug) {
|
||||
itemList.add(new ItemStack(this, 1, 5));
|
||||
itemList.add(new ItemStack(this, 1, 4));
|
||||
}
|
||||
itemList.add(new ItemStack(this, 1, 5));
|
||||
itemList.add(new ItemStack(this, 1, 6));
|
||||
itemList.add(new ItemStack(this, 1, 7));
|
||||
// Swarm hive not added
|
||||
}
|
||||
|
||||
/* ITEM MODELS */
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
manager.registerItemModel(item, 1, "beehives/" + HiveType.FOREST.getName());
|
||||
manager.registerItemModel(item, 2, "beehives/" + HiveType.MEADOWS.getName());
|
||||
manager.registerItemModel(item, 3, "beehives/" + HiveType.DESERT.getName());
|
||||
manager.registerItemModel(item, 4, "beehives/" + HiveType.JUNGLE.getName());
|
||||
manager.registerItemModel(item, 5, "beehives/" + HiveType.END.getName());
|
||||
manager.registerItemModel(item, 6, "beehives/" + HiveType.SNOW.getName());
|
||||
manager.registerItemModel(item, 7, "beehives/" + HiveType.SWAMP.getName());
|
||||
for(int i = 0;i < HiveType.VALUES.length;i++){
|
||||
manager.registerItemModel(item, i, "beehives/" + HiveType.VALUES[i].getName());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType() {
|
||||
return 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameFromMeta(int meta) {
|
||||
return HiveType.VALUES[meta].getName();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -54,7 +54,7 @@ import forestry.core.utils.ItemStackUtil;
|
||||
public class BlockCandle extends BlockTorch implements IItemModelRegister {
|
||||
|
||||
private static final ImmutableMap<String, Integer> colours;
|
||||
private static final Set<Item> lightingItems;
|
||||
public static final Set<Item> lightingItems;
|
||||
public static final String colourTagName = "colour";
|
||||
|
||||
private static final PropertyEnum STATE = PropertyEnum.create("state", State.class);
|
||||
|
||||
@@ -23,7 +23,7 @@ import forestry.core.items.ItemBlockForestry;
|
||||
public class BlockRegistryApiculture extends BlockRegistry {
|
||||
public final BlockApiculture apiculture;
|
||||
public final BlockBase<BlockTypeApicultureTesr> apicultureChest;
|
||||
public final BlockBeehives beehives;
|
||||
public final BlockBeeHives beehives;
|
||||
public final BlockCandle candle;
|
||||
public final BlockStump stump;
|
||||
private final Map<BlockAlvearyType, BlockAlveary> alvearyBlockMap;
|
||||
@@ -35,7 +35,7 @@ public class BlockRegistryApiculture extends BlockRegistry {
|
||||
apicultureChest.setCreativeTab(Tabs.tabApiculture);
|
||||
apicultureChest.setHarvestLevel("axe", 0);
|
||||
|
||||
beehives = registerBlock(new BlockBeehives(), ItemBlockForestry.class, "beehives");
|
||||
beehives = registerBlock(new BlockBeeHives(), ItemBlockForestry.class, "beehives");
|
||||
|
||||
candle = registerBlock(new BlockCandle(), ItemBlockCandle.class, "candle");
|
||||
stump = registerBlock(new BlockStump(), ItemBlockForestry.class, "stump");
|
||||
|
||||
@@ -17,8 +17,6 @@ import net.minecraft.block.BlockTorch;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.BlockPos;
|
||||
@@ -35,7 +33,6 @@ import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.tiles.TileCandle;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class BlockStump extends BlockTorch implements IItemModelRegister {
|
||||
|
||||
@@ -61,10 +58,7 @@ public class BlockStump extends BlockTorch implements IItemModelRegister {
|
||||
public boolean onBlockActivated(World world, BlockPos pos, IBlockState state, EntityPlayer player, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
|
||||
ItemStack held = player.getCurrentEquippedItem();
|
||||
if (held != null &&
|
||||
(held.getItem() == Items.flint_and_steel ||
|
||||
held.getItem() == Items.flint ||
|
||||
ItemStackUtil.equals(Blocks.torch, held))) {
|
||||
if (held != null && BlockCandle.lightingItems.contains(held.getItem())) {
|
||||
world.setBlockState(pos, PluginApiculture.blocks.candle.getStateFromMeta(BlockUtil.getBlockMetadata(world, pos) | 0x08), Constants.FLAG_BLOCK_SYNCH);
|
||||
TileCandle tc = new TileCandle();
|
||||
tc.setColour(0); // default to white
|
||||
@@ -82,6 +76,6 @@ public class BlockStump extends BlockTorch implements IItemModelRegister {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World worldIn, BlockPos pos, IBlockState state, Random rand) {
|
||||
public void randomDisplayTick(World world, BlockPos pos, IBlockState state, Random rand) {
|
||||
}
|
||||
}
|
||||
@@ -26,8 +26,8 @@ import forestry.api.core.Tabs;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.items.ItemForestry;
|
||||
|
||||
public class ItemHoneycomb extends ItemForestry {
|
||||
public ItemHoneycomb() {
|
||||
public class ItemHoneyComb extends ItemForestry {
|
||||
public ItemHoneyComb() {
|
||||
super();
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
|
||||
@@ -15,7 +15,6 @@ import java.util.List;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.block.BlockRailBase;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||
import net.minecraft.dispenser.IBehaviorDispenseItem;
|
||||
import net.minecraft.dispenser.IBlockSource;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -37,12 +36,10 @@ import forestry.apiculture.entities.EntityMinecartBeehouse;
|
||||
|
||||
public class ItemMinecartBeehouse extends ItemMinecart implements IItemModelRegister {
|
||||
private final String[] definition = new String[]{"cart.beehouse", "cart.apiary"};
|
||||
|
||||
private static final IBehaviorDispenseItem dispenserMinecartBehavior = new BehaviorDefaultDispenseItem() {
|
||||
private final BehaviorDefaultDispenseItem behaviourDefaultDispenseItem = new BehaviorDefaultDispenseItem();
|
||||
|
||||
|
||||
private static final IBehaviorDispenseItem dispenserMinecartBehavior = new IBehaviorDispenseItem() {
|
||||
@Override
|
||||
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
|
||||
public ItemStack dispense(IBlockSource source, ItemStack stack) {
|
||||
return stack;
|
||||
}
|
||||
};
|
||||
@@ -51,7 +48,7 @@ public class ItemMinecartBeehouse extends ItemMinecart implements IItemModelRegi
|
||||
super(null);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(this, new BehaviorDefaultDispenseItem());
|
||||
BlockDispenser.dispenseBehaviorRegistry.putObject(this, dispenserMinecartBehavior);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -41,7 +41,7 @@ public class ItemRegistryApiculture extends ItemRegistry {
|
||||
public final ItemForestry honeydew;
|
||||
public final ItemForestry royalJelly;
|
||||
public final ItemForestry waxCast;
|
||||
public final ItemHoneycomb beeComb;
|
||||
public final ItemHoneyComb beeComb;
|
||||
|
||||
public final ItemArmorApiarist apiaristHat;
|
||||
public final ItemArmorApiarist apiaristChest;
|
||||
@@ -86,7 +86,7 @@ public class ItemRegistryApiculture extends ItemRegistry {
|
||||
waxCast = registerItem(new ItemWaxCast(), "waxCast");
|
||||
|
||||
// / BEE COMBS
|
||||
beeComb = registerItem(new ItemHoneycomb(), "beeCombs");
|
||||
beeComb = registerItem(new ItemHoneyComb(), "beeCombs");
|
||||
OreDictionary.registerOre("beeComb", beeComb.getWildcard());
|
||||
|
||||
// / APIARIST'S CLOTHES
|
||||
|
||||
@@ -32,17 +32,17 @@ import forestry.apiculture.genetics.BeeDefinition;
|
||||
|
||||
public enum HiveDescription implements IHiveDescription {
|
||||
|
||||
FOREST(1, 3.0f, BeeDefinition.FOREST, HiveManager.genHelper.tree()),
|
||||
MEADOWS(2, 1.0f, BeeDefinition.MEADOWS, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass)),
|
||||
DESERT(3, 1.0f, BeeDefinition.MODEST, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass, Blocks.sand, Blocks.sandstone)),
|
||||
JUNGLE(4, 4.0f, BeeDefinition.TROPICAL, HiveManager.genHelper.tree()),
|
||||
END(5, 4.0f, BeeDefinition.ENDED, HiveManager.genHelper.ground(Blocks.end_stone)) {
|
||||
FOREST(0, 3.0f, BeeDefinition.FOREST, HiveManager.genHelper.tree()),
|
||||
MEADOWS(1, 1.0f, BeeDefinition.MEADOWS, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass)),
|
||||
DESERT(2, 1.0f, BeeDefinition.MODEST, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass, Blocks.sand, Blocks.sandstone)),
|
||||
JUNGLE(3, 4.0f, BeeDefinition.TROPICAL, HiveManager.genHelper.tree()),
|
||||
END(4, 4.0f, BeeDefinition.ENDED, HiveManager.genHelper.ground(Blocks.end_stone)) {
|
||||
@Override
|
||||
public boolean isGoodBiome(BiomeGenBase biome) {
|
||||
return BiomeDictionary.isBiomeOfType(biome, BiomeDictionary.Type.END);
|
||||
}
|
||||
},
|
||||
SNOW(6, 2.0f, BeeDefinition.WINTRY, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass, Blocks.snow)) {
|
||||
SNOW(5, 2.0f, BeeDefinition.WINTRY, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass, Blocks.snow)) {
|
||||
@Override
|
||||
public void postGen(World world, BlockPos pos) {
|
||||
if (world.isAirBlock(pos.add(0, 1, 0))) {
|
||||
@@ -50,7 +50,7 @@ public enum HiveDescription implements IHiveDescription {
|
||||
}
|
||||
}
|
||||
},
|
||||
SWAMP(7, 2.0f, BeeDefinition.MARSHY, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass)),;
|
||||
SWAMP(6, 2.0f, BeeDefinition.MARSHY, HiveManager.genHelper.ground(Blocks.dirt, Blocks.grass)),;
|
||||
|
||||
private final int meta;
|
||||
private final float genChance;
|
||||
|
||||
Reference in new issue
Block a user