Cleanup...

This commit is contained in:
Vasco Lavos committed 2014-03-03 23:33:11 +00:00
1 parent 5638959b46
commit f3bc2769c6
29 files changed
+161 -166

No files matched your search

@@ -30,7 +30,7 @@ public class ClientTickHandler implements ITickHandler {
@Override
public void tickEnd(EnumSet<TickType> type, Object... tickData) {
LightningBolt.update();
if(Minecraft.getMinecraft().theWorld == null)
ManaNetworkHandler.instance.clear();
}
@@ -116,19 +116,19 @@ public class ClientProxy extends CommonProxy {
}
private static boolean distanceLimit = true;
@Override
public void setWispFXDistanceLimit(boolean limit) {
distanceLimit = limit;
}
@Override
public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size, float motionx, float motiony, float motionz) {
FXWisp wisp = new FXWisp(world, x, y, z, size, r, g, b, distanceLimit);
wisp.motionX = motionx;
wisp.motionY = motiony;
wisp.motionZ = motionz;
Minecraft.getMinecraft().effectRenderer.addEffect(wisp);
}
+2 -2
View File
@@ -45,13 +45,13 @@ public class FXWisp extends EntityFX
noClip = true;
setSize(0.01F, 0.01F);
EntityLivingBase renderentity = FMLClientHandler.instance().getClient().renderViewEntity;
if(distanceLimit) {
int visibleDistance = 50;
if (!FMLClientHandler.instance().getClient().gameSettings.fancyGraphics) visibleDistance=25;
if (renderentity == null || renderentity.getDistance(posX, posY, posZ)>visibleDistance) particleMaxAge=0;
}
prevPosX = posX;
prevPosY = posY;
prevPosZ = posZ;
@@ -15,7 +15,7 @@ import net.minecraft.client.model.ModelBase;
import net.minecraft.client.model.ModelRenderer;
public class ModelPylon extends ModelBase {
ModelRenderer crystal1;
ModelRenderer crystal2;
ModelRenderer crystal3;
@@ -39,31 +39,31 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
GL11.glColor4f(1F, 1F, 1F, 1F);
Minecraft.getMinecraft().renderEngine.bindTexture(texture);
int worldTime = (int) (tileentity.worldObj == null ? 0 : tileentity.worldObj.getTotalWorldTime());
if(tileentity != null)
worldTime += new Random(tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord).nextInt(360);
GL11.glTranslated(d0 + 0.5, d1 + 2.2, d2 + 0.5);
GL11.glScalef(1F, -1.5F, -1F);
int light = 15728880;
int lightmapX = light % 65536;
int lightmapY = light / 65536;
GL11.glPushMatrix();
GL11.glRotatef(worldTime * 1.5F, 0F, 1F, 0F);
model.renderRing();
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0D, Math.sin((double) worldTime / 20D) / 17.5, 0D);
GL11.glTranslated(0D, Math.sin(worldTime / 20D) / 17.5, 0D);
GL11.glRotatef(-worldTime, 0F, 1F, 0F);
GL11.glDisable(GL11.GL_CULL_FACE);
model.renderCrystal();
GL11.glColor4f(1F, 1F, 1F, 1F);
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
double alpha = Math.sin((double) worldTime / 20D) / 2D + 0.5;
double alpha = Math.sin(worldTime / 20D) / 2D + 0.5;
GL11.glColor4d(1D, 1D, 1D, alpha + 0.183F);
GL11.glScalef(1.1F, 1.1F, 1.1F);
GL11.glTranslatef(0F, -0.09F, 0F);
@@ -71,7 +71,7 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glPopMatrix();
GL11.glScalef(1F, -1.5F, -1F);
GL11.glDisable(GL11.GL_BLEND);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
@@ -51,7 +51,7 @@ public class RenderTileRuneAltar extends TileEntitySpecialRenderer {
break;
else items++;
float[] angles = new float[altar.getSizeInventory()];
float anglePer = 360F / items;
float totalAngle = 0F;
for(int i = 0; i < angles.length; i++)
@@ -18,7 +18,6 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Icon;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeDirection;
import vazkii.botania.api.ILexiconable;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.client.core.helper.IconHelper;
@@ -30,7 +29,7 @@ import vazkii.botania.common.lib.LibBlockNames;
public class BlockDistributor extends BlockModContainer implements ILexiconable {
Icon iconSide, iconTop;
protected BlockDistributor() {
super(LibBlockIDs.idDistributor, Material.rock);
setHardness(2.0F);
@@ -38,13 +37,13 @@ public class BlockDistributor extends BlockModContainer implements ILexiconable
setStepSound(soundStoneFootstep);
setUnlocalizedName(LibBlockNames.DISTRIBUTOR);
}
@Override
public void registerIcons(IconRegister par1IconRegister) {
iconTop = IconHelper.forBlock(par1IconRegister, this, 0);
iconSide = IconHelper.forBlock(par1IconRegister, this, 1);
}
@Override
public Icon getIcon(int par1, int par2) {
return par1 == 0 ? ModBlocks.livingrock.getIcon(0, 0) : par1 == 1 ? iconTop : iconSide;
@@ -33,7 +33,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
public class BlockLivingrock extends BlockMod implements ILexiconable {
private static final int TYPES = 5;
private static final int TYPES = 5;
Icon[] icons;
public BlockLivingrock() {
@@ -54,7 +54,7 @@ public class BlockLivingrock extends BlockMod implements ILexiconable {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
return super.setUnlocalizedName(par1Str);
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {
for(int i = 0; i < TYPES; i++)
@@ -72,7 +72,7 @@ public class BlockLivingrock extends BlockMod implements ILexiconable {
public Icon getIcon(int par1, int par2) {
return icons[Math.min(TYPES - 1, par2)];
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
@@ -13,7 +13,6 @@ package vazkii.botania.common.block;
import java.util.List;
import cpw.mods.fml.common.registry.GameRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IconRegister;
@@ -30,19 +29,20 @@ import vazkii.botania.common.item.block.ItemBlockWithMetadataAndName;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibBlockIDs;
import vazkii.botania.common.lib.LibBlockNames;
import cpw.mods.fml.common.registry.GameRegistry;
public class BlockLivingwood extends BlockMod implements ILexiconable {
private static final int TYPES = 5;
private static final int TYPES = 5;
Icon[] icons;
public BlockLivingwood() {
super(LibBlockIDs.idLivingwood, Material.wood);
setHardness(2.0F);
setStepSound(soundWoodFootstep);
setUnlocalizedName(LibBlockNames.LIVING_WOOD);
}
@Override
protected boolean shouldRegisterInNameSet() {
return false;
@@ -53,7 +53,7 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
GameRegistry.registerBlock(this, ItemBlockWithMetadataAndName.class, par1Str);
return super.setUnlocalizedName(par1Str);
}
@Override
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {
for(int i = 0; i < TYPES; i++)
@@ -71,13 +71,13 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
public Icon getIcon(int par1, int par2) {
return icons[Math.min(TYPES - 1, par2)];
}
@Override
public ItemStack getPickBlock(MovingObjectPosition target, World world, int x, int y, int z) {
int meta = world.getBlockMetadata(x, y, z);
return new ItemStack(blockID, 1, meta);
}
@Override
public LexiconEntry getEntry(World world, int x, int y, int z, EntityPlayer player, ItemStack lexicon) {
int meta = world.getBlockMetadata(x, y, z);
@@ -38,7 +38,7 @@ import cpw.mods.fml.common.registry.GameRegistry;
public class BlockManaBeacon extends BlockModContainer implements ILexiconable {
Icon[] icons = new Icon[2];
public BlockManaBeacon() {
super(LibBlockIDs.idManaBeacon, Material.iron);
setHardness(5.0F);
@@ -48,13 +48,13 @@ public class BlockManaBeacon extends BlockModContainer implements ILexiconable {
setBlockBounds(size, size, size, 1F - size, 1F - size, 1F - size);
setUnlocalizedName(LibBlockNames.MANA_BEACON);
}
@Override
public void registerIcons(IconRegister par1IconRegister) {
for(int i = 0; i < 2; i++)
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
}
@Override
public Icon getIcon(int par1, int par2) {
return icons[par1 == 1 ? 1 : 0];
@@ -53,67 +53,67 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
setHardness(2F);
setResistance(10F);
setStepSound(soundMetalFootstep);
TickRegistry.registerTickHandler(new InternalTickHandler(), Side.SERVER);
MinecraftForge.EVENT_BUS.register(this);
}
@Override
public int idDropped(int par1, Random par2Random, int par3) {
return 0;
}
@Override
public int quantityDropped(int meta, int fortune, Random random) {
return 0;
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public void breakBlock(World par1World, int par2, int par3, int par4, int par5, int par6) {
mapCoords(par1World.provider.dimensionId, par2, par3, par4, 2);
}
public static String getCoordsAsString(int world, int x, int y, int z) {
return world + ":" + x + ":" + y + ":" + z;
}
static void mapCoords(int world, int x, int y, int z, int time) {
InternalTickHandler.coordsToCheck.put(getCoordsAsString(world, x, y, z), time);
}
static void decrCoords(String key) {
int time = getTimeInCoords(key);
if(time <= 0)
if(time <= 0)
InternalTickHandler.removeThese.add(key);
else InternalTickHandler.coordsToCheck.put(key, time - 1);
}
static int getTimeInCoords(String key) {
return InternalTickHandler.coordsToCheck.get(key);
}
static int getBlockIDAt(String key) {
MinecraftServer server = MinecraftServer.getServer();
if(server == null)
return 0;
String[] tokens = key.split(":");
int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]);
World world = server.worldServerForDimension(worldId);
return world.getBlockId(x, y, z);
}
static int getBlockMetaAt(String key) {
MinecraftServer server = MinecraftServer.getServer();
if(server == null)
return 0;
String[] tokens = key.split(":");
int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]);
World world = server.worldServerForDimension(worldId);
@@ -130,64 +130,64 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
if(!world.isRemote)
world.playAuxSFX(2001, x, y , z, blockID);
}
return true;
}
@ForgeSubscribe
public void onWorldLoad(WorldEvent.Load event) {
WorldData.get(event.world);
}
public static class WorldData extends WorldSavedData {
private static final String ID = "PistonRelayPairs";
public WorldData(String id) {
super(id);
}
@Override
public void readFromNBT(NBTTagCompound nbttagcompound) {
InternalTickHandler.mappedPositions.clear();
Collection<NBTBase> tags = nbttagcompound.getTags();
for(NBTBase tag : tags) {
if(tag instanceof NBTTagString) {
String key = tag.getName();
String value = ((NBTTagString) tag).data;
InternalTickHandler.mappedPositions.put(key, value);
}
}
}
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
for(String s : InternalTickHandler.mappedPositions.keySet())
nbttagcompound.setString(s, InternalTickHandler.mappedPositions.get(s));
}
public static WorldData get(World world) {
WorldData data = (WorldData) world.mapStorage.loadData(WorldData.class, ID);
if (data == null) {
data = new WorldData(ID);
data.markDirty();
world.mapStorage.setData(ID, data);
}
return data;
}
if (data == null) {
data = new WorldData(ID);
data.markDirty();
world.mapStorage.setData(ID, data);
}
return data;
}
}
public static class InternalTickHandler implements ITickHandler {
public static Map<String, String> playerPositions = new HashMap();
public static Map<String, String> mappedPositions = new HashMap();
static List<String> removeThese = new ArrayList();
static Map<String, Integer> coordsToCheck = new HashMap();
@Override
public void tickStart(EnumSet<TickType> type, Object... tickData) {
// NO-OP
@@ -198,35 +198,35 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
for(String s : coordsToCheck.keySet()) {
int id = getBlockIDAt(s);
decrCoords(s);
if(id == 36) {
int meta = getBlockMetaAt(s);
ForgeDirection dir = ForgeDirection.getOrientation(meta & ~8);
MinecraftServer server = MinecraftServer.getServer();
if(server != null && getTimeInCoords(s) == 0) {
if(server != null && getTimeInCoords(s) == 0) {
String newPos;
{
String[] tokens = s.split(":");
int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]);
World world = server.worldServerForDimension(worldId);
world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, ModBlocks.pistonRelay.blockID);
newPos = getCoordsAsString(world.provider.dimensionId, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
String[] tokens = s.split(":");
int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]);
World world = server.worldServerForDimension(worldId);
world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, ModBlocks.pistonRelay.blockID);
newPos = getCoordsAsString(world.provider.dimensionId, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
}
if(mappedPositions.containsKey(s)) {
String pos = mappedPositions.get(s);
String[] tokens = pos.split(":");
int worldId = Integer.parseInt(tokens[0]), x = Integer.parseInt(tokens[1]), y = Integer.parseInt(tokens[2]), z = Integer.parseInt(tokens[3]);
World world = server.worldServerForDimension(worldId);
int srcId = world.getBlockId(x, y, z);
int srcMeta = world.getBlockMetadata(x, y, z);
TileEntity tile = world.getBlockTileEntity(x, y, z);
Material mat = world.getBlockMaterial(x, y, z);
if(tile == null && mat.getMaterialMobility() == 0 && Block.blocksList[srcId] != null && !Block.blocksList[srcId].isAirBlock(world, x, y, z)) {
Material destMat = world.getBlockMaterial(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ);
if(world.isAirBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) || destMat.isReplaceable()) {
@@ -235,7 +235,7 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
mappedPositions.put(s, getCoordsAsString(world.provider.dimensionId, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ));
}
}
pos = mappedPositions.get(s);
mappedPositions.remove(s);
mappedPositions.put(newPos, pos);
@@ -244,7 +244,7 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
}
}
}
for(String s : removeThese)
coordsToCheck.remove(s);
removeThese.clear();
@@ -259,7 +259,7 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
public String getLabel() {
return LibBlockNames.PISTON_RELAY;
}
}
@Override
@@ -62,7 +62,7 @@ public class BlockPylon extends BlockModContainer implements ILexiconable {
public float getEnchantPowerBonus(World world, int x, int y, int z) {
return 8;
}
@Override
public TileEntity createNewTileEntity(World world) {
return new TilePylon();
@@ -65,7 +65,7 @@ public final class ModBlocks {
pistonRelay = new BlockPistonRelay();
distributor = new BlockDistributor();
manaBeacon = new BlockManaBeacon();
for(int i = 0; i < 16; i++)
OreDictionary.registerOre(LibOreDict.FLOWER[i], new ItemStack(flower.blockID, 1, i));
@@ -96,7 +96,7 @@ public final class ModBlocks {
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_TIGERSEYE, SubTileTigerseye.class);
BotaniaAPI.registerSubTile(LibBlockNames.SUBTILE_JADED_AMARANTHUS, SubTileJadedAmaranthus.class);
}
private static void registerMultiparts() {
if(Loader.isModLoaded("ForgeMultipart")) {
try {
@@ -114,7 +114,7 @@ public class SubTileGenerating extends SubTileEntity {
public int getDelayBetweenPassiveGeneration() {
return 20;
}
public int getValueForPassiveGeneration() {
return 1;
}
@@ -11,26 +11,25 @@
*/
package vazkii.botania.common.block.subtile.functional;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.block.Block;
import net.minecraft.world.World;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.block.subtile.SubTileFunctional;
import cpw.mods.fml.common.network.PacketDispatcher;
public class SubTileJadedAmaranthus extends SubTileFunctional {
private static final int COST = 100;
int cooldown = 0;
@Override
public void onUpdate() {
super.onUpdate();
if(cooldown > 0) {
cooldown--;
return;
}
if(mana >= COST && !supertile.worldObj.isRemote) {
int range = 4;
int x = supertile.xCoord - range + supertile.worldObj.rand.nextInt(range * 2 + 1);
@@ -43,27 +42,27 @@ public class SubTileJadedAmaranthus extends SubTileFunctional {
int color = supertile.worldObj.rand.nextInt(16);
if(ModBlocks.flower.canBlockStay(supertile.worldObj, x, y + 1, z))
supertile.worldObj.setBlock(x, y + 1, z, ModBlocks.flower.blockID, color, 1 | 2);
mana -= COST;
PacketDispatcher.sendPacketToAllInDimension(supertile.getDescriptionPacket(), supertile.worldObj.provider.dimensionId);
cooldown = 30;
break;
}
y--;
}
}
}
@Override
public int getColor() {
return 0x961283;
}
@Override
public int getMaxMana() {
return COST;
}
}
@@ -76,7 +76,7 @@ public class SubTileEndoflame extends SubTileGenerating {
public int getValueForPassiveGeneration() {
return 2;
}
@Override
public int getColor() {
return 0x785000;
@@ -14,20 +14,20 @@ package vazkii.botania.common.block.tile;
import java.util.ArrayList;
import java.util.List;
import cpw.mods.fml.common.network.PacketDispatcher;
import net.minecraft.tileentity.TileEntity;
import net.minecraftforge.common.ForgeDirection;
import vazkii.botania.api.mana.IManaPool;
import vazkii.botania.api.mana.IManaReceiver;
import cpw.mods.fml.common.network.PacketDispatcher;
public class TileDistributor extends TileMod implements IManaReceiver {
List<IManaReceiver> validPools = new ArrayList();
static final ForgeDirection[] DIRECTIONS = new ForgeDirection[] {
ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST
};
@Override
public void updateEntity() {
validPools.clear();
@@ -40,7 +40,7 @@ public class TileDistributor extends TileMod implements IManaReceiver {
}
}
}
@Override
public int getCurrentMana() {
return 0;
@@ -25,14 +25,14 @@ public class TileManaBeacon extends TileMod {
if(redstoneSide > 0)
redstone = true;
}
if(!redstone) {
float[] color = EntitySheep.fleeceColorTable[worldObj.getBlockMetadata(xCoord, yCoord, zCoord)];
Botania.proxy.setWispFXDistanceLimit(false);
for(int i = 0; i < 3; i++)
Botania.proxy.wispFX(worldObj, xCoord + 0.5, yCoord, zCoord + 0.5, color[0], color[1], color[2], (float) Math.random() * 5 + 1F, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt((256F / (256F - (float) yCoord))), (float) (Math.random() - 0.5F));
Botania.proxy.wispFX(worldObj, xCoord + 0.5, yCoord, zCoord + 0.5, color[0], color[1], color[2], (float) Math.random() * 5 + 1F, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt(256F / (256F - yCoord)), (float) (Math.random() - 0.5F));
for(int i = 0; i < 4; i++)
Botania.proxy.wispFX(worldObj, xCoord + 0.5, 256, zCoord + 0.5, color[0], color[1], color[2], (float) Math.random() * 15 + 8F, (float) (Math.random() - 0.5F) * 8F, 0F, (float) (Math.random() - 0.5F) * 8F);
Botania.proxy.setWispFXDistanceLimit(true);
@@ -18,22 +18,22 @@ import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.core.helper.Vector3;
public class TilePylon extends TileEntity {
boolean activated = false; // TODO
@Override
public void updateEntity() {
if(activated && worldObj.isRemote) {
Vector3 centerBlock = new Vector3(-500.5, 4.75 + (Math.random() - 0.5 * 0.25), -411.5);
int id = worldObj.getBlockId(xCoord, yCoord - 1, zCoord);
if(id == ModBlocks.flower.blockID) {
int meta = worldObj.getBlockMetadata(xCoord, yCoord - 1, zCoord);
float[] color = EntitySheep.fleeceColorTable[meta];
if(worldObj.rand.nextInt(4) == 0)
Botania.proxy.sparkleFX(worldObj, centerBlock.x + (Math.random() - 0.5) * 0.5, centerBlock.y, centerBlock.z + (Math.random() - 0.5) * 0.5, color[0], color[1], color[2], (float) Math.random(), 8);
Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.25, yCoord - 0.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 3F, -0.04F);
Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.125, yCoord + 1.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.125, color[0], color[1], color[2], (float) Math.random() / 5F, -0.001F);
@@ -42,9 +42,9 @@ public class TilePylon extends TileEntity {
Botania.proxy.wispFX(worldObj, xCoord + 0.5 + (Math.random() - 0.5) * 0.25, yCoord + 1.5, zCoord + 0.5 + (Math.random() - 0.5) * 0.25, color[0], color[1], color[2], (float) Math.random() / 8F, (float) movementVector.x, (float) movementVector.y, (float) movementVector.z);
}
}
if(worldObj.rand.nextBoolean() && worldObj.isRemote)
Botania.proxy.sparkleFX(worldObj, xCoord + Math.random(), yCoord + Math.random() * 1.5, zCoord + Math.random(), 0.5F, 0.5F, 1F, (float) Math.random(), 2);
}
}
@@ -35,7 +35,7 @@ public final class ConfigHandler {
Property lexiconRotatingItemsProp = config.get(Configuration.CATEGORY_GENERAL, "lexicon.enable.rotatingItems", true);
lexiconRotatingItemsProp.comment = "Set to false to disable the rotating items in the petal and rune entries in the Lexica Botania.";
lexiconRotatingItems = lexiconRotatingItemsProp.getBoolean(true);
Property subtlePowerSystemProp = config.get(Configuration.CATEGORY_GENERAL, "powerSystem.system", false);
subtlePowerSystemProp.comment = "Set to true to set the power system's particles to be a lot more subtle. Good for low-end systems, if the particles are causing lag.";
subtlePowerSystem = subtlePowerSystemProp.getBoolean(false);
@@ -31,7 +31,7 @@ import net.minecraftforge.common.ForgeDirection;
//From OpenBlocksLib: https://github.com/OpenMods/OpenModsLib
public class InventoryHelper {
public static void tryInsertStack(IInventory targetInventory, int slot, ItemStack stack, boolean canMerge) {
if(targetInventory.isItemValidForSlot(slot, stack)) {
ItemStack targetStack = targetInventory.getStackInSlot(slot);
@@ -76,7 +76,7 @@ public class InventoryHelper {
targetInventory = new GenericInventory("temporary.inventory", false, targetInventory.getSizeInventory());
((GenericInventory)targetInventory).copyFrom(inventory);
}
int i = 0;
int[] attemptSlots = new int[0];
@@ -114,16 +114,16 @@ public class InventoryHelper {
TileEntity tileEntity = world.getBlockTileEntity(x, y, z);
if(tileEntity instanceof TileEntityChest) {
int chestId = world.getBlockId(x, y, z);
if(world.getBlockId(x - 1, y, z) == chestId)
if(world.getBlockId(x - 1, y, z) == chestId)
return new InventoryLargeChest("Large chest", (IInventory)world.getBlockTileEntity(x - 1, y, z), (IInventory)tileEntity);
if(world.getBlockId(x + 1, y, z) == chestId)
if(world.getBlockId(x + 1, y, z) == chestId)
return new InventoryLargeChest("Large chest", (IInventory)tileEntity, (IInventory)world.getBlockTileEntity(x + 1, y, z));
if(world.getBlockId(x, y, z - 1) == chestId)
if(world.getBlockId(x, y, z - 1) == chestId)
return new InventoryLargeChest("Large chest", (IInventory)world.getBlockTileEntity(x, y, z - 1), (IInventory)tileEntity);
if(world.getBlockId(x, y, z + 1) == chestId)
if(world.getBlockId(x, y, z + 1) == chestId)
return new InventoryLargeChest("Large chest", (IInventory)tileEntity, (IInventory)world.getBlockTileEntity(x, y, z + 1));
}
return (tileEntity instanceof IInventory)? (IInventory)tileEntity : null;
return tileEntity instanceof IInventory? (IInventory)tileEntity : null;
}
public static IInventory getInventory(World world, int x, int y, int z, ForgeDirection direction) {
@@ -153,8 +153,8 @@ public class InventoryHelper {
public GenericInventory(String name, boolean isInvNameLocalized, int size) {
this.isInvNameLocalized = isInvNameLocalized;
this.slotsCount = size;
this.inventoryTitle = name;
slotsCount = size;
inventoryTitle = name;
inventoryContents = new ItemStack[size];
}
@@ -171,7 +171,7 @@ public class InventoryHelper {
inventoryContents[par1] = null;
return itemstack;
}
itemstack = inventoryContents[par1].splitStack(par2);
if(inventoryContents[par1].stackSize == 0)
inventoryContents[par1] = null;
@@ -207,15 +207,15 @@ public class InventoryHelper {
@Override
public ItemStack getStackInSlotOnClosing(int i) {
if(i >= inventoryContents.length)
if(i >= inventoryContents.length)
return null;
if(inventoryContents[i] != null) {
ItemStack itemstack = inventoryContents[i];
inventoryContents[i] = null;
return itemstack;
}
return null;
}
@@ -249,7 +249,7 @@ public class InventoryHelper {
public void readFromNBT(NBTTagCompound tag) {
if(tag.hasKey("size"))
slotsCount = tag.getInteger("size");
NBTTagList nbttaglist = tag.getTagList("Items");
inventoryContents = new ItemStack[slotsCount];
for(int i = 0; i < nbttaglist.tagCount(); i++) {
@@ -73,7 +73,7 @@ public class CommonProxy {
public void twigWandClientUpdate() {
// NO-OP
}
public long getWorldElapsedTicks() {
return MinecraftServer.getServer().worldServers[0].getTotalWorldTime();
}
@@ -89,7 +89,7 @@ public class CommonProxy {
public void setWispFXDistanceLimit(boolean limit) {
// NO-OP
}
public void wispFX(World world, double x, double y, double z, float r, float g, float b, float size) {
wispFX(world, x, y, z, r, g, b, size, 0F);
}
@@ -187,50 +187,50 @@ public final class ModCrafingRecipes {
'P', LibOreDict.PETAL[i],
'M', new ItemStack(Item.enderPearl));
recipesUnstableBlocks = BotaniaAPI.getLatestAddedRecipes(16);
// Mana Pylon Recipe
addOreDictRecipe(new ItemStack(ModBlocks.pylon),
addOreDictRecipe(new ItemStack(ModBlocks.pylon),
" G ", "MDM", " G ",
'G', "ingotGold",
'M', LibOreDict.MANA_STEEL,
'D', LibOreDict.MANA_DIAMOND);
recipePylon = BotaniaAPI.getLatestAddedRecipe();
// Mana Distributor
addOreDictRecipe(new ItemStack(ModBlocks.distributor),
addOreDictRecipe(new ItemStack(ModBlocks.distributor),
"RRR", "S S", "RRR",
'R', LibOreDict.LIVING_ROCK,
'S', LibOreDict.MANA_STEEL);
recipeDistributor = BotaniaAPI.getLatestAddedRecipe();
// Livingrock Decorative Blocks
addOreDictRecipe(new ItemStack(ModBlocks.livingrock, 4, 1),
"RR", "RR",
addOreDictRecipe(new ItemStack(ModBlocks.livingrock, 4, 1),
"RR", "RR",
'R', LibOreDict.LIVING_ROCK);
livingrockDecorRecipe1 = BotaniaAPI.getLatestAddedRecipe();
addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingrock, 1, 2), new ItemStack(ModBlocks.livingrock, 1, 1), new ItemStack(Item.seeds));
livingrockDecorRecipe2 = BotaniaAPI.getLatestAddedRecipe();
addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingrock, 2, 3), new ItemStack(ModBlocks.livingrock, 1, 1), "cobblestone");
livingrockDecorRecipe3 = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModBlocks.livingrock, 4, 4),
"RR", "RR",
addOreDictRecipe(new ItemStack(ModBlocks.livingrock, 4, 4),
"RR", "RR",
'R', new ItemStack(ModBlocks.livingrock, 1, 1));
livingrockDecorRecipe4 = BotaniaAPI.getLatestAddedRecipe();
// Livingwood Decorative Blocks
addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 1), LibOreDict.LIVING_WOOD);
livingwoodDecorRecipe1 = BotaniaAPI.getLatestAddedRecipe();
addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingwood, 1, 2), new ItemStack(ModBlocks.livingwood, 1, 1), new ItemStack(Item.seeds));
livingwoodDecorRecipe2 = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 3),
addOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 3),
"WW", "WW",
'W', new ItemStack(ModBlocks.livingwood, 1, 1));
livingwoodDecorRecipe3 = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 4),
addOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 4),
" W ", "W W", " W ",
'W', new ItemStack(ModBlocks.livingwood, 1, 1));
livingwoodDecorRecipe4 = BotaniaAPI.getLatestAddedRecipe();
// MANA BEACON RECIPES
for(int i = 0; i < 16; i++)
addOreDictRecipe(new ItemStack(ModBlocks.manaBeacon, 1, i),
@@ -238,7 +238,7 @@ public final class ModCrafingRecipes {
'B', new ItemStack(ModBlocks.unstableBlock, 1, i),
'P', LibOreDict.MANA_PEARL);
recipesManaBeacons = BotaniaAPI.getLatestAddedRecipes(16);
// SIGNAL FLARE RECIPES
for(int i = 0; i < 16; i++)
addOreDictRecipe(ItemSignalFlare.forColor(i),
@@ -11,11 +11,11 @@
*/
package vazkii.botania.common.entity;
import vazkii.botania.common.Botania;
import net.minecraft.entity.Entity;
import net.minecraft.entity.passive.EntitySheep;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import vazkii.botania.common.Botania;
public class EntitySignalFlare extends Entity {
@@ -42,14 +42,14 @@ public class EntitySignalFlare extends Entity {
if(!isDead) {
if(ticksExisted % 10 == 0)
playSound("random.fuse", 1F, 1F);
int color = getColor();
if(color < 16 && color >= 0) {
float[] colorArray = EntitySheep.fleeceColorTable[color];
Botania.proxy.setWispFXDistanceLimit(false);
for(int i = 0; i < 3; i++)
Botania.proxy.wispFX(worldObj, posX, posY, posZ + 0.5, colorArray[0], colorArray[1], colorArray[2], (float) Math.random() * 5 + 1F, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt((256F / (256F - (float) posY))), (float) (Math.random() - 0.5F));
Botania.proxy.wispFX(worldObj, posX, posY, posZ + 0.5, colorArray[0], colorArray[1], colorArray[2], (float) Math.random() * 5 + 1F, (float) (Math.random() - 0.5F), 10F * (float) Math.sqrt(256F / (256F - (float) posY)), (float) (Math.random() - 0.5F));
for(int i = 0; i < 4; i++)
Botania.proxy.wispFX(worldObj, posX + 0.5, 256, posZ + 0.5, colorArray[0], colorArray[1], colorArray[2], (float) Math.random() * 15 + 8F, (float) (Math.random() - 0.5F) * 8F, 0F, (float) (Math.random() - 0.5F) * 8F);
@@ -16,7 +16,6 @@ import java.util.ArrayList;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.texture.IconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
@@ -41,8 +40,6 @@ import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.core.helper.Vector3;
import vazkii.botania.common.lib.LibItemIDs;
import vazkii.botania.common.lib.LibItemNames;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ItemLens extends ItemMod implements ILens {
@@ -39,7 +39,7 @@ public class ItemSignalFlare extends ItemMod {
Icon[] icons;
private static final String TAG_COLOR = "color";
public ItemSignalFlare() {
super(LibItemIDs.idSignalFlare);
setMaxStackSize(1);
@@ -47,12 +47,12 @@ public class ItemSignalFlare extends ItemMod {
setMaxDamage(200);
setUnlocalizedName(LibItemNames.SIGNAL_FLARE);
}
@Override
public boolean isFull3D() {
return true;
}
@Override
public ItemStack onItemRightClick(ItemStack par1ItemStack, World par2World, EntityPlayer par3EntityPlayer) {
if(par1ItemStack.getItemDamage() == 0) {
@@ -65,7 +65,7 @@ public class ItemSignalFlare extends ItemMod {
par2World.playSoundAtEntity(par3EntityPlayer, "random.explode", 40F, (1.0F + (par2World.rand.nextFloat() - par2World.rand.nextFloat()) * 0.2F) * 0.7F);
par2World.spawnEntityInWorld(flare);
int range = 5;
List<EntityLivingBase> entities = par2World.getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(par3EntityPlayer.posX - range, par3EntityPlayer.posY - range, par3EntityPlayer.posZ - range, par3EntityPlayer.posX + range, par3EntityPlayer.posY + range, par3EntityPlayer.posZ + range));
for(EntityLivingBase entity : entities)
@@ -74,7 +74,7 @@ public class ItemSignalFlare extends ItemMod {
}
par1ItemStack.damageItem(200, par3EntityPlayer);
}
return par1ItemStack;
}
@@ -110,18 +110,18 @@ public class ItemSignalFlare extends ItemMod {
for(int i = 0; i < 16; i++)
par3List.add(forColor(i));
}
@Override
public boolean requiresMultipleRenderPasses() {
return true;
}
@Override
public void addInformation(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, List par3List, boolean par4) {
int storedColor = getColor(par1ItemStack);
par3List.add(String.format(StatCollector.translateToLocal("botaniamisc.flareColor"), StatCollector.translateToLocal("botania.color" + storedColor)));
}
public static ItemStack forColor(int color) {
ItemStack stack = new ItemStack(ModItems.signalFlare);
ItemNBTHelper.setInt(stack, TAG_COLOR, color);
@@ -48,7 +48,7 @@ public class ItemTwigWand extends Item16Colors {
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
int id = par3World.getBlockId(par4, par5, par6);
if(Block.blocksList[id] instanceof IWandable) {
boolean wanded = ((IWandable) Block.blocksList[id]).onUsedByWand(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6, par7);
boolean wanded = ((IWandable) Block.blocksList[id]).onUsedByWand(par2EntityPlayer, par1ItemStack, par3World, par4, par5, par6, par7);
if(wanded && par3World.isRemote)
par2EntityPlayer.swingItem();
return wanded;
@@ -60,7 +60,7 @@ public class ItemTwigWand extends Item16Colors {
BlockPistonRelay.InternalTickHandler.playerPositions.remove(par2EntityPlayer.username);
BlockPistonRelay.InternalTickHandler.mappedPositions.put(bindPos, currentPos);
BlockPistonRelay.WorldData.get(par3World).markDirty();
if(par3World.isRemote)
par2EntityPlayer.swingItem();
}
@@ -66,7 +66,7 @@ public final class LexiconData {
public static LexiconEntry generatingIntro;
public static LexiconEntry daybloom;
public static LexiconEntry endoflame;
public static LexiconEntry pistonRelay;
public static LexiconEntry pylon;
@@ -115,7 +115,7 @@ public final class LexiconData {
distributor = new BLexiconEntry(LibLexicon.MANA_DISTRIBUTOR, categoryMana);
distributor.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeDistributor));
lensVelocity = new BLexiconEntry(LibLexicon.MANA_LENS_VELOCITY, categoryMana);
lensVelocity.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipeLensVelocity));
@@ -146,7 +146,7 @@ public final class LexiconData {
jadedAmaranthus = new BLexiconEntry(LibLexicon.FFLOWER_JADED_AMARANTHUS, categoryFunctionalFlowers);
jadedAmaranthus.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.jadedAmaranthusRecipe));
bellethorne = new BLexiconEntry(LibLexicon.FFLOWER_BELLETHORNE, categoryFunctionalFlowers);
bellethorne.setLexiconPages(new PageText("0"), new PagePetalRecipe("1", ModPetalRecipes.bellethorneRecipe));
@@ -169,10 +169,10 @@ public final class LexiconData {
// DEVICES ENTRIES
pistonRelay = new BLexiconEntry(LibLexicon.DEVICE_PISTON_RELAY, categoryDevices);
pistonRelay.setLexiconPages(new PageText("0"), new PageText("1"), new PageManaInfusionRecipe("2", ModManaInfusionRecipes.pistonRelayRecipe));
pylon = new BLexiconEntry(LibLexicon.DEVICE_PYLON, categoryDevices);
pylon.setLexiconPages(new PageText("0"), new PageCraftingRecipe("1", ModCrafingRecipes.recipePylon));
// MISCLENAEOUS ENTRIES
unstableBlocks = new BLexiconEntry(LibLexicon.MISC_UNSTABLE_BLOCKS, categoryMisc);
unstableBlocks.setLexiconPages(new PageText("0"), new PageImage("1", LibResources.ENTRY_UNSTABLE_BLOCK), new PageCraftingRecipe("2", ModCrafingRecipes.recipesUnstableBlocks), new PageText("3"), new PageImage("4", LibResources.ENTRY_UNSTABLE_BEACON), new PageCraftingRecipe("5", ModCrafingRecipes.recipesManaBeacons), new PageText("6"), new PageCraftingRecipe("7", ModCrafingRecipes.recipesSignalFlares));
@@ -52,7 +52,7 @@ public final class LibLexicon {
public static final String GFLOWER_INTRO = "gIntro";
public static final String GFLOWER_DAYBLOOM = "daybloom";
public static final String GFLOWER_ENDOFLAME = "endoflame";
public static final String DEVICE_PISTON_RELAY = "pistonRelay";
public static final String DEVICE_PYLON = "pylon";