diff --git a/src/tconstruct/TConstruct.java b/src/tconstruct/TConstruct.java index 3d2258f2..ca344655 100644 --- a/src/tconstruct/TConstruct.java +++ b/src/tconstruct/TConstruct.java @@ -1,5 +1,7 @@ package tconstruct; +import net.minecraft.server.MinecraftServer; +import net.minecraft.world.gen.structure.MapGenStructureIO; import net.minecraftforge.common.MinecraftForge; import tconstruct.client.event.EventCloakRender; import tconstruct.common.TContent; @@ -20,6 +22,8 @@ import tconstruct.util.player.TPlayerHandler; import tconstruct.worldgen.SlimeIslandGen; import tconstruct.worldgen.TBaseWorldGenerator; import tconstruct.worldgen.TerrainGenEventHandler; +import tconstruct.worldgen.village.ComponentSmeltery; +import tconstruct.worldgen.village.ComponentToolWorkshop; import tconstruct.worldgen.village.TVillageTrades; import tconstruct.worldgen.village.VillageSmelteryHandler; import tconstruct.worldgen.village.VillageToolStationHandler; @@ -85,10 +89,10 @@ public class TConstruct } @EventHandler - public void preInit(FMLPreInitializationEvent event) + public void preInit (FMLPreInitializationEvent event) { - - PHConstruct.initProps(event.getModConfigurationDirectory()); + + PHConstruct.initProps(event.getModConfigurationDirectory()); TConstructRegistry.materialTab = new TabTools("TConstructMaterials"); TConstructRegistry.toolTab = new TabTools("TConstructTools"); TConstructRegistry.blockTab = new TabTools("TConstructBlocks"); @@ -121,6 +125,18 @@ public class TConstruct { VillagerRegistry.instance().registerVillageCreationHandler(new VillageToolStationHandler()); VillagerRegistry.instance().registerVillageCreationHandler(new VillageSmelteryHandler()); + try + { + if (MinecraftServer.getServer().getMinecraftVersion().equals("1.6.4")) + { + MapGenStructureIO.func_143031_a(ComponentToolWorkshop.class, "TConstruct:ToolWorkshopStructure"); + MapGenStructureIO.func_143031_a(ComponentSmeltery.class, "TConstruct:SmelteryStructure"); + } + } + catch (Throwable e) + { + + } } /*DimensionManager.registerProviderType(-7, TinkerWorldProvider.class, true); @@ -131,7 +147,7 @@ public class TConstruct } @EventHandler - public void init(FMLInitializationEvent event) + public void init (FMLInitializationEvent event) { if (event.getSide() == Side.CLIENT) { @@ -146,7 +162,7 @@ public class TConstruct } @EventHandler - public void postInit(FMLPostInitializationEvent evt) + public void postInit (FMLPostInitializationEvent evt) { Behavior.registerBuiltInBehaviors(); SpecialStackHandler.registerBuiltInStackHandlers(); @@ -154,19 +170,19 @@ public class TConstruct TContent.modRecipes(); content.createEntities(); content.modRecipes(); - } + } - public static LiquidCasting getTableCasting() + public static LiquidCasting getTableCasting () { return tableCasting; } - public static LiquidCasting getBasinCasting() + public static LiquidCasting getBasinCasting () { return basinCasting; } - public static Detailing getChiselDetailing() + public static Detailing getChiselDetailing () { return chiselDetailing; } diff --git a/src/tconstruct/common/TContent.java b/src/tconstruct/common/TContent.java index 5c3365ed..037e3417 100644 --- a/src/tconstruct/common/TContent.java +++ b/src/tconstruct/common/TContent.java @@ -1566,8 +1566,12 @@ public class TContent implements IFuelHandler GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(Block.cloth, 8, i), pattern, 'm', dyeTypes[15 - i], '#', new ItemStack(Block.cloth, 1, Short.MAX_VALUE))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(stainedGlassClear, 8, i), pattern, 'm', dyeTypes[15 - i], '#', clearGlass)); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(stainedGlassClear, 1, i), dyeTypes[15 - i], clearGlass)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(stainedGlassClear, 8, i), pattern, 'm', dyeTypes[15 - i], '#', new ItemStack(stainedGlassClear, 1, Short.MAX_VALUE))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(stainedGlassClear, 1, i), dyeTypes[15 - i], new ItemStack(stainedGlassClear, 1, Short.MAX_VALUE))); GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(stainedGlassClearPane, 8, i), pattern, 'm', dyeTypes[15 - i], '#', glassPane)); GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(stainedGlassClearPane, 1, i), dyeTypes[15 - i], glassPane)); + GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(stainedGlassClearPane, 8, i), pattern, 'm', dyeTypes[15 - i], '#', new ItemStack(stainedGlassClearPane, 1, Short.MAX_VALUE))); + GameRegistry.addRecipe(new ShapelessOreRecipe(new ItemStack(stainedGlassClearPane, 1, i), dyeTypes[15 - i], new ItemStack(stainedGlassClearPane, 1, Short.MAX_VALUE))); } //Glass diff --git a/src/tconstruct/library/blocks/AdaptiveInventoryLogic.java b/src/tconstruct/library/blocks/AdaptiveInventoryLogic.java index ac753e36..b48e5be1 100644 --- a/src/tconstruct/library/blocks/AdaptiveInventoryLogic.java +++ b/src/tconstruct/library/blocks/AdaptiveInventoryLogic.java @@ -8,6 +8,7 @@ import net.minecraft.block.Block; import net.minecraft.entity.item.EntityItem; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; import tconstruct.library.util.CoordTuple; import tconstruct.library.util.IFacingLogic; import tconstruct.library.util.IMasterLogic; @@ -151,7 +152,7 @@ public abstract class AdaptiveInventoryLogic extends InventoryLogic implements I airBlocks = 0; blockCoords.clear(); airCoords.clear(); - boolean valid = false; + boolean validAir = false; //Check for air space in front of and behind the structure byte dir = getRenderDirection(); switch (getRenderDirection()) @@ -159,17 +160,18 @@ public abstract class AdaptiveInventoryLogic extends InventoryLogic implements I case 2: // +z case 3: // -z if (checkAir(xCoord, yCoord, zCoord - 1) && checkAir(xCoord, yCoord, zCoord + 1)) - valid = true; + validAir = true; break; case 4: // +x case 5: // -x if (checkAir(xCoord - 1, yCoord, zCoord) && checkAir(xCoord + 1, yCoord, zCoord)) - valid = true; + validAir = true; break; } //Check for at least two connected blocks - + boolean validBlocks = false; + //Recurse the structure int xPos = 0, zPos = 0; if (dir == 2) @@ -226,8 +228,9 @@ public abstract class AdaptiveInventoryLogic extends InventoryLogic implements I if (!block.hasTileEntity(worldObj.getBlockMetadata(x, y, z))) return false; - if (worldObj.getBlockTileEntity(x, y, z) instanceof IServantLogic) - return true; + TileEntity be = worldObj.getBlockTileEntity(x, y, z); + if (be instanceof IServantLogic) + return ((IServantLogic)be).canBeMaster(this, x, y, z); return false; } diff --git a/src/tconstruct/worldgen/village/VillageSmelteryHandler.java b/src/tconstruct/worldgen/village/VillageSmelteryHandler.java index d04e4142..60911ad7 100644 --- a/src/tconstruct/worldgen/village/VillageSmelteryHandler.java +++ b/src/tconstruct/worldgen/village/VillageSmelteryHandler.java @@ -10,11 +10,6 @@ import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler; public class VillageSmelteryHandler implements IVillageCreationHandler { - public VillageSmelteryHandler() - { - MapGenStructureIO.func_143031_a(ComponentSmeltery.class, "TConstruct:SmelteryStructure"); - } - @Override public StructureVillagePieceWeight getVillagePieceWeight (Random random, int i) { diff --git a/src/tconstruct/worldgen/village/VillageToolStationHandler.java b/src/tconstruct/worldgen/village/VillageToolStationHandler.java index 65c4c9c5..ea87911e 100644 --- a/src/tconstruct/worldgen/village/VillageToolStationHandler.java +++ b/src/tconstruct/worldgen/village/VillageToolStationHandler.java @@ -10,12 +10,7 @@ import net.minecraft.world.gen.structure.StructureVillagePieceWeight; import cpw.mods.fml.common.registry.VillagerRegistry.IVillageCreationHandler; public class VillageToolStationHandler implements IVillageCreationHandler -{ - public VillageToolStationHandler() - { - MapGenStructureIO.func_143031_a(ComponentToolWorkshop.class, "TConstruct:ToolWorkshopStructure"); - } - +{ @Override public StructureVillagePieceWeight getVillagePieceWeight (Random random, int i) {