Removed Limbo Decay
Removed the code associated with Limbo decay from EventHookContainer, LimboBlock, and CommonTickHandler. DimHelper still has blocksToDecay since removing it could cause deserialization failures. However, nothing should actually use that list. I also removed several unused or redundant methods (e.g. overriding methods and putting in exactly the same code as in the super class), fixed indentation and renamed cryptic variables. We should have a rule against allowing cryptic variable names like "par2", even if they're inherited from Forge. I'll implement proper limbo decay in the next commit.
This commit is contained in:
@@ -206,20 +206,18 @@ public class CommonTickHandler implements ITickHandler
|
|||||||
while (yTest > y);
|
while (yTest > y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//replaces rifts in game that have been destroyed/have blocks placed over them.
|
|
||||||
private void onTickInGame()
|
private void onTickInGame()
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
//Replace rifts that have been replaced (not permanently removed) by players
|
||||||
if(tickCount>100)
|
if (tickCount > 100)
|
||||||
{
|
{
|
||||||
tickCount=0;
|
tickCount = 0;
|
||||||
int i=0;
|
int i = 0;
|
||||||
|
|
||||||
|
while (i < 15 && FMLCommonHandler.instance().getEffectiveSide() == Side.SERVER)
|
||||||
while (i<15&&FMLCommonHandler.instance().getEffectiveSide()==Side.SERVER)
|
|
||||||
{
|
{
|
||||||
i++;
|
i++;
|
||||||
LinkData link;
|
LinkData link;
|
||||||
@@ -227,8 +225,6 @@ public class CommonTickHandler implements ITickHandler
|
|||||||
//actually gets the random rift based on the size of the list
|
//actually gets the random rift based on the size of the list
|
||||||
link = (LinkData) dimHelper.instance.getRandomLinkData(true);
|
link = (LinkData) dimHelper.instance.getRandomLinkData(true);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(link!=null)
|
if(link!=null)
|
||||||
{
|
{
|
||||||
|
|
||||||
@@ -240,10 +236,7 @@ public class CommonTickHandler implements ITickHandler
|
|||||||
|
|
||||||
if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))//makes sure the rift doesn't replace a door or something
|
if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))//makes sure the rift doesn't replace a door or something
|
||||||
{
|
{
|
||||||
if(dimHelper.instance.getLinkDataFromCoords(link.locXCoord, link.locYCoord, link.locZCoord, link.locDimID)==null)
|
if(dimHelper.instance.getLinkDataFromCoords(link.locXCoord, link.locYCoord, link.locZCoord, link.locDimID) != null)
|
||||||
{
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
|
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
|
||||||
TileEntityRift.class.cast(dimHelper.getWorld(link.locDimID).getBlockTileEntity(link.locXCoord, link.locYCoord, link.locZCoord)).hasGrownRifts=true;
|
TileEntityRift.class.cast(dimHelper.getWorld(link.locDimID).getBlockTileEntity(link.locXCoord, link.locYCoord, link.locZCoord)).hasGrownRifts=true;
|
||||||
@@ -253,92 +246,21 @@ public class CommonTickHandler implements ITickHandler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
tickCount++;
|
System.out.println("An exception occurred in CommonTickHandler.onGameTick():");
|
||||||
System.out.println("something on tick went wrong: " + e);
|
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
tickCount++;
|
finally
|
||||||
|
|
||||||
//this section regulates decay in Limbo- it records any blocks placed by the player and later progresss them through the decay cycle
|
|
||||||
if(tickCount2>10&&dimHelper.blocksToDecay!=null)
|
|
||||||
{
|
{
|
||||||
tickCount2=0;
|
tickCount++;
|
||||||
if(!dimHelper.blocksToDecay.isEmpty()&&dimHelper.getWorld(properties.LimboDimensionID)!=null)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
if(dimHelper.blocksToDecay.size()>rand.nextInt(400))
|
|
||||||
{
|
|
||||||
int index = rand.nextInt(dimHelper.blocksToDecay.size());
|
|
||||||
Point3D point = (Point3D) dimHelper.blocksToDecay.get(index);
|
|
||||||
|
|
||||||
int blockID = dimHelper.getWorld(properties.LimboDimensionID).getBlockId(point.getX(), point.getY(), point.getZ());
|
|
||||||
int idToSet=Block.stone.blockID;
|
|
||||||
|
|
||||||
if(blockID==0||blockID==properties.LimboBlockID)
|
|
||||||
{
|
|
||||||
dimHelper.blocksToDecay.remove(index);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if(Block.blocksList[idToSet] instanceof BlockContainer)
|
|
||||||
{
|
|
||||||
idToSet=-1;
|
|
||||||
dimHelper.blocksToDecay.remove(index);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if(blockID==Block.cobblestone.blockID)
|
|
||||||
{
|
|
||||||
idToSet=Block.gravel.blockID;
|
|
||||||
}
|
|
||||||
if(blockID==Block.stone.blockID)
|
|
||||||
{
|
|
||||||
idToSet=Block.cobblestone.blockID;
|
|
||||||
|
|
||||||
}
|
|
||||||
if(blockID==Block.gravel.blockID&&!dimHelper.getWorld(properties.LimboDimensionID).isAirBlock(point.getX(), point.getY()-1, point.getZ()))
|
|
||||||
{
|
|
||||||
idToSet=properties.LimboBlockID;
|
|
||||||
dimHelper.getWorld(properties.LimboDimensionID).scheduleBlockUpdate(point.getX(), point.getY(), point.getZ(),10, idToSet);
|
|
||||||
|
|
||||||
}
|
|
||||||
else if(blockID==Block.gravel.blockID)
|
|
||||||
{
|
|
||||||
dimHelper.blocksToDecay.remove(index);
|
|
||||||
idToSet=-1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
if(idToSet!=-1)
|
|
||||||
{
|
|
||||||
|
|
||||||
dimHelper.getWorld(properties.LimboDimensionID).setBlock(point.getX(), point.getY(), point.getZ(), idToSet);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
tickCount2++;
|
if (mod_pocketDim.teleTimer > 0)
|
||||||
|
|
||||||
if(mod_pocketDim.teleTimer>0)
|
|
||||||
{
|
{
|
||||||
mod_pocketDim.teleTimer--;
|
mod_pocketDim.teleTimer--;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,50 +1,17 @@
|
|||||||
package StevenDimDoors.mod_pocketDim;
|
package StevenDimDoors.mod_pocketDim;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Iterator;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
|
||||||
import StevenDimDoors.mod_pocketDim.items.ItemRiftBlade;
|
|
||||||
import StevenDimDoors.mod_pocketDim.world.LimboGenerator;
|
|
||||||
import StevenDimDoors.mod_pocketDim.world.LimboProvider;
|
|
||||||
import StevenDimDoors.mod_pocketDim.world.PocketGenerator;
|
|
||||||
import StevenDimDoors.mod_pocketDim.world.pocketProvider;
|
|
||||||
|
|
||||||
import cpw.mods.fml.client.FMLClientHandler;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
|
||||||
import net.minecraft.client.Minecraft;
|
|
||||||
import net.minecraft.entity.EntityLiving;
|
|
||||||
import net.minecraft.entity.monster.EntityEnderman;
|
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.entity.player.EntityPlayerMP;
|
|
||||||
import net.minecraft.item.ItemBlock;
|
|
||||||
import net.minecraft.item.ItemStack;
|
|
||||||
import net.minecraft.util.AxisAlignedBB;
|
|
||||||
import net.minecraft.util.EnumMovingObjectType;
|
|
||||||
import net.minecraft.util.MathHelper;
|
|
||||||
import net.minecraft.util.MovingObjectPosition;
|
|
||||||
import net.minecraft.util.Vec3;
|
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
import net.minecraft.world.WorldServer;
|
|
||||||
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
import net.minecraftforge.client.event.sound.SoundLoadEvent;
|
||||||
import net.minecraftforge.event.Event.Result;
|
|
||||||
import net.minecraftforge.event.ForgeSubscribe;
|
import net.minecraftforge.event.ForgeSubscribe;
|
||||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
|
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
|
||||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
|
||||||
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
|
||||||
import net.minecraftforge.event.terraingen.PopulateChunkEvent;
|
|
||||||
import net.minecraftforge.event.world.WorldEvent;
|
import net.minecraftforge.event.world.WorldEvent;
|
||||||
|
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
||||||
|
import cpw.mods.fml.relauncher.Side;
|
||||||
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class EventHookContainer
|
public class EventHookContainer
|
||||||
{
|
{
|
||||||
private static Random rand = new Random();
|
|
||||||
private static DDProperties properties = null;
|
private static DDProperties properties = null;
|
||||||
|
|
||||||
public EventHookContainer()
|
public EventHookContainer()
|
||||||
@@ -57,8 +24,6 @@ public class EventHookContainer
|
|||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onSoundLoad(SoundLoadEvent event)
|
public void onSoundLoad(SoundLoadEvent event)
|
||||||
{
|
{
|
||||||
File dataDir = Minecraft.getMinecraft().mcDataDir;
|
|
||||||
|
|
||||||
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/monk.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/monk.ogg")));
|
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/monk.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/monk.ogg")));
|
||||||
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/crack.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/crack.ogg")));
|
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/crack.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/crack.ogg")));
|
||||||
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/tearing.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/tearing.ogg")));
|
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/tearing.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/tearing.ogg")));
|
||||||
@@ -67,32 +32,31 @@ public class EventHookContainer
|
|||||||
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftEnd.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/riftEnd.ogg")));
|
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftEnd.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/riftEnd.ogg")));
|
||||||
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftClose.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/riftClose.ogg")));
|
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftClose.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/riftClose.ogg")));
|
||||||
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftDoor.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/riftDoor.ogg")));
|
event.manager.soundPoolSounds.addSound("mods/DimDoors/sfx/riftDoor.ogg", (mod_pocketDim.class.getResource("/mods/DimDoors/sfx/riftDoor.ogg")));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onWorldLoad(WorldEvent.Load event)
|
public void onWorldLoad(WorldEvent.Load event)
|
||||||
{
|
{
|
||||||
if(!mod_pocketDim.hasInitDims&&event.world.provider.dimensionId==0&&!event.world.isRemote)
|
if (!mod_pocketDim.hasInitDims && event.world.provider.dimensionId == 0 && !event.world.isRemote)
|
||||||
{
|
{
|
||||||
System.out.println("Registering Pocket Dims");
|
System.out.println("Registering Pocket Dims");
|
||||||
mod_pocketDim.hasInitDims=true;
|
mod_pocketDim.hasInitDims = true;
|
||||||
dimHelper.instance.unregsisterDims();
|
dimHelper.instance.unregsisterDims();
|
||||||
dimHelper.dimList.clear();
|
dimHelper.dimList.clear();
|
||||||
dimHelper.instance.interDimLinkList.clear();
|
dimHelper.instance.interDimLinkList.clear();
|
||||||
dimHelper.instance.initPockets();
|
dimHelper.instance.initPockets();
|
||||||
}
|
}
|
||||||
for(Integer ids : dimHelper.getIDs())
|
for (Integer ids : dimHelper.getIDs())
|
||||||
{
|
{
|
||||||
World world = dimHelper.getWorld(ids);
|
World world = dimHelper.getWorld(ids);
|
||||||
int linkCount=0;
|
int linkCount = 0;
|
||||||
|
|
||||||
if(dimHelper.dimList.containsKey(world.provider.dimensionId))
|
if (dimHelper.dimList.containsKey(world.provider.dimensionId))
|
||||||
{
|
{
|
||||||
//TODO added temporary Try/catch block to prevent a crash here, getLinksInDim needs to be looked at
|
//TODO added temporary Try/catch block to prevent a crash here, getLinksInDim needs to be looked at
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for(LinkData link:dimHelper.dimList.get(world.provider.dimensionId).getLinksInDim())
|
for (LinkData link:dimHelper.dimList.get(world.provider.dimensionId).getLinksInDim())
|
||||||
{
|
{
|
||||||
if(linkCount>100) //TODO: Wtf? wouldn't this cause some links to not load on servers with several links? Not sure what's going on here. ~SenseiKiwi
|
if(linkCount>100) //TODO: Wtf? wouldn't this cause some links to not load on servers with several links? Not sure what's going on here. ~SenseiKiwi
|
||||||
{
|
{
|
||||||
@@ -100,7 +64,7 @@ public class EventHookContainer
|
|||||||
}
|
}
|
||||||
linkCount++;
|
linkCount++;
|
||||||
int blocktoReplace = world.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord);
|
int blocktoReplace = world.getBlockId(link.locXCoord, link.locYCoord, link.locZCoord);
|
||||||
if(!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))
|
if (!mod_pocketDim.blocksImmuneToRift.contains(blocktoReplace))
|
||||||
{
|
{
|
||||||
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
|
dimHelper.getWorld(link.locDimID).setBlock(link.locXCoord, link.locYCoord, link.locZCoord, properties.RiftBlockID);
|
||||||
}
|
}
|
||||||
@@ -114,65 +78,24 @@ public class EventHookContainer
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ForgeSubscribe
|
|
||||||
public void EntityJoinWorldEvent(net.minecraftforge.event.entity.EntityJoinWorldEvent event)
|
|
||||||
{
|
|
||||||
if(event.entity instanceof EntityPlayer)
|
|
||||||
{
|
|
||||||
// System.out.println(event.entity.worldObj.provider.dimensionId);
|
|
||||||
// PacketDispatcher.sendPacketToPlayer(DimUpdatePacket.sendPacket(event.world.provider.dimensionId,1),(Player) event.entity);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onPlayerFall(LivingFallEvent event)
|
public void onPlayerFall(LivingFallEvent event)
|
||||||
{
|
{
|
||||||
event.setCanceled(event.entity.worldObj.provider.dimensionId==properties.LimboDimensionID);
|
event.setCanceled(event.entity.worldObj.provider.dimensionId == properties.LimboDimensionID);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe
|
|
||||||
public void onPlayerInteract(PlayerInteractEvent event)
|
|
||||||
{
|
|
||||||
if(event.entityPlayer.worldObj.provider.dimensionId==properties.LimboDimensionID&&event.action==PlayerInteractEvent.Action.RIGHT_CLICK_BLOCK)
|
|
||||||
{
|
|
||||||
int x = event.x;
|
|
||||||
int y = event.y;
|
|
||||||
int z = event.z;
|
|
||||||
|
|
||||||
if(event.entityPlayer.getHeldItem()!=null)
|
|
||||||
{
|
|
||||||
if(event.entityPlayer.getHeldItem().getItem() instanceof ItemBlock)
|
|
||||||
{
|
|
||||||
if(event.entityPlayer instanceof EntityPlayerMP)
|
|
||||||
{
|
|
||||||
Point3D point = new Point3D(x,y,z);
|
|
||||||
dimHelper.blocksToDecay.add(point);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onPlayerDrops(PlayerDropsEvent event)
|
public void onPlayerDrops(PlayerDropsEvent event)
|
||||||
{
|
{
|
||||||
|
//TODO: I have some doubts. Is this triggered even if you die outside Limbo? And do you still drop items that others could pick up? We don't cancel the event. ~SenseiKiwi
|
||||||
mod_pocketDim.limboSpawnInventory.put(event.entityPlayer.username, event.drops);
|
mod_pocketDim.limboSpawnInventory.put(event.entityPlayer.username, event.drops);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ForgeSubscribe
|
|
||||||
public void onWorldunload(WorldEvent.Unload event)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@ForgeSubscribe
|
@ForgeSubscribe
|
||||||
public void onWorldsave(WorldEvent.Save event)
|
public void onWorldsave(WorldEvent.Save event)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(mod_pocketDim.hasInitDims&&event.world.provider.dimensionId==0)
|
if (mod_pocketDim.hasInitDims && event.world.provider.dimensionId == 0)
|
||||||
{
|
{
|
||||||
dimHelper.instance.save();
|
dimHelper.instance.save();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,117 +1,41 @@
|
|||||||
package StevenDimDoors.mod_pocketDim.blocks;
|
package StevenDimDoors.mod_pocketDim.blocks;
|
||||||
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import net.minecraft.block.Block;
|
import net.minecraft.block.Block;
|
||||||
import net.minecraft.block.material.Material;
|
import net.minecraft.block.material.Material;
|
||||||
import net.minecraft.client.renderer.texture.IconRegister;
|
import net.minecraft.client.renderer.texture.IconRegister;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
|
||||||
import net.minecraft.util.Icon;
|
import net.minecraft.util.Icon;
|
||||||
import net.minecraft.world.IBlockAccess;
|
import net.minecraft.world.IBlockAccess;
|
||||||
import net.minecraft.world.World;
|
|
||||||
import StevenDimDoors.mod_pocketDim.Point3D;
|
|
||||||
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
|
||||||
import StevenDimDoors.mod_pocketDim.helpers.dimHelper;
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
|
||||||
public class BlockLimbo extends Block
|
public class BlockLimbo extends Block
|
||||||
{
|
{
|
||||||
Random rand= new Random();
|
|
||||||
Icon blockIcon0;
|
|
||||||
Icon blockIcon1;
|
|
||||||
Icon blockIcon2;
|
|
||||||
Icon blockIcon3;
|
|
||||||
|
|
||||||
public BlockLimbo(int i, int j, Material par2Material)
|
public BlockLimbo(int i, int j, Material par2Material)
|
||||||
{
|
{
|
||||||
super(i, Material.ground);
|
super(i, Material.ground);
|
||||||
setTickRandomly(false);
|
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
||||||
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@SideOnly(Side.CLIENT)
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
|
* Retrieves the block texture to use based on the display side. Args: iBlockAccess, x, y, z, side
|
||||||
*/
|
*/
|
||||||
public Icon getBlockTexture(IBlockAccess par1IBlockAccess, int par2, int par3, int par4, int par5)
|
@SideOnly(Side.CLIENT)
|
||||||
{
|
@Override
|
||||||
return this.getIcon(par5, par1IBlockAccess.getBlockMetadata(par2, par3, par4));
|
public Icon getBlockTexture(IBlockAccess blockAccess, int x, int y, int z, int side)
|
||||||
}
|
{
|
||||||
public void registerIcons(IconRegister par1IconRegister)
|
return this.getIcon(side, blockAccess.getBlockMetadata(x, y, z));
|
||||||
{
|
}
|
||||||
this.blockIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
|
|
||||||
this.blockIcon0 = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+0);
|
|
||||||
this.blockIcon1 = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+1);
|
|
||||||
this.blockIcon2 = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+2);
|
|
||||||
this.blockIcon3 = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2()+3);
|
|
||||||
|
|
||||||
}
|
@Override
|
||||||
|
public void registerIcons(IconRegister iconRegister)
|
||||||
|
{
|
||||||
|
this.blockIcon = iconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName2());
|
||||||
|
}
|
||||||
|
|
||||||
public Icon getIcon(int par1, int par2)
|
@Override
|
||||||
{
|
public Icon getIcon(int par1, int par2)
|
||||||
/**
|
{
|
||||||
switch(par2)
|
return this.blockIcon;
|
||||||
{
|
}
|
||||||
case 0: return this.blockIcon0;
|
|
||||||
case 1: return this.blockIcon1;
|
|
||||||
|
|
||||||
case 2: return this.blockIcon2;
|
|
||||||
case 3: return this.blockIcon3;
|
|
||||||
}
|
|
||||||
**/
|
|
||||||
|
|
||||||
|
|
||||||
return this.blockIcon;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void onBlockDestroyedByPlayer(World par1World, int par2, int par3, int par4, int par5) {}
|
|
||||||
|
|
||||||
//part of the decay mech, if a block has fallen onto it, when it turns, it makes sure any block above it gets added too.
|
|
||||||
@Override
|
|
||||||
|
|
||||||
public int quantityDropped(Random par1Random)
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer entityPlayer, int par6, float par7, float par8, float par9)
|
|
||||||
{
|
|
||||||
|
|
||||||
return false;
|
|
||||||
|
|
||||||
}
|
|
||||||
//if a block lands on it and its gravel, adds it to the decay list
|
|
||||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, int par5)
|
|
||||||
{
|
|
||||||
|
|
||||||
if(par1World.getBlockId(par2, par3+1, par4)==Block.gravel.blockID)
|
|
||||||
{
|
|
||||||
Point3D point = new Point3D(par2,par3+1,par4);
|
|
||||||
dimHelper.blocksToDecay.add(point);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random)
|
|
||||||
{
|
|
||||||
if(par1World.getBlockId(par2, par3+1, par4)==Block.gravel.blockID)
|
|
||||||
{
|
|
||||||
Point3D point = new Point3D(par2,par3+1,par4);
|
|
||||||
dimHelper.blocksToDecay.add(point);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@Override
|
|
||||||
public void onBlockAdded(World par1World, int par2, int par3, int par4)
|
|
||||||
{
|
|
||||||
// par1World.setBlockMetadataWithNotify(par2, par3, par4, this.rand.nextInt(4), 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//TODO set render color!!
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user