Skip to content

Commit

Permalink
Add recipes for re-staining clear glass, attempt at backwards compati…
Browse files Browse the repository at this point in the history
…bility for village structures
  • Loading branch information
mDiyo committed Sep 28, 2013
1 parent ea484dc commit 363f1a8
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 26 deletions.
34 changes: 25 additions & 9 deletions 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;
Expand All @@ -20,6 +22,8 @@
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;
Expand Down Expand Up @@ -85,10 +89,10 @@ public 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");
Expand Down Expand Up @@ -121,6 +125,18 @@ public void preInit(FMLPreInitializationEvent event)
{
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);
Expand All @@ -131,7 +147,7 @@ public void preInit(FMLPreInitializationEvent event)
}

@EventHandler
public void init(FMLInitializationEvent event)
public void init (FMLInitializationEvent event)
{
if (event.getSide() == Side.CLIENT)
{
Expand All @@ -146,27 +162,27 @@ public void init(FMLInitializationEvent event)
}

@EventHandler
public void postInit(FMLPostInitializationEvent evt)
public void postInit (FMLPostInitializationEvent evt)
{
Behavior.registerBuiltInBehaviors();
SpecialStackHandler.registerBuiltInStackHandlers();
content.modIntegration();
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;
}
Expand Down
4 changes: 4 additions & 0 deletions src/tconstruct/common/TContent.java
Expand Up @@ -1566,8 +1566,12 @@ void addCraftingRecipes()
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
Expand Down
15 changes: 9 additions & 6 deletions src/tconstruct/library/blocks/AdaptiveInventoryLogic.java
Expand Up @@ -8,6 +8,7 @@
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;
Expand Down Expand Up @@ -151,25 +152,26 @@ public void checkValidStructure ()
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())
{
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)
Expand Down Expand Up @@ -226,8 +228,9 @@ protected boolean checkServant (int x, int y, int z)
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;
}
Expand Down
5 changes: 0 additions & 5 deletions src/tconstruct/worldgen/village/VillageSmelteryHandler.java
Expand Up @@ -10,11 +10,6 @@

public class VillageSmelteryHandler implements IVillageCreationHandler
{
public VillageSmelteryHandler()
{
MapGenStructureIO.func_143031_a(ComponentSmeltery.class, "TConstruct:SmelteryStructure");
}

@Override
public StructureVillagePieceWeight getVillagePieceWeight (Random random, int i)
{
Expand Down
Expand Up @@ -10,12 +10,7 @@
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)
{
Expand Down

0 comments on commit 363f1a8

Please sign in to comment.