mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-25 14:24:42 +00:00
Put Facing on blockstate not Tile. Use one block per type for BlockBase
This commit is contained in:
1 parent
fb7cd3ee09
commit
ff1ff5ae2c
118 files changed
+636
-816
No files matched your search
+1
-1
Submodule lang updated: 8063f9d26b...2d10d35c08.
@@ -67,8 +67,6 @@ import forestry.api.storage.StorageManager;
|
||||
import forestry.apiculture.blocks.BlockAlvearyType;
|
||||
import forestry.apiculture.blocks.BlockCandle;
|
||||
import forestry.apiculture.blocks.BlockRegistryApiculture;
|
||||
import forestry.apiculture.blocks.BlockTypeApiculture;
|
||||
import forestry.apiculture.blocks.BlockTypeApicultureTesr;
|
||||
import forestry.apiculture.commands.CommandBee;
|
||||
import forestry.apiculture.entities.EntityMinecartApiary;
|
||||
import forestry.apiculture.entities.EntityMinecartBeehouse;
|
||||
@@ -191,9 +189,6 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
blocks.apiculture.addDefinitions(BlockTypeApiculture.VALUES);
|
||||
blocks.apicultureChest.addDefinitions(BlockTypeApicultureTesr.APIARIST_CHEST);
|
||||
|
||||
if (Config.enableVillagers) {
|
||||
// Register village components with the Structure registry.
|
||||
VillageCreationApiculture.registerVillageComponents();
|
||||
@@ -313,9 +308,9 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
villagerApiarist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_APIARIST, Constants.TEXTURE_SKIN_BEEKPEEPER);
|
||||
villagerRegistry.register(villagerApiarist);
|
||||
|
||||
ItemStack wildcardPrincess = new ItemStack(PluginApiculture.items.beePrincessGE, 1);
|
||||
ItemStack apiary = PluginApiculture.blocks.apiculture.get(BlockTypeApiculture.APIARY);
|
||||
ItemStack provenFrames = PluginApiculture.items.frameProven.getItemStack();
|
||||
ItemStack wildcardPrincess = new ItemStack(items.beePrincessGE, 1);
|
||||
ItemStack apiary = new ItemStack(blocks.apiary);
|
||||
ItemStack provenFrames = items.frameProven.getItemStack();
|
||||
ItemStack monasticDrone = BeeDefinition.MONASTIC.getMemberStack(EnumBeeType.DRONE);
|
||||
|
||||
VillagerRegistry.VillagerCareer apiaristCareer = new VillagerRegistry.VillagerCareer(villagerApiarist, "apiarist");
|
||||
@@ -339,8 +334,9 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
|
||||
proxy.initializeRendering();
|
||||
|
||||
blocks.apiculture.init();
|
||||
blocks.apicultureChest.init();
|
||||
blocks.apiary.init();
|
||||
blocks.beeHouse.init();
|
||||
blocks.beeChest.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -500,12 +496,12 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
RecipeUtil.addRecipe(items.minecartBeehouse.getBeeHouseMinecart(),
|
||||
"B",
|
||||
"C",
|
||||
'B', blocks.apiculture.get(BlockTypeApiculture.BEE_HOUSE),
|
||||
'B', new ItemStack(blocks.beeHouse),
|
||||
'C', Items.MINECART);
|
||||
RecipeUtil.addRecipe(items.minecartBeehouse.getApiaryMinecart(),
|
||||
"B",
|
||||
"C",
|
||||
'B', blocks.apiculture.get(BlockTypeApiculture.APIARY),
|
||||
'B', new ItemStack(blocks.apiary),
|
||||
'C', Items.MINECART);
|
||||
|
||||
// FOOD STUFF
|
||||
@@ -750,7 +746,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
RecipeManagers.fermenterManager.addRecipe(items.honeydew.getItemStack(), 500, 1.0f, Fluids.SHORT_MEAD.getFluid(1), Fluids.FOR_HONEY.getFluid(1));
|
||||
}
|
||||
|
||||
RecipeUtil.addRecipe(blocks.apiculture.get(BlockTypeApiculture.APIARY),
|
||||
RecipeUtil.addRecipe(blocks.apiary,
|
||||
"XXX",
|
||||
"#C#",
|
||||
"###",
|
||||
@@ -758,7 +754,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'#', "plankWood",
|
||||
'C', PluginCore.items.impregnatedCasing);
|
||||
|
||||
RecipeUtil.addRecipe(new ItemStack(blocks.apicultureChest),
|
||||
RecipeUtil.addRecipe(blocks.beeChest,
|
||||
" # ",
|
||||
"XYX",
|
||||
"XXX",
|
||||
@@ -766,7 +762,7 @@ public class PluginApiculture extends BlankForestryPlugin {
|
||||
'X', "beeComb",
|
||||
'Y', "chestWood");
|
||||
|
||||
RecipeUtil.addRecipe(blocks.apiculture.get(BlockTypeApiculture.BEE_HOUSE),
|
||||
RecipeUtil.addRecipe(blocks.beeHouse,
|
||||
"XXX",
|
||||
"#C#",
|
||||
"###",
|
||||
|
||||
@@ -14,8 +14,8 @@ import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockApiculture extends BlockBase<BlockTypeApiculture> {
|
||||
public BlockApiculture() {
|
||||
super(BlockTypeApiculture.class);
|
||||
public BlockApiculture(BlockTypeApiculture type) {
|
||||
super(type);
|
||||
setCreativeTab(Tabs.tabApiculture);
|
||||
setHarvestLevel("axe", 0);
|
||||
}
|
||||
|
||||
@@ -21,21 +21,25 @@ import forestry.core.blocks.BlockRegistry;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
|
||||
public class BlockRegistryApiculture extends BlockRegistry {
|
||||
public final BlockApiculture apiculture;
|
||||
public final BlockBase<BlockTypeApicultureTesr> apicultureChest;
|
||||
public final BlockApiculture apiary;
|
||||
public final BlockApiculture beeHouse;
|
||||
public final BlockBase<BlockTypeApicultureTesr> beeChest;
|
||||
public final BlockBeeHives beehives;
|
||||
public final BlockCandle candle;
|
||||
public final BlockStump stump;
|
||||
private final Map<BlockAlvearyType, BlockAlveary> alvearyBlockMap;
|
||||
|
||||
public BlockRegistryApiculture() {
|
||||
apiculture = new BlockApiculture();
|
||||
registerBlock(apiculture, new ItemBlockForestry(apiculture), "apiculture");
|
||||
apiary = new BlockApiculture(BlockTypeApiculture.APIARY);
|
||||
registerBlock(apiary, new ItemBlockForestry(apiary), "apiary");
|
||||
|
||||
apicultureChest = new BlockBase<>(BlockTypeApicultureTesr.class);
|
||||
registerBlock(apicultureChest, new ItemBlockForestry(apicultureChest), "apicultureChest");
|
||||
apicultureChest.setCreativeTab(Tabs.tabApiculture);
|
||||
apicultureChest.setHarvestLevel("axe", 0);
|
||||
beeHouse = new BlockApiculture(BlockTypeApiculture.BEE_HOUSE);
|
||||
registerBlock(beeHouse, new ItemBlockForestry(beeHouse), "bee_house");
|
||||
|
||||
beeChest = new BlockBase<>(BlockTypeApicultureTesr.APIARIST_CHEST);
|
||||
registerBlock(beeChest, new ItemBlockForestry(beeChest), "bee_chest");
|
||||
beeChest.setCreativeTab(Tabs.tabApiculture);
|
||||
beeChest.setHarvestLevel("axe", 0);
|
||||
|
||||
beehives = new BlockBeeHives();
|
||||
registerBlock(beehives, new ItemBlockForestry(beehives), "beehives");
|
||||
|
||||
@@ -20,16 +20,16 @@ import forestry.core.blocks.MachineProperties;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
|
||||
public enum BlockTypeApiculture implements IBlockType {
|
||||
APIARY(0, TileApiary.class, "apiary"),
|
||||
BEE_HOUSE(1, TileBeeHouse.class, "bee_house");
|
||||
APIARY(TileApiary.class, "apiary"),
|
||||
BEE_HOUSE(TileBeeHouse.class, "bee_house");
|
||||
|
||||
public static final BlockTypeApiculture[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachineProperties machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeApiculture(int meta, @Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
this.machineProperties = new MachineProperties<>(meta, teClass, name);
|
||||
<T extends TileForestry> BlockTypeApiculture(@Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
this.machineProperties = new MachineProperties<>(teClass, name);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -26,18 +26,18 @@ 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(TileApiaristChest.class, "api_chest", Proxies.render.getRenderChest("apiaristchest"), TileNaturalistChest.chestBoundingBox);
|
||||
|
||||
public static final BlockTypeApicultureTesr[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachinePropertiesTesr<?> machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeApicultureTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nullable AxisAlignedBB boundingBox) {
|
||||
<T extends TileForestry> BlockTypeApicultureTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nullable AxisAlignedBB boundingBox) {
|
||||
if (boundingBox != null) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer, boundingBox, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
} else {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,6 @@ import forestry.apiculture.ApiaryBeeListener;
|
||||
import forestry.apiculture.ApiaryBeeModifier;
|
||||
import forestry.apiculture.IApiary;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.blocks.BlockTypeApiculture;
|
||||
import forestry.apiculture.gui.ContainerMinecartBeehouse;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
import forestry.apiculture.inventory.IApiaryInventory;
|
||||
@@ -72,7 +71,7 @@ public class EntityMinecartApiary extends EntityMinecartBeeHousingBase implement
|
||||
|
||||
@Override
|
||||
public IBlockState getDisplayTile() {
|
||||
return PluginApiculture.blocks.apiculture.getStateFromMeta(BlockTypeApiculture.APIARY.ordinal());
|
||||
return PluginApiculture.blocks.apiary.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -25,7 +25,6 @@ import forestry.api.apiculture.IBeeModifier;
|
||||
import forestry.apiculture.BeehouseBeeModifier;
|
||||
import forestry.apiculture.InventoryBeeHousing;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.blocks.BlockTypeApiculture;
|
||||
import forestry.apiculture.gui.ContainerMinecartBeehouse;
|
||||
import forestry.apiculture.gui.GuiBeeHousing;
|
||||
import forestry.core.config.Config;
|
||||
@@ -54,7 +53,7 @@ public class EntityMinecartBeehouse extends EntityMinecartBeeHousingBase {
|
||||
|
||||
@Override
|
||||
public IBlockState getDisplayTile() {
|
||||
return PluginApiculture.blocks.apiculture.getStateFromMeta(BlockTypeApiculture.BEE_HOUSE.ordinal());
|
||||
return PluginApiculture.blocks.beeHouse.getDefaultState();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -18,6 +18,8 @@ import java.util.Random;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDoor;
|
||||
import net.minecraft.block.BlockFenceGate;
|
||||
import net.minecraft.block.BlockLog;
|
||||
import net.minecraft.block.BlockNewLog;
|
||||
import net.minecraft.block.BlockOldLog;
|
||||
import net.minecraft.block.BlockPlanks;
|
||||
@@ -52,11 +54,9 @@ import forestry.api.core.EnumTemperature;
|
||||
import forestry.api.core.ForestryAPI;
|
||||
import forestry.api.genetics.AlleleManager;
|
||||
import forestry.apiculture.PluginApiculture;
|
||||
import forestry.apiculture.blocks.BlockTypeApiculture;
|
||||
import forestry.apiculture.flowers.Flower;
|
||||
import forestry.apiculture.flowers.FlowerRegistry;
|
||||
import forestry.apiculture.inventory.InventoryApiary;
|
||||
import forestry.apiculture.tiles.TileApiary;
|
||||
import forestry.apiculture.tiles.TileBeeHouse;
|
||||
import forestry.arboriculture.PluginArboriculture;
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.core.blocks.BlockCore;
|
||||
@@ -98,7 +98,7 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
EnumWoodType woodType = EnumWoodType.getRandom(random);
|
||||
|
||||
IWoodAccess woodAccess = TreeManager.woodAccess;
|
||||
this.logs = woodAccess.getLogBlock(woodType, fireproof);
|
||||
this.logs = woodAccess.getLogBlock(woodType, fireproof).withProperty(BlockLog.LOG_AXIS, BlockLog.EnumAxis.X);
|
||||
this.planks = woodAccess.getPlanksBlock(woodType, fireproof);
|
||||
this.stairs = woodAccess.getStairsBlock(woodType, fireproof);
|
||||
this.fence = woodAccess.getFenceBlock(woodType, fireproof);
|
||||
@@ -166,7 +166,9 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
fillWithBlocks(world, structBoundingBox, 8, 1, 6, 8, 1, 10, fence, fence, false);
|
||||
fillWithBlocks(world, structBoundingBox, 2, 1, 10, 7, 1, 10, fence, fence, false);
|
||||
|
||||
placeBlockAtCurrentPosition(world, fenceGate, 8, 1, 8, structBoundingBox);
|
||||
setBlockState(world, fenceGate, 8, 1, 8, structBoundingBox);
|
||||
setBlockState(world, fenceGate, 1, 1, 8, structBoundingBox);
|
||||
setBlockState(world, fenceGate.withProperty(BlockFenceGate.FACING, EnumFacing.NORTH), 4, 1, 10, structBoundingBox);
|
||||
|
||||
// Flowers
|
||||
plantFlowerGarden(world, structBoundingBox, 2, 1, 5, 7, 1, 9);
|
||||
@@ -189,17 +191,17 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
fillWithBlocks(world, structBoundingBox, 0, 4, 4, 8, 4, 4, planks, planks, false);
|
||||
fillWithBlocks(world, structBoundingBox, 0, 5, 2, 8, 5, 3, planks, planks, false);
|
||||
|
||||
placeBlockAtCurrentPosition(world, planks, 0, 4, 2, structBoundingBox);
|
||||
placeBlockAtCurrentPosition(world, planks, 0, 4, 3, structBoundingBox);
|
||||
placeBlockAtCurrentPosition(world, planks, 8, 4, 2, structBoundingBox);
|
||||
placeBlockAtCurrentPosition(world, planks, 8, 4, 3, structBoundingBox);
|
||||
setBlockState(world, planks, 0, 4, 2, structBoundingBox);
|
||||
setBlockState(world, planks, 0, 4, 3, structBoundingBox);
|
||||
setBlockState(world, planks, 8, 4, 2, structBoundingBox);
|
||||
setBlockState(world, planks, 8, 4, 3, structBoundingBox);
|
||||
|
||||
buildRoof(world, structBoundingBox);
|
||||
|
||||
placeBlockAtCurrentPosition(world, logs, 0, 2, 1, structBoundingBox);
|
||||
placeBlockAtCurrentPosition(world, logs, 0, 2, 4, structBoundingBox);
|
||||
placeBlockAtCurrentPosition(world, logs, 8, 2, 1, structBoundingBox);
|
||||
placeBlockAtCurrentPosition(world, logs, 8, 2, 4, structBoundingBox);
|
||||
setBlockState(world, logs, 0, 2, 1, structBoundingBox);
|
||||
setBlockState(world, logs, 0, 2, 4, structBoundingBox);
|
||||
setBlockState(world, logs, 8, 2, 1, structBoundingBox);
|
||||
setBlockState(world, logs, 8, 2, 4, structBoundingBox);
|
||||
|
||||
IBlockState glassPaneState = Blocks.GLASS_PANE.getDefaultState();
|
||||
setBlockState(world, glassPaneState, 0, 2, 2, structBoundingBox);
|
||||
@@ -218,8 +220,8 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
|
||||
// Escritoire
|
||||
if (random.nextInt(2) == 0) {
|
||||
IBlockState escritoireBlock = PluginCore.blocks.escritoire.getDefaultState().withProperty(BlockCore.FACING, EnumFacing.WEST);
|
||||
placeBlockAtCurrentPosition(world, escritoireBlock, 1, 1, 3, structBoundingBox);
|
||||
IBlockState escritoireBlock = PluginCore.blocks.escritoire.getDefaultState().withProperty(BlockCore.FACING, EnumFacing.EAST);
|
||||
setBlockState(world, escritoireBlock, 1, 1, 3, structBoundingBox);
|
||||
}
|
||||
|
||||
IBlockState airState = Blocks.AIR.getDefaultState();
|
||||
@@ -227,6 +229,8 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
this.setBlockState(world, this.door.withProperty(BlockDoor.FACING, EnumFacing.NORTH), 2, 1, 0, structBoundingBox);
|
||||
this.setBlockState(world, this.door.withProperty(BlockDoor.FACING, EnumFacing.NORTH).withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 2, 2, 0, structBoundingBox);
|
||||
|
||||
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH), 2, 3, 1, structBoundingBox);
|
||||
|
||||
if (isAirBlockAtCurrentPosition(world, new BlockPos(2, 0, -1), structBoundingBox) && !isAirBlockAtCurrentPosition(world, new BlockPos(2, -1, -1), structBoundingBox)) {
|
||||
setBlockState(world, Blocks.STONE_STAIRS.getDefaultState().withProperty(BlockStairs.FACING, EnumFacing.NORTH), 2, 0, -1, structBoundingBox);
|
||||
}
|
||||
@@ -234,8 +238,7 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
setBlockState(world, airState, 6, 1, 5, structBoundingBox);
|
||||
setBlockState(world, airState, 6, 2, 5, structBoundingBox);
|
||||
|
||||
// Candles / Lighting
|
||||
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.NORTH), 2, 3, 1, structBoundingBox);
|
||||
this.setBlockState(world, Blocks.TORCH.getDefaultState().withProperty(BlockTorch.FACING, EnumFacing.SOUTH), 6, 3, 4, structBoundingBox);
|
||||
|
||||
this.setBlockState(world, this.door.withProperty(BlockDoor.FACING, EnumFacing.SOUTH), 6, 1, 5, structBoundingBox);
|
||||
this.setBlockState(world, this.door.withProperty(BlockDoor.FACING, EnumFacing.SOUTH).withProperty(BlockDoor.HALF, BlockDoor.EnumDoorHalf.UPPER), 6, 2, 5, structBoundingBox);
|
||||
@@ -258,10 +261,10 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
for (int i = -1; i <= 2; ++i) {
|
||||
for (int j = 0; j <= 8; ++j) {
|
||||
IBlockState northStairs = stairs.withProperty(BlockStairs.FACING, EnumFacing.NORTH);
|
||||
placeBlockAtCurrentPosition(world, northStairs, j, 4 + i, i, structBoundingBox);
|
||||
setBlockState(world, northStairs, j, 4 + i, i, structBoundingBox);
|
||||
|
||||
IBlockState southStairs = stairs.withProperty(BlockStairs.FACING, EnumFacing.SOUTH);
|
||||
placeBlockAtCurrentPosition(world, southStairs, j, 4 + i, 5 - i, structBoundingBox);
|
||||
setBlockState(world, southStairs, j, 4 + i, 5 - i, structBoundingBox);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -326,41 +329,23 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
}
|
||||
|
||||
IBlockState blockState = world.getBlockState(posNew);
|
||||
if (PluginApiculture.blocks.apiculture == blockState.getBlock() || !world.isBlockLoaded(posNew.down())) {
|
||||
if (PluginApiculture.blocks.beeHouse == blockState.getBlock() || !world.isBlockLoaded(posNew.down())) {
|
||||
return;
|
||||
}
|
||||
|
||||
world.setBlockState(posNew, PluginApiculture.blocks.apiculture.getStateFromMeta(BlockTypeApiculture.APIARY.ordinal()), Constants.FLAG_BLOCK_SYNCH);
|
||||
PluginApiculture.blocks.apiculture.onBlockAdded(world, posNew, PluginApiculture.blocks.apiculture.getStateFromMeta(BlockTypeApiculture.APIARY.ordinal()));
|
||||
IBlockState beeHouseDefaultState = PluginApiculture.blocks.beeHouse.getDefaultState();
|
||||
world.setBlockState(posNew, beeHouseDefaultState, Constants.FLAG_BLOCK_SYNCH);
|
||||
|
||||
TileApiary apiary = TileUtil.getTile(world, posNew, TileApiary.class);
|
||||
if (apiary == null) {
|
||||
TileBeeHouse beeHouse = TileUtil.getTile(world, posNew, TileBeeHouse.class);
|
||||
if (beeHouse == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ItemStack randomVillagePrincess = getRandomVillageBeeStack(world, posNew, EnumBeeType.PRINCESS);
|
||||
apiary.getBeeInventory().setQueen(randomVillagePrincess);
|
||||
beeHouse.getBeeInventory().setQueen(randomVillagePrincess);
|
||||
|
||||
ItemStack randomVillageDrone = getRandomVillageBeeStack(world, posNew, EnumBeeType.DRONE);
|
||||
apiary.getBeeInventory().setDrone(randomVillageDrone);
|
||||
|
||||
for (int i = InventoryApiary.SLOT_FRAMES_1; i < InventoryApiary.SLOT_FRAMES_1 + InventoryApiary.SLOT_FRAMES_COUNT; i++) {
|
||||
ItemStack randomFrame = getRandomFrame(world.rand);
|
||||
apiary.setInventorySlotContents(i, randomFrame);
|
||||
}
|
||||
}
|
||||
|
||||
private static ItemStack getRandomFrame(Random random) {
|
||||
float roll = random.nextFloat();
|
||||
if (roll < 0.2f) {
|
||||
return PluginApiculture.items.frameUntreated.getItemStack();
|
||||
} else if (roll < 0.4f) {
|
||||
return PluginApiculture.items.frameImpregnated.getItemStack();
|
||||
} else if (roll < 0.6) {
|
||||
return PluginApiculture.items.frameProven.getItemStack();
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
beeHouse.getBeeInventory().setDrone(randomVillageDrone);
|
||||
}
|
||||
|
||||
private static ItemStack getRandomVillageBeeStack(World world, BlockPos pos, EnumBeeType beeType) {
|
||||
@@ -408,10 +393,6 @@ public class VillageApiaristHouse extends StructureVillagePieces.House1 {
|
||||
species.getHumidity(), genome.getToleranceHumid());
|
||||
}
|
||||
|
||||
private void placeBlockAtCurrentPosition(World world, IBlockState block, int x, int y, int z, StructureBoundingBox boundingboxIn) {
|
||||
setBlockState(world, block, x, y, z, boundingboxIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int chooseProfession(int villagerCount, int currentVillagerProfession) {
|
||||
FMLControlledNamespacedRegistry<VillagerRegistry.VillagerProfession> registry = (FMLControlledNamespacedRegistry<VillagerRegistry.VillagerProfession>) VillagerRegistry.instance().getRegistry();
|
||||
|
||||
@@ -46,7 +46,6 @@ import forestry.api.storage.StorageManager;
|
||||
import forestry.arboriculture.blocks.BlockArbLog;
|
||||
import forestry.arboriculture.blocks.BlockArbSlab;
|
||||
import forestry.arboriculture.blocks.BlockRegistryArboriculture;
|
||||
import forestry.arboriculture.blocks.BlockTypeArboricultureTesr;
|
||||
import forestry.arboriculture.commands.CommandTree;
|
||||
import forestry.arboriculture.genetics.TreeBranchDefinition;
|
||||
import forestry.arboriculture.genetics.TreeDefinition;
|
||||
@@ -140,8 +139,6 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
WoodAccess.registerFenceGates(blocks.fenceGatesFireproof);
|
||||
WoodAccess.registerStairs(blocks.stairsFireproof);
|
||||
|
||||
blocks.arboriculture.addDefinitions(BlockTypeArboricultureTesr.ARB_CHEST);
|
||||
|
||||
// Init rendering
|
||||
proxy.initializeModels();
|
||||
|
||||
@@ -168,7 +165,7 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
GameRegistry.registerTileEntity(TileLeaves.class, "forestry.Leaves");
|
||||
GameRegistry.registerTileEntity(TileFruitPod.class, "forestry.Pods");
|
||||
|
||||
blocks.arboriculture.init();
|
||||
blocks.treeChest.init();
|
||||
|
||||
if (Config.enableVillagers) {
|
||||
villagerArborist = new VillagerRegistry.VillagerProfession(Constants.ID_VILLAGER_ARBORIST, Constants.TEXTURE_SKIN_LUMBERJACK);
|
||||
@@ -360,7 +357,7 @@ public class PluginArboriculture extends BlankForestryPlugin {
|
||||
'B', "ingotBronze",
|
||||
'#', "stickWood");
|
||||
|
||||
RecipeUtil.addRecipe(blocks.arboriculture.get(BlockTypeArboricultureTesr.ARB_CHEST),
|
||||
RecipeUtil.addRecipe(blocks.treeChest,
|
||||
" # ",
|
||||
"XYX",
|
||||
"XXX",
|
||||
|
||||
@@ -14,8 +14,8 @@ import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockArboriculture extends BlockBase<BlockTypeArboricultureTesr> {
|
||||
public BlockArboriculture() {
|
||||
super(BlockTypeArboricultureTesr.class);
|
||||
public BlockArboriculture(BlockTypeArboricultureTesr type) {
|
||||
super(type);
|
||||
setCreativeTab(Tabs.tabArboriculture);
|
||||
}
|
||||
}
|
||||
@@ -53,7 +53,7 @@ public class BlockRegistryArboriculture extends BlockRegistry {
|
||||
private final Map<String, ItemStack> speciesToLeavesDecorative;
|
||||
public final Map<String, BlockFruitPod> podsMap;
|
||||
|
||||
public final BlockArboriculture arboriculture;
|
||||
public final BlockArboriculture treeChest;
|
||||
|
||||
public BlockRegistryArboriculture() {
|
||||
// Wood blocks
|
||||
@@ -196,8 +196,8 @@ public class BlockRegistryArboriculture extends BlockRegistry {
|
||||
}
|
||||
|
||||
// Machines
|
||||
arboriculture = new BlockArboriculture();
|
||||
registerBlock(arboriculture, new ItemBlockForestry(arboriculture), "arboriculture");
|
||||
treeChest = new BlockArboriculture(BlockTypeArboricultureTesr.ARB_CHEST);
|
||||
registerBlock(treeChest, new ItemBlockForestry(treeChest), "tree_chest");
|
||||
}
|
||||
|
||||
public ItemStack getDecorativeLeaves(String speciesUid) {
|
||||
|
||||
@@ -26,18 +26,18 @@ import forestry.core.tiles.TileForestry;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
|
||||
public enum BlockTypeArboricultureTesr implements IBlockTypeTesr {
|
||||
ARB_CHEST(0, TileArboristChest.class, "arb_chest", Proxies.render.getRenderChest("arbchest"), TileNaturalistChest.chestBoundingBox);
|
||||
ARB_CHEST(TileArboristChest.class, "arb_chest", Proxies.render.getRenderChest("arbchest"), TileNaturalistChest.chestBoundingBox);
|
||||
|
||||
public static final BlockTypeArboricultureTesr[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachinePropertiesTesr<?> machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeArboricultureTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nullable AxisAlignedBB boundingBox) {
|
||||
<T extends TileForestry> BlockTypeArboricultureTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nullable AxisAlignedBB boundingBox) {
|
||||
if (boundingBox != null) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer, boundingBox, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
} else {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,6 @@ import forestry.api.storage.ICrateRegistry;
|
||||
import forestry.api.storage.StorageManager;
|
||||
import forestry.core.blocks.BlockRegistryCore;
|
||||
import forestry.core.blocks.BlockSoil;
|
||||
import forestry.core.blocks.BlockTypeCoreTesr;
|
||||
import forestry.core.blocks.EnumResourceType;
|
||||
import forestry.core.circuits.CircuitRegistry;
|
||||
import forestry.core.circuits.SolderManager;
|
||||
@@ -119,15 +118,14 @@ public class PluginCore extends BlankForestryPlugin {
|
||||
MinecraftForge.EVENT_BUS.register(this);
|
||||
|
||||
rootCommand.addChildCommand(new CommandPlugins());
|
||||
|
||||
blocks.core.addDefinitions(BlockTypeCoreTesr.VALUES);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
super.doInit();
|
||||
|
||||
blocks.core.init();
|
||||
blocks.analyzer.init();
|
||||
blocks.escritoire.init();
|
||||
|
||||
ForestryModEnvWarningCallable.register();
|
||||
|
||||
@@ -279,7 +277,7 @@ public class PluginCore extends BlankForestryPlugin {
|
||||
}
|
||||
|
||||
// ANALYZER
|
||||
RecipeUtil.addRecipe(PluginCore.blocks.core.get(BlockTypeCoreTesr.ANALYZER),
|
||||
RecipeUtil.addRecipe(PluginCore.blocks.analyzer,
|
||||
"XTX",
|
||||
" Y ",
|
||||
"X X",
|
||||
|
||||
@@ -10,17 +10,15 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.blocks;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import net.minecraft.block.BlockHorizontal;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.BlockStateContainer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.particle.EffectRenderer;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -31,13 +29,15 @@ import net.minecraft.util.EnumBlockRenderType;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.Mirror;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.util.Rotation;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fluids.IFluidHandler;
|
||||
@@ -62,59 +62,36 @@ import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.InventoryUtil;
|
||||
import forestry.core.utils.PlayerUtil;
|
||||
|
||||
import jline.internal.Log;
|
||||
public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> extends BlockForestry implements IItemModelRegister, ISpriteRegister, IStateMapperRegister {
|
||||
/** use this instead of {@link BlockHorizontal#FACING} so the blocks rotate in a circle instead of NSWE order. */
|
||||
public static final PropertyEnum<EnumFacing> FACING = PropertyEnum.create("facing", EnumFacing.class, EnumFacing.NORTH, EnumFacing.EAST, EnumFacing.SOUTH, EnumFacing.WEST);
|
||||
|
||||
public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> extends BlockForestry implements IItemModelRegister, ISpriteRegister, IStateMapperRegister, IBlockWithMeta {
|
||||
private final Map<P, IMachineProperties> properties = new HashMap<>();
|
||||
private final boolean hasTESR;
|
||||
private final boolean hasCustom;
|
||||
private final Class<P> machinePropertiesClass;
|
||||
|
||||
@Nonnull
|
||||
public final P blockType;
|
||||
|
||||
/* PROPERTIES */
|
||||
private final PropertyEnum<P> TYPE;
|
||||
private final PropertyEnum<EnumFacing> FACE;
|
||||
|
||||
|
||||
private final ParticleHelper.Callback particleCallback;
|
||||
|
||||
protected final BlockStateContainer blockState;
|
||||
|
||||
private boolean canCreateProps = false;
|
||||
|
||||
public BlockBase(Class<P> machinePropertiesClass) {
|
||||
public BlockBase(@Nonnull P blockType) {
|
||||
super(Material.IRON);
|
||||
|
||||
this.hasTESR = IBlockTypeTesr.class.isAssignableFrom(machinePropertiesClass);
|
||||
this.hasCustom = IBlockTypeCustom.class.isAssignableFrom(machinePropertiesClass);
|
||||
this.blockType = blockType;
|
||||
blockType.getMachineProperties().setBlock(this);
|
||||
|
||||
this.hasTESR = blockType instanceof IBlockTypeTesr;
|
||||
this.hasCustom = blockType instanceof IBlockTypeCustom;
|
||||
this.lightOpacity = (!hasTESR && !hasCustom) ? 255 : 0;
|
||||
this.machinePropertiesClass = machinePropertiesClass;
|
||||
|
||||
canCreateProps = true;
|
||||
|
||||
TYPE = PropertyEnum.create("type", machinePropertiesClass);
|
||||
FACE = PropertyEnum.create("face", EnumFacing.class);
|
||||
|
||||
|
||||
this.blockState = this.createBlockState();
|
||||
IBlockState state = this.blockState.getBaseState().withProperty(FACE, EnumFacing.NORTH);
|
||||
IBlockState state = this.blockState.getBaseState().withProperty(FACING, EnumFacing.NORTH);
|
||||
this.setDefaultState(state);
|
||||
|
||||
particleCallback = new MachineParticleCallback<>(this, TYPE);
|
||||
}
|
||||
|
||||
public PropertyEnum<P> getTypeProperty() {
|
||||
return TYPE;
|
||||
}
|
||||
|
||||
@SafeVarargs
|
||||
public final void addDefinitions(P... blockTypes) {
|
||||
for (P blockType : blockTypes) {
|
||||
IMachineProperties<?> machineProperties = blockType.getMachineProperties();
|
||||
if (machineProperties != null) {
|
||||
machineProperties.setBlock(this);
|
||||
this.properties.put(blockType, machineProperties);
|
||||
} else {
|
||||
Log.error("Null Definition found {}", Arrays.toString(blockTypes));
|
||||
}
|
||||
}
|
||||
particleCallback = new MachineParticleCallback<>(this, blockType);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -136,59 +113,30 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
|
||||
}
|
||||
}
|
||||
|
||||
private IMachineProperties getDefinition(IBlockAccess world, BlockPos pos) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
if (!(state.getBlock() instanceof BlockBase)) {
|
||||
return null;
|
||||
}
|
||||
return state.getValue(TYPE).getMachineProperties();
|
||||
@Nonnull
|
||||
private IMachineProperties getDefinition() {
|
||||
return blockType.getMachineProperties();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBox(IBlockState blockState, World worldIn, BlockPos pos) {
|
||||
IMachineProperties definition = getDefinition(worldIn, pos);
|
||||
if (definition == null) {
|
||||
return super.getCollisionBoundingBox(blockState, worldIn, pos);
|
||||
}
|
||||
IMachineProperties definition = getDefinition();
|
||||
return definition.getBoundingBox(pos, blockState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end) {
|
||||
IMachineProperties definition = getDefinition(worldIn, pos);
|
||||
if (definition == null) {
|
||||
return super.collisionRayTrace(blockState, worldIn, pos, start, end);
|
||||
} else {
|
||||
return definition.collisionRayTrace(worldIn, pos, start, end);
|
||||
}
|
||||
}
|
||||
|
||||
/* CREATIVE INVENTORY */
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List<ItemStack> list) {
|
||||
for (IMachineProperties definition : properties.values()) {
|
||||
definition.getSubBlocks(item, tab, list);
|
||||
}
|
||||
IMachineProperties definition = getDefinition();
|
||||
return definition.collisionRayTrace(worldIn, pos, start, end);
|
||||
}
|
||||
|
||||
/* TILE ENTITY CREATION */
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
IMachineProperties definition = getStateFromMeta(meta).getValue(TYPE).getMachineProperties();
|
||||
if (definition == null) {
|
||||
return null;
|
||||
}
|
||||
return definition.createTileEntity();
|
||||
return getDefinition().createTileEntity();
|
||||
}
|
||||
|
||||
/* INTERACTION */
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
IMachineProperties definition = getDefinition(world, pos);
|
||||
return definition != null && definition.isSolidOnSide(world, pos, side);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumHand hand, ItemStack heldItem, EnumFacing side, float hitX, float hitY, float hitZ) {
|
||||
if (playerIn.isSneaking()) {
|
||||
@@ -224,13 +172,23 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) {
|
||||
IMachineProperties definition = getDefinition(world, pos);
|
||||
if (definition == null) {
|
||||
return super.rotateBlock(world, pos, axis);
|
||||
public void rotateAfterPlacement(EntityPlayer player, World world, BlockPos pos, EnumFacing side) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
|
||||
int l = MathHelper.floor_double(player.rotationYaw * 4F / 360F + 0.5D) & 3;
|
||||
if (l == 0) {
|
||||
state = state.withProperty(FACING, EnumFacing.NORTH);
|
||||
}
|
||||
return definition.rotateBlock(world, pos, axis);
|
||||
if (l == 1) {
|
||||
state = state.withProperty(FACING, EnumFacing.EAST);
|
||||
}
|
||||
if (l == 2) {
|
||||
state = state.withProperty(FACING, EnumFacing.SOUTH);
|
||||
}
|
||||
if (l == 3) {
|
||||
state = state.withProperty(FACING, EnumFacing.WEST);
|
||||
}
|
||||
world.setBlockState(pos, state, 2);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -260,69 +218,36 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
|
||||
}
|
||||
|
||||
public void init() {
|
||||
for (IMachineProperties def : properties.values()) {
|
||||
def.registerTileEntity();
|
||||
}
|
||||
blockType.getMachineProperties().registerTileEntity();
|
||||
}
|
||||
|
||||
/* ITEM MODELS */
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerModel(Item item, IModelManager manager) {
|
||||
for (IMachineProperties def : properties.values()) {
|
||||
def.registerModel(item, manager);
|
||||
}
|
||||
blockType.getMachineProperties().registerModel(item, manager);
|
||||
}
|
||||
|
||||
/* STATES */
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerStateMapper() {
|
||||
Proxies.render.registerStateMapper(this, new MachineStateMapper<>(machinePropertiesClass, TYPE, FACE));
|
||||
Proxies.render.registerStateMapper(this, new MachineStateMapper<>(blockType));
|
||||
}
|
||||
|
||||
@Override
|
||||
protected BlockStateContainer createBlockState() {
|
||||
if (!canCreateProps) {
|
||||
return super.createBlockState();
|
||||
}
|
||||
return new BlockStateContainer(this, TYPE, FACE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
IBlockType blockType = (IBlockType) state.getProperties().get(this.TYPE);
|
||||
IMachineProperties machineProperties = blockType.getMachineProperties();
|
||||
return machineProperties.getMeta();
|
||||
return new BlockStateContainer(this, FACING);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getStateFromMeta(int meta) {
|
||||
for (Map.Entry<P, IMachineProperties> entry : properties.entrySet()) {
|
||||
IMachineProperties<?> machineProperties = entry.getValue();
|
||||
if (machineProperties.getMeta() == meta) {
|
||||
P blockType = entry.getKey();
|
||||
return getDefaultState().withProperty(this.TYPE, blockType);
|
||||
}
|
||||
}
|
||||
return getDefaultState();
|
||||
return this.getDefaultState().withProperty(FACING, EnumFacing.getHorizontal(meta));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameFromMeta(int meta) {
|
||||
IBlockState state = getStateFromMeta(meta);
|
||||
IBlockType blockType = (IBlockType) state.getProperties().get(TYPE);
|
||||
IMachineProperties machineProperties = blockType.getMachineProperties();
|
||||
return machineProperties.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState getActualState(IBlockState state, IBlockAccess world, BlockPos pos) {
|
||||
TileForestry tile = TileUtil.getTile(world, pos, TileForestry.class);
|
||||
if (tile != null) {
|
||||
state = state.withProperty(FACE, tile.getOrientation());
|
||||
}
|
||||
return super.getActualState(state, world, pos);
|
||||
public int getMetaFromState(IBlockState state) {
|
||||
return state.getValue(FACING).getHorizontalIndex();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -330,6 +255,17 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
|
||||
return this.blockState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withMirror(IBlockState state, Mirror mirrorIn) {
|
||||
return super.withMirror(state, mirrorIn);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBlockState withRotation(IBlockState state, Rotation rot) {
|
||||
EnumFacing facing = state.getValue(FACING);
|
||||
return state.withProperty(FACING, rot.rotate(facing));
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getUseNeighborBrightness(IBlockState state) {
|
||||
return hasTESR;
|
||||
@@ -339,8 +275,7 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean addHitEffects(IBlockState state, World worldObj, RayTraceResult target, EffectRenderer effectRenderer) {
|
||||
P property = state.getValue(TYPE);
|
||||
if(property.getMachineProperties() instanceof IMachinePropertiesTesr){
|
||||
if (blockType.getMachineProperties() instanceof IMachinePropertiesTesr) {
|
||||
return ParticleHelper.addBlockHitEffects(worldObj, target.getBlockPos(), target.sideHit, effectRenderer, particleCallback);
|
||||
}
|
||||
return false;
|
||||
@@ -349,28 +284,21 @@ public class BlockBase<P extends Enum<P> & IBlockType & IStringSerializable> ext
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public boolean addDestroyEffects(World world, BlockPos pos, EffectRenderer effectRenderer) {
|
||||
IBlockState state = world.getBlockState(pos);
|
||||
|
||||
P property = state.getValue(TYPE);
|
||||
if(property.getMachineProperties() instanceof IMachinePropertiesTesr){
|
||||
return ParticleHelper.addDestroyEffects(world, this, world.getBlockState(pos), pos, effectRenderer, particleCallback);
|
||||
if (blockType.getMachineProperties() instanceof IMachinePropertiesTesr) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
return ParticleHelper.addDestroyEffects(world, this, blockState, pos, effectRenderer, particleCallback);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public final ItemStack get(P type) {
|
||||
return new ItemStack(this, 1, type.getMachineProperties().getMeta());
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerSprites(ITextureManager manager) {
|
||||
for(P property : properties.keySet()){
|
||||
if(property.getMachineProperties() instanceof IMachinePropertiesTesr){
|
||||
Proxies.common.getClientInstance().getTextureMapBlocks().registerSprite(new ResourceLocation(((IMachinePropertiesTesr)property.getMachineProperties()).getParticleTextureLocation()));
|
||||
}
|
||||
IMachineProperties<?> machineProperties = blockType.getMachineProperties();
|
||||
if (machineProperties instanceof IMachinePropertiesTesr) {
|
||||
TextureMap textureMapBlocks = Proxies.common.getClientInstance().getTextureMapBlocks();
|
||||
String particleTextureLocation = ((IMachinePropertiesTesr) machineProperties).getParticleTextureLocation();
|
||||
textureMapBlocks.registerSprite(new ResourceLocation(particleTextureLocation));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,7 +11,7 @@
|
||||
package forestry.core.blocks;
|
||||
|
||||
public class BlockCore extends BlockBase<BlockTypeCoreTesr> {
|
||||
public BlockCore() {
|
||||
super(BlockTypeCoreTesr.class);
|
||||
public BlockCore(BlockTypeCoreTesr blockType) {
|
||||
super(blockType);
|
||||
}
|
||||
}
|
||||
@@ -17,14 +17,18 @@ import net.minecraftforge.oredict.OreDictionary;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
|
||||
public class BlockRegistryCore extends BlockRegistry {
|
||||
public final BlockCore core;
|
||||
public final BlockCore analyzer;
|
||||
public final BlockCore escritoire;
|
||||
public final BlockSoil soil;
|
||||
public final BlockResourceOre resources;
|
||||
public final BlockResourceStorage resourceStorage;
|
||||
|
||||
public BlockRegistryCore() {
|
||||
core = new BlockCore();
|
||||
registerBlock(core, new ItemBlockForestry(core), "core");
|
||||
analyzer = new BlockCore(BlockTypeCoreTesr.ANALYZER);
|
||||
registerBlock(analyzer, new ItemBlockForestry(analyzer), "analyzer");
|
||||
|
||||
escritoire = new BlockCore(BlockTypeCoreTesr.ESCRITOIRE);
|
||||
registerBlock(escritoire, new ItemBlockForestry<>(escritoire), "escritoire");
|
||||
|
||||
soil = new BlockSoil();
|
||||
registerBlock(soil, new ItemBlockForestry(soil), "soil");
|
||||
|
||||
@@ -14,6 +14,7 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileAnalyzer;
|
||||
@@ -21,16 +22,16 @@ import forestry.core.tiles.TileEscritoire;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
|
||||
public enum BlockTypeCoreTesr implements IBlockTypeTesr {
|
||||
ANALYZER(0, TileAnalyzer.class, "analyzer", Proxies.render.getRendererAnalyzer()),
|
||||
ESCRITOIRE(1, TileEscritoire.class, "escritoire", Proxies.render.getRenderEscritoire());
|
||||
ANALYZER(TileAnalyzer.class, "analyzer", Proxies.render.getRendererAnalyzer()),
|
||||
ESCRITOIRE(TileEscritoire.class, "escritoire", Proxies.render.getRenderEscritoire());
|
||||
|
||||
public static final BlockTypeCoreTesr[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachinePropertiesTesr machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeCoreTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<T> renderer) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
<T extends TileForestry> BlockTypeCoreTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<T> renderer) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -11,29 +11,22 @@
|
||||
package forestry.core.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
|
||||
public interface IMachineProperties<T extends TileForestry> extends IStringSerializable {
|
||||
int getMeta();
|
||||
|
||||
@Nonnull
|
||||
String getTeIdent();
|
||||
|
||||
@@ -54,15 +47,9 @@ public interface IMachineProperties<T extends TileForestry> extends IStringSeria
|
||||
|
||||
Block getBlock();
|
||||
|
||||
void getSubBlocks(@Nonnull Item item, @Nonnull CreativeTabs tab, @Nonnull List<ItemStack> list);
|
||||
|
||||
@Nonnull
|
||||
AxisAlignedBB getBoundingBox(@Nonnull BlockPos pos, @Nonnull IBlockState state);
|
||||
|
||||
@Nonnull
|
||||
RayTraceResult collisionRayTrace(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull Vec3d startVec, @Nonnull Vec3d endVec);
|
||||
|
||||
boolean isSolidOnSide(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side);
|
||||
|
||||
boolean rotateBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing axis);
|
||||
}
|
||||
@@ -2,33 +2,25 @@ package forestry.core.blocks;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
|
||||
import forestry.api.core.IModelManager;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
import forestry.core.utils.ItemStackUtil;
|
||||
|
||||
public class MachineProperties<T extends TileForestry> implements IMachineProperties<T> {
|
||||
|
||||
private final int meta;
|
||||
@Nonnull
|
||||
private final String name;
|
||||
@Nonnull
|
||||
@@ -40,16 +32,15 @@ public class MachineProperties<T extends TileForestry> implements IMachineProper
|
||||
@Nullable
|
||||
private Block block;
|
||||
|
||||
public MachineProperties(int meta, @Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
this(meta, "forestry." + name, teClass, name, new AxisAlignedBB(0, 0, 0, 1, 1, 1));
|
||||
public MachineProperties(@Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
this("forestry." + name, teClass, name, new AxisAlignedBB(0, 0, 0, 1, 1, 1));
|
||||
}
|
||||
|
||||
public MachineProperties(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nonnull AxisAlignedBB boundingBox) {
|
||||
this(meta, "forestry." + name, teClass, name, boundingBox);
|
||||
public MachineProperties(@Nonnull Class<T> teClass, @Nonnull String name, @Nonnull AxisAlignedBB boundingBox) {
|
||||
this("forestry." + name, teClass, name, boundingBox);
|
||||
}
|
||||
|
||||
private MachineProperties(int meta, @Nonnull String teIdent, @Nonnull Class<T> teClass, @Nonnull String name, @Nonnull AxisAlignedBB boundingBox) {
|
||||
this.meta = meta;
|
||||
private MachineProperties(@Nonnull String teIdent, @Nonnull Class<T> teClass, @Nonnull String name, @Nonnull AxisAlignedBB boundingBox) {
|
||||
this.teIdent = teIdent;
|
||||
this.teClass = teClass;
|
||||
this.name = name;
|
||||
@@ -67,11 +58,6 @@ public class MachineProperties<T extends TileForestry> implements IMachineProper
|
||||
return block;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(@Nonnull Item item, @Nonnull CreativeTabs tab, @Nonnull List<ItemStack> list) {
|
||||
list.add(new ItemStack(item, 1, meta));
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public AxisAlignedBB getBoundingBox(@Nonnull BlockPos pos, @Nonnull IBlockState state) {
|
||||
@@ -84,20 +70,6 @@ public class MachineProperties<T extends TileForestry> implements IMachineProper
|
||||
return BlockUtil.collisionRayTrace(pos, startVec, endVec, boundingBox);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolidOnSide(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(@Nonnull World world, @Nonnull BlockPos pos, @Nonnull EnumFacing axis) {
|
||||
T tile = TileUtil.getTile(world, pos, teClass);
|
||||
if (tile == null) {
|
||||
return false;
|
||||
}
|
||||
return tile.rotate(axis);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerTileEntity() {
|
||||
GameRegistry.registerTileEntity(teClass, teIdent);
|
||||
@@ -105,8 +77,8 @@ public class MachineProperties<T extends TileForestry> implements IMachineProper
|
||||
|
||||
@Override
|
||||
public void registerModel(@Nonnull Item item, @Nonnull IModelManager manager) {
|
||||
String identifier = ItemStackUtil.getItemNameFromRegistry(item).getResourcePath() + "_" + name;
|
||||
manager.registerItemModel(item, meta, identifier);
|
||||
String identifier = ItemStackUtil.getItemNameFromRegistry(item).getResourcePath();
|
||||
manager.registerItemModel(item, 0, identifier);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -119,11 +91,6 @@ public class MachineProperties<T extends TileForestry> implements IMachineProper
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public String getTeIdent() {
|
||||
|
||||
@@ -20,14 +20,14 @@ public class MachinePropertiesTesr<T extends TileForestry> extends MachineProper
|
||||
@Nonnull
|
||||
private final String particleTextureLocation;
|
||||
|
||||
public MachinePropertiesTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nonnull String particleTextureLocation) {
|
||||
super(meta, teClass, name);
|
||||
public MachinePropertiesTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nonnull String particleTextureLocation) {
|
||||
super(teClass, name);
|
||||
this.renderer = renderer;
|
||||
this.particleTextureLocation = particleTextureLocation;
|
||||
}
|
||||
|
||||
public MachinePropertiesTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nonnull AxisAlignedBB boundingBox, @Nonnull String particleTextureLocation) {
|
||||
super(meta, teClass, name, boundingBox);
|
||||
public MachinePropertiesTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nonnull AxisAlignedBB boundingBox, @Nonnull String particleTextureLocation) {
|
||||
super(teClass, name, boundingBox);
|
||||
this.renderer = renderer;
|
||||
this.particleTextureLocation = particleTextureLocation;
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class MachinePropertiesTesr<T extends TileForestry> extends MachineProper
|
||||
ClientRegistry.bindTileEntitySpecialRenderer(getTeClass(), renderer);
|
||||
Item item = Item.getItemFromBlock(getBlock());
|
||||
if (item != null) {
|
||||
ForgeHooksClient.registerTESRItemStack(item, getMeta(), getTeClass());
|
||||
ForgeHooksClient.registerTESRItemStack(item, 0, getTeClass());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,10 +15,11 @@ import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.blocks.IBlockWithMeta;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
@@ -58,18 +59,19 @@ public class ItemBlockForestry<B extends Block> extends ItemBlock {
|
||||
boolean placed = super.placeBlockAt(stack, player, world, pos, side, hitX, hitY, hitZ, newState);
|
||||
|
||||
if (block.hasTileEntity(newState)) {
|
||||
TileForestry tile = TileUtil.getTile(world, pos, TileForestry.class);
|
||||
|
||||
if (tile != null) {
|
||||
if (stack.getItem() instanceof ItemBlockNBT && stack.hasTagCompound()) {
|
||||
if (stack.getItem() instanceof ItemBlockNBT && stack.hasTagCompound()) {
|
||||
TileForestry tile = TileUtil.getTile(world, pos, TileForestry.class);
|
||||
if (tile != null) {
|
||||
tile.readFromNBT(stack.getTagCompound());
|
||||
tile.setPos(pos);
|
||||
}
|
||||
|
||||
tile.rotateAfterPlacement(player, side);
|
||||
}
|
||||
}
|
||||
|
||||
if (block instanceof BlockBase) {
|
||||
((BlockBase) block).rotateAfterPlacement(player, world, pos, side);
|
||||
}
|
||||
|
||||
return placed;
|
||||
}
|
||||
}
|
||||
@@ -15,6 +15,7 @@ import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.inventory.InventoryCrafting;
|
||||
import net.minecraft.item.Item;
|
||||
@@ -208,6 +209,10 @@ public abstract class RecipeUtil {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void addRecipe(Block block, Object... obj) {
|
||||
addRecipe(new ItemStack(block), obj);
|
||||
}
|
||||
|
||||
public static void addRecipe(Item item, Object... obj) {
|
||||
addRecipe(new ItemStack(item), obj);
|
||||
}
|
||||
|
||||
@@ -10,14 +10,13 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.render;
|
||||
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.particle.EntityDiggingFX;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.IStringSerializable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.blocks.IBlockType;
|
||||
@@ -27,17 +26,16 @@ import forestry.core.proxy.Proxies;
|
||||
|
||||
public class MachineParticleCallback<P extends Enum<P> & IBlockType & IStringSerializable> extends ParticleHelper.DefaultCallback<BlockBase> {
|
||||
|
||||
private final PropertyEnum<P> TYPE;
|
||||
private final P blockType;
|
||||
|
||||
public MachineParticleCallback(BlockBase block, PropertyEnum<P> TYPE) {
|
||||
public MachineParticleCallback(BlockBase block, P blockType) {
|
||||
super(block);
|
||||
this.TYPE = TYPE;
|
||||
this.blockType = blockType;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void setTexture(EntityDiggingFX fx, BlockPos pos, IBlockState state) {
|
||||
P property = state.getValue(TYPE);
|
||||
IMachineProperties<?> machineProperties = property.getMachineProperties();
|
||||
IMachineProperties<?> machineProperties = blockType.getMachineProperties();
|
||||
if(machineProperties instanceof IMachinePropertiesTesr){
|
||||
Minecraft minecraft = Proxies.common.getClientInstance();
|
||||
TextureMap textureMapBlocks = minecraft.getTextureMapBlocks();
|
||||
|
||||
@@ -7,7 +7,6 @@ import java.util.Map;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.properties.IProperty;
|
||||
import net.minecraft.block.properties.PropertyEnum;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
@@ -17,39 +16,34 @@ import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.blocks.IBlockType;
|
||||
import forestry.core.blocks.IMachinePropertiesTesr;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class MachineStateMapper<T extends Enum<T> & IBlockType & IStringSerializable> extends ForestryStateMapper {
|
||||
|
||||
private final Class<T> machinePropertiesClass;
|
||||
private final PropertyEnum<T> META;
|
||||
private final PropertyEnum<EnumFacing> FACE;
|
||||
|
||||
public MachineStateMapper(Class<T> machinePropertiesClass, PropertyEnum<T> META, PropertyEnum<EnumFacing> FACE) {
|
||||
this.machinePropertiesClass = machinePropertiesClass;
|
||||
this.META = META;
|
||||
this.FACE = FACE;
|
||||
private final T type;
|
||||
|
||||
public MachineStateMapper(T type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<IBlockState, ModelResourceLocation> putStateModelLocations(Block block) {
|
||||
for (T type : machinePropertiesClass.getEnumConstants()) {
|
||||
if (type.getMachineProperties() instanceof IMachinePropertiesTesr) {
|
||||
continue;
|
||||
}
|
||||
if (!(type.getMachineProperties() instanceof IMachinePropertiesTesr)) {
|
||||
for (EnumFacing facing : EnumFacing.values()) {
|
||||
if (facing == EnumFacing.DOWN || facing == EnumFacing.UP) {
|
||||
continue;
|
||||
}
|
||||
IBlockState state = block.getDefaultState().withProperty(META, type).withProperty(FACE, facing);
|
||||
IBlockState state = block.getDefaultState().withProperty(BlockBase.FACING, facing);
|
||||
LinkedHashMap<IProperty<?>, Comparable<?>> linkedhashmap = Maps.newLinkedHashMap(state.getProperties());
|
||||
ResourceLocation blockLocation = Block.REGISTRY.getNameForObject(block);
|
||||
String s = String.format("%s:%s", blockLocation.getResourceDomain(), blockLocation.getResourcePath() + "_" + META.getName((T) linkedhashmap.remove(META)));
|
||||
String s = String.format("%s:%s", blockLocation.getResourceDomain(), blockLocation.getResourcePath());
|
||||
mapStateModelLocations.put(state, new ModelResourceLocation(s, getPropertyString(linkedhashmap)));
|
||||
}
|
||||
}
|
||||
|
||||
return this.mapStateModelLocations;
|
||||
}
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.render;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.entity.RenderManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
@@ -19,6 +20,7 @@ import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.apiculture.render.ModelAnalyzer;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.TileAnalyzer;
|
||||
|
||||
@@ -38,10 +40,14 @@ public class RenderAnalyzer extends TileEntitySpecialRenderer<TileAnalyzer> {
|
||||
@Override
|
||||
public void renderTileEntityAt(TileAnalyzer analyzer, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
if (analyzer != null) {
|
||||
render(analyzer.getIndividualOnDisplay(), analyzer.getWorld(), analyzer.getOrientation(), x, y, z);
|
||||
} else {
|
||||
render(null, null, EnumFacing.WEST, x, y, z);
|
||||
IBlockState blockState = analyzer.getWorldObj().getBlockState(analyzer.getPos());
|
||||
if (blockState != null && blockState.getBlock() instanceof BlockBase) {
|
||||
EnumFacing facing = blockState.getValue(BlockBase.FACING);
|
||||
render(analyzer.getIndividualOnDisplay(), analyzer.getWorld(), facing, x, y, z);
|
||||
return;
|
||||
}
|
||||
}
|
||||
render(null, null, EnumFacing.WEST, x, y, z);
|
||||
}
|
||||
|
||||
private void render(ItemStack itemstack, World world, EnumFacing orientation, double x, double y, double z) {
|
||||
|
||||
@@ -10,12 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.render;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.inventory.InventoryEscritoire;
|
||||
import forestry.core.models.ModelEscritoire;
|
||||
@@ -38,10 +40,14 @@ public class RenderEscritoire extends TileEntitySpecialRenderer<TileEscritoire>
|
||||
@Override
|
||||
public void renderTileEntityAt(TileEscritoire escritoire, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
if (escritoire != null) {
|
||||
render(escritoire.getStackInSlot(InventoryEscritoire.SLOT_ANALYZE), escritoire.getOrientation(), x, y, z);
|
||||
} else {
|
||||
render(null, EnumFacing.SOUTH, x, y, z);
|
||||
IBlockState blockState = escritoire.getWorldObj().getBlockState(escritoire.getPos());
|
||||
if (blockState != null && blockState.getBlock() instanceof BlockBase) {
|
||||
EnumFacing facing = blockState.getValue(BlockBase.FACING);
|
||||
render(escritoire.getStackInSlot(InventoryEscritoire.SLOT_ANALYZE), facing, x, y, z);
|
||||
return;
|
||||
}
|
||||
}
|
||||
render(null, EnumFacing.SOUTH, x, y, z);
|
||||
}
|
||||
|
||||
private void render(ItemStack itemstack, EnumFacing orientation, double x, double y, double z) {
|
||||
|
||||
@@ -14,6 +14,7 @@ import java.awt.Color;
|
||||
import java.util.EnumMap;
|
||||
import java.util.Locale;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -21,6 +22,7 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.tiles.IRenderableTile;
|
||||
import forestry.core.tiles.TileBase;
|
||||
@@ -89,10 +91,14 @@ public class RenderMachine extends TileEntitySpecialRenderer<TileBase> {
|
||||
public void renderTileEntityAt(TileBase tile, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
if (tile != null) {
|
||||
IRenderableTile generator = (IRenderableTile) tile;
|
||||
render(generator.getResourceTankInfo(), generator.getProductTankInfo(), generator.getOrientation(), x, y, z, destroyStage);
|
||||
} else {
|
||||
render(TankRenderInfo.EMPTY, TankRenderInfo.EMPTY, EnumFacing.SOUTH, x, y, z, -1);
|
||||
IBlockState blockState = tile.getWorldObj().getBlockState(tile.getPos());
|
||||
if (blockState != null && blockState.getBlock() instanceof BlockBase) {
|
||||
EnumFacing facing = blockState.getValue(BlockBase.FACING);
|
||||
render(generator.getResourceTankInfo(), generator.getProductTankInfo(), facing, x, y, z, destroyStage);
|
||||
return;
|
||||
}
|
||||
}
|
||||
render(TankRenderInfo.EMPTY, TankRenderInfo.EMPTY, EnumFacing.SOUTH, x, y, z, -1);
|
||||
}
|
||||
|
||||
private void render(TankRenderInfo resourceTankInfo, TankRenderInfo productTankInfo, EnumFacing orientation, double x, double y, double z, int destroyStage) {
|
||||
|
||||
@@ -10,12 +10,14 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.render;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.model.ModelChest;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.tiles.TileNaturalistChest;
|
||||
|
||||
@@ -34,10 +36,14 @@ public class RenderNaturalistChest extends TileEntitySpecialRenderer<TileNatural
|
||||
@Override
|
||||
public void renderTileEntityAt(TileNaturalistChest chest, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
if (chest != null) {
|
||||
render(chest.getOrientation(), chest.prevLidAngle, chest.lidAngle, x, y, z, partialTicks);
|
||||
} else {
|
||||
render(EnumFacing.SOUTH, 0, 0, x, y, z, 0);
|
||||
IBlockState blockState = chest.getWorldObj().getBlockState(chest.getPos());
|
||||
if (blockState != null && blockState.getBlock() instanceof BlockBase) {
|
||||
EnumFacing facing = blockState.getValue(BlockBase.FACING);
|
||||
render(facing, chest.prevLidAngle, chest.lidAngle, x, y, z, partialTicks);
|
||||
return;
|
||||
}
|
||||
}
|
||||
render(EnumFacing.SOUTH, 0, 0, x, y, z, 0);
|
||||
}
|
||||
|
||||
public void render(EnumFacing orientation, float prevLidAngle, float lidAngle, double x, double y, double z, float partialTick) {
|
||||
|
||||
@@ -10,14 +10,9 @@
|
||||
******************************************************************************/
|
||||
package forestry.core.tiles;
|
||||
|
||||
import net.minecraft.util.EnumFacing;
|
||||
|
||||
import forestry.core.render.TankRenderInfo;
|
||||
|
||||
public interface IRenderableTile {
|
||||
|
||||
EnumFacing getOrientation();
|
||||
|
||||
TankRenderInfo getResourceTankInfo();
|
||||
|
||||
TankRenderInfo getProductTankInfo();
|
||||
|
||||
@@ -50,9 +50,7 @@ public abstract class TileBase extends TileForestry implements IHintSource {
|
||||
public String getUnlocalizedTitle() {
|
||||
Block block = getBlockType();
|
||||
if (block instanceof BlockBase) {
|
||||
BlockBase blockBase = (BlockBase) block;
|
||||
int meta = getBlockMetadata();
|
||||
return block.getUnlocalizedName() + "." + blockBase.getNameFromMeta(meta) + ".name";
|
||||
return block.getUnlocalizedName() + ".name";
|
||||
}
|
||||
return super.getUnlocalizedTitle();
|
||||
}
|
||||
@@ -61,12 +59,6 @@ public abstract class TileBase extends TileForestry implements IHintSource {
|
||||
public boolean shouldRefresh(World world, BlockPos pos, IBlockState oldState, IBlockState newState) {
|
||||
Block oldBlock = oldState.getBlock();
|
||||
Block newBlock = newState.getBlock();
|
||||
if (oldBlock != newBlock || !(oldBlock instanceof BlockBase) || !(newBlock instanceof BlockBase)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
BlockBase oldBlockBase = (BlockBase) oldBlock;
|
||||
BlockBase newBlockBase = (BlockBase) newBlock;
|
||||
return oldState.getValue(oldBlockBase.getTypeProperty()) != newState.getValue(newBlockBase.getTypeProperty());
|
||||
return oldBlock != newBlock || !(oldBlock instanceof BlockBase) || !(newBlock instanceof BlockBase);
|
||||
}
|
||||
}
|
||||
@@ -12,7 +12,7 @@ package forestry.core.tiles;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.inventory.Container;
|
||||
import net.minecraft.inventory.ICrafting;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
@@ -21,6 +21,7 @@ import net.minecraft.util.EnumFacing;
|
||||
|
||||
import forestry.api.core.IErrorLogic;
|
||||
import forestry.apiculture.network.packets.PacketActiveUpdate;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.config.Config;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.errors.EnumErrorCode;
|
||||
@@ -65,16 +66,7 @@ public abstract class TileEngine extends TileBase implements IEnergyConnection,
|
||||
hints.addAll(Config.hints.get("engine"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateAfterPlacement(EntityPlayer player, EnumFacing side) {
|
||||
EnumFacing orientation = side.getOpposite();
|
||||
if (isOrientedAtEnergyReciever(orientation)) {
|
||||
setOrientation(orientation);
|
||||
} else {
|
||||
super.rotateAfterPlacement(player, side);
|
||||
rotate();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
protected void addHeat(int i) {
|
||||
heat += i;
|
||||
@@ -124,7 +116,9 @@ public abstract class TileEngine extends TileBase implements IEnergyConnection,
|
||||
errorLogic.setCondition(!enabledRedstone, EnumErrorCode.NO_REDSTONE);
|
||||
|
||||
// Determine targeted tile
|
||||
TileEntity tile = worldObj.getTileEntity(getPos().offset(getOrientation()));
|
||||
IBlockState blockState = worldObj.getBlockState(getPos());
|
||||
EnumFacing facing = blockState.getValue(BlockBase.FACING);
|
||||
TileEntity tile = worldObj.getTileEntity(getPos().offset(facing));
|
||||
|
||||
float newPistonSpeed = getPistonSpeed();
|
||||
if (newPistonSpeed != pistonSpeedServer) {
|
||||
@@ -136,7 +130,7 @@ public abstract class TileEngine extends TileBase implements IEnergyConnection,
|
||||
|
||||
progress += pistonSpeedServer;
|
||||
|
||||
energyManager.sendEnergy(getOrientation(), tile);
|
||||
energyManager.sendEnergy(facing, tile);
|
||||
|
||||
if (progress > 0.25 && stagePiston == 1) {
|
||||
stagePiston = 2;
|
||||
@@ -144,8 +138,8 @@ public abstract class TileEngine extends TileBase implements IEnergyConnection,
|
||||
progress = 0;
|
||||
stagePiston = 0;
|
||||
}
|
||||
} else if (enabledRedstone && BlockUtil.isEnergyReceiverOrEngine(getOrientation().getOpposite(), tile)) {
|
||||
if (energyManager.canSendEnergy(getOrientation(), tile)) {
|
||||
} else if (enabledRedstone && BlockUtil.isEnergyReceiverOrEngine(facing.getOpposite(), tile)) {
|
||||
if (energyManager.canSendEnergy(facing, tile)) {
|
||||
stagePiston = 1; // If we can transfer energy, start running
|
||||
setActive(true);
|
||||
cantSendEnergyCountdown = CANT_SEND_ENERGY_TIME;
|
||||
@@ -188,30 +182,6 @@ public abstract class TileEngine extends TileBase implements IEnergyConnection,
|
||||
}
|
||||
}
|
||||
|
||||
/* INTERACTION */
|
||||
@Override
|
||||
public boolean rotate(EnumFacing axis) {
|
||||
rotate();
|
||||
|
||||
// it would be irritating if the wrench opened the engine gui when it failed to rotate, so always return true
|
||||
return true;
|
||||
}
|
||||
|
||||
private void rotate() {
|
||||
for (int i = getOrientation().ordinal() + 1; i <= getOrientation().ordinal() + 6; ++i) {
|
||||
EnumFacing orientation = EnumFacing.values()[i % 6];
|
||||
if (isOrientedAtEnergyReciever(orientation)) {
|
||||
setOrientation(orientation);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isOrientedAtEnergyReciever(EnumFacing orientation) {
|
||||
TileEntity tile = worldObj.getTileEntity(getPos().offset(orientation));
|
||||
return BlockUtil.isEnergyReceiverOrEngine(getOrientation().getOpposite(), tile);
|
||||
}
|
||||
|
||||
// STATE INFORMATION
|
||||
protected double getHeatLevel() {
|
||||
return (double) heat / (double) maxHeat;
|
||||
|
||||
@@ -24,7 +24,6 @@ import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ITickable;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.text.ITextComponent;
|
||||
import net.minecraft.util.text.TextComponentTranslation;
|
||||
import net.minecraft.world.World;
|
||||
@@ -62,7 +61,6 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE
|
||||
|
||||
private int tickCount = rand.nextInt(256);
|
||||
private boolean needsNetworkUpdate = false;
|
||||
private EnumFacing orientation = EnumFacing.WEST;
|
||||
|
||||
protected AdjacentTileCache getTileCache() {
|
||||
return tileCache;
|
||||
@@ -84,31 +82,6 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE
|
||||
super.validate();
|
||||
}
|
||||
|
||||
public void rotateAfterPlacement(EntityPlayer player, EnumFacing side) {
|
||||
int l = MathHelper.floor_double(player.rotationYaw * 4F / 360F + 0.5D) & 3;
|
||||
if (l == 0) {
|
||||
setOrientation(EnumFacing.NORTH);
|
||||
}
|
||||
if (l == 1) {
|
||||
setOrientation(EnumFacing.EAST);
|
||||
}
|
||||
if (l == 2) {
|
||||
setOrientation(EnumFacing.SOUTH);
|
||||
}
|
||||
if (l == 3) {
|
||||
setOrientation(EnumFacing.WEST);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean rotate(EnumFacing axis) {
|
||||
if (axis == EnumFacing.DOWN || axis == EnumFacing.UP) {
|
||||
EnumFacing orientation = getOrientation().rotateAround(axis.getAxis());
|
||||
setOrientation(orientation);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// / UPDATING
|
||||
@Override
|
||||
public final void update() {
|
||||
@@ -143,12 +116,6 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE
|
||||
|
||||
inventory.readFromNBT(data);
|
||||
accessHandler.readFromNBT(data);
|
||||
|
||||
if (data.hasKey("Orientation")) {
|
||||
orientation = EnumFacing.values()[data.getInteger("Orientation")];
|
||||
} else {
|
||||
orientation = EnumFacing.WEST;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -156,7 +123,6 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE
|
||||
super.writeToNBT(data);
|
||||
inventory.writeToNBT(data);
|
||||
accessHandler.writeToNBT(data);
|
||||
data.setInteger("Orientation", orientation.ordinal());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,12 +140,12 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE
|
||||
/* IStreamable */
|
||||
@Override
|
||||
public void writeData(DataOutputStreamForestry data) throws IOException {
|
||||
data.writeEnum(orientation, forgeDirections);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readData(DataInputStreamForestry data) throws IOException {
|
||||
orientation = data.readEnum(forgeDirections);
|
||||
|
||||
}
|
||||
|
||||
public void onRemoval() {
|
||||
@@ -209,25 +175,6 @@ public abstract class TileForestry extends TileEntity implements IStreamable, IE
|
||||
return worldObj.isBlockIndirectlyGettingPowered(getPos()) > 0;
|
||||
}
|
||||
|
||||
// / ORIENTATION
|
||||
public EnumFacing getOrientation() {
|
||||
return this.orientation;
|
||||
}
|
||||
|
||||
public void setOrientation(EnumFacing orientation) {
|
||||
if (orientation == null) {
|
||||
throw new NullPointerException("Orientation cannot be null");
|
||||
}
|
||||
if (this.orientation == orientation) {
|
||||
return;
|
||||
}
|
||||
this.orientation = orientation;
|
||||
this.setNeedsNetworkUpdate();
|
||||
BlockPos pos = getPos();
|
||||
worldObj.notifyBlockOfStateChange(pos, worldObj.getBlockState(pos).getBlock());
|
||||
worldObj.markBlockRangeForRenderUpdate(pos, pos);
|
||||
}
|
||||
|
||||
protected final void setNeedsNetworkUpdate() {
|
||||
needsNetworkUpdate = true;
|
||||
}
|
||||
|
||||
@@ -1,59 +0,0 @@
|
||||
/*******************************************************************************
|
||||
* Copyright (c) 2011-2014 SirSengir.
|
||||
* All rights reserved. This program and the accompanying materials
|
||||
* are made available under the terms of the GNU Lesser Public License v3
|
||||
* which accompanies this distribution, and is available at
|
||||
* http://www.gnu.org/licenses/lgpl-3.0.txt
|
||||
*
|
||||
* Various Contributors including, but not limited to:
|
||||
* SirSengir (original work), CovertJaguar, Player, Binnie, MysteriousAges
|
||||
******************************************************************************/
|
||||
package forestry.core.worldgen;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.tiles.TileForestry;
|
||||
|
||||
public class BlockTypeTileForestry implements IBlockType {
|
||||
private final Block block;
|
||||
private final int meta;
|
||||
private EnumFacing direction;
|
||||
|
||||
public BlockTypeTileForestry(Block block, int meta) {
|
||||
this.block = block;
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDirection(EnumFacing facing) {
|
||||
this.direction = facing;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlock(World world, BlockPos pos) {
|
||||
boolean placed = world.setBlockState(pos, block.getStateFromMeta(meta), Constants.FLAG_BLOCK_SYNCH_AND_UPDATE);
|
||||
if (!placed) {
|
||||
return;
|
||||
}
|
||||
|
||||
Block worldBlock = world.getBlockState(pos).getBlock();
|
||||
if (!Block.isEqualTo(block, worldBlock)) {
|
||||
return;
|
||||
}
|
||||
|
||||
TileEntity tile = world.getTileEntity(pos);
|
||||
if (!(tile instanceof TileForestry)) {
|
||||
world.setBlockToAir(pos);
|
||||
return;
|
||||
}
|
||||
|
||||
TileForestry tileForestry = (TileForestry) tile;
|
||||
|
||||
tileForestry.setOrientation(direction);
|
||||
}
|
||||
}
|
||||
@@ -12,6 +12,7 @@ package forestry.energy;
|
||||
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
|
||||
@@ -19,7 +20,6 @@ import forestry.api.core.ForestryAPI;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.energy.blocks.BlockRegistryEnergy;
|
||||
import forestry.energy.blocks.BlockTypeEngine;
|
||||
import forestry.energy.proxy.ProxyEnergy;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
@@ -39,27 +39,20 @@ public class PluginEnergy extends BlankForestryPlugin {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preInit() {
|
||||
blocks.engine.addDefinitions(
|
||||
BlockTypeEngine.PEAT,
|
||||
BlockTypeEngine.BIOGAS
|
||||
);
|
||||
public void doInit() {
|
||||
blocks.peatEngine.init();
|
||||
blocks.biogasEngine.init();
|
||||
|
||||
if (ForestryAPI.activeMode.getBooleanSetting("energy.engine.clockwork")) {
|
||||
blocks.engine.addDefinitions(BlockTypeEngine.CLOCKWORK);
|
||||
blocks.clockworkEngine.init();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void doInit() {
|
||||
blocks.engine.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerRecipes() {
|
||||
super.registerRecipes();
|
||||
|
||||
RecipeUtil.addRecipe(blocks.engine.get(BlockTypeEngine.PEAT),
|
||||
RecipeUtil.addRecipe(new ItemStack(blocks.peatEngine),
|
||||
"###",
|
||||
" X ",
|
||||
"YVY",
|
||||
@@ -68,7 +61,7 @@ public class PluginEnergy extends BlankForestryPlugin {
|
||||
'Y', "gearCopper",
|
||||
'V', Blocks.PISTON);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.engine.get(BlockTypeEngine.BIOGAS),
|
||||
RecipeUtil.addRecipe(new ItemStack(blocks.biogasEngine),
|
||||
"###",
|
||||
" X ",
|
||||
"YVY",
|
||||
@@ -78,7 +71,7 @@ public class PluginEnergy extends BlankForestryPlugin {
|
||||
'V', Blocks.PISTON);
|
||||
|
||||
if (ForestryAPI.activeMode.getBooleanSetting("energy.engine.clockwork")) {
|
||||
RecipeUtil.addRecipe(blocks.engine.get(BlockTypeEngine.CLOCKWORK),
|
||||
RecipeUtil.addRecipe(new ItemStack(blocks.clockworkEngine),
|
||||
"###",
|
||||
" X ",
|
||||
"ZVY",
|
||||
|
||||
@@ -17,16 +17,18 @@ import java.util.List;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.AxisAlignedBB;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
import forestry.core.utils.BlockUtil;
|
||||
|
||||
public class BlockEngine extends BlockBase<BlockTypeEngine> {
|
||||
private static final EnumMap<EnumFacing, List<AxisAlignedBB>> boundingBoxesForDirections = new EnumMap<>(EnumFacing.class);
|
||||
@@ -52,19 +54,13 @@ public class BlockEngine extends BlockBase<BlockTypeEngine> {
|
||||
));
|
||||
}
|
||||
|
||||
public BlockEngine() {
|
||||
super(BlockTypeEngine.class);
|
||||
public BlockEngine(BlockTypeEngine blockType) {
|
||||
super(blockType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxToList(IBlockState state, World worldIn, BlockPos pos, AxisAlignedBB entityBox, List<AxisAlignedBB> collidingBoxes, Entity entityIn) {
|
||||
TileEngine tile = TileUtil.getTile(worldIn, pos, TileEngine.class);
|
||||
if (tile == null) {
|
||||
super.addCollisionBoxToList(state, worldIn, pos, entityBox, collidingBoxes, entityIn);
|
||||
return;
|
||||
}
|
||||
|
||||
EnumFacing orientation = tile.getOrientation();
|
||||
EnumFacing orientation = state.getValue(FACING);
|
||||
List<AxisAlignedBB> boundingBoxes = boundingBoxesForDirections.get(orientation);
|
||||
if (boundingBoxes == null) {
|
||||
return;
|
||||
@@ -80,12 +76,7 @@ public class BlockEngine extends BlockBase<BlockTypeEngine> {
|
||||
|
||||
@Override
|
||||
public RayTraceResult collisionRayTrace(IBlockState blockState, World worldIn, BlockPos pos, Vec3d start, Vec3d end) {
|
||||
TileEngine tile = TileUtil.getTile(worldIn, pos, TileEngine.class);
|
||||
if (tile == null) {
|
||||
return super.collisionRayTrace(blockState, worldIn, pos, start, end);
|
||||
}
|
||||
|
||||
EnumFacing orientation = tile.getOrientation();
|
||||
EnumFacing orientation = blockState.getValue(FACING);
|
||||
List<AxisAlignedBB> boundingBoxes = boundingBoxesForDirections.get(orientation);
|
||||
if (boundingBoxes == null) {
|
||||
return super.collisionRayTrace(blockState, worldIn, pos, start, end);
|
||||
@@ -112,4 +103,52 @@ public class BlockEngine extends BlockBase<BlockTypeEngine> {
|
||||
|
||||
return nearestIntersection;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean rotateBlock(World world, BlockPos pos, EnumFacing axis) {
|
||||
if (rotate(world, pos)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return super.rotateBlock(world, pos, axis);
|
||||
}
|
||||
|
||||
private static boolean isOrientedAtEnergyReciever(World world, BlockPos pos, EnumFacing orientation) {
|
||||
TileEntity tile = world.getTileEntity(pos.offset(orientation));
|
||||
return BlockUtil.isEnergyReceiverOrEngine(orientation.getOpposite(), tile);
|
||||
}
|
||||
|
||||
private static boolean rotate(World world, BlockPos pos) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
EnumFacing blockFacing = blockState.getValue(FACING);
|
||||
for (int i = blockFacing.ordinal() + 1; i <= blockFacing.ordinal() + 6; ++i) {
|
||||
EnumFacing orientation = EnumFacing.values()[i % 6];
|
||||
if (isOrientedAtEnergyReciever(world, pos, orientation)) {
|
||||
blockState = blockState.withProperty(FACING, orientation);
|
||||
world.setBlockState(pos, blockState, 2);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void rotateAfterPlacement(EntityPlayer player, World world, BlockPos pos, EnumFacing side) {
|
||||
EnumFacing orientation = side.getOpposite();
|
||||
if (isOrientedAtEnergyReciever(world, pos, orientation)) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
blockState = blockState.withProperty(FACING, orientation);
|
||||
world.setBlockState(pos, blockState, 2);
|
||||
} else {
|
||||
super.rotateAfterPlacement(player, world, pos, side);
|
||||
rotate(world, pos);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSideSolid(IBlockState base_state, IBlockAccess world, BlockPos pos, EnumFacing side) {
|
||||
IBlockState blockState = world.getBlockState(pos);
|
||||
EnumFacing facing = blockState.getValue(BlockBase.FACING);
|
||||
return facing.getOpposite() == side;
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,18 @@ import forestry.core.blocks.BlockRegistry;
|
||||
import forestry.energy.items.ItemEngine;
|
||||
|
||||
public class BlockRegistryEnergy extends BlockRegistry {
|
||||
public final BlockEngine engine;
|
||||
public final BlockEngine peatEngine;
|
||||
public final BlockEngine biogasEngine;
|
||||
public final BlockEngine clockworkEngine;
|
||||
|
||||
public BlockRegistryEnergy() {
|
||||
engine = new BlockEngine();
|
||||
registerBlock(engine, new ItemEngine(engine), "engine");
|
||||
peatEngine = new BlockEngine(BlockTypeEngine.PEAT);
|
||||
registerBlock(peatEngine, new ItemEngine(peatEngine), "engine.peat");
|
||||
|
||||
biogasEngine = new BlockEngine(BlockTypeEngine.BIOGAS);
|
||||
registerBlock(biogasEngine, new ItemEngine(biogasEngine), "engine.biogas");
|
||||
|
||||
clockworkEngine = new BlockEngine(BlockTypeEngine.CLOCKWORK);
|
||||
registerBlock(clockworkEngine, new ItemEngine(clockworkEngine), "engine.clockwork");
|
||||
}
|
||||
}
|
||||
@@ -29,11 +29,11 @@ import forestry.energy.tiles.TileEnginePeat;
|
||||
import forestry.energy.tiles.TileEuGenerator;
|
||||
|
||||
public enum BlockTypeEngine implements IBlockTypeTesr {
|
||||
PEAT(createEngineProperties(0, TileEnginePeat.class, "peat", "/engine_copper")),
|
||||
BIOGAS(createEngineProperties(1, TileEngineBiogas.class, "biogas", "/engine_bronze")),
|
||||
CLOCKWORK(createEngineProperties(2, TileEngineClockwork.class, "clockwork", "/engine_clock")),
|
||||
ELECTRICAL(createEngineProperties(3, TileEngineElectric.class, "electrical", "/engine_tin")),
|
||||
GENERATOR(createMachineProperties(4, TileEuGenerator.class, "generator", "/generator"));
|
||||
PEAT(createEngineProperties(TileEnginePeat.class, "peat", "/engine_copper")),
|
||||
BIOGAS(createEngineProperties(TileEngineBiogas.class, "biogas", "/engine_bronze")),
|
||||
CLOCKWORK(createEngineProperties(TileEngineClockwork.class, "clockwork", "/engine_clock")),
|
||||
ELECTRICAL(createEngineProperties(TileEngineElectric.class, "electrical", "/engine_tin")),
|
||||
GENERATOR(createMachineProperties(TileEuGenerator.class, "generator", "/generator"));
|
||||
|
||||
public static final BlockTypeEngine[] VALUES = values();
|
||||
|
||||
@@ -44,14 +44,14 @@ public enum BlockTypeEngine implements IBlockTypeTesr {
|
||||
this.machineProperties = machineProperties;
|
||||
}
|
||||
|
||||
protected static IMachinePropertiesTesr<?> createEngineProperties(int meta, @Nonnull Class<? extends TileEngine> teClass, @Nonnull String name, @Nonnull String textureName) {
|
||||
protected static IMachinePropertiesTesr<?> createEngineProperties(@Nonnull Class<? extends TileEngine> teClass, @Nonnull String name, @Nonnull String textureName) {
|
||||
TileEntitySpecialRenderer<TileEngine> renderer = PluginEnergy.proxy.getRenderDefaultEngine(Constants.TEXTURE_PATH_BLOCKS + textureName + "_");
|
||||
return new MachinePropertiesEngine<>(meta, teClass, name, renderer, Constants.RESOURCE_ID + ":blocks" + textureName + ".0");
|
||||
return new MachinePropertiesEngine<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks" + textureName + ".0");
|
||||
}
|
||||
|
||||
protected static IMachinePropertiesTesr<?> createMachineProperties(int meta, @Nonnull Class<? extends TileBase> teClass, @Nonnull String name, @Nonnull String textureName) {
|
||||
protected static IMachinePropertiesTesr<?> createMachineProperties(@Nonnull Class<? extends TileBase> teClass, @Nonnull String name, @Nonnull String textureName) {
|
||||
TileEntitySpecialRenderer<TileBase> renderer = Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + textureName + "_");
|
||||
return new MachinePropertiesTesr<>(meta, teClass, name, renderer, Constants.RESOURCE_ID + ":blocks" + textureName + ".0");
|
||||
return new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks" + textureName + ".0");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -4,26 +4,12 @@ import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
|
||||
import forestry.core.blocks.MachinePropertiesTesr;
|
||||
import forestry.core.tiles.TileEngine;
|
||||
import forestry.core.tiles.TileUtil;
|
||||
|
||||
public class MachinePropertiesEngine<T extends TileEngine> extends MachinePropertiesTesr<T> {
|
||||
public MachinePropertiesEngine(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, String particleTextureLocation) {
|
||||
super(meta, teClass, name, renderer, particleTextureLocation);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isSolidOnSide(@Nonnull IBlockAccess world, @Nonnull BlockPos pos, @Nonnull EnumFacing side) {
|
||||
TileEngine tile = TileUtil.getTile(world, pos, TileEngine.class);
|
||||
if (tile == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
return tile.getOrientation().getOpposite() == side;
|
||||
public MachinePropertiesEngine(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, String particleTextureLocation) {
|
||||
super(teClass, name, renderer, particleTextureLocation);
|
||||
}
|
||||
}
|
||||
@@ -56,7 +56,7 @@ public abstract class GuiEngine<C extends Container, I extends TileEngine> exten
|
||||
drawText(inventory.getCurrentOutput() + " RF/t", x + 22, y + 32);
|
||||
|
||||
drawSubheader(Translator.translateToLocal("for.gui.stored") + ':', x + 22, y + 44);
|
||||
drawText(inventory.getEnergyManager().getEnergyStored(inventory.getOrientation()) + " RF", x + 22, y + 56);
|
||||
drawText(inventory.getEnergyManager().getEnergyStored(null) + " RF", x + 22, y + 56);
|
||||
|
||||
drawSubheader(Translator.translateToLocal("for.gui.heat") + ':', x + 22, y + 68);
|
||||
drawText((double) inventory.getHeat() / (double) 10 + 20.0 + " C", x + 22, y + 80);
|
||||
|
||||
@@ -12,6 +12,7 @@ package forestry.energy.render;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import net.minecraft.block.state.IBlockState;
|
||||
import net.minecraft.client.model.ModelBase;
|
||||
import net.minecraft.client.model.ModelRenderer;
|
||||
import net.minecraft.client.renderer.GlStateManager;
|
||||
@@ -19,6 +20,7 @@ import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
import forestry.core.blocks.BlockBase;
|
||||
import forestry.core.config.Constants;
|
||||
import forestry.core.proxy.Proxies;
|
||||
import forestry.core.render.ForestryResource;
|
||||
@@ -92,10 +94,14 @@ public class RenderEngine extends TileEntitySpecialRenderer<TileEngine> {
|
||||
@Override
|
||||
public void renderTileEntityAt(@Nullable TileEngine engine, double x, double y, double z, float partialTicks, int destroyStage) {
|
||||
if (engine != null) {
|
||||
render(engine.getTemperatureState(), engine.progress, engine.getOrientation(), x, y, z);
|
||||
} else {
|
||||
render(TemperatureState.COOL, 0.25F, EnumFacing.UP, x, y, z);
|
||||
IBlockState blockState = engine.getWorldObj().getBlockState(engine.getPos());
|
||||
if (blockState != null && blockState.getBlock() instanceof BlockBase) {
|
||||
EnumFacing facing = blockState.getValue(BlockBase.FACING);
|
||||
render(engine.getTemperatureState(), engine.progress, facing, x, y, z);
|
||||
return;
|
||||
}
|
||||
}
|
||||
render(TemperatureState.COOL, 0.25F, EnumFacing.UP, x, y, z);
|
||||
}
|
||||
|
||||
private void render(TemperatureState state, float progress, EnumFacing orientation, double x, double y, double z) {
|
||||
|
||||
@@ -35,7 +35,6 @@ import forestry.apiculture.items.ItemRegistryApiculture;
|
||||
import forestry.core.PluginCore;
|
||||
import forestry.core.PluginFluids;
|
||||
import forestry.core.blocks.BlockSoil;
|
||||
import forestry.core.blocks.BlockTypeCoreTesr;
|
||||
import forestry.core.circuits.Circuit;
|
||||
import forestry.core.circuits.CircuitLayout;
|
||||
import forestry.core.circuits.EnumCircuitBoardType;
|
||||
@@ -50,8 +49,6 @@ import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.core.utils.datastructures.FluidMap;
|
||||
import forestry.core.utils.datastructures.ItemStackMap;
|
||||
import forestry.factory.blocks.BlockRegistryFactory;
|
||||
import forestry.factory.blocks.BlockTypeFactoryPlain;
|
||||
import forestry.factory.blocks.BlockTypeFactoryTesr;
|
||||
import forestry.factory.circuits.CircuitSpeedUpgrade;
|
||||
import forestry.factory.network.PacketRegistryFactory;
|
||||
import forestry.factory.recipes.CarpenterRecipeManager;
|
||||
@@ -171,18 +168,6 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
FuelManager.rainSubstrate.put(iodineCharge, new RainSubstrate(iodineCharge, Constants.RAINMAKER_RAIN_DURATION_IODINE, 0.01f));
|
||||
FuelManager.rainSubstrate.put(dissipationCharge, new RainSubstrate(dissipationCharge, 0.075f));
|
||||
|
||||
blocks.factoryTESR.addDefinitions(
|
||||
BlockTypeFactoryTesr.BOTTLER,
|
||||
BlockTypeFactoryTesr.CARPENTER,
|
||||
BlockTypeFactoryTesr.CENTRIFUGE,
|
||||
BlockTypeFactoryTesr.FERMENTER,
|
||||
BlockTypeFactoryTesr.MOISTENER,
|
||||
BlockTypeFactoryTesr.SQUEEZER,
|
||||
BlockTypeFactoryTesr.STILL,
|
||||
BlockTypeFactoryTesr.RAINMAKER
|
||||
);
|
||||
blocks.factoryPlain.addDefinitions(BlockTypeFactoryPlain.VALUES);
|
||||
|
||||
ICircuitLayout layoutMachineUpgrade = new CircuitLayout("machine.upgrade", CircuitSocketType.MACHINE);
|
||||
ChipsetManager.circuitRegistry.registerLayout(layoutMachineUpgrade);
|
||||
|
||||
@@ -203,8 +188,18 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
public void doInit() {
|
||||
super.doInit();
|
||||
|
||||
blocks.factoryTESR.init();
|
||||
blocks.factoryPlain.init();
|
||||
blocks.bottler.init();
|
||||
blocks.carpenter.init();
|
||||
blocks.centrifuge.init();
|
||||
blocks.fermenter.init();
|
||||
blocks.moistener.init();
|
||||
blocks.squeezer.init();
|
||||
blocks.still.init();
|
||||
blocks.rainmaker.init();
|
||||
|
||||
blocks.fabricator.init();
|
||||
blocks.raintank.init();
|
||||
blocks.worktable.init();
|
||||
|
||||
Circuit.machineSpeedUpgrade1 = new CircuitSpeedUpgrade("machine.speed.boost.1", 0.125f, 0.05f, 4);
|
||||
Circuit.machineSpeedUpgrade2 = new CircuitSpeedUpgrade("machine.speed.boost.2", 0.250f, 0.10f, 4);
|
||||
@@ -315,7 +310,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
"###",
|
||||
'#', "logWood");
|
||||
RecipeManagers.carpenterManager.addRecipe(50, Fluids.SEED_OIL.getFluid(500), null,
|
||||
PluginCore.blocks.core.get(BlockTypeCoreTesr.ESCRITOIRE),
|
||||
new ItemStack(PluginCore.blocks.escritoire),
|
||||
"# ",
|
||||
"###",
|
||||
"# #",
|
||||
@@ -433,7 +428,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
ChipsetManager.solderManager.addRecipe(layout, PluginCore.items.tubes.get(EnumElectronTube.BLAZE, 1), Circuit.machineSpeedUpgrade2);
|
||||
ChipsetManager.solderManager.addRecipe(layout, PluginCore.items.tubes.get(EnumElectronTube.GOLD, 1), Circuit.machineEfficiencyUpgrade1);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.BOTTLER),
|
||||
RecipeUtil.addRecipe(blocks.bottler,
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -441,7 +436,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', PluginFluids.items.canEmpty,
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.CARPENTER),
|
||||
RecipeUtil.addRecipe(blocks.carpenter,
|
||||
"X#X",
|
||||
"XYX",
|
||||
"X#X",
|
||||
@@ -449,7 +444,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "ingotBronze",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.CENTRIFUGE),
|
||||
RecipeUtil.addRecipe(blocks.centrifuge,
|
||||
"X#X",
|
||||
"XYX",
|
||||
"X#X",
|
||||
@@ -457,7 +452,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "ingotCopper",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.FERMENTER),
|
||||
RecipeUtil.addRecipe(blocks.fermenter,
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -465,7 +460,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "gearBronze",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.MOISTENER),
|
||||
RecipeUtil.addRecipe(blocks.moistener,
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -473,7 +468,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "gearCopper",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.SQUEEZER),
|
||||
RecipeUtil.addRecipe(blocks.squeezer,
|
||||
"X#X",
|
||||
"XYX",
|
||||
"X#X",
|
||||
@@ -481,7 +476,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "ingotTin",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.STILL),
|
||||
RecipeUtil.addRecipe(blocks.still,
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -489,7 +484,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "dustRedstone",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryTESR.get(BlockTypeFactoryTesr.RAINMAKER),
|
||||
RecipeUtil.addRecipe(blocks.rainmaker,
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"X#X",
|
||||
@@ -497,7 +492,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "gearTin",
|
||||
'Y', PluginCore.items.hardenedCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryPlain.get(BlockTypeFactoryPlain.FABRICATOR),
|
||||
RecipeUtil.addRecipe(blocks.fabricator,
|
||||
"X#X",
|
||||
"#Y#",
|
||||
"XZX",
|
||||
@@ -506,7 +501,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'Y', PluginCore.items.sturdyCasing,
|
||||
'Z', "chestWood");
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryPlain.get(BlockTypeFactoryPlain.RAINTANK),
|
||||
RecipeUtil.addRecipe(blocks.raintank,
|
||||
"X#X",
|
||||
"XYX",
|
||||
"X#X",
|
||||
@@ -514,7 +509,7 @@ public class PluginFactory extends BlankForestryPlugin {
|
||||
'X', "ingotIron",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.factoryPlain.get(BlockTypeFactoryPlain.WORKTABLE),
|
||||
RecipeUtil.addRecipe(blocks.worktable,
|
||||
"B",
|
||||
"W",
|
||||
"C",
|
||||
|
||||
@@ -13,7 +13,7 @@ package forestry.factory.blocks;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockFactoryPlain extends BlockBase<BlockTypeFactoryPlain> {
|
||||
public BlockFactoryPlain() {
|
||||
super(BlockTypeFactoryPlain.class);
|
||||
public BlockFactoryPlain(BlockTypeFactoryPlain type) {
|
||||
super(type);
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ package forestry.factory.blocks;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockFactoryTESR extends BlockBase<BlockTypeFactoryTesr> {
|
||||
public BlockFactoryTESR() {
|
||||
super(BlockTypeFactoryTesr.class);
|
||||
public BlockFactoryTESR(BlockTypeFactoryTesr type) {
|
||||
super(type);
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,51 @@ import forestry.core.items.ItemBlockForestry;
|
||||
import forestry.core.items.ItemBlockNBT;
|
||||
|
||||
public class BlockRegistryFactory extends BlockRegistry {
|
||||
public final BlockFactoryTESR factoryTESR;
|
||||
public final BlockFactoryPlain factoryPlain;
|
||||
public final BlockFactoryTESR bottler;
|
||||
public final BlockFactoryTESR carpenter;
|
||||
public final BlockFactoryTESR centrifuge;
|
||||
public final BlockFactoryTESR fermenter;
|
||||
public final BlockFactoryTESR moistener;
|
||||
public final BlockFactoryTESR squeezer;
|
||||
public final BlockFactoryTESR still;
|
||||
public final BlockFactoryTESR rainmaker;
|
||||
|
||||
public final BlockFactoryPlain fabricator;
|
||||
public final BlockFactoryPlain raintank;
|
||||
public final BlockFactoryPlain worktable;
|
||||
|
||||
public BlockRegistryFactory() {
|
||||
factoryTESR = new BlockFactoryTESR();
|
||||
registerBlock(factoryTESR, new ItemBlockForestry(factoryTESR), "factory");
|
||||
bottler = new BlockFactoryTESR(BlockTypeFactoryTesr.BOTTLER);
|
||||
registerBlock(bottler, new ItemBlockForestry(bottler), "bottler");
|
||||
|
||||
factoryPlain = new BlockFactoryPlain();
|
||||
registerBlock(factoryPlain, new ItemBlockNBT(factoryPlain), "factory2");
|
||||
carpenter = new BlockFactoryTESR(BlockTypeFactoryTesr.CARPENTER);
|
||||
registerBlock(carpenter, new ItemBlockForestry(carpenter), "carpenter");
|
||||
|
||||
centrifuge = new BlockFactoryTESR(BlockTypeFactoryTesr.CENTRIFUGE);
|
||||
registerBlock(centrifuge, new ItemBlockForestry(centrifuge), "centrifuge");
|
||||
|
||||
fermenter = new BlockFactoryTESR(BlockTypeFactoryTesr.FERMENTER);
|
||||
registerBlock(fermenter, new ItemBlockForestry(fermenter), "fermenter");
|
||||
|
||||
moistener = new BlockFactoryTESR(BlockTypeFactoryTesr.MOISTENER);
|
||||
registerBlock(moistener, new ItemBlockForestry(moistener), "moistener");
|
||||
|
||||
squeezer = new BlockFactoryTESR(BlockTypeFactoryTesr.SQUEEZER);
|
||||
registerBlock(squeezer, new ItemBlockForestry(squeezer), "squeezer");
|
||||
|
||||
still = new BlockFactoryTESR(BlockTypeFactoryTesr.STILL);
|
||||
registerBlock(still, new ItemBlockForestry(still), "still");
|
||||
|
||||
rainmaker = new BlockFactoryTESR(BlockTypeFactoryTesr.RAINMAKER);
|
||||
registerBlock(rainmaker, new ItemBlockForestry(rainmaker), "rainmaker");
|
||||
|
||||
fabricator = new BlockFactoryPlain(BlockTypeFactoryPlain.FABRICATOR);
|
||||
registerBlock(fabricator, new ItemBlockNBT(fabricator), "fabricator");
|
||||
|
||||
raintank = new BlockFactoryPlain(BlockTypeFactoryPlain.RAINTANK);
|
||||
registerBlock(raintank, new ItemBlockNBT(raintank), "raintank");
|
||||
|
||||
worktable = new BlockFactoryPlain(BlockTypeFactoryPlain.WORKTABLE);
|
||||
registerBlock(worktable, new ItemBlockNBT(worktable), "worktable");
|
||||
}
|
||||
}
|
||||
@@ -21,17 +21,17 @@ import forestry.factory.tiles.TileRaintank;
|
||||
import forestry.factory.tiles.TileWorktable;
|
||||
|
||||
public enum BlockTypeFactoryPlain implements IBlockType {
|
||||
FABRICATOR(0, TileFabricator.class, "fabricator"),
|
||||
RAINTANK(1, TileRaintank.class, "raintank"),
|
||||
WORKTABLE(2, TileWorktable.class, "worktable");
|
||||
FABRICATOR(TileFabricator.class, "fabricator"),
|
||||
RAINTANK(TileRaintank.class, "raintank"),
|
||||
WORKTABLE(TileWorktable.class, "worktable");
|
||||
|
||||
public static final BlockTypeFactoryPlain[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachineProperties machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeFactoryPlain(int meta, @Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
this.machineProperties = new MachineProperties<>(meta, teClass, name);
|
||||
<T extends TileForestry> BlockTypeFactoryPlain(@Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
this.machineProperties = new MachineProperties<>(teClass, name);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -31,27 +31,27 @@ import forestry.factory.tiles.TileSqueezer;
|
||||
import forestry.factory.tiles.TileStill;
|
||||
|
||||
public enum BlockTypeFactoryTesr implements IBlockTypeTesr {
|
||||
BOTTLER(0, TileBottler.class, "bottler"),
|
||||
CARPENTER(1, TileCarpenter.class, "carpenter"),
|
||||
CENTRIFUGE(2, TileCentrifuge.class, "centrifuge"),
|
||||
FERMENTER(3, TileFermenter.class, "fermenter"),
|
||||
MOISTENER(4, TileMoistener.class, "moistener"),
|
||||
SQUEEZER(5, TileSqueezer.class, "squeezer"),
|
||||
STILL(6, TileStill.class, "still"),
|
||||
RAINMAKER(7, TileMillRainmaker.class, "rainmaker", Proxies.render.getRenderMill(Constants.TEXTURE_PATH_BLOCKS + "/rainmaker_"));
|
||||
BOTTLER(TileBottler.class, "bottler"),
|
||||
CARPENTER(TileCarpenter.class, "carpenter"),
|
||||
CENTRIFUGE(TileCentrifuge.class, "centrifuge"),
|
||||
FERMENTER(TileFermenter.class, "fermenter"),
|
||||
MOISTENER(TileMoistener.class, "moistener"),
|
||||
SQUEEZER(TileSqueezer.class, "squeezer"),
|
||||
STILL(TileStill.class, "still"),
|
||||
RAINMAKER(TileMillRainmaker.class, "rainmaker", Proxies.render.getRenderMill(Constants.TEXTURE_PATH_BLOCKS + "/rainmaker_"));
|
||||
|
||||
public static final BlockTypeFactoryTesr[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachinePropertiesTesr<?> machineProperties;
|
||||
|
||||
<T extends TileBase> BlockTypeFactoryTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
<T extends TileBase> BlockTypeFactoryTesr(@Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
TileEntitySpecialRenderer<TileBase> renderer = Proxies.render.getRenderDefaultMachine(Constants.TEXTURE_PATH_BLOCKS + "/" + name + "_");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
|
||||
<T extends TileBase> BlockTypeFactoryTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
<T extends TileBase> BlockTypeFactoryTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -5,11 +5,11 @@ import javax.annotation.Nullable;
|
||||
import java.awt.Rectangle;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import forestry.core.gui.GuiForestry;
|
||||
import forestry.core.recipes.jei.ForestryRecipeCategoryUid;
|
||||
import forestry.factory.PluginFactory;
|
||||
import forestry.factory.blocks.BlockTypeFactoryPlain;
|
||||
import forestry.factory.blocks.BlockTypeFactoryTesr;
|
||||
import forestry.factory.gui.GuiBottler;
|
||||
import forestry.factory.gui.GuiCarpenter;
|
||||
import forestry.factory.gui.GuiCentrifuge;
|
||||
@@ -108,15 +108,15 @@ public class FactoryJeiPlugin extends BlankModPlugin {
|
||||
registry.addRecipeClickArea(GuiSqueezer.class, 76, 41, 43, 16, ForestryRecipeCategoryUid.SQUEEZER);
|
||||
registry.addRecipeClickArea(GuiStill.class, 73, 17, 33, 57, ForestryRecipeCategoryUid.STILL);
|
||||
|
||||
registry.addRecipeCategoryCraftingItem(PluginFactory.blocks.factoryTESR.get(BlockTypeFactoryTesr.BOTTLER), ForestryRecipeCategoryUid.BOTTLER);
|
||||
registry.addRecipeCategoryCraftingItem(PluginFactory.blocks.factoryTESR.get(BlockTypeFactoryTesr.CARPENTER), ForestryRecipeCategoryUid.CARPENTER);
|
||||
registry.addRecipeCategoryCraftingItem(PluginFactory.blocks.factoryTESR.get(BlockTypeFactoryTesr.CENTRIFUGE), ForestryRecipeCategoryUid.CENTRIFUGE);
|
||||
registry.addRecipeCategoryCraftingItem(PluginFactory.blocks.factoryPlain.get(BlockTypeFactoryPlain.FABRICATOR), ForestryRecipeCategoryUid.FABRICATOR);
|
||||
registry.addRecipeCategoryCraftingItem(PluginFactory.blocks.factoryTESR.get(BlockTypeFactoryTesr.FERMENTER), ForestryRecipeCategoryUid.FERMENTER);
|
||||
registry.addRecipeCategoryCraftingItem(PluginFactory.blocks.factoryTESR.get(BlockTypeFactoryTesr.MOISTENER), ForestryRecipeCategoryUid.MOISTENER);
|
||||
registry.addRecipeCategoryCraftingItem(PluginFactory.blocks.factoryTESR.get(BlockTypeFactoryTesr.RAINMAKER), ForestryRecipeCategoryUid.RAINMAKER);
|
||||
registry.addRecipeCategoryCraftingItem(PluginFactory.blocks.factoryTESR.get(BlockTypeFactoryTesr.SQUEEZER), ForestryRecipeCategoryUid.SQUEEZER);
|
||||
registry.addRecipeCategoryCraftingItem(PluginFactory.blocks.factoryTESR.get(BlockTypeFactoryTesr.STILL), ForestryRecipeCategoryUid.STILL);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(PluginFactory.blocks.bottler), ForestryRecipeCategoryUid.BOTTLER);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(PluginFactory.blocks.carpenter), ForestryRecipeCategoryUid.CARPENTER);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(PluginFactory.blocks.centrifuge), ForestryRecipeCategoryUid.CENTRIFUGE);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(PluginFactory.blocks.fabricator), ForestryRecipeCategoryUid.FABRICATOR);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(PluginFactory.blocks.fermenter), ForestryRecipeCategoryUid.FERMENTER);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(PluginFactory.blocks.moistener), ForestryRecipeCategoryUid.MOISTENER);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(PluginFactory.blocks.rainmaker), ForestryRecipeCategoryUid.RAINMAKER);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(PluginFactory.blocks.squeezer), ForestryRecipeCategoryUid.SQUEEZER);
|
||||
registry.addRecipeCategoryCraftingItem(new ItemStack(PluginFactory.blocks.still), ForestryRecipeCategoryUid.STILL);
|
||||
|
||||
IRecipeTransferRegistry transferRegistry = registry.getRecipeTransferRegistry();
|
||||
transferRegistry.addRecipeTransferHandler(new WorktableRecipeTransferHandler());
|
||||
|
||||
@@ -31,7 +31,7 @@ public class BottlerRecipeCategory extends ForestryRecipeCategory {
|
||||
private final IDrawable tankOverlay;
|
||||
|
||||
public BottlerRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 52, 16, 81, 60), "tile.for.factory.bottler.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 52, 16, 81, 60), "tile.for.bottler.name");
|
||||
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 74, 24, 17);
|
||||
this.arrow = guiHelper.createAnimatedDrawable(arrowDrawable, 200, IDrawableAnimated.StartDirection.LEFT, false);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class CarpenterRecipeCategory extends ForestryRecipeCategory {
|
||||
private final IDrawable tankOverlay;
|
||||
|
||||
public CarpenterRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 9, 16, 158, 61), "tile.for.factory.carpenter.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 9, 16, 158, 61), "tile.for.carpenter.name");
|
||||
|
||||
craftingGridHelper = guiHelper.createCraftingGridHelper(craftInputSlot, craftOutputSlot);
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 59, 4, 17);
|
||||
|
||||
@@ -44,7 +44,7 @@ public class CentrifugeRecipeCategory extends ForestryRecipeCategory {
|
||||
private final ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
|
||||
|
||||
public CentrifugeRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 25, 18, 126, 54), "tile.for.factory.centrifuge.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 25, 18, 126, 54), "tile.for.centrifuge.name");
|
||||
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 0, 4, 17);
|
||||
this.arrow = guiHelper.createAnimatedDrawable(arrowDrawable, 80, IDrawableAnimated.StartDirection.BOTTOM, false);
|
||||
|
||||
@@ -39,7 +39,7 @@ public class FabricatorRecipeCategory extends ForestryRecipeCategory {
|
||||
private final ICraftingGridHelper craftingGridHelper;
|
||||
|
||||
public FabricatorRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 20, 16, 136, 54), "tile.for.factory2.fabricator.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 20, 16, 136, 54), "tile.for.fabricator.name");
|
||||
|
||||
craftingGridHelper = guiHelper.createCraftingGridHelper(craftInputSlot, craftOutputSlot);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ public class FermenterRecipeCategory extends ForestryRecipeCategory {
|
||||
private final IDrawable tankOverlay;
|
||||
|
||||
public FermenterRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 34, 18, 108, 60), "tile.for.factory.fermenter.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 34, 18, 108, 60), "tile.for.fermenter.name");
|
||||
|
||||
IDrawableStatic progressBarDrawable0 = guiHelper.createDrawable(guiTexture, 176, 60, 4, 18);
|
||||
this.progressBar0 = guiHelper.createAnimatedDrawable(progressBarDrawable0, 40, IDrawableAnimated.StartDirection.BOTTOM, false);
|
||||
|
||||
@@ -38,7 +38,7 @@ public class MoistenerRecipeCategory extends ForestryRecipeCategory {
|
||||
private final IDrawable tankOverlay;
|
||||
|
||||
public MoistenerRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 15, 15, 145, 60), "tile.for.factory.moistener.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 15, 15, 145, 60), "tile.for.moistener.name");
|
||||
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 91, 29, 55);
|
||||
this.arrow = guiHelper.createAnimatedDrawable(arrowDrawable, 80, IDrawableAnimated.StartDirection.BOTTOM, false);
|
||||
|
||||
@@ -20,7 +20,7 @@ public class RainmakerRecipeCategory extends ForestryRecipeCategory {
|
||||
private final IDrawable slot;
|
||||
|
||||
public RainmakerRecipeCategory(@Nonnull IGuiHelper guiHelper) {
|
||||
super(guiHelper.createBlankDrawable(150, 30), "tile.for.factory.rainmaker.name");
|
||||
super(guiHelper.createBlankDrawable(150, 30), "tile.for.rainmaker.name");
|
||||
this.slot = guiHelper.getSlotDrawable();
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ public class SqueezerRecipeCategory extends ForestryRecipeCategory {
|
||||
private final ForestryTooltipCallback tooltip = new ForestryTooltipCallback();
|
||||
|
||||
public SqueezerRecipeCategory(@Nonnull IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 9, 16, 158, 62), "tile.for.factory.squeezer.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 9, 16, 158, 62), "tile.for.squeezer.name");
|
||||
|
||||
IDrawableStatic arrowDrawable = guiHelper.createDrawable(guiTexture, 176, 60, 43, 18);
|
||||
this.arrow = guiHelper.createAnimatedDrawable(arrowDrawable, 200, IDrawableAnimated.StartDirection.LEFT, false);
|
||||
|
||||
@@ -30,7 +30,7 @@ public class StillRecipeCategory extends ForestryRecipeCategory {
|
||||
private final IDrawableAnimated progressBar;
|
||||
|
||||
public StillRecipeCategory(IGuiHelper guiHelper) {
|
||||
super(guiHelper.createDrawable(guiTexture, 34, 14, 108, 60), "tile.for.factory.still.name");
|
||||
super(guiHelper.createDrawable(guiTexture, 34, 14, 108, 60), "tile.for.still.name");
|
||||
this.tankOverlay = guiHelper.createDrawable(guiTexture, 176, 0, 16, 58);
|
||||
|
||||
IDrawableStatic progressBarDrawable0 = guiHelper.createDrawable(guiTexture, 176, 74, 4, 18);
|
||||
|
||||
@@ -28,6 +28,7 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.item.crafting.CraftingManager;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.chunk.IChunkGenerator;
|
||||
|
||||
import net.minecraftforge.common.config.Property;
|
||||
import net.minecraftforge.fml.common.SidedProxy;
|
||||
import net.minecraftforge.fml.common.registry.GameRegistry;
|
||||
@@ -50,7 +51,6 @@ import forestry.core.utils.ItemStackUtil;
|
||||
import forestry.core.utils.Log;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.lepidopterology.blocks.BlockRegistryLepidopterology;
|
||||
import forestry.lepidopterology.blocks.BlockTypeLepidopterologyTesr;
|
||||
import forestry.lepidopterology.commands.CommandButterfly;
|
||||
import forestry.lepidopterology.entities.EntityButterfly;
|
||||
import forestry.lepidopterology.genetics.ButterflyBranchDefinition;
|
||||
@@ -111,8 +111,6 @@ public class PluginLepidopterology extends BlankForestryPlugin {
|
||||
|
||||
GameRegistry.registerTileEntity(TileCocoon.class, "forestry.Cocoon");
|
||||
proxy.preInitializeRendering();
|
||||
|
||||
blocks.lepidopterology.addDefinitions(BlockTypeLepidopterologyTesr.VALUES);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@@ -133,7 +131,7 @@ public class PluginLepidopterology extends BlankForestryPlugin {
|
||||
ButterflyDefinition.initButterflies();
|
||||
AlleleButterflyCocoon.createLoot();
|
||||
|
||||
blocks.lepidopterology.init();
|
||||
blocks.butterflyChest.init();
|
||||
|
||||
if(spawnButterflysFromLeaves){
|
||||
TreeManager.treeRoot.registerLeafTickHandler(new ButterflySpawner());
|
||||
@@ -261,7 +259,7 @@ public class PluginLepidopterology extends BlankForestryPlugin {
|
||||
public void registerRecipes() {
|
||||
CraftingManager.getInstance().getRecipeList().add(new MatingRecipe());
|
||||
|
||||
RecipeUtil.addRecipe(blocks.lepidopterology.get(BlockTypeLepidopterologyTesr.LEPICHEST),
|
||||
RecipeUtil.addRecipe(blocks.butterflyChest,
|
||||
" # ",
|
||||
"XYX",
|
||||
"XXX",
|
||||
|
||||
@@ -14,8 +14,8 @@ import forestry.api.core.Tabs;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockLepidopterology extends BlockBase<BlockTypeLepidopterologyTesr> {
|
||||
public BlockLepidopterology() {
|
||||
super(BlockTypeLepidopterologyTesr.class);
|
||||
public BlockLepidopterology(BlockTypeLepidopterologyTesr type) {
|
||||
super(type);
|
||||
setCreativeTab(Tabs.tabLepidopterology);
|
||||
}
|
||||
}
|
||||
@@ -15,13 +15,13 @@ import forestry.core.items.ItemBlockForestry;
|
||||
import forestry.lepidopterology.genetics.alleles.AlleleButterflyCocoon;
|
||||
|
||||
public class BlockRegistryLepidopterology extends BlockRegistry {
|
||||
public final BlockLepidopterology lepidopterology;
|
||||
public final BlockLepidopterology butterflyChest;
|
||||
public final BlockCocoon cocoon;
|
||||
public final BlockSolidCocoon solidCocoon;
|
||||
|
||||
public BlockRegistryLepidopterology() {
|
||||
lepidopterology = new BlockLepidopterology();
|
||||
registerBlock(lepidopterology, new ItemBlockForestry(lepidopterology), "lepidopterology");
|
||||
butterflyChest = new BlockLepidopterology(BlockTypeLepidopterologyTesr.LEPICHEST);
|
||||
registerBlock(butterflyChest, new ItemBlockForestry(butterflyChest), "butterfly_chest");
|
||||
|
||||
AlleleButterflyCocoon.createAlleles();
|
||||
cocoon = new BlockCocoon();
|
||||
|
||||
@@ -26,18 +26,18 @@ import forestry.core.tiles.TileNaturalistChest;
|
||||
import forestry.lepidopterology.tiles.TileLepidopteristChest;
|
||||
|
||||
public enum BlockTypeLepidopterologyTesr implements IBlockTypeTesr {
|
||||
LEPICHEST(0, TileLepidopteristChest.class, "lepi_chest", Proxies.render.getRenderChest("lepichest"), TileNaturalistChest.chestBoundingBox);
|
||||
LEPICHEST(TileLepidopteristChest.class, "lepi_chest", Proxies.render.getRenderChest("lepichest"), TileNaturalistChest.chestBoundingBox);
|
||||
|
||||
public static final BlockTypeLepidopterologyTesr[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachinePropertiesTesr<?> machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeLepidopterologyTesr(int meta, @Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nullable AxisAlignedBB boundingBox) {
|
||||
<T extends TileForestry> BlockTypeLepidopterologyTesr(@Nonnull Class<T> teClass, @Nonnull String name, @Nullable TileEntitySpecialRenderer<? super T> renderer, @Nullable AxisAlignedBB boundingBox) {
|
||||
if (boundingBox != null) {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer, boundingBox, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, boundingBox, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
} else {
|
||||
this.machineProperties = new MachinePropertiesTesr<>(meta, teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
this.machineProperties = new MachinePropertiesTesr<>(teClass, name, renderer, Constants.RESOURCE_ID + ":blocks/" + name + ".0");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,7 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import forestry.api.circuits.ICircuit;
|
||||
import forestry.api.mail.EnumAddressee;
|
||||
import forestry.api.mail.PostManager;
|
||||
@@ -31,7 +32,6 @@ import forestry.core.items.EnumElectronTube;
|
||||
import forestry.core.network.IPacketRegistry;
|
||||
import forestry.core.recipes.RecipeUtil;
|
||||
import forestry.mail.blocks.BlockRegistryMail;
|
||||
import forestry.mail.blocks.BlockTypeMail;
|
||||
import forestry.mail.commands.CommandMail;
|
||||
import forestry.mail.items.EnumStampDefinition;
|
||||
import forestry.mail.items.ItemRegistryMail;
|
||||
@@ -67,8 +67,6 @@ public class PluginMail extends BlankForestryPlugin {
|
||||
if (Config.mailAlertEnabled) {
|
||||
MinecraftForge.EVENT_BUS.register(new EventHandlerMailAlert());
|
||||
}
|
||||
|
||||
blocks.mail.addDefinitions(BlockTypeMail.VALUES);
|
||||
}
|
||||
|
||||
// TODO: Buildcraft for 1.9
|
||||
@@ -81,7 +79,9 @@ public class PluginMail extends BlankForestryPlugin {
|
||||
public void doInit() {
|
||||
super.doInit();
|
||||
|
||||
blocks.mail.init();
|
||||
blocks.mailbox.init();
|
||||
blocks.tradeStation.init();
|
||||
blocks.stampCollector.init();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -136,7 +136,7 @@ public class PluginMail extends BlankForestryPlugin {
|
||||
|
||||
RecipeUtil.addShapelessRecipe(items.catalogue.getItemStack(), items.stamps.getWildcard(), new ItemStack(Items.BOOK));
|
||||
|
||||
RecipeUtil.addRecipe(blocks.mail.get(BlockTypeMail.MAILBOX),
|
||||
RecipeUtil.addRecipe(new ItemStack(blocks.mailbox),
|
||||
" # ",
|
||||
"#Y#",
|
||||
"XXX",
|
||||
@@ -144,7 +144,7 @@ public class PluginMail extends BlankForestryPlugin {
|
||||
'X', "chestWood",
|
||||
'Y', PluginCore.items.sturdyCasing);
|
||||
|
||||
RecipeUtil.addRecipe(blocks.mail.get(BlockTypeMail.TRADE_STATION),
|
||||
RecipeUtil.addRecipe(new ItemStack(blocks.tradeStation),
|
||||
"Z#Z",
|
||||
"#Y#",
|
||||
"XWX",
|
||||
|
||||
@@ -13,7 +13,7 @@ package forestry.mail.blocks;
|
||||
import forestry.core.blocks.BlockBase;
|
||||
|
||||
public class BlockMail extends BlockBase<BlockTypeMail> {
|
||||
public BlockMail() {
|
||||
super(BlockTypeMail.class);
|
||||
public BlockMail(BlockTypeMail blockType) {
|
||||
super(blockType);
|
||||
}
|
||||
}
|
||||
@@ -14,10 +14,18 @@ import forestry.core.blocks.BlockRegistry;
|
||||
import forestry.core.items.ItemBlockForestry;
|
||||
|
||||
public class BlockRegistryMail extends BlockRegistry {
|
||||
public final BlockMail mail;
|
||||
public final BlockMail mailbox;
|
||||
public final BlockMail tradeStation;
|
||||
public final BlockMail stampCollector;
|
||||
|
||||
public BlockRegistryMail() {
|
||||
mail = new BlockMail();
|
||||
registerBlock(mail, new ItemBlockForestry(mail), "mail");
|
||||
mailbox = new BlockMail(BlockTypeMail.MAILBOX);
|
||||
registerBlock(mailbox, new ItemBlockForestry(mailbox), "mailbox");
|
||||
|
||||
tradeStation = new BlockMail(BlockTypeMail.TRADE_STATION);
|
||||
registerBlock(tradeStation, new ItemBlockForestry(tradeStation), "trade_station");
|
||||
|
||||
stampCollector = new BlockMail(BlockTypeMail.PHILATELIST);
|
||||
registerBlock(stampCollector, new ItemBlockForestry(stampCollector), "stamp_collector");
|
||||
}
|
||||
}
|
||||
@@ -21,17 +21,17 @@ import forestry.mail.tiles.TileStampCollector;
|
||||
import forestry.mail.tiles.TileTrader;
|
||||
|
||||
public enum BlockTypeMail implements IBlockType {
|
||||
MAILBOX(0, TileMailbox.class, "mailbox"),
|
||||
TRADE_STATION(1, TileTrader.class, "trade_station"),
|
||||
PHILATELIST(2, TileStampCollector.class, "stamp_collector");
|
||||
MAILBOX(TileMailbox.class, "mailbox"),
|
||||
TRADE_STATION(TileTrader.class, "trade_station"),
|
||||
PHILATELIST(TileStampCollector.class, "stamp_collector");
|
||||
|
||||
public static final BlockTypeMail[] VALUES = values();
|
||||
|
||||
@Nonnull
|
||||
private final IMachineProperties machineProperties;
|
||||
|
||||
<T extends TileForestry> BlockTypeMail(int meta, @Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
this.machineProperties = new MachineProperties<>(meta, teClass, name);
|
||||
<T extends TileForestry> BlockTypeMail(@Nonnull Class<T> teClass, @Nonnull String name) {
|
||||
this.machineProperties = new MachineProperties<>(teClass, name);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
package forestry.plugins.compat;
|
||||
|
||||
import forestry.core.blocks.BlockRegistry;
|
||||
import forestry.energy.blocks.BlockEngine;
|
||||
import forestry.energy.blocks.BlockTypeEngine;
|
||||
import forestry.energy.items.ItemEngine;
|
||||
|
||||
public class BlockRegistryIC2 extends BlockRegistry {
|
||||
public final BlockEngine electricalEngine;
|
||||
public final BlockEngine generator;
|
||||
|
||||
public BlockRegistryIC2() {
|
||||
electricalEngine = new BlockEngine(BlockTypeEngine.ELECTRICAL);
|
||||
registerBlock(electricalEngine, new ItemEngine(electricalEngine), "electricalEngine");
|
||||
|
||||
generator = new BlockEngine(BlockTypeEngine.GENERATOR);
|
||||
registerBlock(generator, new ItemEngine(generator), "generator");
|
||||
}
|
||||
}
|
||||
@@ -32,6 +32,8 @@ public class PluginIC2 extends BlankForestryPlugin {
|
||||
public static ItemStack rubberWood;
|
||||
public static ItemStack resin;
|
||||
|
||||
public BlockRegistryIC2 blocks;
|
||||
|
||||
public PluginIC2() {
|
||||
if (PluginIC2.instance == null) {
|
||||
PluginIC2.instance = this;
|
||||
@@ -100,6 +102,9 @@ public class PluginIC2 extends BlankForestryPlugin {
|
||||
// Circuit.energyElectricEfficiency1 = new CircuitElectricEfficiency("electric.efficiency.1");
|
||||
// Circuit.energyElectricBoost1 = new CircuitElectricBoost("electric.boost.1", 2, 7, 20);
|
||||
// Circuit.energyElectricBoost2 = new CircuitElectricBoost("electric.boost.2", 2, 15, 40);
|
||||
//
|
||||
// blocks.electricalEngine.init();
|
||||
// blocks.generator.init();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
@@ -266,5 +271,11 @@ public class PluginIC2 extends BlankForestryPlugin {
|
||||
// 'Y', "gearTin",
|
||||
// 'V', Blocks.PISTON);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void registerItemsAndBlocks() {
|
||||
// super.registerItemsAndBlocks();
|
||||
// blocks = new BlockRegistryIC2();
|
||||
// }
|
||||
}
|
||||
@@ -62,7 +62,6 @@ import forestry.core.utils.Log;
|
||||
import forestry.core.utils.Translator;
|
||||
import forestry.lepidopterology.PluginLepidopterology;
|
||||
import forestry.lepidopterology.blocks.BlockRegistryLepidopterology;
|
||||
import forestry.lepidopterology.blocks.BlockTypeLepidopterologyTesr;
|
||||
import forestry.plugins.BlankForestryPlugin;
|
||||
import forestry.plugins.ForestryPlugin;
|
||||
import forestry.plugins.ForestryPluginUids;
|
||||
@@ -448,12 +447,12 @@ public class PluginStorage extends BlankForestryPlugin {
|
||||
public void registerRecipes() {
|
||||
BlockRegistryApiculture beeBlocks = PluginApiculture.blocks;
|
||||
if (items.apiaristBackpack != null && beeBlocks != null) {
|
||||
addBackpackRecipe(items.apiaristBackpack, "stickWood", beeBlocks.apicultureChest);
|
||||
addBackpackRecipe(items.apiaristBackpack, "stickWood", beeBlocks.beeChest);
|
||||
}
|
||||
|
||||
BlockRegistryLepidopterology butterflyBlocks = PluginLepidopterology.blocks;
|
||||
if (items.lepidopteristBackpack != null && butterflyBlocks != null) {
|
||||
ItemStack chest = butterflyBlocks.lepidopterology.get(BlockTypeLepidopterologyTesr.LEPICHEST);
|
||||
ItemStack chest = new ItemStack(butterflyBlocks.butterflyChest);
|
||||
addBackpackRecipe(items.lepidopteristBackpack, "stickWood", chest);
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"variants": {
|
||||
"facing=north": { "model": "forestry:apiary" },
|
||||
"facing=east": { "model": "forestry:apiary", "y": 90 },
|
||||
"facing=south": { "model": "forestry:apiary", "y": 180 },
|
||||
"facing=west": { "model": "forestry:apiary", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"face=north": { "model": "forestry:apiculture_apiary" },
|
||||
"face=east": { "model": "forestry:apiculture_apiary", "y": 90 },
|
||||
"face=south": { "model": "forestry:apiculture_apiary", "y": 180 },
|
||||
"face=west": { "model": "forestry:apiculture_apiary", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"face=north": { "model": "forestry:apiculture_bee_house" },
|
||||
"face=east": { "model": "forestry:apiculture_bee_house", "y": 90 },
|
||||
"face=south": { "model": "forestry:apiculture_bee_house", "y": 180 },
|
||||
"face=west": { "model": "forestry:apiculture_bee_house", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"variants": {
|
||||
"facing=north": { "model": "forestry:bee_house" },
|
||||
"facing=east": { "model": "forestry:bee_house", "y": 90 },
|
||||
"facing=south": { "model": "forestry:bee_house", "y": 180 },
|
||||
"facing=west": { "model": "forestry:bee_house", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"variants": {
|
||||
"facing=north": { "model": "forestry:fabricator" },
|
||||
"facing=east": { "model": "forestry:fabricator", "y": 90 },
|
||||
"facing=south": { "model": "forestry:fabricator", "y": 180 },
|
||||
"facing=west": { "model": "forestry:fabricator", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"face=north": { "model": "forestry:factory2_fabricator" },
|
||||
"face=east": { "model": "forestry:factory2_fabricator", "y": 90 },
|
||||
"face=south": { "model": "forestry:factory2_fabricator", "y": 180 },
|
||||
"face=west": { "model": "forestry:factory2_fabricator", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"face=north": { "model": "forestry:factory2_raintank" },
|
||||
"face=east": { "model": "forestry:factory2_raintank", "y": 90 },
|
||||
"face=south": { "model": "forestry:factory2_raintank", "y": 180 },
|
||||
"face=west": { "model": "forestry:factory2_raintank", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"face=north": { "model": "forestry:factory2_worktable" },
|
||||
"face=east": { "model": "forestry:factory2_worktable", "y": 90 },
|
||||
"face=south": { "model": "forestry:factory2_worktable", "y": 180 },
|
||||
"face=west": { "model": "forestry:factory2_worktable", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"face=north": { "model": "forestry:mail_mailbox" },
|
||||
"face=east": { "model": "forestry:mail_mailbox", "y": 90 },
|
||||
"face=south": { "model": "forestry:mail_mailbox", "y": 180 },
|
||||
"face=west": { "model": "forestry:mail_mailbox", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"face=north": { "model": "forestry:mail_philatelist" },
|
||||
"face=east": { "model": "forestry:mail_philatelist", "y": 90 },
|
||||
"face=south": { "model": "forestry:mail_philatelist", "y": 180 },
|
||||
"face=west": { "model": "forestry:mail_philatelist", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"face=north": { "model": "forestry:mail_stamp_collector" },
|
||||
"face=east": { "model": "forestry:mail_stamp_collector", "y": 90 },
|
||||
"face=south": { "model": "forestry:mail_stamp_collector", "y": 180 },
|
||||
"face=west": { "model": "forestry:mail_stamp_collector", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
{
|
||||
"variants": {
|
||||
"face=north": { "model": "forestry:mail_trade_station" },
|
||||
"face=east": { "model": "forestry:mail_trade_station", "y": 90 },
|
||||
"face=south": { "model": "forestry:mail_trade_station", "y": 180 },
|
||||
"face=west": { "model": "forestry:mail_trade_station", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"variants": {
|
||||
"facing=north": { "model": "forestry:mailbox" },
|
||||
"facing=east": { "model": "forestry:mailbox", "y": 90 },
|
||||
"facing=south": { "model": "forestry:mailbox", "y": 180 },
|
||||
"facing=west": { "model": "forestry:mailbox", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"variants": {
|
||||
"facing=north": { "model": "forestry:raintank" },
|
||||
"facing=east": { "model": "forestry:raintank", "y": 90 },
|
||||
"facing=south": { "model": "forestry:raintank", "y": 180 },
|
||||
"facing=west": { "model": "forestry:raintank", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"variants": {
|
||||
"facing=north": { "model": "forestry:stamp_collector" },
|
||||
"facing=east": { "model": "forestry:stamp_collector", "y": 90 },
|
||||
"facing=south": { "model": "forestry:stamp_collector", "y": 180 },
|
||||
"facing=west": { "model": "forestry:stamp_collector", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"variants": {
|
||||
"facing=north": { "model": "forestry:trade_station" },
|
||||
"facing=east": { "model": "forestry:trade_station", "y": 90 },
|
||||
"facing=south": { "model": "forestry:trade_station", "y": 180 },
|
||||
"facing=west": { "model": "forestry:trade_station", "y": -90 }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
{
|
||||
"variants": {
|
||||
"facing=north": { "model": "forestry:worktable" },
|
||||
"facing=east": { "model": "forestry:worktable", "y": 90 },
|
||||
"facing=south": { "model": "forestry:worktable", "y": 180 },
|
||||
"facing=west": { "model": "forestry:worktable", "y": -90 }
|
||||
}
|
||||
}
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "forestry:block/mail_mailbox",
|
||||
"parent": "forestry:block/apiary",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
@@ -1,10 +0,0 @@
|
||||
{
|
||||
"parent": "forestry:block/apiculture_bee_house",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
"translation": [ 0, 1.5, -2.75 ],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
}
|
||||
}
|
||||
}
|
||||
File renamed without changes.
+1
-1
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"parent": "forestry:block/apiculture_apiary",
|
||||
"parent": "forestry:block/bee_house",
|
||||
"display": {
|
||||
"thirdperson": {
|
||||
"rotation": [ 10, -45, 170 ],
|
||||
File renamed without changes.
File renamed without changes.
Loaded 100 of 118 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user