Crystallinity

master
mDiyo 2013-06-25 14:24:29 -07:00
parent 3be23a69a0
commit acb850352c
14 changed files with 302 additions and 94 deletions

View File

@ -38,7 +38,7 @@ import cpw.mods.fml.common.registry.VillagerRegistry;
* @dependencies: IC2 API, MFR API
*/
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.6.2", dependencies = "required-after:Forge@[7.7.1.675,)")
@Mod(modid = "TConstruct", name = "TConstruct", version = "1.5.1_1.3.6.3", dependencies = "required-after:Forge@[7.7.1.675,)")
@NetworkMod(serverSideRequired = false, clientSideRequired = true, channels = { "TConstruct" }, packetHandler = mods.tinker.tconstruct.util.network.TPacketHandler.class)
public class TConstruct
{

View File

@ -58,7 +58,7 @@ public class Aggregator extends InventoryBlock
if (side == 1)
{
GlowstoneAggregator logic = (GlowstoneAggregator) iblockaccess.getBlockTileEntity(x, y, z);
if (logic.currentLightLevel >= 12)
if (logic.getActive())
return icons[0];
else
return icons[1];
@ -73,7 +73,7 @@ public class Aggregator extends InventoryBlock
if (side == 0)
return icons[3];
if (side == 1)
return icons[0];
return icons[1];
return icons[2];
//return icons[meta];
}
@ -83,14 +83,14 @@ public class Aggregator extends InventoryBlock
{
super.onBlockPlacedBy(world, x, y, z, entityliving, stack);
if (!world.isRemote)
TheftValueTracker.updateCrystallinity(x, z, world.provider.dimensionId, 4);
TheftValueTracker.updateCrystallinity(world.provider.dimensionId, x, z, 4);
}
@Override
public void breakBlock (World world, int x, int y, int z, int par5, int par6)
{
super.breakBlock(world, x, y, z, par5, par6);
TheftValueTracker.updateCrystallinity(x, z, world.provider.dimensionId, -4);
TheftValueTracker.updateCrystallinity(world.provider.dimensionId, x, z, -4);
}
@Override

View File

@ -4,6 +4,7 @@ import java.util.List;
import mods.natura.common.NContent;
import mods.tinker.tconstruct.client.block.CrystalBlockRender;
import mods.tinker.tconstruct.crystal.TheftValueTracker;
import mods.tinker.tconstruct.library.TConstructRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@ -11,6 +12,7 @@ import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.ItemStack;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
public class LightCrystalBase extends Block
{
@ -70,4 +72,25 @@ public class LightCrystalBase extends Block
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
}
}
@Override
public void breakBlock (World world, int x, int y, int z, int par5, int meta)
{
switch (meta % 5)
{
case 0:
case 4:
TheftValueTracker.updateCrystallinity(world.provider.dimensionId, x, z, -10);
break;
case 1:
TheftValueTracker.updateCrystallinity(world.provider.dimensionId, x, z, -20);
break;
case 2:
TheftValueTracker.updateCrystallinity(world.provider.dimensionId, x, z, -35);
break;
case 3:
TheftValueTracker.updateCrystallinity(world.provider.dimensionId, x, z, -60);
break;
}
}
}

View File

@ -1,18 +1,26 @@
package mods.tinker.tconstruct.blocks.logic;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.crystal.TheftValueTracker;
import mods.tinker.tconstruct.inventory.AggregatorContainer;
import mods.tinker.tconstruct.library.util.IActiveLogic;
import net.minecraft.block.Block;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.packet.Packet;
import net.minecraft.network.packet.Packet132TileEntityData;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World;
public class GlowstoneAggregator extends AggregatorLogic
public class GlowstoneAggregator extends AggregatorLogic implements IActiveLogic
{
short currentTime;
short maxTime = 20 * 60 * 5;
public int currentLightLevel;
public boolean active;
public byte crystalValue;
public GlowstoneAggregator()
{
@ -36,36 +44,130 @@ public class GlowstoneAggregator extends AggregatorLogic
{
if (worldObj.isRemote)
return;
if (inventory[2] == null || inventory[2].stackSize < this.getInventoryStackLimit())
if (worldObj.canBlockSeeTheSky(xCoord, yCoord+1, zCoord) && crystalValue < 64)
{
if (inventory[0] != null && inventory[0].itemID == Block.cobblestone.blockID)
Block block = Block.blocksList[worldObj.getBlockId(xCoord, yCoord + 1, zCoord)];
if (block == null || validBlock(block) || block.isAirBlock(worldObj, xCoord, yCoord + 1, zCoord))
{
currentLightLevel = worldObj.getSavedLightValue(EnumSkyBlock.Sky, xCoord, yCoord, zCoord) - worldObj.skylightSubtracted;
if (currentLightLevel > 12)
{
currentTime++;
if (currentTime >= 20)
if (currentTime >= 180)
{
currentTime = 0;
inventory[0].stackSize--;
if (inventory[0].stackSize < 1)
inventory[0] = null;
if (inventory[2] != null)
inventory[2].stackSize++;
crystalValue++;
if (block == TContent.lightCrystalBase)
{
int meta = worldObj.getBlockMetadata(xCoord, yCoord + 1, zCoord);
if (crystalValue >= 64)
{
if (meta < 3)
{
worldObj.setBlockMetadataWithNotify(xCoord, yCoord + 1, zCoord, 3, 3);
TheftValueTracker.updateCrystallinity(worldObj.provider.dimensionId, xCoord, zCoord, 25); //Total 60
}
}
else if (crystalValue >= 28)
{
if (meta < 3)
{
worldObj.setBlockMetadataWithNotify(xCoord, yCoord + 1, zCoord, 2, 3);
TheftValueTracker.updateCrystallinity(worldObj.provider.dimensionId, xCoord, zCoord, 15); //Total 35
}
}
else if (crystalValue >= 8)
{
if (meta < 1)
{
worldObj.setBlockMetadataWithNotify(xCoord, yCoord + 1, zCoord, 1, 3);
TheftValueTracker.updateCrystallinity(worldObj.provider.dimensionId, xCoord, zCoord, 10); //Total 20
}
}
}
else
inventory[2] = new ItemStack(Block.glowStone);
{
worldObj.setBlock(xCoord, yCoord + 1, zCoord, TContent.lightCrystalBase.blockID, 0, 3);
TheftValueTracker.updateCrystallinity(worldObj.provider.dimensionId, xCoord, zCoord, 10); //Total 10
}
}
if (active == false)
{
active = true;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
/*
if (this.currentTime % 60 == 0)
System.out.println("Light: " + lightLevel);
currentTime++;
if (currentTime >= maxTime)
else
{
currentTime = 0;
}*/
if (active == true)
{
active = false;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
}
}
}
}
boolean validBlock (Block block)
{
return block == TContent.lightCrystalBase;
}
@Override
public boolean getActive ()
{
return active;
}
@Override
public void setActive (boolean flag)
{
active = flag;
}
@Override
public void readFromNBT (NBTTagCompound tags)
{
super.readFromNBT(tags);
tags.setShort("Time", currentTime);
tags.setByte("Value", crystalValue);
readCustomNBT(tags);
}
@Override
public void writeToNBT (NBTTagCompound tags)
{
super.writeToNBT(tags);
currentTime = tags.getShort("Time");
crystalValue = tags.getByte("Value");
writeCustomNBT(tags);
}
public void readCustomNBT (NBTTagCompound tags)
{
active = tags.getBoolean("Active");
}
public void writeCustomNBT (NBTTagCompound tags)
{
tags.setBoolean("Active", active);
}
/* Packets */
@Override
public Packet getDescriptionPacket ()
{
NBTTagCompound tag = new NBTTagCompound();
writeCustomNBT(tag);
return new Packet132TileEntityData(xCoord, yCoord, zCoord, 1, tag);
}
@Override
public void onDataPacket (INetworkManager net, Packet132TileEntityData packet)
{
readCustomNBT(packet.customParam1);
worldObj.markBlockForRenderUpdate(xCoord, yCoord, zCoord);
}
}

View File

@ -213,6 +213,7 @@ public class TProxyClient extends TProxyCommon
public void registerTickHandler ()
{
TickRegistry.registerTickHandler(new TClientTickHandler(), Side.CLIENT);
//TickRegistry.registerTickHandler(new TimeTicker(), Side.CLIENT);
//TickRegistry.registerTickHandler(new TCommonTickHandler(), Side.CLIENT);
}

View File

@ -108,7 +108,7 @@ public class SmelteryGui extends NewContainerGui
{
fontRenderer.drawString(StatCollector.translateToLocal("crafters.Smeltery"), 86, 5, 0x404040);
fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"), 90, (ySize - 96) + 2, 0x404040);
int base = 0;
int cornerX = (width - xSize) / 2 + 36;
int cornerY = (height - ySize) / 2;
@ -124,9 +124,9 @@ public class SmelteryGui extends NewContainerGui
liquidSize = liquid.amount * 52 / liquidLayers;
base += liquidSize;
}
int leftX = cornerX + basePos;
int topY = (cornerY + 68) - base;
int topY = (cornerY + 68) - base;
int sizeX = 52;
int sizeY = liquidSize;
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
@ -134,11 +134,11 @@ public class SmelteryGui extends NewContainerGui
drawLiquidStackTooltip(liquid, mouseX - cornerX + 36, mouseY - cornerY);
}
}
if (logic.fuelGague > 0)
{
int leftX = cornerX + 117;
int topY = (cornerY + 68) - logic.getScaledFuelGague(52);
int topY = (cornerY + 68) - logic.getScaledFuelGague(52);
int sizeX = 12;
int sizeY = logic.getScaledFuelGague(52);
if (mouseX >= leftX && mouseX <= leftX + sizeX && mouseY >= topY && mouseY < topY + sizeY)
@ -219,7 +219,7 @@ public class SmelteryGui extends NewContainerGui
base += size;
}
}
/*int leftX = cornerX + basePos;
int topY = (cornerY + 68) - base;
int sizeX = 52;
@ -273,7 +273,7 @@ public class SmelteryGui extends NewContainerGui
}
}
}
protected void drawLiquidStackTooltip (LiquidStack par1ItemStack, int par2, int par3)
{
this.zLevel = 100;
@ -287,8 +287,8 @@ public class SmelteryGui extends NewContainerGui
this.drawToolTip(list, par2, par3);
this.zLevel = 0;
}
public List getLiquidTooltip(LiquidStack liquid, boolean par2)
public List getLiquidTooltip (LiquidStack liquid, boolean par2)
{
ArrayList list = new ArrayList();
if (liquid.itemID == Block.lavaStill.blockID)
@ -296,21 +296,28 @@ public class SmelteryGui extends NewContainerGui
list.add("\u00A7fFuel");
int mB = liquid.amount;
if (mB > 0)
list.add("mB: "+mB);
list.add("mB: " + mB);
}
else
{
list.add("\u00A7f"+LiquidDictionary.findLiquidName(liquid));
int ingots = liquid.amount / 144;
if (ingots > 0)
list.add("Ingots: "+ingots);
int mB = liquid.amount % 144;
if (mB > 0)
list.add("mB: "+mB);
list.add("\u00A7f" + LiquidDictionary.findLiquidName(liquid));
int ingots = liquid.amount / 144;
if (ingots > 0)
list.add("Ingots: " + ingots);
int mB = liquid.amount % 144;
if (mB > 0)
{
if (mB % 72 == 0)
list.add("Chunks: " + liquid.amount % 144 / 72);
else if (mB % 16 == 0)
list.add("Nuggets: " + liquid.amount % 144 / 16);
else
list.add("mB: " + mB);
}
}
return list;
}
protected void drawToolTip (List par1List, int par2, int par3)
{
if (!par1List.isEmpty())
@ -388,15 +395,15 @@ public class SmelteryGui extends NewContainerGui
GL11.glEnable(GL12.GL_RESCALE_NORMAL);*/
}
}
public void drawLiquidRect(int par1, int par2, Icon par3Icon, int par4, int par5)
public void drawLiquidRect (int par1, int par2, Icon par3Icon, int par4, int par5)
{
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + par5), (double)this.zLevel, (double)par3Icon.getMinU(), (double)par3Icon.getMaxV());
tessellator.addVertexWithUV((double)(par1 + par4), (double)(par2 + par5), (double)this.zLevel, (double)par3Icon.getMaxU(), (double)par3Icon.getMaxV());
tessellator.addVertexWithUV((double)(par1 + par4), (double)(par2 + 0), (double)this.zLevel, (double)par3Icon.getMaxU(), (double)par3Icon.getMinV());
tessellator.addVertexWithUV((double)(par1 + 0), (double)(par2 + 0), (double)this.zLevel, (double)par3Icon.getMinU(), (double)par3Icon.getMinV());
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMaxV());
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMaxV());
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMinV());
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMinV());
tessellator.draw();
}
}

View File

@ -368,9 +368,9 @@ public class TContent implements IFuelHandler
GameRegistry.registerBlock(aggregator, "Aggregator");
GameRegistry.registerTileEntity(GlowstoneAggregator.class, "GlowstoneAggregator");
/*lightCrystalBase = new LightCrystalBase(PHConstruct.lightCrystalBase).setUnlocalizedName("LightCrystalBase");
lightCrystalBase = new LightCrystalBase(PHConstruct.lightCrystalBase).setUnlocalizedName("LightCrystalBase");
lightCrystalBase.stepSound = Block.soundGlassFootstep;
GameRegistry.registerBlock(lightCrystalBase, LightCrystalItem.class, "LightCrystalBase");*/
GameRegistry.registerBlock(lightCrystalBase, LightCrystalItem.class, "LightCrystalBase");
/*redstoneBallRepeater = new RedstoneBallRepeater(PHConstruct.redstoneBallRepeater, false).setUnlocalizedName("decoration.redstoneballrepeater");
GameRegistry.registerBlock(redstoneBallRepeater, "decoration.redstoneballrepeater");

View File

@ -7,12 +7,13 @@ import mods.tinker.tconstruct.inventory.ArmorExtendedContainer;
import mods.tinker.tconstruct.inventory.KnapsackContainer;
import mods.tinker.tconstruct.library.blocks.InventoryLogic;
import mods.tinker.tconstruct.util.player.TPlayerStats;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.IGuiHandler;
import cpw.mods.fml.common.registry.LanguageRegistry;
import cpw.mods.fml.common.registry.TickRegistry;
import cpw.mods.fml.relauncher.Side;
/**
* Common proxy class for InfiTools
@ -77,11 +78,11 @@ public class TProxyCommon implements IGuiHandler
return null;
}
public void registerTickHandler()
{
//TickRegistry.registerTickHandler(new TimeTicker(), Side.SERVER);
}
/* Registers any rendering code. Does nothing server-side */
public void registerRenderer() {}
/* Ties an internal name to a visible one. */
@ -166,7 +167,7 @@ public class TProxyCommon implements IGuiHandler
LanguageRegistry.addName(TContent.battleaxe, "Battleaxe");
LanguageRegistry.addName(TContent.cutlass, "Cutlass");
LanguageRegistry.addName(TContent.aggregator, "Glowstone Aggregator");
//LanguageRegistry.addName(TContent.lightCrystalBase, "Lightstone Crystal");
LanguageRegistry.addName(TContent.lightCrystalBase, "Lightstone Crystal");
LanguageRegistry.addName(TContent.knapsack, "Knapsack");
}

View File

@ -0,0 +1,41 @@
package mods.tinker.tconstruct.common;
import java.util.EnumSet;
import cpw.mods.fml.common.ITickHandler;
import cpw.mods.fml.common.TickType;
public class TimeTicker implements ITickHandler
{
public static long time = 0;
public static int tickParts = 0;
public static int seconds = 0;
public static int minutes = 0;
@Override
public void tickStart (EnumSet<TickType> type, Object... tickData)
{
System.out.println("Tick");
time++;
tickParts = (int) (time % 20);
seconds = (int) (time / 20);
minutes = (int) (time / 1200);
}
@Override
public void tickEnd (EnumSet<TickType> type, Object... tickData)
{
}
@Override
public EnumSet<TickType> ticks ()
{
return EnumSet.of(TickType.WORLD);
}
@Override
public String getLabel ()
{
return null;
}
}

View File

@ -3,20 +3,40 @@ package mods.tinker.tconstruct.crystal;
import java.util.ArrayList;
import java.util.HashMap;
import mods.tinker.tconstruct.library.util.ChunkCoordTuple;
import mods.tinker.tconstruct.library.util.ValueCoordTuple;
import mods.tinker.tconstruct.library.util.CoordTuple;
public class TheftValueTracker
{
public static HashMap<ChunkCoordTuple, ArrayList> chunkMap = new HashMap<ChunkCoordTuple, ArrayList>();
//public static HashMap<ChunkCoordTuple, Integer> crystallinity = new HashMap<ChunkCoordTuple, Integer>();
public static HashMap<Integer, HashMap<ChunkCoordTuple, Integer>> crystallinity = new HashMap<Integer, HashMap<ChunkCoordTuple, Integer>>();
public static void updateCrystallinity(int posX, int posZ, int world, int value)
public static HashMap<ValueCoordTuple, Integer> crystallinity = new HashMap<ValueCoordTuple, Integer>();
//public static HashMap<Integer, HashMap<ChunkCoordTuple, Integer>> crystallinity = new HashMap<Integer, HashMap<ChunkCoordTuple, Integer>>();
public static void updateCrystallinity (int dim, int posX, int posZ, int value)
{
ChunkCoordTuple tuple = new ChunkCoordTuple((int)Math.floor(posX/16), (int)Math.floor(posZ/16));
ValueCoordTuple coord = new ValueCoordTuple(dim, posX / 16, posZ / 16);
int crystal = crystallinity.get(coord);
crystal += value;
crystallinity.put(coord, crystal);
/*ChunkCoordTuple tuple = new ChunkCoordTuple(posX / 16, posZ / 16);
HashMap<ChunkCoordTuple, Integer> dimensionMap = crystallinity.get(world);
int level = dimensionMap.get(tuple);
level += value;
dimensionMap.put(tuple, level);
if (dimensionMap.containsKey(tuple))
{
int level = dimensionMap.get(tuple);
level += value;
dimensionMap.put(tuple, level);
}
else
{
System.out.println("[TConstruct] Missing Theft value data at "+tuple);
HashMap<ChunkCoordTuple, Integer> crystalMap = TheftValueTracker.crystallinity.get(world);
if (crystalMap == null)
{
crystalMap = new HashMap<ChunkCoordTuple, Integer>();
TheftValueTracker.crystallinity.put(world, crystalMap);
}
crystalMap.put(tuple, value);
}*/
}
}

View File

@ -1,19 +1,21 @@
package mods.tinker.tconstruct.library.util;
public class ChunkCoordTuple
public class ValueCoordTuple
{
public final int dim;
public final int x;
public final int z;
public ChunkCoordTuple(int posX, int posZ)
public ValueCoordTuple(int worldID, int posX, int posZ)
{
dim = worldID;
x = posX;
z = posZ;
}
public boolean equalCoords (int posX, int posZ)
public boolean equalCoords (int worldID, int posX, int posZ)
{
if (this.x == posX && this.z == posZ)
if (this.dim == posX && this.x == posX && this.z == posZ)
return true;
else
return false;
@ -27,8 +29,8 @@ public class ChunkCoordTuple
if(getClass() == obj.getClass())
{
ChunkCoordTuple coord = (ChunkCoordTuple)obj;
if(this.x == coord.x && this.z == coord.z)
ValueCoordTuple coord = (ValueCoordTuple)obj;
if(this.dim == coord.dim && this.x == coord.x && this.z == coord.z)
return true;
}
return false;
@ -39,6 +41,7 @@ public class ChunkCoordTuple
{
final int prime = 37;
int result = 1;
result = prime * result + dim;
result = prime * result + x;
result = prime * result + z;
return result;
@ -46,6 +49,6 @@ public class ChunkCoordTuple
public String toString ()
{
return "ChunkX: " + x + ", ChunkZ: " + z;
return "Dim: " + dim + ", X: " + x + ", Z: " + z;
}
}

View File

@ -90,7 +90,7 @@ public class PHConstruct
multiBrickFancy = config.getBlock("Multi Brick Fancy", 1467).getInt(1467);
aggregator = config.getBlock("Aggregator", 3221).getInt(3221);
//lightCrystalBase = config.getBlock("Light Crystal", 3222).getInt(3222);
lightCrystalBase = config.getBlock("Light Crystal", 3222).getInt(3222);
/*golemCore = config.getBlock("Golem Core", 1481).getInt(1481);
golemHead = config.getBlock("Golem Head", 1482).getInt(1482);*/

View File

@ -1,7 +1,6 @@
package mods.tinker.tconstruct.util;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Random;
import mods.tinker.tconstruct.TConstruct;
@ -13,7 +12,7 @@ import mods.tinker.tconstruct.library.crafting.Smeltery;
import mods.tinker.tconstruct.library.crafting.ToolBuilder;
import mods.tinker.tconstruct.library.event.ToolCraftEvent;
import mods.tinker.tconstruct.library.tools.ToolCore;
import mods.tinker.tconstruct.library.util.ChunkCoordTuple;
import mods.tinker.tconstruct.library.util.ValueCoordTuple;
import mods.tinker.tconstruct.modifiers.ModAttack;
import mods.tinker.tconstruct.util.player.TPlayerStats;
import net.minecraft.entity.Entity;
@ -34,13 +33,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumMovingObjectType;
import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.ForgeSubscribe;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.living.LivingSpawnEvent;
import net.minecraftforge.event.entity.player.FillBucketEvent;
import net.minecraftforge.event.world.ChunkDataEvent;
import net.minecraftforge.event.world.ChunkEvent;
import net.minecraftforge.liquids.LiquidStack;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
@ -314,28 +313,46 @@ public class TEventHandler
}
/* Chunks */
/*@ForgeSubscribe
@ForgeSubscribe
public void chunkDataLoad (ChunkDataEvent.Load event)
{
ChunkCoordTuple coord = new ChunkCoordTuple(event.getChunk().xPosition, event.getChunk().zPosition);
Chunk chunk = event.getChunk();
int worldID = chunk.worldObj.provider.dimensionId;
ValueCoordTuple coord = new ValueCoordTuple(worldID, chunk.xPosition, chunk.zPosition);
TheftValueTracker.crystallinity.put(coord, event.getData().getInteger("TConstruct.Crystallinity"));
/*ValueCoordTuple coord = new ValueCoordTuple(event.getChunk().xPosition, event.getChunk().zPosition);
int worldID = event.getChunk().worldObj.provider.dimensionId;
int crystal = event.getData().getInteger("TConstruct.Crystallinity");
HashMap<ChunkCoordTuple, Integer> crystalMap = TheftValueTracker.crystallinity.get(worldID);
HashMap<ValueCoordTuple, Integer> crystalMap = TheftValueTracker.crystallinity.get(worldID);
if (crystalMap == null)
{
crystalMap = new HashMap<ChunkCoordTuple, Integer>();
crystalMap = new HashMap<ValueCoordTuple, Integer>();
TheftValueTracker.crystallinity.put(worldID, crystalMap);
}
crystalMap.put(coord, crystal);
crystalMap.put(coord, crystal);*/
}
@ForgeSubscribe
public void chunkDataSave (ChunkDataEvent.Save event)
{
ChunkCoordTuple coord = new ChunkCoordTuple(event.getChunk().xPosition, event.getChunk().zPosition);
Chunk chunk = event.getChunk();
int worldID = chunk.worldObj.provider.dimensionId;
ValueCoordTuple coord = new ValueCoordTuple(worldID, chunk.xPosition, chunk.zPosition);
if (TheftValueTracker.crystallinity.containsKey(coord))
{
int crystal = TheftValueTracker.crystallinity.get(coord);
event.getData().setInteger("TConstruct.Crystallinity", crystal);
if (!event.getChunk().isChunkLoaded)
{
TheftValueTracker.crystallinity.remove(worldID);
}
}
/*ValueCoordTuple coord = new ValueCoordTuple(event.getChunk().xPosition, event.getChunk().zPosition);
int worldID = event.getChunk().worldObj.provider.dimensionId;
HashMap<ChunkCoordTuple, Integer> crystalMap = TheftValueTracker.crystallinity.get(worldID);
HashMap<ValueCoordTuple, Integer> crystalMap = TheftValueTracker.crystallinity.get(worldID);
if (crystalMap.containsKey(coord))
{
@ -345,8 +362,8 @@ public class TEventHandler
{
TheftValueTracker.crystallinity.remove(worldID);
}
}
}*/
}*/
}
/* Ore Dictionary */
@ForgeSubscribe

View File

@ -5,7 +5,7 @@ import java.util.Random;
import mods.tinker.tconstruct.common.TContent;
import mods.tinker.tconstruct.crystal.TheftValueTracker;
import mods.tinker.tconstruct.library.util.ChunkCoordTuple;
import mods.tinker.tconstruct.library.util.ValueCoordTuple;
import mods.tinker.tconstruct.library.util.CoordTuple;
import mods.tinker.tconstruct.util.PHConstruct;
import net.minecraft.block.Block;
@ -71,15 +71,8 @@ public class TBaseWorldGenerator implements IWorldGenerator
void initializeChunkData(int chunkX, int chunkZ, int worldID)
{
ChunkCoordTuple coord = new ChunkCoordTuple(chunkX, chunkZ);
int crystal = 0;
HashMap<ChunkCoordTuple, Integer> crystalMap = TheftValueTracker.crystallinity.get(worldID);
if (crystalMap == null)
{
crystalMap = new HashMap<ChunkCoordTuple, Integer>();
TheftValueTracker.crystallinity.put(worldID, crystalMap);
}
crystalMap.put(coord, crystal);
ValueCoordTuple coord = new ValueCoordTuple(worldID, chunkX, chunkZ);
TheftValueTracker.crystallinity.put(coord, 0);
}
void generateSurface (Random random, int xChunk, int zChunk, World world)