More Progress on Rewrite

Continued fixing things across various classes to make them work with
our new core classes. I've also cleaned up indentation and random code
snippets along the way.
This commit is contained in:
SenseiKiwi 2013-08-31 12:58:35 -04:00
parent 5cabd3762e
commit d9056e551f
14 changed files with 357 additions and 516 deletions

View file

@ -1,11 +1,5 @@
package StevenDimDoors.mod_pocketDim;
import java.util.ArrayList;
import java.util.Collection;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import net.minecraft.network.INetworkManager;
import net.minecraft.network.NetLoginHandler;
import net.minecraft.network.packet.NetHandler;
@ -14,45 +8,25 @@ import net.minecraft.server.MinecraftServer;
import cpw.mods.fml.common.network.IConnectionHandler;
import cpw.mods.fml.common.network.Player;
public class ConnectionHandler implements IConnectionHandler
public class ConnectionHandler implements IConnectionHandler
{
private static boolean connected = false;
private static DDProperties properties = null;
//sends a packet to clients containing all the information about the dims and links. Lots of packets, actually.
@Override
public String connectionReceived(NetLoginHandler netHandler, INetworkManager manager)
{
if (properties == null)
properties = DDProperties.instance();
PacketHandler.onClientJoinPacket(manager, PocketManager.dimList);
PacketHandler.onDimCreatedPacket(new NewDimData(properties.LimboDimensionID, false, 0, 0, 0, 0, 0));
//Sends a packet to the client containing all the information about the dimensions and links.
//Lots of packets, actually.
PacketHandler.sendClientJoinPacket(manager);
return null;
}
@Override
public void connectionOpened(NetHandler netClientHandler, String server,int port, INetworkManager manager)
{
connected = true;
}
public void connectionOpened(NetHandler netClientHandler, String server, int port, INetworkManager manager) { }
@Override
public void connectionOpened(NetHandler netClientHandler,MinecraftServer server, INetworkManager manager) { }
@Override
public void connectionClosed(INetworkManager manager)
{
if (connected)
{
System.out.println("Clearing dim cache");
PocketManager.instance.save();
PocketManager.instance.unregsisterDims();
PocketManager.dimList.clear();
}
connected = false;
}
public void connectionClosed(INetworkManager manager) { }
@Override
public void clientLoggedIn(NetHandler clientHandler, INetworkManager manager, Packet1Login login) { }

View file

@ -126,7 +126,7 @@ public class PacketHandler implements IPacketHandler
}
public static void onClientJoinPacket(INetworkManager manager, HashMap<Integer, NewDimData> dimList)
public static void sendClientJoinPacket(INetworkManager manager)
{
Collection<Integer> dimIDs= dimList.keySet();
Collection<NewDimData> dimDataSet= dimList.values();

View file

@ -200,7 +200,7 @@ public class dimDoor extends BlockContainer
public dimDoor updateAttachedTile(World world, int x, int y, int z)
{
TileEntity tile = world.getBlockTileEntity(x, y, z);
if (tile instanceof TileEntityDimDoor )
if (tile instanceof TileEntityDimDoor)
{
TileEntityDimDoor dimTile = (TileEntityDimDoor) tile;
dimTile.openOrClosed = PocketManager.getLink(x, y, z, world.provider.dimensionId) != null;

View file

@ -5,14 +5,12 @@ import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.EnumAction;
import net.minecraft.item.EnumToolMaterial;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.ItemSword;
import net.minecraft.util.AxisAlignedBB;
@ -22,7 +20,6 @@ import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.NewLinkData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

View file

@ -2,20 +2,16 @@ package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.NewLinkData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@ -29,7 +25,7 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
this.setMaxStackSize(1);
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
this.setMaxDamage(0);
this.hasSubtypes=true;
this.hasSubtypes = true;
if (properties == null)
properties = DDProperties.instance();
}
@ -69,19 +65,19 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
{
boolean hasEnder = false;
// checks to see if the item has a link stored, if so, it creates it
if(par2EntityPlayer.inventory.hasItem(Item.enderPearl.itemID)||par2EntityPlayer.inventory.hasItem(properties.StableFabricItemID))
if (par2EntityPlayer.inventory.hasItem(Item.enderPearl.itemID)||par2EntityPlayer.inventory.hasItem(properties.StableFabricItemID))
{
if(!par2EntityPlayer.inventory.consumeInventoryItem(properties.StableFabricItemID))
if (!par2EntityPlayer.inventory.consumeInventoryItem(properties.StableFabricItemID))
{
par2EntityPlayer.inventory.consumeInventoryItem(Item.enderPearl.itemID);
}
hasEnder=true;
}
if(par3World.getBlockId(par4, par5, par6)==Block.snow.blockID)
if (par3World.getBlockId(par4, par5, par6)==Block.snow.blockID)
{
offset = 1;
}
if(hasEnder&&!par3World.isRemote)
if (hasEnder&&!par3World.isRemote)
{
if(PocketManager.instance.getLinkDataFromCoords(linkCoords[0], linkCoords[1], linkCoords[2], par3World)==null)
{
@ -92,20 +88,20 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
par2EntityPlayer.sendChatToPlayer("Rift Created");
}
else if(!par3World.isRemote)
else if (!par3World.isRemote)
{
par2EntityPlayer.sendChatToPlayer("No Ender Pearls!");
}
}
}
else if(!par3World.isRemote)
else if (!par3World.isRemote)
{
if(par3World.getBlockId(par4, par5, par6)==Block.snow.blockID)
{
offset = 1;
}
//otherwise, it creates the first half of the link. Next click will complete it.
key= PocketManager.instance.createUniqueInterDimLinkKey();
key = PocketManager.instance.createUniqueInterDimLinkKey();
this.writeToNBT(par1ItemStack, par4, par5+offset, par6,par3World.provider.dimensionId);
par2EntityPlayer.worldObj.playSoundAtEntity(par2EntityPlayer,"mods.DimDoors.sfx.riftStart", (float) .6, 1);
@ -114,28 +110,28 @@ public class ItemStabilizedRiftSignature extends itemLinkSignature
return true;
}
@SideOnly(Side.CLIENT)
/**
* allows items to add custom lines of information to the mouseover description
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
if(par1ItemStack.hasTagCompound())
if (par1ItemStack.hasTagCompound())
{
if(par1ItemStack.stackTagCompound.getBoolean("isCreated"))
if (par1ItemStack.stackTagCompound.getBoolean("isCreated"))
{
Integer[] coords = this.readFromNBT(par1ItemStack);
par3List.add(String.valueOf("Leads to dim "+coords[3] +" with depth "+PocketManager.instance.getDimDepth(PocketManager.instance.getDimDepth(coords[3]))));
par3List.add("at x="+coords[0]+" y="+coords[1]+" z="+coords[2]);
par3List.add("Leads to (" + coords[0] + ", " + coords[1] + ", " + coords[2] + ") at dimension #" + coords[3]);
}
}
else
{
par3List.add("First click stores location,");
par3List.add ("second click creates two rifts,");
par3List.add("that link the first location");
par3List.add("with the second location");
par3List.add("First click stores a location,");
par3List.add("second click creates two rifts");
par3List.add("that link the locations together.");
}
}

View file

@ -2,22 +2,17 @@ package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.ILinkData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;

View file

@ -2,12 +2,8 @@ package StevenDimDoors.mod_pocketDim.items;
import java.util.List;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
@ -16,40 +12,25 @@ import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.mod_pocketDim;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class itemRiftRemover extends Item
{
private Material doorMaterial;
public itemRiftRemover(int par1, Material par2Material)
{
super(par1);
this.setMaxStackSize(1);
// this.setTextureFile("/PocketBlockTextures.png");
this.setCreativeTab(mod_pocketDim.dimDoorsCreativeTab);
// this.itemIcon=6;
this.setMaxDamage(5);
this.hasSubtypes=true;
//TODO move to proxy
this.hasSubtypes = true;
}
public void registerIcons(IconRegister par1IconRegister)
{
this.itemIcon = par1IconRegister.registerIcon(mod_pocketDim.modid + ":" + this.getUnlocalizedName());
}
@SideOnly(Side.CLIENT)
@Override
public boolean hasEffect(ItemStack par1ItemStack)
{
// adds effect if item has a link stored
return false;
}
public static MovingObjectPosition getBlockTarget(World par1World, EntityPlayer par2EntityPlayer, boolean par3)
@ -78,59 +59,27 @@ public class itemRiftRemover extends Item
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
{
MovingObjectPosition hit = this.getBlockTarget(par3EntityPlayer.worldObj, par3EntityPlayer, false );
if(hit!=null)
{
//System.out.println(hit.hitVec);
if(PocketManager.instance.removeRift(par2World, hit.blockX, hit.blockY, hit.blockZ, 1, par3EntityPlayer, par1ItemStack))
{
par3EntityPlayer.worldObj.playSoundAtEntity(par3EntityPlayer,"mods.DimDoors.sfx.riftClose", (float) .8, 1);
}
}
// dimHelper.removeRift( par3World, par4, par5, par6, range, par2EntityPlayer, par1ItemStack);
}
MovingObjectPosition hit = getBlockTarget(par3EntityPlayer.worldObj, par3EntityPlayer, false);
if (hit != null)
{
if (PocketManager.removeRift(par2World, hit.blockX, hit.blockY, hit.blockZ, 1, par3EntityPlayer, par1ItemStack))
{
par3EntityPlayer.worldObj.playSoundAtEntity(par3EntityPlayer,"mods.DimDoors.sfx.riftClose", 0.8f, 1);
}
}
return par1ItemStack;
}
@SideOnly(Side.CLIENT)
/**
* allows items to add custom lines of information to the mouseover description
*/
@SuppressWarnings({ "unchecked", "rawtypes" })
@SideOnly(Side.CLIENT)
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4)
{
par3List.add("Use near exposed rift");
par3List.add ("to remove it and");
par3List.add("any nearby rifts");
}
@Override
public void onCreated(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer)
{
if(!par2World.isRemote)
{
/**
//creates the first half of the link on item creation
int key= dimHelper.instance.createUniqueInterDimLinkKey();
LinkData linkData= new LinkData(par2World.provider.dimensionId,MathHelper.floor_double(par3EntityPlayer.posX),MathHelper.floor_double(par3EntityPlayer.posY),MathHelper.floor_double(par3EntityPlayer.posZ));
System.out.println(key);
dimHelper.instance.interDimLinkList.put(key, linkData);
par1ItemStack.setItemDamage(key);
**/
}
}
par3List.add("Use near exposed rift");
par3List.add("to remove it and");
par3List.add("any nearby rifts.");
}
}

View file

@ -104,7 +104,7 @@ public class mod_pocketDim
public static Block exitDoor;
public static Block unstableDoor;
public static Block blockLimbo;
public static Block dimensionalDoor;
public static dimDoor dimensionalDoor;
public static Block blockDimWall;
public static Block dimHatch;
public static Block blockDimWallPerm;
@ -188,7 +188,7 @@ public class mod_pocketDim
blockRift = (BlockRift) (new BlockRift(properties.RiftBlockID, 0, Material.air, properties).setHardness(1.0F) .setUnlocalizedName("rift"));
blockLimbo = (new BlockLimbo(properties.LimboBlockID, 15, Material.iron, properties.LimboDimensionID, decay).setHardness(.2F).setUnlocalizedName("BlockLimbo").setLightValue(.0F));
unstableDoor = (new ChaosDoor(properties.UnstableDoorID, Material.iron).setHardness(.2F).setUnlocalizedName("chaosDoor").setLightValue(.0F) );
dimensionalDoor = (new dimDoor(properties.DimensionalDoorID, Material.iron)).setHardness(1.0F).setResistance(2000.0F) .setUnlocalizedName("dimDoor");
dimensionalDoor = (dimDoor) (new dimDoor(properties.DimensionalDoorID, Material.iron)).setHardness(1.0F).setResistance(2000.0F) .setUnlocalizedName("dimDoor");
dimHatch = (new dimHatch(properties.TransTrapdoorID, 84, Material.iron)).setHardness(1.0F) .setUnlocalizedName("dimHatch");
// dimRail = (new DimRail(dimRailID, 88, false)).setHardness(.5F) .setUnlocalizedName("dimRail");

View file

@ -1,26 +0,0 @@
package StevenDimDoors.mod_pocketDim.ticking;
import java.util.ArrayList;
import java.util.Random;
import net.minecraft.entity.Entity;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.GameRules;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.core.NewDimData;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import StevenDimDoors.mod_pocketDim.helpers.yCoordHelper;
import StevenDimDoors.mod_pocketDim.util.ChunkLocation;
public class LimboGatewayGenerator implements IRegularTickReceiver
{
@Override
public void notifyTick()
{
}
}

View file

@ -150,7 +150,7 @@ public class MobMonolith extends EntityFlying implements IMob
(int) this.posY + 500,
(int) this.posZ + MathHelper.getRandomIntegerInRange(rand, -250, 250),
properties.LimboDimensionID);
DDTeleporter.teleport(worldObj, destination, entityPlayer);
DDTeleporter.teleport(entityPlayer, destination);
this.aggro = 0;
entityPlayer.worldObj.playSoundAtEntity(entityPlayer,"mods.DimDoors.sfx.crack",13, 1);

View file

@ -12,18 +12,12 @@ import net.minecraft.world.biome.BiomeGenBase;
import net.minecraft.world.chunk.Chunk;
import net.minecraft.world.chunk.IChunkProvider;
import net.minecraft.world.gen.ChunkProviderGenerate;
import net.minecraft.world.gen.MapGenBase;
import net.minecraft.world.gen.MapGenRavine;
import net.minecraft.world.gen.NoiseGeneratorOctaves;
import net.minecraft.world.gen.feature.MapGenScatteredFeature;
import net.minecraft.world.gen.structure.MapGenMineshaft;
import net.minecraft.world.gen.structure.MapGenStronghold;
import net.minecraft.world.gen.structure.MapGenVillage;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.Event.Result;
import net.minecraftforge.event.terraingen.ChunkProviderEvent;
import StevenDimDoors.mod_pocketDim.DDProperties;
import StevenDimDoors.mod_pocketDim.ticking.CommonTickHandler;
import StevenDimDoors.mod_pocketDim.ticking.MonolithSpawner;
public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvider
@ -46,8 +40,6 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
public NoiseGeneratorOctaves noiseGen5;
public World world;
private final byte[] field_82700_c = new byte[256];
private final byte[] field_82698_d = new byte[256];
/** A NoiseGeneratorOctaves used in generating terrain */
public NoiseGeneratorOctaves noiseGen6;
@ -56,27 +48,11 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
/** Reference to the World object. */
private World worldObj;
/** are map structures going to be generated (e.g. strongholds) */
private final boolean mapFeaturesEnabled = false;
/** Holds the overall noise array used in chunk generation */
private double[] noiseArray;
private double[] stoneNoise = new double[256];
private MapGenBase caveGenerator = new CustomCaveGen();
/** Holds Stronghold Generator */
private MapGenStronghold strongholdGenerator = new MapGenStronghold();
/** Holds Village Generator */
private MapGenVillage villageGenerator = new MapGenVillage();
/** Holds Mineshaft Generator */
private MapGenMineshaft mineshaftGenerator = new MapGenMineshaft();
private MapGenScatteredFeature scatteredFeatureGenerator = new MapGenScatteredFeature();
/** Holds ravine generator */
private MapGenBase ravineGenerator = new MapGenRavine();
/** The biomes that are used to generate the chunk */
private BiomeGenBase[] biomesForGeneration = new BiomeGenBase[1];
@ -137,10 +113,11 @@ public class LimboGenerator extends ChunkProviderGenerate implements IChunkProvi
}
@Override
public boolean chunkExists(int var1, int var2) {
// TODO Auto-generated method stub
public boolean chunkExists(int var1, int var2)
{
return super.chunkExists(var1, var2);
}
@Override
public void replaceBlocksForBiome(int par1, int par2, byte[] par3ArrayOfByte, BiomeGenBase[] par4ArrayOfBiomeGenBase)
{

View file

@ -12,181 +12,172 @@ import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class ClosingRiftFX extends EntityFX
{
private int field_92049_a = 160;
private boolean field_92054_ax;
private boolean field_92048_ay;
private final EffectRenderer field_92047_az;
private float field_92050_aA;
private float field_92051_aB;
private float field_92052_aC;
private boolean field_92053_aD;
private int field_92049_a = 160;
private boolean field_92054_ax;
private boolean field_92048_ay;
private final EffectRenderer field_92047_az;
private float field_92050_aA;
private float field_92051_aB;
private float field_92052_aC;
private boolean field_92053_aD;
public ClosingRiftFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, EffectRenderer par14EffectRenderer)
{
super(par1World, par2, par4, par6);
this.motionX = par8;
this.motionY = par10;
this.motionZ = par12;
this.field_92047_az = par14EffectRenderer;
this.particleScale *= .55F;
this.particleMaxAge = 30 + this.rand.nextInt(16);
this.noClip = false;
}
public ClosingRiftFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, EffectRenderer par14EffectRenderer)
{
public void func_92045_e(boolean par1)
{
this.field_92054_ax = par1;
}
super(par1World, par2, par4, par6);
this.motionX = par8;
this.motionY = par10;
this.motionZ = par12;
this.field_92047_az = par14EffectRenderer;
this.particleScale *= .55F;
this.particleMaxAge = 30 + this.rand.nextInt(16);
this.noClip = false;
}
public void func_92043_f(boolean par1)
{
this.field_92048_ay = par1;
}
public void func_92045_e(boolean par1)
{
this.field_92054_ax = par1;
}
public void func_92044_a(int par1)
{
float var2 = (float)((par1 & 16711680) >> 16) / 255.0F;
float var3 = (float)((par1 & 65280) >> 8) / 255.0F;
float var4 = (float)((par1 & 255) >> 0) / 255.0F;
float var5 = 1.0F;
this.setRBGColorF(var2 * var5, var3 * var5, var4 * var5);
}
public void func_92043_f(boolean par1)
{
this.field_92048_ay = par1;
}
public void func_92046_g(int par1)
{
this.field_92050_aA = (float)((par1 & 16711680) >> 16) / 255.0F;
this.field_92051_aB = (float)((par1 & 65280) >> 8) / 255.0F;
this.field_92052_aC = (float)((par1 & 255) >> 0) / 255.0F;
this.field_92053_aD = true;
}
public void func_92044_a(int par1)
{
float var2 = (float)((par1 & 16711680) >> 16) / 255.0F;
float var3 = (float)((par1 & 65280) >> 8) / 255.0F;
float var4 = (float)((par1 & 255) >> 0) / 255.0F;
float var5 = 1.0F;
this.setRBGColorF(var2 * var5, var3 * var5, var4 * var5);
}
/**
* returns the bounding box for this entity
*/
public AxisAlignedBB getBoundingBox()
{
return null;
}
public void func_92046_g(int par1)
{
this.field_92050_aA = (float)((par1 & 16711680) >> 16) / 255.0F;
this.field_92051_aB = (float)((par1 & 65280) >> 8) / 255.0F;
this.field_92052_aC = (float)((par1 & 255) >> 0) / 255.0F;
this.field_92053_aD = true;
}
/**
* Returns true if this entity should push and be pushed by other entities when colliding.
*/
public boolean canBePushed()
{
return false;
}
/**
* returns the bounding box for this entity
*/
public AxisAlignedBB getBoundingBox()
{
return null;
}
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
if (!this.field_92048_ay || this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0)
{
this.doRenderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7);
}
}
public void doRenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
float var8 = (float)(super.particleTextureIndexX % 16) / 16.0F;
float var9 = var8 + 0.0624375F;
float var10 = (float)(this.particleTextureIndexX / 16) / 16.0F;
float var11 = var10 + 0.0624375F;
float var12 = 0.1F * this.particleScale;
float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
float var16 = .8F;
try
{
if(PocketManager.instance.getDimData(this.worldObj.provider.dimensionId).isPocket)
{
var16=.4F;
}
else
{
}
}
catch(Exception E)
{
}
par1Tessellator.setColorRGBA_F(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16, (float) .7);
/**
* Returns true if this entity should push and be pushed by other entities when colliding.
*/
public boolean canBePushed()
{
return false;
}
par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 - par5 * var12 - par7 * var12), (double)var9, (double)var11);
par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 - par5 * var12 + par7 * var12), (double)var9, (double)var10);
par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 + par5 * var12 + par7 * var12), (double)var8, (double)var10);
par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 + par5 * var12 - par7 * var12), (double)var8, (double)var11);
}
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
if (!this.field_92048_ay || this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0)
{
this.doRenderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7);
}
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
public void doRenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
float var8 = (float)(super.particleTextureIndexX % 16) / 16.0F;
float var9 = var8 + 0.0624375F;
float var10 = (float)(this.particleTextureIndexX / 16) / 16.0F;
float var11 = var10 + 0.0624375F;
float var12 = 0.1F * this.particleScale;
float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
float var16 = 0.8F;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
if (PocketManager.getDimensionData(worldObj).isPocketDimension())
{
var16 = 0.4F;
}
par1Tessellator.setColorRGBA_F(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16, (float) .7);
if (this.particleAge > this.particleMaxAge / 2)
{
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 - par5 * var12 - par7 * var12), (double)var9, (double)var11);
par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 - par5 * var12 + par7 * var12), (double)var9, (double)var10);
par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 + par5 * var12 + par7 * var12), (double)var8, (double)var10);
par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 + par5 * var12 - par7 * var12), (double)var8, (double)var11);
}
if (this.field_92053_aD)
{
this.particleRed += (this.field_92050_aA - this.particleRed) * 0.2F;
this.particleGreen += (this.field_92051_aB - this.particleGreen) * 0.2F;
this.particleBlue += (this.field_92052_aC - this.particleBlue) * 0.2F;
}
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
this.setParticleTextureIndex(this.field_92049_a + (7 - this.particleAge * 8 / this.particleMaxAge));
// this.motionY -= 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9100000262260437D;
this.motionY *= 0.9100000262260437D;
this.motionZ *= 0.9100000262260437D;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
if (this.particleAge > this.particleMaxAge / 2)
{
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
if (this.field_92054_ax && this.particleAge < this.particleMaxAge / 2 && (this.particleAge + this.particleMaxAge) % 2 == 0)
{
ClosingRiftFX var1 = new ClosingRiftFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, this.field_92047_az);
var1.setRBGColorF(this.particleRed, this.particleGreen, this.particleBlue);
var1.particleAge = var1.particleMaxAge / 2;
if (this.field_92053_aD)
{
this.particleRed += (this.field_92050_aA - this.particleRed) * 0.2F;
this.particleGreen += (this.field_92051_aB - this.particleGreen) * 0.2F;
this.particleBlue += (this.field_92052_aC - this.particleBlue) * 0.2F;
}
}
if (this.field_92053_aD)
{
var1.field_92053_aD = true;
var1.field_92050_aA = this.field_92050_aA;
var1.field_92051_aB = this.field_92051_aB;
var1.field_92052_aC = this.field_92052_aC;
}
this.setParticleTextureIndex(this.field_92049_a + (7 - this.particleAge * 8 / this.particleMaxAge));
// this.motionY -= 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9100000262260437D;
this.motionY *= 0.9100000262260437D;
this.motionZ *= 0.9100000262260437D;
var1.field_92048_ay = this.field_92048_ay;
this.field_92047_az.addEffect(var1);
}
}
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
public int getBrightnessForRender(float par1)
{
return 15728880;
}
if (this.field_92054_ax && this.particleAge < this.particleMaxAge / 2 && (this.particleAge + this.particleMaxAge) % 2 == 0)
{
ClosingRiftFX var1 = new ClosingRiftFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, this.field_92047_az);
var1.setRBGColorF(this.particleRed, this.particleGreen, this.particleBlue);
var1.particleAge = var1.particleMaxAge / 2;
/**
* Gets how bright this entity is.
*/
public float getBrightness(float par1)
{
return 1.0F;
}
if (this.field_92053_aD)
{
var1.field_92053_aD = true;
var1.field_92050_aA = this.field_92050_aA;
var1.field_92051_aB = this.field_92051_aB;
var1.field_92052_aC = this.field_92052_aC;
}
var1.field_92048_ay = this.field_92048_ay;
this.field_92047_az.addEffect(var1);
}
}
public int getBrightnessForRender(float par1)
{
return 15728880;
}
/**
* Gets how bright this entity is.
*/
public float getBrightness(float par1)
{
return 1.0F;
}
}

View file

@ -1,195 +1,185 @@
package StevenDimDoors.mod_pocketDimClient;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.particle.EntityFX;
import net.minecraft.client.particle.EntityFireworkSparkFX;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.world.World;
import StevenDimDoors.mod_pocketDim.core.PocketManager;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
public class GoggleRiftFX extends EntityFireworkSparkFX
{
private int field_92049_a = 160;
private boolean field_92054_ax;
private boolean field_92048_ay;
private final EffectRenderer field_92047_az;
private float field_92050_aA;
private float field_92051_aB;
private float field_92052_aC;
private boolean field_92053_aD;
private int field_92049_a = 160;
private boolean field_92054_ax;
private boolean field_92048_ay;
private final EffectRenderer field_92047_az;
private float field_92050_aA;
private float field_92051_aB;
private float field_92052_aC;
private boolean field_92053_aD;
public GoggleRiftFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, EffectRenderer par14EffectRenderer)
{
super(par1World, par2, par4, par6, par12, par12, par12, par14EffectRenderer);
this.motionX = par8;
this.motionY = par10;
this.motionZ = par12;
this.field_92047_az = par14EffectRenderer;
this.particleScale *= .55F;
this.particleMaxAge = 30 + this.rand.nextInt(16);
this.noClip = false;
}
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
if (!this.field_92048_ay || this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0)
{
this.doRenderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7);
}
}
public void doRenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
float var8 = (float)(super.particleTextureIndexX % 16) / 16.0F;
float var9 = var8 + 0.0624375F;
float var10 = (float)(this.particleTextureIndexX / 16) / 16.0F;
float var11 = var10 + 0.0624375F;
float var12 = 0.1F * this.particleScale;
float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
float var16 = .0F;
try
{
if(PocketManager.instance.getDimData(this.worldObj.provider.dimensionId).isPocket)
{
var16=.7F;
}
else
{
}
}
catch(Exception E)
{
}
par1Tessellator.setColorRGBA_F(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16, (float) .7);
public GoggleRiftFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, EffectRenderer par14EffectRenderer)
{
par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 - par5 * var12 - par7 * var12), (double)var9, (double)var11);
par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 - par5 * var12 + par7 * var12), (double)var9, (double)var10);
par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 + par5 * var12 + par7 * var12), (double)var8, (double)var10);
par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 + par5 * var12 - par7 * var12), (double)var8, (double)var11);
}
super(par1World, par2, par4, par6, par12, par12, par12, par14EffectRenderer);
this.motionX = par8;
this.motionY = par10;
this.motionZ = par12;
this.field_92047_az = par14EffectRenderer;
this.particleScale *= .55F;
this.particleMaxAge = 30 + this.rand.nextInt(16);
this.noClip = false;
}
public void renderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
if (!this.field_92048_ay || this.particleAge < this.particleMaxAge / 3 || (this.particleAge + this.particleMaxAge) / 3 % 2 == 0)
{
this.doRenderParticle(par1Tessellator, par2, par3, par4, par5, par6, par7);
}
}
public void doRenderParticle(Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
{
float var8 = (float)(super.particleTextureIndexX % 16) / 16.0F;
float var9 = var8 + 0.0624375F;
float var10 = (float)(this.particleTextureIndexX / 16) / 16.0F;
float var11 = var10 + 0.0624375F;
float var12 = 0.1F * this.particleScale;
float var13 = (float)(this.prevPosX + (this.posX - this.prevPosX) * (double)par2 - interpPosX);
float var14 = (float)(this.prevPosY + (this.posY - this.prevPosY) * (double)par2 - interpPosY);
float var15 = (float)(this.prevPosZ + (this.posZ - this.prevPosZ) * (double)par2 - interpPosZ);
float var16 = .0F;
if (PocketManager.getDimensionData(worldObj).isPocketDimension())
{
var16 = .7F;
}
par1Tessellator.setColorRGBA_F(this.particleRed * var16, this.particleGreen * var16, this.particleBlue * var16, (float) .7);
par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 - par5 * var12 - par7 * var12), (double)var9, (double)var11);
par1Tessellator.addVertexWithUV((double)(var13 - par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 - par5 * var12 + par7 * var12), (double)var9, (double)var10);
par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 + par6 * var12), (double)(var14 + par4 * var12), (double)(var15 + par5 * var12 + par7 * var12), (double)var8, (double)var10);
par1Tessellator.addVertexWithUV((double)(var13 + par3 * var12 - par6 * var12), (double)(var14 - par4 * var12), (double)(var15 + par5 * var12 - par7 * var12), (double)var8, (double)var11);
}
public void func_92045_e(boolean par1)
{
this.field_92054_ax = par1;
}
public void func_92045_e(boolean par1)
{
this.field_92054_ax = par1;
}
public void func_92043_f(boolean par1)
{
this.field_92048_ay = par1;
}
public void func_92043_f(boolean par1)
{
this.field_92048_ay = par1;
}
public void func_92044_a(int par1)
{
float var2 = (float)((par1 & 16711680) >> 16) / 255.0F;
float var3 = (float)((par1 & 65280) >> 8) / 255.0F;
float var4 = (float)((par1 & 255) >> 0) / 255.0F;
float var5 = 1.0F;
this.setRBGColorF(var2 * var5, var3 * var5, var4 * var5);
}
public void func_92044_a(int par1)
{
float var2 = (float)((par1 & 16711680) >> 16) / 255.0F;
float var3 = (float)((par1 & 65280) >> 8) / 255.0F;
float var4 = (float)((par1 & 255) >> 0) / 255.0F;
float var5 = 1.0F;
this.setRBGColorF(var2 * var5, var3 * var5, var4 * var5);
}
public void func_92046_g(int par1)
{
this.field_92050_aA = (float)((par1 & 16711680) >> 16) / 255.0F;
this.field_92051_aB = (float)((par1 & 65280) >> 8) / 255.0F;
this.field_92052_aC = (float)((par1 & 255) >> 0) / 255.0F;
this.field_92053_aD = true;
}
public void func_92046_g(int par1)
{
this.field_92050_aA = (float)((par1 & 16711680) >> 16) / 255.0F;
this.field_92051_aB = (float)((par1 & 65280) >> 8) / 255.0F;
this.field_92052_aC = (float)((par1 & 255) >> 0) / 255.0F;
this.field_92053_aD = true;
}
/**
* returns the bounding box for this entity
*/
public AxisAlignedBB getBoundingBox()
{
return null;
}
/**
* returns the bounding box for this entity
*/
public AxisAlignedBB getBoundingBox()
{
return null;
}
/**
* Returns true if this entity should push and be pushed by other entities when colliding.
*/
public boolean canBePushed()
{
return false;
}
/**
* Returns true if this entity should push and be pushed by other entities when colliding.
*/
public boolean canBePushed()
{
return false;
}
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
if (this.particleAge > this.particleMaxAge / 2)
{
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
/**
* Called to update the entity's position/logic.
*/
public void onUpdate()
{
this.prevPosX = this.posX;
this.prevPosY = this.posY;
this.prevPosZ = this.posZ;
if (this.field_92053_aD)
{
this.particleRed += (this.field_92050_aA - this.particleRed) * 0.2F;
this.particleGreen += (this.field_92051_aB - this.particleGreen) * 0.2F;
this.particleBlue += (this.field_92052_aC - this.particleBlue) * 0.2F;
}
}
if (this.particleAge++ >= this.particleMaxAge)
{
this.setDead();
}
this.setParticleTextureIndex(this.field_92049_a + (7 - this.particleAge * 8 / this.particleMaxAge));
// this.motionY -= 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9100000262260437D;
this.motionY *= 0.9100000262260437D;
this.motionZ *= 0.9100000262260437D;
if (this.particleAge > this.particleMaxAge / 2)
{
this.setAlphaF(1.0F - ((float)this.particleAge - (float)(this.particleMaxAge / 2)) / (float)this.particleMaxAge);
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
if (this.field_92053_aD)
{
this.particleRed += (this.field_92050_aA - this.particleRed) * 0.2F;
this.particleGreen += (this.field_92051_aB - this.particleGreen) * 0.2F;
this.particleBlue += (this.field_92052_aC - this.particleBlue) * 0.2F;
}
}
if (this.field_92054_ax && this.particleAge < this.particleMaxAge / 2 && (this.particleAge + this.particleMaxAge) % 2 == 0)
{
GoggleRiftFX var1 = new GoggleRiftFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, this.field_92047_az);
var1.setRBGColorF(this.particleRed, this.particleGreen, this.particleBlue);
var1.particleAge = var1.particleMaxAge / 2;
this.setParticleTextureIndex(this.field_92049_a + (7 - this.particleAge * 8 / this.particleMaxAge));
// this.motionY -= 0.004D;
this.moveEntity(this.motionX, this.motionY, this.motionZ);
this.motionX *= 0.9100000262260437D;
this.motionY *= 0.9100000262260437D;
this.motionZ *= 0.9100000262260437D;
if (this.field_92053_aD)
{
var1.field_92053_aD = true;
var1.field_92050_aA = this.field_92050_aA;
var1.field_92051_aB = this.field_92051_aB;
var1.field_92052_aC = this.field_92052_aC;
}
if (this.onGround)
{
this.motionX *= 0.699999988079071D;
this.motionZ *= 0.699999988079071D;
}
var1.field_92048_ay = this.field_92048_ay;
this.field_92047_az.addEffect(var1);
}
}
if (this.field_92054_ax && this.particleAge < this.particleMaxAge / 2 && (this.particleAge + this.particleMaxAge) % 2 == 0)
{
GoggleRiftFX var1 = new GoggleRiftFX(this.worldObj, this.posX, this.posY, this.posZ, 0.0D, 0.0D, 0.0D, this.field_92047_az);
var1.setRBGColorF(this.particleRed, this.particleGreen, this.particleBlue);
var1.particleAge = var1.particleMaxAge / 2;
public int getBrightnessForRender(float par1)
{
return 15728880;
}
if (this.field_92053_aD)
{
var1.field_92053_aD = true;
var1.field_92050_aA = this.field_92050_aA;
var1.field_92051_aB = this.field_92051_aB;
var1.field_92052_aC = this.field_92052_aC;
}
/**
* Gets how bright this entity is.
*/
public float getBrightness(float par1)
{
return 1.0F;
}
var1.field_92048_ay = this.field_92048_ay;
this.field_92047_az.addEffect(var1);
}
}
public int getBrightnessForRender(float par1)
{
return 15728880;
}
/**
* Gets how bright this entity is.
*/
public float getBrightness(float par1)
{
return 1.0F;
}
}

View file

@ -40,12 +40,10 @@ public class RenderDimDoor extends TileEntitySpecialRenderer
{
try
{
dimDoor.class.cast(Block.blocksList[properties.DimensionalDoorID]).updateAttatchedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord).getFullMetadata(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord);
mod_pocketDim.dimensionalDoor.updateAttachedTile(tile.worldObj, tile.xCoord, tile.yCoord, tile.zCoord);
}
catch(Exception e)
{
e.printStackTrace();
}