No spaces before paranthesis, bad IDEA.

This commit is contained in:
Vasco Lavos committed 2014-04-20 19:17:59 +01:00
1 parent 1076d99507
commit 9a937135d2
134 files changed
+1227 -1805

No files matched your search

+2 -3
View File
@@ -205,15 +205,14 @@ public final class BotaniaAPI {
public static List<IRecipe> getLatestAddedRecipes(int x) {
List<IRecipe> list = CraftingManager.getInstance().getRecipeList();
List<IRecipe> newList = new ArrayList();
for (int i = x - 1; i >= 0; i--)
for(int i = x - 1; i >= 0; i--)
newList.add(list.get(list.size() - 1 - i));
return newList;
}
public static Class<? extends SubTileEntity> getSubTileMapping(String key) {
if (!subTiles.containsKey(key))
key = "";
if(!subTiles.containsKey(key)) key = "";
return subTiles.get(key);
}
@@ -55,7 +55,7 @@ public class LexiconEntry implements Comparable<LexiconEntry> {
public LexiconEntry setLexiconPages(LexiconPage... pages) {
this.pages.addAll(Arrays.asList(pages));
for (int i = 0; i < this.pages.size(); i++)
for(int i = 0; i < this.pages.size(); i++)
this.pages.get(i).onPageAdded(this, i);
return this;
@@ -32,8 +32,7 @@ public final class LexiconRecipeMappings {
EntryData data = new EntryData(entry, page);
String str = stackToString(stack);
if (force || !mappings.containsKey(str))
mappings.put(str, data);
if(force || !mappings.containsKey(str)) mappings.put(str, data);
}
public static void map(ItemStack stack, LexiconEntry entry, int page) {
@@ -46,7 +45,7 @@ public final class LexiconRecipeMappings {
}
public static String stackToString(ItemStack stack) {
if (stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
if(stack.hasTagCompound() && stack.getItem() instanceof IRecipeKeyProvider)
return ((IRecipeKeyProvider) stack.getItem()).getKey(stack);
return stack.getUnlocalizedName() + "~" + stack.getItemDamage();
@@ -26,23 +26,20 @@ public final class ManaItemHandler {
* @return The amount of mana received from the request.
*/
public static int requestMana(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
if (stack == null)
return 0;
if(stack == null) return 0;
for (ItemStack stackInSlot : player.inventory.mainInventory) {
if (stackInSlot == stack)
continue;
for(ItemStack stackInSlot : player.inventory.mainInventory) {
if(stackInSlot == stack) continue;
if (stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
IManaItem manaItem = (IManaItem) stackInSlot.getItem();
if (manaItem.canExportManaToItem(stackInSlot, stack) && manaItem.getMana(stackInSlot) > 0) {
if (stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canReceiveManaFromItem(stack, stackInSlot))
if(manaItem.canExportManaToItem(stackInSlot, stack) && manaItem.getMana(stackInSlot) > 0) {
if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canReceiveManaFromItem(stack, stackInSlot))
continue;
int mana = Math.min(manaToGet, manaItem.getMana(stackInSlot));
if (remove)
manaItem.addMana(stackInSlot, -mana);
if(remove) manaItem.addMana(stackInSlot, -mana);
return mana;
}
@@ -62,21 +59,18 @@ public final class ManaItemHandler {
* @return If the request was succesful.
*/
public static boolean requestManaExact(ItemStack stack, EntityPlayer player, int manaToGet, boolean remove) {
if (stack == null)
return false;
if(stack == null) return false;
for (ItemStack stackInSlot : player.inventory.mainInventory) {
if (stackInSlot == stack)
continue;
for(ItemStack stackInSlot : player.inventory.mainInventory) {
if(stackInSlot == stack) continue;
if (stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
if(stackInSlot != null && stackInSlot.getItem() instanceof IManaItem) {
IManaItem manaItemSlot = (IManaItem) stackInSlot.getItem();
if (manaItemSlot.canExportManaToItem(stackInSlot, stack) && manaItemSlot.getMana(stackInSlot) > manaToGet) {
if (stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canReceiveManaFromItem(stack, stackInSlot))
if(manaItemSlot.canExportManaToItem(stackInSlot, stack) && manaItemSlot.getMana(stackInSlot) > manaToGet) {
if(stack.getItem() instanceof IManaItem && !((IManaItem) stack.getItem()).canReceiveManaFromItem(stack, stackInSlot))
continue;
if (remove)
manaItemSlot.addMana(stackInSlot, -manaToGet);
if(remove) manaItemSlot.addMana(stackInSlot, -manaToGet);
return true;
}
@@ -27,8 +27,7 @@ public class RecipeManaInfusion {
}
public boolean matches(ItemStack stack) {
if (input instanceof ItemStack)
return stack.isItemEqual((ItemStack) input);
if(input instanceof ItemStack) return stack.isItemEqual((ItemStack) input);
String oredict = OreDictionary.getOreName(OreDictionary.getOreID(stack));
return oredict.equals(input);
@@ -27,9 +27,8 @@ public class RecipePetals {
this.output = output;
List<Object> inputsToSet = new ArrayList();
for (Object obj : inputs) {
if (obj instanceof String || obj instanceof ItemStack)
inputsToSet.add(obj);
for(Object obj : inputs) {
if(obj instanceof String || obj instanceof ItemStack) inputsToSet.add(obj);
else throw new IllegalArgumentException("Invalid input");
}
@@ -39,30 +38,27 @@ public class RecipePetals {
public boolean matches(IInventory inv) {
List<Object> inputsMissing = new ArrayList(inputs);
for (int i = 0; i < inv.getSizeInventory(); i++) {
for(int i = 0; i < inv.getSizeInventory(); i++) {
ItemStack stack = inv.getStackInSlot(i);
if (stack == null)
break;
if(stack == null) break;
String oredict = OreDictionary.getOreName(OreDictionary.getOreID(stack));
int stackIndex = -1, oredictIndex = -1;
for (int j = 0; j < inputsMissing.size(); j++) {
for(int j = 0; j < inputsMissing.size(); j++) {
Object input = inputsMissing.get(j);
if (input instanceof String && input.equals(oredict)) {
if(input instanceof String && input.equals(oredict)) {
oredictIndex = j;
break;
} else if (input instanceof ItemStack && simpleAreStacksEqual((ItemStack) input, stack)) {
} else if(input instanceof ItemStack && simpleAreStacksEqual((ItemStack) input, stack)) {
stackIndex = j;
break;
}
}
if (stackIndex != -1)
inputsMissing.remove(stackIndex);
else if (oredictIndex != -1)
inputsMissing.remove(oredictIndex);
if(stackIndex != -1) inputsMissing.remove(stackIndex);
else if(oredictIndex != -1) inputsMissing.remove(oredictIndex);
else return false;
}
@@ -55,7 +55,7 @@ public class SubTileFunctional extends SubTileEntity {
linkPool();
if (linkedPool != null) {
if(linkedPool != null) {
IManaPool pool = (IManaPool) linkedPool;
int manaInPool = pool.getCurrentMana();
int manaMissing = getMaxMana() - mana;
@@ -64,10 +64,10 @@ public class SubTileFunctional extends SubTileEntity {
addMana(manaToRemove);
}
if (supertile.getWorldObj().isRemote) {
if(supertile.getWorldObj().isRemote) {
double particleChance = 1F - (double) mana / (double) getMaxMana() / 2F;
Color color = new Color(getColor());
if (Math.random() > particleChance)
if(Math.random() > particleChance)
BotaniaAPI.internalHandler.sparkleFX(supertile.getWorldObj(), supertile.xCoord + 0.3 + Math.random() * 0.5, supertile.yCoord + 0.5 + Math.random() * 0.5, supertile.zCoord + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5);
}
}
@@ -76,12 +76,12 @@ public class SubTileFunctional extends SubTileEntity {
final int range = 10;
boolean needsNew = false;
if (linkedPool == null) {
if(linkedPool == null) {
needsNew = true;
if (cachedPoolCoordinates != null) {
if(cachedPoolCoordinates != null) {
TileEntity tileAt = supertile.getWorldObj().getTileEntity(cachedPoolCoordinates.posX, cachedPoolCoordinates.posY, cachedPoolCoordinates.posZ);
if (tileAt != null && tileAt instanceof IManaPool) {
if(tileAt != null && tileAt instanceof IManaPool) {
linkedPool = tileAt;
needsNew = false;
}
@@ -89,18 +89,18 @@ public class SubTileFunctional extends SubTileEntity {
}
}
if (!needsNew) {
if(!needsNew) {
TileEntity tileAt = supertile.getWorldObj().getTileEntity(linkedPool.xCoord, linkedPool.yCoord, linkedPool.zCoord);
if (!(tileAt instanceof IManaPool)) {
if(!(tileAt instanceof IManaPool)) {
linkedPool = null;
needsNew = true;
} else linkedPool = tileAt;
}
if (needsNew) {
if(needsNew) {
IManaNetwork network = BotaniaAPI.internalHandler.getManaNetworkInstance();
int size = network.getAllPoolsInWorld(supertile.getWorldObj().provider.dimensionId).size();
if (size != sizeLastCheck) {
if(size != sizeLastCheck) {
ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord, supertile.yCoord, supertile.zCoord);
linkedPool = network.getClosestPool(coords, supertile.getWorldObj().provider.dimensionId, range);
sizeLastCheck = size;
@@ -154,8 +154,7 @@ public class SubTileFunctional extends SubTileEntity {
@Override
public ChunkCoordinates getBinding() {
if (linkedPool == null)
return null;
if(linkedPool == null) return null;
return new ChunkCoordinates(linkedPool.xCoord, linkedPool.yCoord, linkedPool.zCoord);
}
@@ -55,20 +55,19 @@ public class SubTileGenerating extends SubTileEntity {
linkCollector();
if (canGeneratePassively()) {
if(canGeneratePassively()) {
int delay = getDelayBetweenPassiveGeneration();
if (delay > 0 && supertile.getWorldObj().getWorldTime() % delay == 0) {
if (shouldSyncPassiveGeneration())
sync();
if(delay > 0 && supertile.getWorldObj().getWorldTime() % delay == 0) {
if(shouldSyncPassiveGeneration()) sync();
addMana(getValueForPassiveGeneration());
}
emptyManaIntoCollector();
}
if (supertile.getWorldObj().isRemote) {
if(supertile.getWorldObj().isRemote) {
double particleChance = 1F - (double) mana / (double) getMaxMana() / 2F;
Color color = new Color(getColor());
if (Math.random() > particleChance)
if(Math.random() > particleChance)
BotaniaAPI.internalHandler.sparkleFX(supertile.getWorldObj(), supertile.xCoord + 0.3 + Math.random() * 0.5, supertile.yCoord + 0.5 + Math.random() * 0.5, supertile.zCoord + 0.3 + Math.random() * 0.5, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random(), 5);
}
}
@@ -77,12 +76,12 @@ public class SubTileGenerating extends SubTileEntity {
final int range = 4;
boolean needsNew = false;
if (linkedCollector == null) {
if(linkedCollector == null) {
needsNew = true;
if (cachedCollectorCoordinates != null) {
if(cachedCollectorCoordinates != null) {
TileEntity tileAt = supertile.getWorldObj().getTileEntity(cachedCollectorCoordinates.posX, cachedCollectorCoordinates.posY, cachedCollectorCoordinates.posZ);
if (tileAt != null && tileAt instanceof IManaCollector) {
if(tileAt != null && tileAt instanceof IManaCollector) {
linkedCollector = tileAt;
needsNew = false;
}
@@ -90,18 +89,18 @@ public class SubTileGenerating extends SubTileEntity {
}
}
if (!needsNew) {
if(!needsNew) {
TileEntity tileAt = supertile.getWorldObj().getTileEntity(linkedCollector.xCoord, linkedCollector.yCoord, linkedCollector.zCoord);
if (!(tileAt instanceof IManaCollector)) {
if(!(tileAt instanceof IManaCollector)) {
linkedCollector = null;
needsNew = true;
} else linkedCollector = tileAt;
}
if (needsNew) {
if(needsNew) {
IManaNetwork network = BotaniaAPI.internalHandler.getManaNetworkInstance();
int size = network.getAllCollectorsInWorld(supertile.getWorldObj().provider.dimensionId).size();
if (size != sizeLastCheck) {
if(size != sizeLastCheck) {
ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord, supertile.yCoord, supertile.zCoord);
linkedCollector = network.getClosestCollector(coords, supertile.getWorldObj().provider.dimensionId, range);
sizeLastCheck = size;
@@ -114,9 +113,9 @@ public class SubTileGenerating extends SubTileEntity {
}
public void emptyManaIntoCollector() {
if (linkedCollector != null) {
if(linkedCollector != null) {
IManaCollector collector = (IManaCollector) linkedCollector;
if (!collector.isFull()) {
if(!collector.isFull()) {
collector.recieveMana(mana);
mana = 0;
}
@@ -142,8 +141,7 @@ public class SubTileGenerating extends SubTileEntity {
@Override
public boolean onWanded(EntityPlayer player, ItemStack wand) {
if (!player.worldObj.isRemote)
sync();
if(!player.worldObj.isRemote) sync();
knownMana = mana;
player.worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 1F);
@@ -185,8 +183,7 @@ public class SubTileGenerating extends SubTileEntity {
@Override
public ChunkCoordinates getBinding() {
if (linkedCollector == null)
return null;
if(linkedCollector == null) return null;
return new ChunkCoordinates(linkedCollector.xCoord, linkedCollector.yCoord, linkedCollector.zCoord);
}
@@ -45,13 +45,13 @@ public final class BoundTileRenderer {
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
World world = player.worldObj;
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.getItem() instanceof ItemTwigWand) {
if(stack != null && stack.getItem() instanceof ItemTwigWand) {
MovingObjectPosition pos = Minecraft.getMinecraft().objectMouseOver;
if (pos != null) {
if(pos != null) {
TileEntity tile = world.getTileEntity(pos.blockX, pos.blockY, pos.blockZ);
if (tile != null && tile instanceof ITileBound) {
if(tile != null && tile instanceof ITileBound) {
ChunkCoordinates coords = ((ITileBound) tile).getBinding();
if (coords != null)
if(coords != null)
renderBlockOutlineAt(coords, Color.HSBtoRGB(world.getTotalWorldTime() % 200 / 200F, 0.6F, 1F));
}
}
@@ -73,15 +73,14 @@ public final class BoundTileRenderer {
Block block = world.getBlock(pos.posX, pos.posY, pos.posZ);
drawWireframe:
{
if (block != null) {
if(block != null) {
AxisAlignedBB axis;
if (block instanceof IWireframeAABBProvider)
if(block instanceof IWireframeAABBProvider)
axis = ((IWireframeAABBProvider) block).getWireframeAABB(world, pos.posX, pos.posY, pos.posZ);
else axis = block.getSelectedBoundingBoxFromPool(world, pos.posX, pos.posY, pos.posZ);
if (axis == null)
break drawWireframe;
if(axis == null) break drawWireframe;
axis.minX -= pos.posX;
axis.maxX -= pos.posX;
@@ -38,13 +38,12 @@ public class CapeHandler {
@SubscribeEvent
public void onPreRenderSpecials(RenderPlayerEvent.Specials.Pre event) {
if (Loader.isModLoaded("shadersmod"))
return;
if(Loader.isModLoaded("shadersmod")) return;
if (event.entityPlayer instanceof AbstractClientPlayer && (event.entityPlayer.getCommandSenderName().equals("Vazkii"))) {
if(event.entityPlayer instanceof AbstractClientPlayer && (event.entityPlayer.getCommandSenderName().equals("Vazkii"))) {
AbstractClientPlayer abstractClientPlayer = (AbstractClientPlayer) event.entityPlayer;
if (!capePlayers.contains(abstractClientPlayer)) {
if(!capePlayers.contains(abstractClientPlayer)) {
ReflectionHelper.setPrivateValue(ThreadDownloadImageData.class, abstractClientPlayer.getTextureCape(), false, LibObfuscation.TEXTURE_UPLOADED);
new Thread(new CloakThread(abstractClientPlayer)).start();
event.renderCape = true;
@@ -65,7 +64,7 @@ public class CapeHandler {
try {
BufferedImage bo = ImageIO.read(Botania.class.getResourceAsStream(LibResources.MODEL_CAPE));
ReflectionHelper.setPrivateValue(ThreadDownloadImageData.class, abstractClientPlayer.getTextureCape(), bo, LibObfuscation.BUFFERED_IMAGE);
} catch (IOException e) {
} catch(IOException e) {
e.printStackTrace();
}
}
@@ -37,42 +37,36 @@ public class ClientTickHandler {
@SubscribeEvent
public void tickEnd(ClientTickEvent event) {
if (event.phase == Phase.END && event.type == Type.CLIENT) {
if(event.phase == Phase.END && event.type == Type.CLIENT) {
LightningBolt.update();
if (Minecraft.getMinecraft().theWorld == null)
ManaNetworkHandler.instance.clear();
if(Minecraft.getMinecraft().theWorld == null) ManaNetworkHandler.instance.clear();
GuiScreen gui = Minecraft.getMinecraft().currentScreen;
if (gui == null || !gui.doesGuiPauseGame()) {
if(gui == null || !gui.doesGuiPauseGame()) {
ticksInGame++;
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
if (player != null) {
if(player != null) {
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.getItem() instanceof ItemTwigWand) {
if(stack != null && stack.getItem() instanceof ItemTwigWand) {
List<TileEntity> list = new ArrayList(ManaNetworkHandler.instance.getAllCollectorsInWorld(Minecraft.getMinecraft().theWorld.provider.dimensionId));
for (TileEntity tile : list) {
if (tile instanceof IManaCollector)
((IManaCollector) tile).onClientDisplayTick();
for(TileEntity tile : list) {
if(tile instanceof IManaCollector) ((IManaCollector) tile).onClientDisplayTick();
}
}
}
}
int ticksToOpen = 10;
if (gui instanceof GuiLexicon) {
if (ticksWithLexicaOpen < 0)
ticksWithLexicaOpen = 0;
if (ticksWithLexicaOpen < ticksToOpen)
ticksWithLexicaOpen++;
if (pageFlipTicks > 0)
pageFlipTicks--;
if(gui instanceof GuiLexicon) {
if(ticksWithLexicaOpen < 0) ticksWithLexicaOpen = 0;
if(ticksWithLexicaOpen < ticksToOpen) ticksWithLexicaOpen++;
if(pageFlipTicks > 0) pageFlipTicks--;
} else {
pageFlipTicks = 0;
if (ticksWithLexicaOpen > 0) {
if (ticksWithLexicaOpen > ticksToOpen)
ticksWithLexicaOpen = ticksToOpen;
if(ticksWithLexicaOpen > 0) {
if(ticksWithLexicaOpen > ticksToOpen) ticksWithLexicaOpen = ticksToOpen;
ticksWithLexicaOpen--;
}
}
@@ -80,8 +74,7 @@ public class ClientTickHandler {
}
public static void notifyPageChange() {
if (pageFlipTicks == 0)
pageFlipTicks = 5;
if(pageFlipTicks == 0) pageFlipTicks = 5;
}
}
@@ -39,19 +39,18 @@ public final class HUDHandler {
@SubscribeEvent
public void onDrawScreen(RenderGameOverlayEvent.Post event) {
if (event.type == ElementType.ALL) {
if(event.type == ElementType.ALL) {
Minecraft mc = Minecraft.getMinecraft();
MovingObjectPosition pos = mc.objectMouseOver;
if (pos != null && mc.thePlayer.getCurrentEquippedItem() != null && mc.thePlayer.getCurrentEquippedItem().getItem() == ModItems.twigWand) {
if(pos != null && mc.thePlayer.getCurrentEquippedItem() != null && mc.thePlayer.getCurrentEquippedItem().getItem() == ModItems.twigWand) {
Block block = mc.theWorld.getBlock(pos.blockX, pos.blockY, pos.blockZ);
if (block instanceof IWandHUD)
if(block instanceof IWandHUD)
((IWandHUD) block).renderHUD(mc, event.resolution, mc.theWorld, pos.blockX, pos.blockY, pos.blockZ);
} else if (pos != null && mc.thePlayer.getCurrentEquippedItem() != null && mc.thePlayer.getCurrentEquippedItem().getItem() == ModItems.lexicon) {
} else if(pos != null && mc.thePlayer.getCurrentEquippedItem() != null && mc.thePlayer.getCurrentEquippedItem().getItem() == ModItems.lexicon) {
Block block = mc.theWorld.getBlock(pos.blockX, pos.blockY, pos.blockZ);
if (block instanceof ILexiconable) {
if(block instanceof ILexiconable) {
LexiconEntry entry = ((ILexiconable) block).getEntry(mc.theWorld, pos.blockX, pos.blockY, pos.blockZ, mc.thePlayer, mc.thePlayer.getCurrentEquippedItem());
if (entry != null)
drawLexiconGUI(entry, event.resolution);
if(entry != null) drawLexiconGUI(entry, event.resolution);
}
}
}
@@ -90,7 +89,7 @@ public final class HUDHandler {
renderManaBar(x, y, color, 0.5F, mana, maxMana);
if (mana < 0) {
if(mana < 0) {
String text = StatCollector.translateToLocal("botaniamisc.statusUnknown");
x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(text) / 2;
y -= 1;
@@ -109,8 +108,7 @@ public final class HUDHandler {
int manaPercentage = Math.max(0, (int) ((double) mana / (double) maxMana * 100));
if (manaPercentage == 0 && mana > 0)
manaPercentage = 1;
if(manaPercentage == 0 && mana > 0) manaPercentage = 1;
RenderHelper.drawTexturedModalRect(x + 1 + manaPercentage, y + 1, 0, 0, 5, 100 - manaPercentage, 3);
@@ -69,14 +69,14 @@ public class LightningHandler {
render.bindTexture(outsideResource);
tessellator.startDrawingQuads();
tessellator.setBrightness(0xF000F0);
for (LightningBolt bolt : LightningBolt.boltlist)
for(LightningBolt bolt : LightningBolt.boltlist)
renderBolt(bolt, tessellator, frame, ActiveRenderInfo.rotationX, ActiveRenderInfo.rotationXZ, ActiveRenderInfo.rotationZ, ActiveRenderInfo.rotationXY, 0, false);
tessellator.draw();
render.bindTexture(insideResource);
tessellator.startDrawingQuads();
tessellator.setBrightness(0xF000F0);
for (LightningBolt bolt : LightningBolt.boltlist)
for(LightningBolt bolt : LightningBolt.boltlist)
renderBolt(bolt, tessellator, frame, ActiveRenderInfo.rotationX, ActiveRenderInfo.rotationXZ, ActiveRenderInfo.rotationZ, ActiveRenderInfo.rotationXY, 1, true);
tessellator.draw();
@@ -96,8 +96,7 @@ public class LightningHandler {
private void renderBolt(LightningBolt bolt, Tessellator tessellator, float partialframe, float cosyaw, float cospitch, float sinyaw, float cossinpitch, int pass, boolean inner) {
float boltage = bolt.particleAge < 0 ? 0 : (float) bolt.particleAge / (float) bolt.particleMaxAge;
float mainalpha = 1;
if (pass == 0)
mainalpha = (1 - boltage) * 0.4F;
if(pass == 0) mainalpha = (1 - boltage) * 0.4F;
else mainalpha = 1 - boltage * 0.5F;
int expandTime = (int) (bolt.length * bolt.speed);
@@ -105,9 +104,8 @@ public class LightningHandler {
int renderstart = (int) ((expandTime / 2 - bolt.particleMaxAge + bolt.particleAge) / (float) (expandTime / 2) * bolt.numsegments0);
int renderend = (int) ((bolt.particleAge + expandTime) / (float) expandTime * bolt.numsegments0);
for (Segment rendersegment : bolt.segments) {
if (rendersegment.segmentno < renderstart || rendersegment.segmentno > renderend)
continue;
for(Segment rendersegment : bolt.segments) {
if(rendersegment.segmentno < renderstart || rendersegment.segmentno > renderend) continue;
Vector3 playervec = getRelativeViewVector(rendersegment.startpoint.point).multiply(-1);
@@ -126,7 +124,7 @@ public class LightningHandler {
tessellator.addVertexWithUV(startvec.x + diff1.x, startvec.y + diff1.y, startvec.z + diff1.z, 0.5, 1);
tessellator.addVertexWithUV(endvec.x + diff2.x, endvec.y + diff2.y, endvec.z + diff2.z, 0.5, 1);
if (rendersegment.next == null) {
if(rendersegment.next == null) {
Vector3 roundend = rendersegment.endpoint.point.copy().add(rendersegment.diff.copy().normalize().multiply(width));
tessellator.addVertexWithUV(roundend.x - diff2.x, roundend.y - diff2.y, roundend.z - diff2.z, 0, 0);
@@ -135,7 +133,7 @@ public class LightningHandler {
tessellator.addVertexWithUV(roundend.x + diff2.x, roundend.y + diff2.y, roundend.z + diff2.z, 0, 1);
}
if (rendersegment.prev == null) {
if(rendersegment.prev == null) {
Vector3 roundend = rendersegment.startpoint.point.copy().subtract(rendersegment.diff.copy().normalize().multiply(width));
tessellator.addVertexWithUV(startvec.x - diff1.x, startvec.y - diff1.y, startvec.z - diff1.z, 0.5, 0);
@@ -198,8 +196,7 @@ public class LightningHandler {
@Override
public int compare(Segment o1, Segment o2) {
int comp = Integer.valueOf(o1.splitno).compareTo(o2.splitno);
if (comp == 0)
return Integer.valueOf(o1.segmentno).compareTo(o2.segmentno);
if(comp == 0) return Integer.valueOf(o1.segmentno).compareTo(o2.segmentno);
else return comp;
}
}
@@ -231,7 +228,7 @@ public class LightningHandler {
}
public void calcEndDiffs() {
if (prev != null) {
if(prev != null) {
Vector3 prevdiffnorm = prev.diff.copy().normalize();
Vector3 thisdiffnorm = diff.copy().normalize();
@@ -242,7 +239,7 @@ public class LightningHandler {
sinprev = 1;
}
if (next != null) {
if(next != null) {
Vector3 nextdiffnorm = next.diff.copy().normalize();
Vector3 thisdiffnorm = diff.copy().normalize();
@@ -317,15 +314,14 @@ public class LightningHandler {
}
public void fractal(int splits, double amount, double splitchance, double splitlength, double splitangle) {
if (finalized)
return;
if(finalized) return;
ArrayList<Segment> oldsegments = segments;
segments = new ArrayList<Segment>();
Segment prev = null;
for (Segment segment : oldsegments) {
for(Segment segment : oldsegments) {
prev = segment.prev;
Vector3 subsegment = segment.diff.copy().multiply(1F / splits);
@@ -336,7 +332,7 @@ public class LightningHandler {
newpoints[0] = segment.startpoint;
newpoints[splits] = segment.endpoint;
for (int i = 1; i < splits; i++) {
for(int i = 1; i < splits; i++) {
Vector3 randoff = segment.diff.copy().perpendicular().normalize().rotate(rand.nextFloat() * 360, segment.diff);
randoff.multiply((rand.nextFloat() - 0.5F) * amount * 2);
@@ -345,13 +341,12 @@ public class LightningHandler {
newpoints[i] = new BoltPoint(basepoint, randoff);
}
for (int i = 0; i < splits; i++) {
for(int i = 0; i < splits; i++) {
Segment next = new Segment(newpoints[i], newpoints[i + 1], segment.light, segment.segmentno * splits + i, segment.splitno);
next.prev = prev;
if (prev != null)
prev.next = next;
if(prev != null) prev.next = next;
if (i != 0 && rand.nextFloat() < splitchance) {
if(i != 0 && rand.nextFloat() < splitchance) {
Vector3 splitrot = next.diff.copy().xCrossProduct().rotate(rand.nextFloat() * 360, next.diff);
Vector3 diff = next.diff.copy().rotate((rand.nextFloat() * 0.66F + 0.33F) * splitangle, splitrot).multiply(splitlength);
@@ -368,8 +363,7 @@ public class LightningHandler {
segments.add(next);
}
if (segment.next != null)
segment.next.prev = prev;
if(segment.next != null) segment.next.prev = prev;
}
numsegments0 *= splits;
@@ -388,14 +382,12 @@ public class LightningHandler {
private float rayTraceResistance(Vector3 start, Vector3 end, float prevresistance) {
MovingObjectPosition mop = world.rayTraceBlocks(start.toVec3D(), end.toVec3D());
if (mop == null)
return prevresistance;
if(mop == null) return prevresistance;
if (mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
if(mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
Block block = world.getBlock(mop.blockX, mop.blockY, mop.blockZ);
if (world.isAirBlock(mop.blockX, mop.blockY, mop.blockZ))
return prevresistance;
if(world.isAirBlock(mop.blockX, mop.blockY, mop.blockZ)) return prevresistance;
return prevresistance + block.getExplosionResistance(source) + 0.3F;
} else return prevresistance;
@@ -410,16 +402,15 @@ public class LightningHandler {
int lastactiveseg = 0;// unterminated
float splitresistance = 0;
for (Segment segment : segments) {
if (segment.splitno > lastsplitcalc) {
for(Segment segment : segments) {
if(segment.splitno > lastsplitcalc) {
lastactivesegment.put(lastsplitcalc, lastactiveseg);
lastsplitcalc = segment.splitno;
lastactiveseg = lastactivesegment.get(splitparents.get(segment.splitno));
splitresistance = lastactiveseg < segment.segmentno ? 50 : 0;
}
if (splitresistance >= 40 * segment.light)
continue;
if(splitresistance >= 40 * segment.light) continue;
splitresistance = rayTraceResistance(segment.startpoint.point, segment.endpoint.point, splitresistance);
lastactiveseg = segment.segmentno;
@@ -428,22 +419,20 @@ public class LightningHandler {
lastsplitcalc = 0;
lastactiveseg = lastactivesegment.get(0);
for (Iterator<Segment> iterator = segments.iterator(); iterator.hasNext(); ) {
for(Iterator<Segment> iterator = segments.iterator(); iterator.hasNext(); ) {
Segment segment = iterator.next();
if (lastsplitcalc != segment.splitno) {
if(lastsplitcalc != segment.splitno) {
lastsplitcalc = segment.splitno;
lastactiveseg = lastactivesegment.get(segment.splitno);
}
if (segment.segmentno > lastactiveseg)
iterator.remove();
if(segment.segmentno > lastactiveseg) iterator.remove();
segment.calcEndDiffs();
}
}
public void finalizeBolt() {
if (finalized)
return;
if(finalized) return;
finalized = true;
calculateCollisionAndDiffs();
@@ -456,18 +445,16 @@ public class LightningHandler {
public void onUpdate() {
particleAge++;
if (particleAge >= particleMaxAge)
isDead = true;
if(particleAge >= particleMaxAge) isDead = true;
}
// Called in ClientTickHandler
public static void update() {
for (Iterator<LightningBolt> iterator = boltlist.iterator(); iterator.hasNext(); ) {
for(Iterator<LightningBolt> iterator = boltlist.iterator(); iterator.hasNext(); ) {
LightningBolt bolt = iterator.next();
bolt.onUpdate();
if (bolt.isDead)
iterator.remove();
if(bolt.isDead) iterator.remove();
}
}
}
@@ -17,7 +17,7 @@ import vazkii.botania.client.lib.LibResources;
public final class LocalizationHandler {
public static void loadLocalizations() {
for (String locale : LibResources.LANGS)
for(String locale : LibResources.LANGS)
LanguageRegistry.instance().loadLocalization(LibResources.PREFIX_LANG + locale + ".lang", locale, false);
}
@@ -26,14 +26,12 @@ public final class FontHelper {
int i = -1;
int j = par0Str.length();
while ((i = par0Str.indexOf(167, i + 1)) != -1) {
if (i < j - 1) {
while((i = par0Str.indexOf(167, i + 1)) != -1) {
if(i < j - 1) {
char c0 = par0Str.charAt(i + 1);
if (isFormatColor(c0))
s1 = "\u00a7" + c0;
else if (isFormatSpecial(c0))
s1 = s1 + "\u00a7" + c0;
if(isFormatColor(c0)) s1 = "\u00a7" + c0;
else if(isFormatSpecial(c0)) s1 = s1 + "\u00a7" + c0;
}
}
@@ -44,24 +44,21 @@ public final class RenderHelper {
public static void renderTooltip(int x, int y, List<String> tooltipData, int color, int color2) {
boolean lighting = GL11.glGetBoolean(GL11.GL_LIGHTING);
if (lighting)
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
if(lighting) net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
if (!tooltipData.isEmpty()) {
if(!tooltipData.isEmpty()) {
int var5 = 0;
int var6;
int var7;
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
for (var6 = 0; var6 < tooltipData.size(); ++var6) {
for(var6 = 0; var6 < tooltipData.size(); ++var6) {
var7 = fontRenderer.getStringWidth(tooltipData.get(var6));
if (var7 > var5)
var5 = var7;
if(var7 > var5) var5 = var7;
}
var6 = x + 12;
var7 = y - 12;
int var9 = 8;
if (tooltipData.size() > 1)
var9 += 2 + (tooltipData.size() - 1) * 10;
if(tooltipData.size() > 1) var9 += 2 + (tooltipData.size() - 1) * 10;
float z = 300F;
drawGradientRect(var6 - 3, var7 - 4, z, var6 + var5 + 3, var7 - 3, color2, color2);
drawGradientRect(var6 - 3, var7 + var9 + 3, z, var6 + var5 + 3, var7 + var9 + 4, color2, color2);
@@ -75,17 +72,15 @@ public final class RenderHelper {
drawGradientRect(var6 - 3, var7 + var9 + 2, z, var6 + var5 + 3, var7 + var9 + 3, var12, var12);
GL11.glDisable(GL11.GL_DEPTH_TEST);
for (int var13 = 0; var13 < tooltipData.size(); ++var13) {
for(int var13 = 0; var13 < tooltipData.size(); ++var13) {
String var14 = tooltipData.get(var13);
fontRenderer.drawStringWithShadow(var14, var6, var7, -1);
if (var13 == 0)
var7 += 2;
if(var13 == 0) var7 += 2;
var7 += 10;
}
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
if (!lighting)
net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
if(!lighting) net.minecraft.client.renderer.RenderHelper.disableStandardItemLighting();
GL11.glColor4f(1F, 1F, 1F, 1F);
}
@@ -134,13 +129,11 @@ public final class RenderHelper {
Tessellator tessellator = Tessellator.instance;
int ticks = (int) (Minecraft.getMinecraft().theWorld.getTotalWorldTime() % 200);
if (ticks >= 100)
ticks = 200 - ticks - 1;
if(ticks >= 100) ticks = 200 - ticks - 1;
float f1 = ticks / 200F;
float f2 = 0F;
if (f1 > 0.7F)
f2 = (f1 - 0.7F) / 0.2F;
if(f1 > 0.7F) f2 = (f1 - 0.7F) / 0.2F;
Random random = new Random(seed);
GL11.glPushMatrix();
@@ -154,7 +147,7 @@ public final class RenderHelper {
GL11.glTranslatef(0F, -1F, -2F);
GL11.glScalef(xScale, yScale, zScale);
for (int i = 0; i < (f1 + f1 * f1) / 2F * 90F + 30F; i++) {
for(int i = 0; i < (f1 + f1 * f1) / 2F * 90F + 30F; i++) {
GL11.glRotatef(random.nextFloat() * 360F, 1F, 0F, 0F);
GL11.glRotatef(random.nextFloat() * 360F, 0F, 1F, 0F);
GL11.glRotatef(random.nextFloat() * 360F, 0F, 0F, 1F);
@@ -36,8 +36,7 @@ public final class ShaderHelper {
public static int manaPool = 0;
public static void initShaders() {
if (!useShaders())
return;
if(!useShaders()) return;
pylonGlow = createProgram(null, LibResources.SHADER_PYLON_GLOW_FRAG);
enchanterRune = createProgram(null, LibResources.SHADER_ENCHANTER_RUNE_FRAG);
@@ -45,12 +44,11 @@ public final class ShaderHelper {
}
public static void useShader(int shader) {
if (!useShaders())
return;
if(!useShaders()) return;
ARBShaderObjects.glUseProgramObjectARB(shader);
if (shader != 0) {
if(shader != 0) {
int time = ARBShaderObjects.glGetUniformLocationARB(shader, "time");
ARBShaderObjects.glUniform1iARB(time, ClientTickHandler.ticksInGame);
}
@@ -69,28 +67,23 @@ public final class ShaderHelper {
private static int createProgram(String vert, String frag) {
int vertId = 0, fragId = 0, program = 0;
if (vert != null)
vertId = createShader(vert, VERT);
if (frag != null)
fragId = createShader(frag, FRAG);
if(vert != null) vertId = createShader(vert, VERT);
if(frag != null) fragId = createShader(frag, FRAG);
program = ARBShaderObjects.glCreateProgramObjectARB();
if (program == 0)
return 0;
if(program == 0) return 0;
if (vert != null)
ARBShaderObjects.glAttachObjectARB(program, vertId);
if (frag != null)
ARBShaderObjects.glAttachObjectARB(program, fragId);
if(vert != null) ARBShaderObjects.glAttachObjectARB(program, vertId);
if(frag != null) ARBShaderObjects.glAttachObjectARB(program, fragId);
ARBShaderObjects.glLinkProgramARB(program);
if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) {
if(ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_LINK_STATUS_ARB) == GL11.GL_FALSE) {
FMLLog.log(Level.ERROR, getLogInfo(program));
return 0;
}
ARBShaderObjects.glValidateProgramARB(program);
if (ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) {
if(ARBShaderObjects.glGetObjectParameteriARB(program, ARBShaderObjects.GL_OBJECT_VALIDATE_STATUS_ARB) == GL11.GL_FALSE) {
FMLLog.log(Level.ERROR, getLogInfo(program));
return 0;
}
@@ -103,17 +96,16 @@ public final class ShaderHelper {
try {
shader = ARBShaderObjects.glCreateShaderObjectARB(shaderType);
if (shader == 0)
return 0;
if(shader == 0) return 0;
ARBShaderObjects.glShaderSourceARB(shader, readFileAsString(filename));
ARBShaderObjects.glCompileShaderARB(shader);
if (ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE)
if(ARBShaderObjects.glGetObjectParameteriARB(shader, ARBShaderObjects.GL_OBJECT_COMPILE_STATUS_ARB) == GL11.GL_FALSE)
throw new RuntimeException("Error creating shader: " + getLogInfo(shader));
return shader;
} catch (Exception e) {
} catch(Exception e) {
ARBShaderObjects.glDeleteObjectARB(shader);
e.printStackTrace();
return -1;
@@ -130,8 +122,7 @@ public final class ShaderHelper {
Exception exception = null;
BufferedReader reader;
if (in == null)
return "";
if(in == null) return "";
try {
reader = new BufferedReader(new InputStreamReader(in, "UTF-8"));
@@ -139,35 +130,30 @@ public final class ShaderHelper {
Exception innerExc = null;
try {
String line;
while ((line = reader.readLine()) != null)
source.append(line).append('\n');
} catch (Exception exc) {
while((line = reader.readLine()) != null) source.append(line).append('\n');
} catch(Exception exc) {
exception = exc;
} finally {
try {
reader.close();
} catch (Exception exc) {
if (innerExc == null)
innerExc = exc;
} catch(Exception exc) {
if(innerExc == null) innerExc = exc;
else exc.printStackTrace();
}
}
if (innerExc != null)
throw innerExc;
} catch (Exception exc) {
if(innerExc != null) throw innerExc;
} catch(Exception exc) {
exception = exc;
} finally {
try {
in.close();
} catch (Exception exc) {
if (exception == null)
exception = exc;
} catch(Exception exc) {
if(exception == null) exception = exc;
else exc.printStackTrace();
}
if (exception != null)
throw exception;
if(exception != null) throw exception;
}
return source.toString();
@@ -48,8 +48,7 @@ public class ClientProxy extends CommonProxy {
MinecraftForge.EVENT_BUS.register(new HUDHandler());
MinecraftForge.EVENT_BUS.register(new LightningHandler());
MinecraftForge.EVENT_BUS.register(new CapeHandler());
if (ConfigHandler.boundBlockWireframe)
MinecraftForge.EVENT_BUS.register(new BoundTileRenderer());
if(ConfigHandler.boundBlockWireframe) MinecraftForge.EVENT_BUS.register(new BoundTileRenderer());
initRenderers();
}
@@ -68,7 +67,7 @@ public class ClientProxy extends CommonProxy {
RenderingRegistry.registerBlockHandler(new RenderPylon());
MinecraftForgeClient.registerItemRenderer(ModItems.lens, new RenderLens());
if (ConfigHandler.lexicon3dModel)
if(ConfigHandler.lexicon3dModel)
MinecraftForgeClient.registerItemRenderer(ModItems.lexicon, new RenderLexicon());
ClientRegistry.bindTileEntitySpecialRenderer(TileAltar.class, new RenderTileAltar());
+19 -22
View File
@@ -62,7 +62,7 @@ public class FXSparkle extends EntityFX {
float var10 = part / 8 / 8.0F;
float var11 = var10 + 0.0624375F * 2;
float var12 = 0.1F * particleScale;
if (shrink) var12 *= (particleMaxAge - particleAge + 1) / (float) particleMaxAge;
if(shrink) var12 *= (particleMaxAge - particleAge + 1) / (float) particleMaxAge;
float var13 = (float) (prevPosX + (posX - prevPosX) * f - interpPosX);
float var14 = (float) (prevPosY + (posY - prevPosY) * f - interpPosY);
float var15 = (float) (prevPosZ + (posZ - prevPosZ) * f - interpPosZ);
@@ -93,31 +93,28 @@ public class FXSparkle extends EntityFX {
prevPosY = posY;
prevPosZ = posZ;
if (particleAge++ >= particleMaxAge)
setDead();
if(particleAge++ >= particleMaxAge) setDead();
motionY -= 0.04D * particleGravity;
if (!noClip && !fake)
pushOutOfBlocks(posX, (boundingBox.minY + boundingBox.maxY) / 2.0D, posZ);
if(!noClip && !fake) pushOutOfBlocks(posX, (boundingBox.minY + boundingBox.maxY) / 2.0D, posZ);
posX += motionX;
posY += motionY;
posZ += motionZ;
if (slowdown) {
if(slowdown) {
motionX *= 0.908000001907348633D;
motionY *= 0.908000001907348633D;
motionZ *= 0.908000001907348633D;
if (onGround) {
if(onGround) {
motionX *= 0.69999998807907104D;
motionZ *= 0.69999998807907104D;
}
}
if (fake && particleAge > 1)
setDead();
if(fake && particleAge > 1) setDead();
}
public void setGravity(float value) {
@@ -132,7 +129,7 @@ public class FXSparkle extends EntityFX {
double var12 = par3 - var8;
double var14 = par5 - var9;
if (!worldObj.isAirBlock(var7, var8, var9)) {
if(!worldObj.isAirBlock(var7, var8, var9)) {
boolean var16 = !worldObj.isBlockNormalCubeDefault(var7 - 1, var8, var9, false);
boolean var17 = !worldObj.isBlockNormalCubeDefault(var7 + 1, var8, var9, false);
boolean var18 = !worldObj.isBlockNormalCubeDefault(var7, var8 - 1, var9, false);
@@ -142,32 +139,32 @@ public class FXSparkle extends EntityFX {
byte var22 = -1;
double var23 = 9999.0D;
if (var16 && var10 < var23) {
if(var16 && var10 < var23) {
var23 = var10;
var22 = 0;
}
if (var17 && 1.0D - var10 < var23) {
if(var17 && 1.0D - var10 < var23) {
var23 = 1.0D - var10;
var22 = 1;
}
if (var18 && var12 < var23) {
if(var18 && var12 < var23) {
var23 = var12;
var22 = 2;
}
if (var19 && 1.0D - var12 < var23) {
if(var19 && 1.0D - var12 < var23) {
var23 = 1.0D - var12;
var22 = 3;
}
if (var20 && var14 < var23) {
if(var20 && var14 < var23) {
var23 = var14;
var22 = 4;
}
if (var21 && 1.0D - var14 < var23) {
if(var21 && 1.0D - var14 < var23) {
var23 = 1.0D - var14;
var22 = 5;
}
@@ -175,32 +172,32 @@ public class FXSparkle extends EntityFX {
float var25 = rand.nextFloat() * 0.05F + 0.025F;
float var26 = (rand.nextFloat() - rand.nextFloat()) * 0.1F;
if (var22 == 0) {
if(var22 == 0) {
motionX = -var25;
motionY = motionZ = var26;
}
if (var22 == 1) {
if(var22 == 1) {
motionX = var25;
motionY = motionZ = var26;
}
if (var22 == 2) {
if(var22 == 2) {
motionY = -var25;
motionX = motionZ = var26;
}
if (var22 == 3) {
if(var22 == 3) {
motionY = var25;
motionX = motionZ = var26;
}
if (var22 == 4) {
if(var22 == 4) {
motionZ = -var25;
motionY = motionX = var26;
}
if (var22 == 5) {
if(var22 == 5) {
motionZ = var25;
motionY = motionX = var26;
}
+5 -9
View File
@@ -42,13 +42,11 @@ public class FXWisp extends EntityFX {
setSize(0.01F, 0.01F);
EntityLivingBase renderentity = FMLClientHandler.instance().getClient().renderViewEntity;
if (distanceLimit) {
if(distanceLimit) {
int visibleDistance = 50;
if (!FMLClientHandler.instance().getClient().gameSettings.fancyGraphics)
visibleDistance = 25;
if(!FMLClientHandler.instance().getClient().gameSettings.fancyGraphics) visibleDistance = 25;
if (renderentity == null || renderentity.getDistance(posX, posY, posZ) > visibleDistance)
particleMaxAge = 0;
if(renderentity == null || renderentity.getDistance(posX, posY, posZ) > visibleDistance) particleMaxAge = 0;
}
prevPosX = posX;
@@ -60,8 +58,7 @@ public class FXWisp extends EntityFX {
public void renderParticle(Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5) {
float agescale = 0;
agescale = (float) particleAge / (float) moteHalfLife;
if (agescale > 1F)
agescale = 2 - agescale;
if(agescale > 1F) agescale = 2 - agescale;
particleScale = moteParticleScale * agescale;
@@ -105,8 +102,7 @@ public class FXWisp extends EntityFX {
prevPosY = posY;
prevPosZ = posZ;
if (particleAge++ >= particleMaxAge)
setDead();
if(particleAge++ >= particleMaxAge) setDead();
motionY -= 0.04D * particleGravity;
posX += motionX;
@@ -44,9 +44,9 @@ public class GuiLexicon extends GuiScreen {
top = height / 2 - guiHeight / 2;
buttonList.clear();
if (isIndex()) {
if(isIndex()) {
int x = 18;
for (int i = 0; i < 12; i++) {
for(int i = 0; i < 12; i++) {
int y = 16 + i * 12;
buttonList.add(new GuiButtonInvisible(i, left + x, top + y, 110, 10, ""));
}
@@ -76,13 +76,12 @@ public class GuiLexicon extends GuiScreen {
@Override
protected void actionPerformed(GuiButton par1GuiButton) {
int i = par1GuiButton.id - 3;
if (i < 0)
return;
if(i < 0) return;
List<LexiconCategory> categoryList = BotaniaAPI.getAllCategories();
LexiconCategory category = i >= categoryList.size() ? null : categoryList.get(i);
if (category != null) {
if(category != null) {
mc.displayGuiScreen(new GuiLexiconIndex(category));
ClientTickHandler.notifyPageChange();
}
@@ -103,12 +102,11 @@ public class GuiLexicon extends GuiScreen {
void populateIndex() {
List<LexiconCategory> categoryList = BotaniaAPI.getAllCategories();
for (int i = 3; i < 12; i++) {
for(int i = 3; i < 12; i++) {
int i_ = i - 3;
GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i);
LexiconCategory category = i_ >= categoryList.size() ? null : categoryList.get(i_);
if (category != null)
button.displayString = StatCollector.translateToLocal(category.getUnlocalizedName());
if(category != null) button.displayString = StatCollector.translateToLocal(category.getUnlocalizedName());
else button.displayString = "";
}
}
@@ -75,7 +75,7 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry {
@Override
protected void actionPerformed(GuiButton par1GuiButton) {
switch (par1GuiButton.id) {
switch(par1GuiButton.id) {
case 0:
mc.displayGuiScreen(GuiScreen.isShiftKeyDown() ? new GuiLexicon() : parent);
ClientTickHandler.notifyPageChange();
@@ -67,10 +67,10 @@ public class GuiLexiconIndex extends GuiLexicon {
@Override
void populateIndex() {
for (int i = page * 12; i < (page + 1) * 12; i++) {
for(int i = page * 12; i < (page + 1) * 12; i++) {
GuiButtonInvisible button = (GuiButtonInvisible) buttonList.get(i - page * 12);
LexiconEntry entry = i >= entriesToDisplay.size() ? null : entriesToDisplay.get(i);
if (entry != null)
if(entry != null)
button.displayString = (entry.isPriority() ? EnumChatFormatting.ITALIC : "") + StatCollector.translateToLocal(entry.getUnlocalizedName());
else button.displayString = "";
}
@@ -78,7 +78,7 @@ public class GuiLexiconIndex extends GuiLexicon {
@Override
protected void actionPerformed(GuiButton par1GuiButton) {
switch (par1GuiButton.id) {
switch(par1GuiButton.id) {
case 12:
mc.displayGuiScreen(new GuiLexicon());
ClientTickHandler.notifyPageChange();
@@ -97,8 +97,7 @@ public class GuiLexiconIndex extends GuiLexicon {
break;
default:
int index = par1GuiButton.id + page * 12;
if (index >= entriesToDisplay.size())
return;
if(index >= entriesToDisplay.size()) return;
LexiconEntry entry = entriesToDisplay.get(index);
mc.displayGuiScreen(new GuiLexiconEntry(entry, this));
@@ -38,8 +38,7 @@ public class GuiButtonBack extends GuiButton {
List<String> tooltip = getTooltip();
int tooltipY = (tooltip.size() - 1) * 10;
if (k == 2)
RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
if(k == 2) RenderHelper.renderTooltip(par2, par3 + tooltipY, tooltip);
}
public List<String> getTooltip() {
@@ -31,7 +31,7 @@ public class GuiButtonPage extends GuiButton {
@Override
public void drawButton(Minecraft par1Minecraft, int par2, int par3) {
if (enabled) {
if(enabled) {
field_146123_n = par2 >= xPosition && par3 >= yPosition && par2 < xPosition + width && par3 < yPosition + height;
int k = getHoverState(field_146123_n);
@@ -39,7 +39,7 @@ public class GuiButtonPage extends GuiButton {
GL11.glColor4f(1F, 1F, 1F, 1F);
drawTexturedModalRect(xPosition, yPosition, k == 2 ? 18 : 0, right ? 180 : 190, 18, 10);
if (k == 2)
if(k == 2)
RenderHelper.renderTooltip(par2, par3, Arrays.asList(StatCollector.translateToLocal(right ? "botaniamisc.nextPage" : "botaniamisc.prevPage")));
}
}
@@ -68,8 +68,6 @@ public final class LibResources {
public static final String SHADER_ENCHANTER_RUNE_FRAG = PREFIX_SHADER + "enchanter_rune.frag";
public static final String SHADER_MANA_POOL_FRAG = PREFIX_SHADER + "mana_pool.frag";
public static final String[] LANGS = new String[]{
"en_US", "de_DE"
};
public static final String[] LANGS = new String[]{"en_US", "de_DE"};
}
@@ -36,7 +36,7 @@ public class ModelPylon implements IPylonModel {
@Override
public void renderGems() {
for (int i = 1; i < 5; i++)
for(int i = 1; i < 5; i++)
model.renderPart("Ring_Gem0" + i);
}
}
@@ -41,7 +41,7 @@ public class ModelSpinningCubes extends ModelBase {
GL11.glPushMatrix();
GL11.glTranslatef(-0.025F, 0.85F, -0.025F);
for (int i = 0; i < cubes; i++) {
for(int i = 0; i < cubes; i++) {
float offset = offsetPerCube * i;
float deg = (int) (ticks / rotationModifier % 360F + offset);
float rad = deg * (float) Math.PI / 180F;
@@ -58,7 +58,7 @@ public class ModelSpinningCubes extends ModelBase {
float zRotate = (float) Math.cos(ticks * rotationModifier) / 2F;
GL11.glRotatef(deg, xRotate, yRotate, zRotate);
if (repeat < origRepeat) {
if(repeat < origRepeat) {
GL11.glColor4f(1F, 1F, 1F, 0.2F);
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
@@ -71,8 +71,7 @@ public class ModelSpinningCubes extends ModelBase {
OpenGlHelper.setLightmapTextureCoords(OpenGlHelper.lightmapTexUnit, lightmapX, lightmapY);
spinningCube.render(1F / 16F);
if (repeat < origRepeat)
GL11.glDisable(GL11.GL_BLEND);
if(repeat < origRepeat) GL11.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
}
@@ -80,8 +79,7 @@ public class ModelSpinningCubes extends ModelBase {
GL11.glEnable(GL11.GL_TEXTURE_2D);
if (repeat != 0)
renderSpinningCubes(cubes, repeat - 1, origRepeat);
if(repeat != 0) renderSpinningCubes(cubes, repeat - 1, origRepeat);
}
}
@@ -47,7 +47,7 @@ public class RenderSpecialFlower implements ISimpleBlockRenderingHandler {
float f2 = (l >> 8 & 255) / 255.0F;
float f3 = (l & 255) / 255.0F;
if (EntityRenderer.anaglyphEnable) {
if(EntityRenderer.anaglyphEnable) {
float f4 = (f1 * 30.0F + f2 * 59.0F + f3 * 11.0F) / 100.0F;
float f5 = (f1 * 30.0F + f2 * 70.0F) / 100.0F;
float f6 = (f1 * 30.0F + f3 * 70.0F) / 100.0F;
@@ -41,7 +41,7 @@ public class RenderLens implements IItemRenderer {
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
switch (type) {
switch(type) {
case ENTITY: {
GL11.glPushMatrix();
GL11.glTranslatef(-0.5F, 0F, 0F);
@@ -107,8 +107,7 @@ public class RenderLens implements IItemRenderer {
float zLevel = 0F;
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
if (shiny)
tessellator.setBrightness(240);
if(shiny) tessellator.setBrightness(240);
tessellator.addVertexWithUV(par1 + 0, par2 + par5, zLevel, icon.getMinU(), icon.getMaxV());
tessellator.addVertexWithUV(par1 + par4, par2 + par5, zLevel, icon.getMaxU(), icon.getMaxV());
tessellator.addVertexWithUV(par1 + par4, par2 + 0, zLevel, icon.getMaxU(), icon.getMinV());
@@ -51,19 +51,18 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
GL11.glScalef(1F, -1F, -1F);
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
if (altar.hasWater) {
if(altar.hasWater) {
GL11.glPushMatrix();
float s = 1F / 256F * 10F;
float v = 1F / 8F;
float w = -v * 2.5F;
int petals = 0;
for (int i = 0; i < altar.getSizeInventory(); i++)
if (altar.getStackInSlot(i) != null)
petals++;
for(int i = 0; i < altar.getSizeInventory(); i++)
if(altar.getStackInSlot(i) != null) petals++;
else break;
if (petals > 0) {
if(petals > 0) {
final float modifier = 6F;
final float rotationModifier = 0.25F;
final float radiusBase = 1.2F;
@@ -75,7 +74,7 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
GL11.glPushMatrix();
GL11.glTranslatef(-0.05F, -0.5F, 0F);
GL11.glScalef(v, v, v);
for (int i = 0; i < petals; i++) {
for(int i = 0; i < petals; i++) {
float offset = offsetPerPetal * i;
float deg = (int) (ticks / rotationModifier % 360F + offset);
float rad = deg * (float) Math.PI / 180F;
@@ -102,7 +101,7 @@ public class RenderTileAltar extends TileEntitySpecialRenderer {
ItemStack stack = altar.getStackInSlot(i);
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
IIcon icon = stack.getItem().getIcon(stack, 0);
if (icon != null) {
if(icon != null) {
Color color = new Color(stack.getItem().getColorFromItemStack(stack, 0));
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
float f = icon.getMinU();
@@ -37,15 +37,12 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer {
TileEnchanter enchanter = (TileEnchanter) tileentity;
float alphaMod = 0F;
if (enchanter.stage == 2)
alphaMod = Math.min(20, enchanter.stageTicks) / 20F;
else if (enchanter.stage == 4)
alphaMod = (20 - enchanter.stageTicks) / 20F;
else if (enchanter.stage > 2)
alphaMod = 1F;
if(enchanter.stage == 2) alphaMod = Math.min(20, enchanter.stageTicks) / 20F;
else if(enchanter.stage == 4) alphaMod = (20 - enchanter.stageTicks) / 20F;
else if(enchanter.stage > 2) alphaMod = 1F;
if (enchanter.itemToEnchant != null) {
if (item == null)
if(enchanter.itemToEnchant != null) {
if(item == null)
item = new EntityItem(enchanter.getWorldObj(), enchanter.xCoord, enchanter.yCoord + 1, enchanter.zCoord, enchanter.itemToEnchant);
item.age = (int) tileentity.getWorldObj().getTotalWorldTime();
@@ -68,8 +65,7 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer {
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glDisable(GL11.GL_ALPHA_TEST);
float alpha = (float) ((Math.sin(enchanter.getWorldObj().getTotalWorldTime() / 8D) + 1D) / 5D + 0.4D) * alphaMod;
if (ShaderHelper.useShaders())
GL11.glColor4f(1F, 1F, 1F, alpha);
if(ShaderHelper.useShaders()) GL11.glColor4f(1F, 1F, 1F, alpha);
else {
int light = 15728880;
int lightmapX = light % 65536;
@@ -80,7 +76,7 @@ public class RenderTileEnchanter extends TileEntitySpecialRenderer {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
if (enchanter.stage == 3 || enchanter.stage == 4) {
if(enchanter.stage == 3 || enchanter.stage == 4) {
int ticks = enchanter.stageTicks + enchanter.stage3EndTicks;
int angle = ticks * 2;
float yTranslation = Math.min(20, ticks) / 20F * 1.15F;
@@ -52,7 +52,7 @@ public class RenderTilePool extends TileEntitySpecialRenderer {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);
float waterLevel = (float) pool.getCurrentMana() / (float) TilePool.MAX_MANA * 0.40F;
if (waterLevel > 0) {
if(waterLevel > 0) {
float s = 1F / 256F * 14F;
float v = 1F / 8F;
float w = -v * 3.5F;
@@ -36,8 +36,7 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tileentity, double d0, double d1, double d2, float pticks) {
if (model == null)
model = ConfigHandler.oldPylonModel ? new ModelPylonOld() : new ModelPylon();
if(model == null) model = ConfigHandler.oldPylonModel ? new ModelPylonOld() : new ModelPylon();
GL11.glPushMatrix();
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
@@ -47,10 +46,10 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
Minecraft.getMinecraft().renderEngine.bindTexture(ConfigHandler.oldPylonModel ? textureOld : texture);
int worldTime = (int) (tileentity.getWorldObj() == null ? 0 : tileentity.getWorldObj().getTotalWorldTime());
if (tileentity != null)
if(tileentity != null)
worldTime += new Random(tileentity.xCoord ^ tileentity.yCoord ^ tileentity.zCoord).nextInt(360);
if (ConfigHandler.oldPylonModel) {
if(ConfigHandler.oldPylonModel) {
GL11.glTranslated(d0 + 0.5, d1 + 2.2, d2 + 0.5);
GL11.glScalef(1F, -1.5F, -1F);
} else {
@@ -59,11 +58,9 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
}
GL11.glPushMatrix();
if (!ConfigHandler.oldPylonModel)
GL11.glTranslatef(0.5F, 0F, -0.5F);
if(!ConfigHandler.oldPylonModel) GL11.glTranslatef(0.5F, 0F, -0.5F);
GL11.glRotatef(worldTime * 1.5F, 0F, 1F, 0F);
if (!ConfigHandler.oldPylonModel)
GL11.glTranslatef(-0.5F, 0F, 0.5F);
if(!ConfigHandler.oldPylonModel) GL11.glTranslatef(-0.5F, 0F, 0.5F);
model.renderRing();
GL11.glTranslated(0D, Math.sin(worldTime / 20D) / 20 - 0.025, 0D);
@@ -73,19 +70,17 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
GL11.glPushMatrix();
GL11.glTranslated(0D, Math.sin(worldTime / 20D) / 17.5, 0D);
if (!ConfigHandler.oldPylonModel)
GL11.glTranslatef(0.5F, 0F, -0.5F);
if(!ConfigHandler.oldPylonModel) GL11.glTranslatef(0.5F, 0F, -0.5F);
GL11.glRotatef(-worldTime, 0F, 1F, 0F);
if (!ConfigHandler.oldPylonModel)
GL11.glTranslatef(-0.5F, 0F, 0.5F);
if(!ConfigHandler.oldPylonModel) GL11.glTranslatef(-0.5F, 0F, 0.5F);
GL11.glDisable(GL11.GL_CULL_FACE);
model.renderCrystal();
GL11.glColor4f(1F, 1F, 1F, 1F);
if (!ShaderHelper.useShaders()) {
if(!ShaderHelper.useShaders()) {
int light = 15728880;
int lightmapX = light % 65536;
int lightmapY = light / 65536;
@@ -96,8 +91,7 @@ public class RenderTilePylon extends TileEntitySpecialRenderer {
GL11.glDisable(GL11.GL_ALPHA_TEST);
GL11.glScalef(1.1F, 1.1F, 1.1F);
if (!ConfigHandler.oldPylonModel)
GL11.glTranslatef(-0.05F, -0.1F, 0.05F);
if(!ConfigHandler.oldPylonModel) GL11.glTranslatef(-0.05F, -0.1F, 0.05F);
else GL11.glTranslatef(0F, -0.09F, 0F);
ShaderHelper.useShader(ShaderHelper.pylonGlow);
@@ -45,18 +45,17 @@ public class RenderTileRuneAltar extends TileEntitySpecialRenderer {
GL11.glTranslated(x, y, z);
int items = 0;
for (int i = 0; i < altar.getSizeInventory(); i++)
if (altar.getStackInSlot(i) == null)
break;
for(int i = 0; i < altar.getSizeInventory(); i++)
if(altar.getStackInSlot(i) == null) break;
else items++;
float[] angles = new float[altar.getSizeInventory()];
float anglePer = 360F / items;
float totalAngle = 0F;
for (int i = 0; i < angles.length; i++)
for(int i = 0; i < angles.length; i++)
angles[i] = totalAngle += anglePer;
for (int i = 0; i < altar.getSizeInventory(); i++) {
for(int i = 0; i < altar.getSizeInventory(); i++) {
GL11.glPushMatrix();
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(1F, 2.5F, 1F);
@@ -66,13 +65,13 @@ public class RenderTileRuneAltar extends TileEntitySpecialRenderer {
GL11.glTranslated(0D, 0.15 * Math.sin((tileentity.getWorldObj().getTotalWorldTime() + i * 10) / 5D), 0F);
ItemStack stack = altar.getStackInSlot(i);
Minecraft mc = Minecraft.getMinecraft();
if (stack != null) {
if(stack != null) {
mc.renderEngine.bindTexture(stack.getItem() instanceof ItemBlock ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
GL11.glScalef(2F, 2F, 2F);
if (!ForgeHooksClient.renderEntityItem(new EntityItem(altar.getWorldObj(), altar.xCoord, altar.yCoord, altar.zCoord, stack), stack, 0F, 0F, altar.getWorldObj().rand, mc.renderEngine, renderBlocks, 1)) {
if(!ForgeHooksClient.renderEntityItem(new EntityItem(altar.getWorldObj(), altar.xCoord, altar.yCoord, altar.zCoord, stack), stack, 0F, 0F, altar.getWorldObj().rand, mc.renderEngine, renderBlocks, 1)) {
GL11.glScalef(0.5F, 0.5F, 0.5F);
if (stack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) {
if(stack.getItem() instanceof ItemBlock && RenderBlocks.renderItemIn3d(Block.getBlockFromItem(stack.getItem()).getRenderType())) {
GL11.glScalef(0.5F, 0.5F, 0.5F);
GL11.glTranslatef(1F, 1.1F, 0F);
renderBlocks.renderBlockAsItem(Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 1F);
@@ -82,7 +81,7 @@ public class RenderTileRuneAltar extends TileEntitySpecialRenderer {
int renderPass = 0;
do {
IIcon icon = stack.getItem().getIcon(stack, renderPass);
if (icon != null) {
if(icon != null) {
Color color = new Color(stack.getItem().getColorFromItemStack(stack, renderPass));
GL11.glColor3ub((byte) color.getRed(), (byte) color.getGreen(), (byte) color.getBlue());
float f = icon.getMinU();
@@ -93,7 +92,7 @@ public class RenderTileRuneAltar extends TileEntitySpecialRenderer {
GL11.glColor3f(1F, 1F, 1F);
}
renderPass++;
} while (renderPass < stack.getItem().getRenderPasses(stack.getItemDamage()));
} while(renderPass < stack.getItem().getRenderPasses(stack.getItemDamage()));
}
}
}
@@ -111,7 +110,7 @@ public class RenderTileRuneAltar extends TileEntitySpecialRenderer {
GL11.glTranslatef(0F, 1.2F, 2F);
float scale = altar.getTargetMana() == 0 ? 0 : (float) altar.getCurrentMana() / (float) altar.getTargetMana() / 75F;
if (scale != 0) {
if(scale != 0) {
int seed = altar.xCoord ^ altar.yCoord ^ altar.zCoord;
GL11.glTranslatef(0.5F, 0.7F, 0.5F);
RenderHelper.renderStar(0x00E4D7, scale, scale, scale, seed);
@@ -52,7 +52,7 @@ public class RenderTileSpreader extends TileEntitySpecialRenderer {
GL11.glScalef(1F, -1F, -1F);
ItemStack stack = spreader.getStackInSlot(0);
if (stack != null) {
if(stack != null) {
Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationItemsTexture);
ILens lens = (ILens) stack.getItem();
GL11.glPushMatrix();
@@ -57,10 +57,9 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
@Override
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
if (par5Entity instanceof EntityItem) {
if(par5Entity instanceof EntityItem) {
TileAltar tile = (TileAltar) par1World.getTileEntity(par2, par3, par4);
if (tile.collideEntityItem((EntityItem) par5Entity))
par1World.markBlockForUpdate(par2, par3, par4);
if(tile.collideEntityItem((EntityItem) par5Entity)) par1World.markBlockForUpdate(par2, par3, par4);
}
}
@@ -68,9 +67,9 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
ItemStack stack = par5EntityPlayer.getCurrentEquippedItem();
TileAltar tile = (TileAltar) par1World.getTileEntity(par2, par3, par4);
if (stack != null && stack.getItem() == Items.water_bucket) {
if (!tile.hasWater) {
if (!par5EntityPlayer.capabilities.isCreativeMode)
if(stack != null && stack.getItem() == Items.water_bucket) {
if(!tile.hasWater) {
if(!par5EntityPlayer.capabilities.isCreativeMode)
par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, new ItemStack(Items.bucket));
tile.hasWater = true;
par1World.func_147453_f(par2, par3, par4, this);
@@ -111,20 +110,19 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4);
if (inv != null) {
for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
if(inv != null) {
for(int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
ItemStack itemstack = inv.getStackInSlot(j1);
if (itemstack != null) {
if(itemstack != null) {
float f = random.nextFloat() * 0.8F + 0.1F;
float f1 = random.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem;
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
for(float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
int k1 = random.nextInt(21) + 10;
if (k1 > itemstack.stackSize)
k1 = itemstack.stackSize;
if(k1 > itemstack.stackSize) k1 = itemstack.stackSize;
itemstack.stackSize -= k1;
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
@@ -133,7 +131,7 @@ public class BlockAltar extends BlockModContainer implements ILexiconable {
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float) random.nextGaussian() * f3;
if (itemstack.hasTagCompound())
if(itemstack.hasTagCompound())
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
}
}
@@ -76,19 +76,18 @@ public class BlockEnchanter extends BlockModContainer implements IWandable, ILex
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
TileEnchanter enchanter = (TileEnchanter) par1World.getTileEntity(par2, par3, par4);
ItemStack stack = par5EntityPlayer.getCurrentEquippedItem();
if (stack != null && stack.getItem() == ModItems.twigWand)
return false;
if(stack != null && stack.getItem() == ModItems.twigWand) return false;
boolean stackEnchantable = stack != null && stack.isItemEnchantable() && stack.stackSize == 1 && stack.getItem().getItemEnchantability() > 0;
if (enchanter.itemToEnchant == null) {
if (stackEnchantable) {
if(enchanter.itemToEnchant == null) {
if(stackEnchantable) {
enchanter.itemToEnchant = stack.copy();
par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null);
enchanter.sync();
}
} else if (enchanter.stage == 0) {
if (par5EntityPlayer.inventory.addItemStackToInventory(enchanter.itemToEnchant.copy())) {
} else if(enchanter.stage == 0) {
if(par5EntityPlayer.inventory.addItemStackToInventory(enchanter.itemToEnchant.copy())) {
enchanter.itemToEnchant = null;
enchanter.sync();
} else par5EntityPlayer.addChatMessage(new ChatComponentTranslation("botaniamisc.invFull"));
@@ -103,16 +102,15 @@ public class BlockEnchanter extends BlockModContainer implements IWandable, ILex
ItemStack itemstack = enchanter.itemToEnchant;
if (itemstack != null) {
if(itemstack != null) {
float f = random.nextFloat() * 0.8F + 0.1F;
float f1 = random.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem;
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
for(float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
int k1 = random.nextInt(21) + 10;
if (k1 > itemstack.stackSize)
k1 = itemstack.stackSize;
if(k1 > itemstack.stackSize) k1 = itemstack.stackSize;
itemstack.stackSize -= k1;
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
@@ -121,7 +119,7 @@ public class BlockEnchanter extends BlockModContainer implements IWandable, ILex
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float) random.nextGaussian() * f3 * 0.5;
if (itemstack.hasTagCompound())
if(itemstack.hasTagCompound())
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
}
}
@@ -62,14 +62,14 @@ public class BlockLivingrock extends BlockMod implements ILexiconable {
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 0; i < TYPES; i++)
for(int i = 0; i < TYPES; i++)
par3List.add(new ItemStack(par1, 1, i));
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
icons = new IIcon[TYPES];
for (int i = 0; i < TYPES; i++)
for(int i = 0; i < TYPES; i++)
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
}
@@ -62,14 +62,14 @@ public class BlockLivingwood extends BlockMod implements ILexiconable {
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 0; i < TYPES; i++)
for(int i = 0; i < TYPES; i++)
par3List.add(new ItemStack(par1, 1, i));
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
icons = new IIcon[TYPES];
for (int i = 0; i < TYPES; i++)
for(int i = 0; i < TYPES; i++)
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
}
@@ -52,7 +52,7 @@ public class BlockManaBeacon extends BlockModContainer implements ILexiconable {
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
icons = new IIcon[2];
for (int i = 0; i < 2; i++)
for(int i = 0; i < 2; i++)
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
}
@@ -63,7 +63,7 @@ public class BlockManaBeacon extends BlockModContainer implements ILexiconable {
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 0; i < 16; i++)
for(int i = 0; i < 16; i++)
par3List.add(new ItemStack(par1, 1, i));
}
@@ -47,7 +47,7 @@ public class BlockManaDetector extends BlockModContainer implements ILexiconable
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
icons = new IIcon[2];
for (int i = 0; i < icons.length; i++)
for(int i = 0; i < icons.length; i++)
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
}
@@ -68,7 +68,7 @@ public class BlockManaDetector extends BlockModContainer implements ILexiconable
@Override
public void addCollisionBoxesToList(World par1World, int par2, int par3, int par4, AxisAlignedBB par5AxisAlignedBB, List par6List, Entity par7Entity) {
if (par7Entity != null && !(par7Entity instanceof IManaBurst))
if(par7Entity != null && !(par7Entity instanceof IManaBurst))
super.addCollisionBoxesToList(par1World, par2, par3, par4, par5AxisAlignedBB, par6List, par7Entity);
}
@@ -24,14 +24,12 @@ public class BlockMod extends Block {
public BlockMod(Material par2Material) {
super(par2Material);
if (registerInCreative())
setCreativeTab(BotaniaCreativeTab.INSTANCE);
if(registerInCreative()) setCreativeTab(BotaniaCreativeTab.INSTANCE);
}
@Override
public Block setBlockName(String par1Str) {
if (shouldRegisterInNameSet())
GameRegistry.registerBlock(this, par1Str);
if(shouldRegisterInNameSet()) GameRegistry.registerBlock(this, par1Str);
return super.setBlockName(par1Str);
}
@@ -27,14 +27,12 @@ public abstract class BlockModContainer<T extends TileEntity> extends BlockConta
protected BlockModContainer(Material par2Material) {
super(par2Material);
if (registerInCreative())
setCreativeTab(BotaniaCreativeTab.INSTANCE);
if(registerInCreative()) setCreativeTab(BotaniaCreativeTab.INSTANCE);
}
@Override
public Block setBlockName(String par1Str) {
if (shouldRegisterInNameSet())
GameRegistry.registerBlock(this, par1Str);
if(shouldRegisterInNameSet()) GameRegistry.registerBlock(this, par1Str);
return super.setBlockName(par1Str);
}
@@ -54,7 +54,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable {
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 0; i < 16; i++)
for(int i = 0; i < 16; i++)
par3List.add(new ItemStack(par1, 1, i));
}
@@ -68,7 +68,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable {
@SideOnly(Side.CLIENT)
public void registerBlockIcons(IIconRegister par1IconRegister) {
icons = new IIcon[17];
for (int i = 0; i < icons.length; i++)
for(int i = 0; i < icons.length; i++)
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
}
@@ -92,7 +92,7 @@ public class BlockModFlower extends BlockFlower implements ILexiconable {
int meta = par1World.getBlockMetadata(par2, par3, par4);
float[] color = EntitySheep.fleeceColorTable[meta];
if (par5Random.nextDouble() < ConfigHandler.flowerParticleFrequency)
if(par5Random.nextDouble() < ConfigHandler.flowerParticleFrequency)
Botania.proxy.sparkleFX(par1World, par2 + 0.3 + par5Random.nextFloat() * 0.5, par3 + 0.5 + par5Random.nextFloat() * 0.5, par4 + 0.3 + par5Random.nextFloat() * 0.5, color[0], color[1], color[2], par5Random.nextFloat(), 5);
}
@@ -84,8 +84,7 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
static void decrCoords(String key) {
int time = getTimeInCoords(key);
if (time <= 0)
removeThese.add(key);
if(time <= 0) removeThese.add(key);
else coordsToCheck.put(key, time - 1);
}
@@ -95,8 +94,7 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
static Block getBlockAt(String key) {
MinecraftServer server = MinecraftServer.getServer();
if (server == null)
return Blocks.air;
if(server == null) return Blocks.air;
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]);
@@ -106,8 +104,7 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
static int getBlockMetaAt(String key) {
MinecraftServer server = MinecraftServer.getServer();
if (server == null)
return 0;
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]);
@@ -117,14 +114,13 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
@Override
public boolean onUsedByWand(EntityPlayer player, ItemStack stack, World world, int x, int y, int z, int side) {
if (!player.isSneaking()) {
if(!player.isSneaking()) {
playerPositions.put(player.getCommandSenderName(), getCoordsAsString(world.provider.dimensionId, x, y, z));
world.playSoundEffect(x, y, z, "random.orb", 0.5F, 1F);
} else {
dropBlockAsItem(world, x, y, z, new ItemStack(this));
world.setBlockToAir(x, y, z);
if (!world.isRemote)
world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(this));
if(!world.isRemote) world.playAuxSFX(2001, x, y, z, Block.getIdFromBlock(this));
}
return true;
@@ -148,9 +144,9 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
mappedPositions.clear();
Collection<String> tags = nbttagcompound.func_150296_c();
for (String key : tags) {
for(String key : tags) {
NBTBase tag = nbttagcompound.getTag(key);
if (tag instanceof NBTTagString) {
if(tag instanceof NBTTagString) {
String value = ((NBTTagString) tag).func_150285_a_();
mappedPositions.put(key, value);
@@ -160,14 +156,14 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
@Override
public void writeToNBT(NBTTagCompound nbttagcompound) {
for (String s : mappedPositions.keySet())
for(String s : mappedPositions.keySet())
nbttagcompound.setString(s, mappedPositions.get(s));
}
public static WorldData get(World world) {
WorldData data = (WorldData) world.mapStorage.loadData(WorldData.class, ID);
if (data == null) {
if(data == null) {
data = new WorldData(ID);
data.markDirty();
world.mapStorage.setData(ID, data);
@@ -178,58 +174,57 @@ public class BlockPistonRelay extends BlockMod implements IWandable, ILexiconabl
@SubscribeEvent
public void tickEnd(TickEvent event) {
if (event.type == Type.SERVER && event.phase == Phase.END)
for (String s : coordsToCheck.keySet()) {
Block block = getBlockAt(s);
decrCoords(s);
if(event.type == Type.SERVER && event.phase == Phase.END) for(String s : coordsToCheck.keySet()) {
Block block = getBlockAt(s);
decrCoords(s);
if (block == Blocks.piston_extension) {
int meta = getBlockMetaAt(s);
ForgeDirection dir = ForgeDirection.getOrientation(meta & ~8);
if(block == Blocks.piston_extension) {
int meta = getBlockMetaAt(s);
ForgeDirection dir = ForgeDirection.getOrientation(meta & ~8);
MinecraftServer server = MinecraftServer.getServer();
MinecraftServer server = MinecraftServer.getServer();
if (server != null && getTimeInCoords(s) == 0) {
String newPos;
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);
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);
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);
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);
Block srcBlock = world.getBlock(x, y, z);
int srcMeta = world.getBlockMetadata(x, y, z);
TileEntity tile = world.getTileEntity(x, y, z);
Material mat = srcBlock.getMaterial();
Block srcBlock = world.getBlock(x, y, z);
int srcMeta = world.getBlockMetadata(x, y, z);
TileEntity tile = world.getTileEntity(x, y, z);
Material mat = srcBlock.getMaterial();
if (tile == null && mat.getMaterialMobility() == 0 && !srcBlock.isAir(world, x, y, z)) {
Material destMat = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).getMaterial();
if (world.isAirBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) || destMat.isReplaceable()) {
world.setBlock(x, y, z, Blocks.air);
world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, srcBlock, srcMeta, 1 | 2);
mappedPositions.put(s, getCoordsAsString(world.provider.dimensionId, x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ));
}
if(tile == null && mat.getMaterialMobility() == 0 && !srcBlock.isAir(world, x, y, z)) {
Material destMat = world.getBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ).getMaterial();
if(world.isAirBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ) || destMat.isReplaceable()) {
world.setBlock(x, y, z, Blocks.air);
world.setBlock(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, srcBlock, srcMeta, 1 | 2);
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);
WorldData.get(world).markDirty();
}
pos = mappedPositions.get(s);
mappedPositions.remove(s);
mappedPositions.put(newPos, pos);
WorldData.get(world).markDirty();
}
}
}
}
for (String s : removeThese)
for(String s : removeThese)
coordsToCheck.remove(s);
removeThese.clear();
}
@@ -54,10 +54,9 @@ public class BlockPool extends BlockModContainer implements IWandHUD, IWandable,
@Override
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
if (par5Entity instanceof EntityItem) {
if(par5Entity instanceof EntityItem) {
TilePool tile = (TilePool) par1World.getTileEntity(par2, par3, par4);
if (tile.collideEntityItem((EntityItem) par5Entity))
par1World.markBlockForUpdate(par2, par3, par4);
if(tile.collideEntityItem((EntityItem) par5Entity)) par1World.markBlockForUpdate(par2, par3, par4);
}
}
@@ -90,8 +89,7 @@ public class BlockPool extends BlockModContainer implements IWandHUD, IWandable,
public int getComparatorInputOverride(World par1World, int par2, int par3, int par4, int par5) {
TilePool pool = (TilePool) par1World.getTileEntity(par2, par3, par4);
int val = (int) ((double) pool.getCurrentMana() / (double) TilePool.MAX_MANA * 15.0);
if (pool.getCurrentMana() > 0)
val = Math.max(val, 1);
if(pool.getCurrentMana() > 0) val = Math.max(val, 1);
return val;
}
@@ -61,14 +61,14 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, ILex
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
icons = new IIcon[3];
for (int i = 0; i < icons.length; i++)
for(int i = 0; i < icons.length; i++)
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer par5EntityPlayer, int par6, float par7, float par8, float par9) {
ItemStack stack = par5EntityPlayer.getCurrentEquippedItem();
if (stack != null)
if(stack != null)
return ((TileRuneAltar) par1World.getTileEntity(par2, par3, par4)).addItem(par5EntityPlayer, stack);
return false;
@@ -78,20 +78,19 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, ILex
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4);
if (inv != null) {
for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
if(inv != null) {
for(int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
ItemStack itemstack = inv.getStackInSlot(j1);
if (itemstack != null) {
if(itemstack != null) {
float f = random.nextFloat() * 0.8F + 0.1F;
float f1 = random.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem;
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
for(float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
int k1 = random.nextInt(21) + 10;
if (k1 > itemstack.stackSize)
k1 = itemstack.stackSize;
if(k1 > itemstack.stackSize) k1 = itemstack.stackSize;
itemstack.stackSize -= k1;
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
@@ -100,7 +99,7 @@ public class BlockRuneAltar extends BlockModContainer implements IWandable, ILex
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float) random.nextGaussian() * f3;
if (itemstack.hasTagCompound())
if(itemstack.hasTagCompound())
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
}
}
@@ -50,26 +50,10 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
LibBlockNames.SUBTILE_PUREDAISY,
// Generating
LibBlockNames.SUBTILE_DAYBLOOM,
LibBlockNames.SUBTILE_NIGHTSHADE,
LibBlockNames.SUBTILE_ENDOFLAME,
LibBlockNames.SUBTILE_HYDROANGEAS,
LibBlockNames.SUBTILE_THERMALILY,
LibBlockNames.SUBTILE_ARCANE_ROSE,
LibBlockNames.SUBTILE_DAYBLOOM, LibBlockNames.SUBTILE_NIGHTSHADE, LibBlockNames.SUBTILE_ENDOFLAME, LibBlockNames.SUBTILE_HYDROANGEAS, LibBlockNames.SUBTILE_THERMALILY, LibBlockNames.SUBTILE_ARCANE_ROSE,
// Functional
LibBlockNames.SUBTILE_JADED_AMARANTHUS,
LibBlockNames.SUBTILE_BELLETHORN,
LibBlockNames.SUBTILE_HEISEI_DREAM,
LibBlockNames.SUBTILE_TIGERSEYE,
LibBlockNames.SUBTILE_ORECHID,
LibBlockNames.SUBTILE_FALLEN_KANADE,
LibBlockNames.SUBTILE_EXOFLAME,
LibBlockNames.SUBTILE_AGRICARNATION,
LibBlockNames.SUBTILE_HOPPERHOCK,
LibBlockNames.SUBTILE_TANGLEBERRIE,
LibBlockNames.SUBTILE_JIYUULIA
};
LibBlockNames.SUBTILE_JADED_AMARANTHUS, LibBlockNames.SUBTILE_BELLETHORN, LibBlockNames.SUBTILE_HEISEI_DREAM, LibBlockNames.SUBTILE_TIGERSEYE, LibBlockNames.SUBTILE_ORECHID, LibBlockNames.SUBTILE_FALLEN_KANADE, LibBlockNames.SUBTILE_EXOFLAME, LibBlockNames.SUBTILE_AGRICARNATION, LibBlockNames.SUBTILE_HOPPERHOCK, LibBlockNames.SUBTILE_TANGLEBERRIE, LibBlockNames.SUBTILE_JIYUULIA};
protected BlockSpecialFlower() {
super(0);
@@ -99,13 +83,13 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (String s : subtypes)
for(String s : subtypes)
par3List.add(ItemBlockSpecialFlower.ofType(s));
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
for (String s : subtypes)
for(String s : subtypes)
icons.put(s, IconHelper.forName(par1IconRegister, s));
}
@@ -127,8 +111,7 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
@Override
public void onBlockHarvested(World par1World, int par2, int par3, int par4, int par5, EntityPlayer par6EntityPlayer) {
if (!par6EntityPlayer.capabilities.isCreativeMode)
dropBlockAsItem(par1World, par2, par3, par4, par5, 0);
if(!par6EntityPlayer.capabilities.isCreativeMode) dropBlockAsItem(par1World, par2, par3, par4, par5, 0);
}
@Override
@@ -136,7 +119,7 @@ public class BlockSpecialFlower extends BlockFlower implements ITileEntityProvid
ArrayList<ItemStack> list = new ArrayList();
TileEntity tile = world.getTileEntity(x, y, z);
if (tile != null) {
if(tile != null) {
String name = ((TileSpecialFlower) tile).subTileName;
list.add(ItemBlockSpecialFlower.ofType(name));
}
@@ -75,7 +75,7 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
@Override
public void getSubBlocks(Item par1, CreativeTabs par2, List par3) {
for (int i = 0; i < 2; i++)
for(int i = 0; i < 2; i++)
par3.add(new ItemStack(par1, 1, i));
}
@@ -85,7 +85,7 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
TileSpreader spreader = (TileSpreader) par1World.getTileEntity(par2, par3, par4);
par1World.setBlockMetadataWithNotify(par2, par3, par4, par6ItemStack.getItemDamage() & 1, 1 | 2);
switch (orientation) {
switch(orientation) {
case 0:
spreader.rotationY = -90F;
break;
@@ -138,17 +138,15 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
ItemStack heldItem = par5EntityPlayer.getCurrentEquippedItem();
boolean isHeldItemLens = heldItem != null && heldItem.getItem() instanceof ILens;
if (heldItem != null)
if (heldItem.getItem() == ModItems.twigWand)
return false;
if(heldItem != null) if(heldItem.getItem() == ModItems.twigWand) return false;
if (lens == null && isHeldItemLens) {
if(lens == null && isHeldItemLens) {
par5EntityPlayer.inventory.setInventorySlotContents(par5EntityPlayer.inventory.currentItem, null);
spreader.setInventorySlotContents(0, heldItem.copy());
spreader.markDirty();
} else if (lens != null) {
} else if(lens != null) {
ItemStack add = lens.copy();
if (!par5EntityPlayer.inventory.addItemStackToInventory(add))
if(!par5EntityPlayer.inventory.addItemStackToInventory(add))
par5EntityPlayer.dropPlayerItemWithRandomChoice(add, false);
spreader.setInventorySlotContents(0, null);
spreader.markDirty();
@@ -161,20 +159,19 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
TileSimpleInventory inv = (TileSimpleInventory) par1World.getTileEntity(par2, par3, par4);
if (inv != null) {
for (int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
if(inv != null) {
for(int j1 = 0; j1 < inv.getSizeInventory(); ++j1) {
ItemStack itemstack = inv.getStackInSlot(j1);
if (itemstack != null) {
if(itemstack != null) {
float f = random.nextFloat() * 0.8F + 0.1F;
float f1 = random.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem;
for (float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
for(float f2 = random.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; par1World.spawnEntityInWorld(entityitem)) {
int k1 = random.nextInt(21) + 10;
if (k1 > itemstack.stackSize)
k1 = itemstack.stackSize;
if(k1 > itemstack.stackSize) k1 = itemstack.stackSize;
itemstack.stackSize -= k1;
entityitem = new EntityItem(par1World, par2 + f, par3 + f1, par4 + f2, new ItemStack(itemstack.getItem(), k1, itemstack.getItemDamage()));
@@ -183,7 +180,7 @@ public class BlockSpreader extends BlockModContainer implements IWandable, IWand
entityitem.motionY = (float) random.nextGaussian() * f3 + 0.2F;
entityitem.motionZ = (float) random.nextGaussian() * f3;
if (itemstack.hasTagCompound())
if(itemstack.hasTagCompound())
entityitem.getEntityItem().setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy());
}
}
@@ -43,7 +43,7 @@ public class BlockTurntable extends BlockModContainer implements IWandable, IWan
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
icons = new IIcon[2];
for (int i = 0; i < icons.length; i++)
for(int i = 0; i < icons.length; i++)
icons[i] = IconHelper.forBlock(par1IconRegister, this, i);
}
@@ -47,7 +47,7 @@ public class BlockUnstable extends BlockMod implements ILexiconable {
@Override
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 0; i < 16; i++)
for(int i = 0; i < 16; i++)
par3List.add(new ItemStack(par1, 1, i));
}
@@ -63,7 +63,7 @@ public final class ModBlocks {
enchanter = new BlockEnchanter();
turntable = new BlockTurntable();
for (int i = 0; i < 16; i++)
for(int i = 0; i < 16; i++)
OreDictionary.registerOre(LibOreDict.FLOWER[i], new ItemStack(flower, 1, i));
OreDictionary.registerOre(LibOreDict.LIVING_ROCK, livingrock);
@@ -110,11 +110,11 @@ public final class ModBlocks {
}
private static void registerMultiparts() {
if (Loader.isModLoaded("ForgeMultipart")) {
if(Loader.isModLoaded("ForgeMultipart")) {
try {
Class clazz = Class.forName("vazkii.botania.common.block.multipart.MultipartHandler");
clazz.newInstance();
} catch (Throwable e) {
} catch(Throwable e) {
e.printStackTrace();
}
}
@@ -22,7 +22,7 @@ public final class MultipartHandler {
}
private static void registerMultipartMetadataLine(Block block, int maxMeta) {
for (int i = 0; i < maxMeta; i++)
for(int i = 0; i < maxMeta; i++)
registerMultipart(block, i);
}
@@ -28,16 +28,7 @@ public class SubTilePureDaisy extends SubTileEntity {
private static final String TAG_POSITION = "position";
private static final String TAG_TICKS_REMAINING = "ticksRemaining";
private static final int[][] POSITIONS = new int[][]{
{-1, 0, -1},
{-1, 0, 0},
{-1, 0, 1},
{0, 0, 1},
{1, 0, 1},
{1, 0, 0},
{1, 0, -1},
{0, 0, -1},
};
private static final int[][] POSITIONS = new int[][]{{-1, 0, -1}, {-1, 0, 0}, {-1, 0, 1}, {0, 0, 1}, {1, 0, 1}, {1, 0, 0}, {1, 0, -1}, {0, 0, -1},};
int positionAt = 0;
int[] ticksRemaining = new int[]{200, 200, 200, 200, 200, 200, 200, 200};
@@ -50,25 +41,24 @@ public class SubTilePureDaisy extends SubTileEntity {
@Override
public void onUpdate() {
positionAt++;
if (positionAt == POSITIONS.length)
positionAt = 0;
if(positionAt == POSITIONS.length) positionAt = 0;
int[] acoords = POSITIONS[positionAt];
ChunkCoordinates coords = new ChunkCoordinates(supertile.xCoord + acoords[0], supertile.yCoord + acoords[1], supertile.zCoord + acoords[2]);
Block block = supertile.getWorldObj().getBlock(coords.posX, coords.posY, coords.posZ);
if (block != Blocks.air) {
if(block != Blocks.air) {
String oredict = OreDictionary.getOreName(OreDictionary.getOreID(new ItemStack(block, 1, supertile.getWorldObj().getBlockMetadata(coords.posX, coords.posY, coords.posZ))));
Block output = oredict.equals("stone") ? ModBlocks.livingrock : oredict.endsWith("logWood") ? ModBlocks.livingwood : null;
if (output != null) {
if(output != null) {
ticksRemaining[positionAt] = ticksRemaining[positionAt] - 1;
Botania.proxy.sparkleFX(supertile.getWorldObj(), coords.posX + Math.random(), coords.posY + Math.random(), coords.posZ + Math.random(), 1F, 1F, 1F, (float) Math.random(), 5);
if (ticksRemaining[positionAt] <= 0) {
if(ticksRemaining[positionAt] <= 0) {
supertile.getWorldObj().setBlock(coords.posX, coords.posY, coords.posZ, output);
ticksRemaining[positionAt] = 200;
for (int i = 0; i < 25; i++) {
for(int i = 0; i < 25; i++) {
double x = coords.posX + Math.random();
double y = coords.posY + Math.random() + 0.5;
double z = coords.posZ + Math.random();
@@ -84,15 +74,15 @@ public class SubTilePureDaisy extends SubTileEntity {
public void readFromPacketNBT(NBTTagCompound cmp) {
positionAt = cmp.getInteger(TAG_POSITION);
if (supertile.getWorldObj() != null && !supertile.getWorldObj().isRemote)
for (int i = 0; i < ticksRemaining.length; i++)
if(supertile.getWorldObj() != null && !supertile.getWorldObj().isRemote)
for(int i = 0; i < ticksRemaining.length; i++)
ticksRemaining[i] = cmp.getInteger(TAG_TICKS_REMAINING + i);
}
@Override
public void writeToPacketNBT(NBTTagCompound cmp) {
cmp.setInteger(TAG_POSITION, positionAt);
for (int i = 0; i < ticksRemaining.length; i++)
for(int i = 0; i < ticksRemaining.length; i++)
cmp.setInteger(TAG_TICKS_REMAINING + i, ticksRemaining[i]);
}
@@ -23,18 +23,17 @@ public class SubTileAgricarnation extends SubTileFunctional {
public void onUpdate() {
super.onUpdate();
if (supertile.getWorldObj().getTotalWorldTime() % 3 == 0) {
if(supertile.getWorldObj().getTotalWorldTime() % 3 == 0) {
int range = 5;
int x = supertile.xCoord + supertile.getWorldObj().rand.nextInt(range * 2 + 1) - range;
int z = supertile.zCoord + supertile.getWorldObj().rand.nextInt(range * 2 + 1) - range;
for (int i = 4; i > -2; i--) {
for(int i = 4; i > -2; i--) {
int y = supertile.yCoord + i;
if (supertile.getWorldObj().isAirBlock(x, y, z))
continue;
if(supertile.getWorldObj().isAirBlock(x, y, z)) continue;
if (isPlant(x, y, z) && mana > 5) {
if(isPlant(x, y, z) && mana > 5) {
Block block = supertile.getWorldObj().getBlock(x, y, z);
mana -= 5;
supertile.getWorldObj().scheduleBlockUpdate(x, y, z, block, 1);
@@ -45,7 +44,7 @@ public class SubTileAgricarnation extends SubTileFunctional {
boolean isPlant(int x, int y, int z) {
Block block = supertile.getWorldObj().getBlock(x, y, z);
if (block == Blocks.grass || block == Blocks.leaves || block == Blocks.leaves2 || block instanceof BlockBush)
if(block == Blocks.grass || block == Blocks.leaves || block == Blocks.leaves2 || block instanceof BlockBush)
return false;
Material mat = block.getMaterial();
@@ -40,13 +40,12 @@ public class SubTileBellethorn extends SubTileFunctional {
final int range = 6;
final int manaToUse = 16;
if (supertile.getWorldObj().getTotalWorldTime() % 15 == 0) {
if(supertile.getWorldObj().getTotalWorldTime() % 15 == 0) {
List<EntityLivingBase> entities = supertile.getWorldObj().getEntitiesWithinAABB(EntityLivingBase.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + 1, supertile.zCoord + range));
for (EntityLivingBase entity : entities) {
if (entity instanceof EntityPlayer)
continue;
for(EntityLivingBase entity : entities) {
if(entity instanceof EntityPlayer) continue;
if (entity.hurtTime == 0 && mana >= manaToUse) {
if(entity.hurtTime == 0 && mana >= manaToUse) {
entity.attackEntityFrom(DamageSource.magic, 1);
mana -= manaToUse;
}
@@ -29,30 +29,29 @@ public class SubTileExoflame extends SubTileFunctional {
fireFurnaces:
{
for (int i = -range + 1; i < range; i++)
for (int j = -rangeY; j < rangeY; j++)
for (int k = -range + 1; k < range; k++) {
for(int i = -range + 1; i < range; i++)
for(int j = -rangeY; j < rangeY; j++)
for(int k = -range + 1; k < range; k++) {
int x = supertile.xCoord + i;
int y = supertile.yCoord + j;
int z = supertile.zCoord + k;
TileEntity tile = supertile.getWorldObj().getTileEntity(x, y, z);
if (tile != null && tile instanceof TileEntityFurnace) {
if(tile != null && tile instanceof TileEntityFurnace) {
TileEntityFurnace furnace = (TileEntityFurnace) tile;
boolean canSmelt = canFurnaceSmelt(furnace);
if (canSmelt && mana > 2) {
if (furnace.furnaceBurnTime < 2) {
if (furnace.furnaceBurnTime == 0)
if(canSmelt && mana > 2) {
if(furnace.furnaceBurnTime < 2) {
if(furnace.furnaceBurnTime == 0)
BlockFurnace.updateFurnaceBlockState(true, supertile.getWorldObj(), x, y, z);
furnace.furnaceBurnTime = 200;
}
if (supertile.getWorldObj().getTotalWorldTime() % 2 == 0)
if(supertile.getWorldObj().getTotalWorldTime() % 2 == 0)
furnace.furnaceCookTime = Math.min(199, furnace.furnaceCookTime + 1);
mana -= 2;
if (mana == 0)
break fireFurnaces;
if(mana == 0) break fireFurnaces;
}
}
}
@@ -60,19 +59,15 @@ public class SubTileExoflame extends SubTileFunctional {
}
public boolean canFurnaceSmelt(TileEntityFurnace furnace) {
if (furnace.getStackInSlot(0) == null)
return false;
if(furnace.getStackInSlot(0) == null) return false;
else {
ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(furnace.getStackInSlot(0));
if (itemstack == null)
return false;
if(itemstack == null) return false;
if (furnace.getStackInSlot(2) == null)
return true;
if(furnace.getStackInSlot(2) == null) return true;
if (!furnace.getStackInSlot(2).isItemEqual(itemstack))
return false;
if(!furnace.getStackInSlot(2).isItemEqual(itemstack)) return false;
int result = furnace.getStackInSlot(2).stackSize + itemstack.stackSize;
return result <= 64 && result <= itemstack.getMaxStackSize();
@@ -31,8 +31,8 @@ public class SubTileFallenKanade extends SubTileFunctional {
final int cost = 20;
List<EntityPlayer> players = supertile.getWorldObj().getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + range, supertile.zCoord + range));
for (EntityPlayer player : players) {
if (player.getActivePotionEffect(Potion.regeneration) == null && mana >= cost) {
for(EntityPlayer player : players) {
if(player.getActivePotionEffect(Potion.regeneration) == null && mana >= cost) {
player.addPotionEffect(new PotionEffect(Potion.regeneration.id, 100, 1));
mana -= cost;
sync();
@@ -37,35 +37,33 @@ public class SubTileHeiseiDream extends SubTileFunctional {
final int cost = 100;
List<IMob> mobs = supertile.getWorldObj().getEntitiesWithinAABB(IMob.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + range, supertile.zCoord + range));
if (mobs.size() > 1 && mana >= cost)
for (IMob mob : mobs) {
if (mob instanceof EntityLiving) {
EntityLiving entity = (EntityLiving) mob;
EntityLivingBase target = entity.getAttackTarget();
if (target == null || !(target instanceof IMob)) {
IMob newTarget;
do newTarget = mobs.get(supertile.getWorldObj().rand.nextInt(mobs.size()));
while (newTarget == mob);
if(mobs.size() > 1 && mana >= cost) for(IMob mob : mobs) {
if(mob instanceof EntityLiving) {
EntityLiving entity = (EntityLiving) mob;
EntityLivingBase target = entity.getAttackTarget();
if(target == null || !(target instanceof IMob)) {
IMob newTarget;
do newTarget = mobs.get(supertile.getWorldObj().rand.nextInt(mobs.size())); while(newTarget == mob);
if (newTarget instanceof EntityLivingBase) {
entity.setAttackTarget((EntityLivingBase) newTarget);
if(newTarget instanceof EntityLivingBase) {
entity.setAttackTarget((EntityLivingBase) newTarget);
List<EntityAITaskEntry> entries = new ArrayList(entity.tasks.taskEntries);
entries.addAll(new ArrayList(entity.targetTasks.taskEntries));
List<EntityAITaskEntry> entries = new ArrayList(entity.tasks.taskEntries);
entries.addAll(new ArrayList(entity.targetTasks.taskEntries));
for (EntityAITaskEntry entry : entries)
if (entry.action instanceof EntityAINearestAttackableTarget)
messWithGetTargetAI((EntityAINearestAttackableTarget) entry.action);
else if (entry.action instanceof EntityAIAttackOnCollide)
messWithAttackOnCollideAI((EntityAIAttackOnCollide) entry.action);
for(EntityAITaskEntry entry : entries)
if(entry.action instanceof EntityAINearestAttackableTarget)
messWithGetTargetAI((EntityAINearestAttackableTarget) entry.action);
else if(entry.action instanceof EntityAIAttackOnCollide)
messWithAttackOnCollideAI((EntityAIAttackOnCollide) entry.action);
mana -= cost;
sync();
break;
}
mana -= cost;
sync();
break;
}
}
}
}
}
private void messWithGetTargetAI(EntityAINearestAttackableTarget aiEntry) {
@@ -40,9 +40,7 @@ public class SubTileHopperhock extends SubTileFunctional {
int filterType = 0;
private static final ForgeDirection[] VALID_DIRS = new ForgeDirection[]{
ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST
};
private static final ForgeDirection[] VALID_DIRS = new ForgeDirection[]{ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST};
@Override
public void onUpdate() {
@@ -56,9 +54,8 @@ public class SubTileHopperhock extends SubTileFunctional {
int z = supertile.zCoord;
List<EntityItem> items = supertile.getWorldObj().getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x - range, y - 3, z - range, x + range + 1, y + 3, z + range + 1));
for (EntityItem item : items) {
if (item.age < 60)
continue;
for(EntityItem item : items) {
if(item.age < 60) continue;
ItemStack stack = item.getEntityItem();
@@ -66,25 +63,24 @@ public class SubTileHopperhock extends SubTileFunctional {
ForgeDirection sideToPutItemIn = ForgeDirection.UNKNOWN;
boolean priorityInv = false;
for (ForgeDirection dir : VALID_DIRS) {
for(ForgeDirection dir : VALID_DIRS) {
int x_ = x + dir.offsetX;
int y_ = y + dir.offsetY;
int z_ = z + dir.offsetZ;
IInventory inv = InventoryHelper.getInventory(supertile.getWorldObj(), x_, y_, z_);
if (inv != null) {
if(inv != null) {
List<ItemStack> filter = getFilterForInventory(inv, x_, y_, z_, true);
boolean canAccept = canAcceptItem(stack, filter, filterType);
int stackSize = InventoryHelper.testInventoryInsertion(inv, stack, dir);
canAccept &= stackSize == stack.stackSize;
if (canAccept) {
if(canAccept) {
boolean priority = !filter.isEmpty();
setInv:
{
if (priorityInv && !priority)
break setInv;
if(priorityInv && !priority) break setInv;
invToPutItemIn = inv;
priorityInv = priority;
@@ -94,33 +90,28 @@ public class SubTileHopperhock extends SubTileFunctional {
}
}
if (invToPutItemIn != null) {
if(invToPutItemIn != null) {
InventoryHelper.insertItemIntoInventory(invToPutItemIn, stack.copy(), sideToPutItemIn, -1);
if (!supertile.getWorldObj().isRemote)
item.setDead();
if(!supertile.getWorldObj().isRemote) item.setDead();
pulledAny = true;
break;
}
}
if (pulledAny && mana > 1)
mana--;
if(pulledAny && mana > 1) mana--;
}
public boolean canAcceptItem(ItemStack stack, List<ItemStack> filter, int filterType) {
if (stack == null)
return false;
if(stack == null) return false;
if (filter.isEmpty())
return true;
if(filter.isEmpty()) return true;
switch (filterType) {
switch(filterType) {
case 0: { // Accept items in frames only
for (ItemStack filterEntry : filter) {
if (filterEntry == null)
continue;
for(ItemStack filterEntry : filter) {
if(filterEntry == null) continue;
if (stack.isItemEqual(filterEntry) && ItemStack.areItemStackTagsEqual(filterEntry, stack))
if(stack.isItemEqual(filterEntry) && ItemStack.areItemStackTagsEqual(filterEntry, stack))
return true;
}
@@ -136,28 +127,24 @@ public class SubTileHopperhock extends SubTileFunctional {
public List<ItemStack> getFilterForInventory(IInventory inv, int x, int y, int z, boolean recursiveForDoubleChests) {
List<ItemStack> filter = new ArrayList();
if (recursiveForDoubleChests) {
if(recursiveForDoubleChests) {
TileEntity tileEntity = supertile.getWorldObj().getTileEntity(x, y, z);
Block chest = supertile.getWorldObj().getBlock(x, y, z);
if (tileEntity instanceof TileEntityChest)
for (ForgeDirection dir : VALID_DIRS)
if (supertile.getWorldObj().getBlock(x + dir.offsetX, y, z + dir.offsetZ) == chest) {
filter.addAll(getFilterForInventory((IInventory) supertile.getWorldObj().getTileEntity(x + dir.offsetX, y, z + dir.offsetZ), x + dir.offsetX, y, z + dir.offsetZ, false));
break;
}
if(tileEntity instanceof TileEntityChest) for(ForgeDirection dir : VALID_DIRS)
if(supertile.getWorldObj().getBlock(x + dir.offsetX, y, z + dir.offsetZ) == chest) {
filter.addAll(getFilterForInventory((IInventory) supertile.getWorldObj().getTileEntity(x + dir.offsetX, y, z + dir.offsetZ), x + dir.offsetX, y, z + dir.offsetZ, false));
break;
}
}
final int[] orientationToDir = new int[]{
3, 4, 2, 5
};
final int[] orientationToDir = new int[]{3, 4, 2, 5};
for (ForgeDirection dir : VALID_DIRS) {
for(ForgeDirection dir : VALID_DIRS) {
List<EntityItemFrame> frames = supertile.getWorldObj().getEntitiesWithinAABB(EntityItemFrame.class, AxisAlignedBB.getBoundingBox(x + dir.offsetX, y + dir.offsetY, z + dir.offsetZ, x + dir.offsetX + 1, y + dir.offsetY + 1, z + dir.offsetZ + 1));
for (EntityItemFrame frame : frames) {
for(EntityItemFrame frame : frames) {
int orientation = frame.hangingDirection;
if (orientationToDir[orientation] == dir.ordinal())
filter.add(frame.getDisplayedItem());
if(orientationToDir[orientation] == dir.ordinal()) filter.add(frame.getDisplayedItem());
}
}
@@ -166,7 +153,7 @@ public class SubTileHopperhock extends SubTileFunctional {
@Override
public boolean onWanded(EntityPlayer player, ItemStack wand) {
if (player.isSneaking()) {
if(player.isSneaking()) {
filterType = filterType == 2 ? 0 : filterType + 1;
sync();
@@ -27,22 +27,22 @@ public class SubTileJadedAmaranthus extends SubTileFunctional {
public void onUpdate() {
super.onUpdate();
if (cooldown > 0) {
if(cooldown > 0) {
cooldown--;
return;
}
if (mana >= COST && !supertile.getWorldObj().isRemote) {
if(mana >= COST && !supertile.getWorldObj().isRemote) {
int range = 4;
int x = supertile.xCoord - range + supertile.getWorldObj().rand.nextInt(range * 2 + 1);
int y = supertile.yCoord + range;
int z = supertile.zCoord - range + supertile.getWorldObj().rand.nextInt(range * 2 + 1);
for (int i = 0; i < range * 2; i++) {
for(int i = 0; i < range * 2; i++) {
Block block = supertile.getWorldObj().getBlock(x, y, z);
if ((block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland) && supertile.getWorldObj().isAirBlock(x, y + 1, z)) {
if((block == Blocks.grass || block == Blocks.dirt || block == Blocks.farmland) && supertile.getWorldObj().isAirBlock(x, y + 1, z)) {
int color = supertile.getWorldObj().rand.nextInt(16);
if (ModBlocks.flower.canBlockStay(supertile.getWorldObj(), x, y + 1, z))
if(ModBlocks.flower.canBlockStay(supertile.getWorldObj(), x, y + 1, z))
supertile.getWorldObj().setBlock(x, y + 1, z, ModBlocks.flower, color, 1 | 2);
mana -= COST;
@@ -29,7 +29,7 @@ public class SubTileTangleberrie extends SubTileFunctional {
public void onUpdate() {
super.onUpdate();
if (mana > 0) {
if(mana > 0) {
double x1 = supertile.xCoord + 0.5;
double y1 = supertile.yCoord + 0.5;
double z1 = supertile.zCoord + 0.5;
@@ -40,9 +40,8 @@ public class SubTileTangleberrie extends SubTileFunctional {
AxisAlignedBB boundingBox = AxisAlignedBB.getBoundingBox(x1 - range, y1 - range, z1 - range, x1 + range, y1 + range, z1 + range);
List<EntityLivingBase> entities = supertile.getWorldObj().getEntitiesWithinAABB(EntityLivingBase.class, boundingBox);
for (EntityLivingBase entity : entities) {
if (entity instanceof EntityPlayer)
continue;
for(EntityLivingBase entity : entities) {
if(entity instanceof EntityPlayer) continue;
double x2 = entity.posX;
double y2 = entity.posY;
@@ -50,14 +49,14 @@ public class SubTileTangleberrie extends SubTileFunctional {
float distance = MathHelper.pointDistanceSpace(x1, y1, z1, x2, y2, z2);
if (distance > maxDist && distance < range) {
if(distance > maxDist && distance < range) {
MathHelper.setEntityMotionFromVector(entity, new Vector3(x1, y1, z1), getMotionVelocity());
if (supertile.getWorldObj().rand.nextInt(3) == 0)
if(supertile.getWorldObj().rand.nextInt(3) == 0)
Botania.proxy.sparkleFX(supertile.getWorldObj(), x2 + Math.random() * entity.width, y2 + Math.random() * entity.height, z2 + Math.random() * entity.width, 0.5F, 0.5F, 0.5F, 1F, 3);
}
}
if (supertile.getWorldObj().getTotalWorldTime() % 4 == 0) {
if(supertile.getWorldObj().getTotalWorldTime() % 4 == 0) {
mana--;
sync();
}
@@ -43,26 +43,25 @@ public class SubTileTigerseye extends SubTileFunctional {
List<EntityLiving> entities = supertile.getWorldObj().getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - rangeY, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + rangeY, supertile.zCoord + range));
for (EntityLiving entity : entities) {
for(EntityLiving entity : entities) {
List<EntityAITaskEntry> entries = new ArrayList(entity.tasks.taskEntries);
entries.addAll(new ArrayList(entity.targetTasks.taskEntries));
boolean avoidsOcelots = false;
if (shouldAfffect)
for (EntityAITaskEntry entry : entries) {
if (entry.action instanceof EntityAIAvoidEntity)
avoidsOcelots = messWithRunAwayAI((EntityAIAvoidEntity) entry.action) || avoidsOcelots;
if(shouldAfffect) for(EntityAITaskEntry entry : entries) {
if(entry.action instanceof EntityAIAvoidEntity)
avoidsOcelots = messWithRunAwayAI((EntityAIAvoidEntity) entry.action) || avoidsOcelots;
if (entry.action instanceof EntityAINearestAttackableTarget)
messWithGetTargetAI((EntityAINearestAttackableTarget) entry.action);
}
if(entry.action instanceof EntityAINearestAttackableTarget)
messWithGetTargetAI((EntityAINearestAttackableTarget) entry.action);
}
if (entity instanceof EntityCreeper) {
if(entity instanceof EntityCreeper) {
ReflectionHelper.setPrivateValue(EntityCreeper.class, (EntityCreeper) entity, 2, LibObfuscation.TIME_SINCE_IGNITED);
entity.setAttackTarget(null);
}
if (avoidsOcelots) {
if(avoidsOcelots) {
mana -= cost;
sync();
shouldAfffect = false;
@@ -71,7 +70,7 @@ public class SubTileTigerseye extends SubTileFunctional {
}
private boolean messWithRunAwayAI(EntityAIAvoidEntity aiEntry) {
if (ReflectionHelper.getPrivateValue(EntityAIAvoidEntity.class, aiEntry, LibObfuscation.TARGET_ENTITY_CLASS) == EntityOcelot.class) {
if(ReflectionHelper.getPrivateValue(EntityAIAvoidEntity.class, aiEntry, LibObfuscation.TARGET_ENTITY_CLASS) == EntityOcelot.class) {
ReflectionHelper.setPrivateValue(EntityAIAvoidEntity.class, aiEntry, EntityPlayer.class, LibObfuscation.TARGET_ENTITY_CLASS);
return true;
}
@@ -79,7 +78,7 @@ public class SubTileTigerseye extends SubTileFunctional {
}
private void messWithGetTargetAI(EntityAINearestAttackableTarget aiEntry) {
if (ReflectionHelper.getPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, LibObfuscation.TARGET_CLASS) == EntityPlayer.class)
if(ReflectionHelper.getPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, LibObfuscation.TARGET_CLASS) == EntityPlayer.class)
ReflectionHelper.setPrivateValue(EntityAINearestAttackableTarget.class, aiEntry, EntityEnderCrystal.class, LibObfuscation.TARGET_CLASS); // Something random that won't be around
}
@@ -34,11 +34,11 @@ public class SubtileOrechid extends SubTileFunctional {
public void onUpdate() {
super.onUpdate();
if (!supertile.getWorldObj().isRemote && mana >= COST && supertile.getWorldObj().getTotalWorldTime() % 100 == 0) {
if(!supertile.getWorldObj().isRemote && mana >= COST && supertile.getWorldObj().getTotalWorldTime() % 100 == 0) {
ChunkCoordinates coords = getCoordsToPut();
if (coords != null) {
if(coords != null) {
ItemStack stack = getOreToPut();
if (stack != null) {
if(stack != null) {
supertile.getWorldObj().setBlock(coords.posX, coords.posY, coords.posZ, Block.getBlockFromItem(stack.getItem()), stack.getItemDamage(), 1 | 2);
mana -= COST;
@@ -50,14 +50,13 @@ public class SubtileOrechid extends SubTileFunctional {
public ItemStack getOreToPut() {
Collection<WeightedRandom.Item> values = new ArrayList();
for (String s : BotaniaAPI.oreWeights.keySet())
for(String s : BotaniaAPI.oreWeights.keySet())
values.add(new StringRandomItem(BotaniaAPI.oreWeights.get(s), s));
String ore = ((StringRandomItem) WeightedRandom.getRandomItem(supertile.getWorldObj().rand, values)).s;
List<ItemStack> ores = OreDictionary.getOres(ore);
if (ores.isEmpty())
return getOreToPut();
if(ores.isEmpty()) return getOreToPut();
return ores.get(0);
}
@@ -67,19 +66,18 @@ public class SubtileOrechid extends SubTileFunctional {
int range = 5;
int rangeY = 3;
for (int i = -range; i < range; i++)
for (int j = -rangeY; j < rangeY; j++)
for (int k = -range; k < range; k++) {
for(int i = -range; i < range; i++)
for(int j = -rangeY; j < rangeY; j++)
for(int k = -range; k < range; k++) {
int x = supertile.xCoord + i;
int y = supertile.yCoord + j;
int z = supertile.zCoord + k;
Block block = supertile.getWorldObj().getBlock(x, y, z);
if (block != null && block.isReplaceableOreGen(supertile.getWorldObj(), x, y, z, Blocks.stone))
if(block != null && block.isReplaceableOreGen(supertile.getWorldObj(), x, y, z, Blocks.stone))
possibleCoords.add(new ChunkCoordinates(x, y, z));
}
if (possibleCoords.isEmpty())
return null;
if(possibleCoords.isEmpty()) return null;
return possibleCoords.get(supertile.getWorldObj().rand.nextInt(possibleCoords.size()));
}
@@ -26,12 +26,11 @@ public class SubTileArcaneRose extends SubTileGenerating {
public void onUpdate() {
super.onUpdate();
if (mana >= getMaxMana())
return;
if(mana >= getMaxMana()) return;
List<EntityPlayer> players = supertile.getWorldObj().getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - 1, supertile.yCoord, supertile.zCoord - 1, supertile.xCoord + 2, supertile.yCoord + 1, supertile.zCoord + 2));
for (EntityPlayer player : players)
if (ExperienceHelper.getPlayerXP(player) >= 1 && player.onGround) {
for(EntityPlayer player : players)
if(ExperienceHelper.getPlayerXP(player) >= 1 && player.onGround) {
ExperienceHelper.drainPlayerXP(player, 1);
mana += 10;
sync();
@@ -34,27 +34,25 @@ public class SubTileEndoflame extends SubTileGenerating {
public void onUpdate() {
super.onUpdate();
if (linkedCollector != null) {
if (burnTime == 0) {
if (mana < getMaxMana() && !supertile.getWorldObj().isRemote) {
if(linkedCollector != null) {
if(burnTime == 0) {
if(mana < getMaxMana() && !supertile.getWorldObj().isRemote) {
final int range = 3;
boolean didSomething = false;
List<EntityItem> items = supertile.getWorldObj().getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(supertile.xCoord - range, supertile.yCoord - range, supertile.zCoord - range, supertile.xCoord + range, supertile.yCoord + range, supertile.zCoord + range));
for (EntityItem item : items) {
if (item.age >= 60 && !item.isDead) {
for(EntityItem item : items) {
if(item.age >= 60 && !item.isDead) {
ItemStack stack = item.getEntityItem();
if (stack.getItem().hasContainerItem(stack))
continue;
if(stack.getItem().hasContainerItem(stack)) continue;
int burnTime = stack == null || stack.getItem() == Item.getItemFromBlock(ModBlocks.spreader) ? 0 : TileEntityFurnace.getItemBurnTime(stack);
if (burnTime > 0 && stack.stackSize > 0) {
if(burnTime > 0 && stack.stackSize > 0) {
this.burnTime = burnTime / 2;
stack.stackSize--;
if (stack.stackSize == 0)
item.setDead();
if(stack.stackSize == 0) item.setDead();
didSomething = true;
@@ -63,11 +61,10 @@ public class SubTileEndoflame extends SubTileGenerating {
}
}
if (didSomething)
sync();
if(didSomething) sync();
}
} else {
if (supertile.getWorldObj().rand.nextInt(8) == 0)
if(supertile.getWorldObj().rand.nextInt(8) == 0)
Botania.proxy.wispFX(supertile.getWorldObj(), supertile.xCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.yCoord + 0.55 + Math.random() * 0.2 - 0.1, supertile.zCoord + 0.5, 0.7F, 0.05F, 0.05F, (float) Math.random() / 6, (float) -Math.random() / 60);
burnTime--;
@@ -33,27 +33,24 @@ public class SubTileHydroangeas extends SubTileGenerating {
boolean didSomething = false;
if (burnTime == 0) {
if (supertile.getWorldObj().getWorldTime() % 40L == 0) {
if (mana < getMaxMana() && !supertile.getWorldObj().isRemote)
for (int i = -range; i <= range; i++)
for (int j = -range; j <= range; j++) {
if (supertile.getWorldObj().getBlock(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j) == getBlockToSearchFor() && supertile.getWorldObj().getBlockMetadata(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j) == 0) {
supertile.getWorldObj().setBlockToAir(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j);
didSomething = true;
burnTime += getBurnTime();
if(burnTime == 0) {
if(supertile.getWorldObj().getWorldTime() % 40L == 0) {
if(mana < getMaxMana() && !supertile.getWorldObj().isRemote) for(int i = -range; i <= range; i++)
for(int j = -range; j <= range; j++) {
if(supertile.getWorldObj().getBlock(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j) == getBlockToSearchFor() && supertile.getWorldObj().getBlockMetadata(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j) == 0) {
supertile.getWorldObj().setBlockToAir(supertile.xCoord + i, supertile.yCoord, supertile.zCoord + j);
didSomething = true;
burnTime += getBurnTime();
break;
break;
}
}
}
if (didSomething)
sync();
if(didSomething) sync();
}
} else {
if (supertile.getWorldObj().rand.nextInt(8) == 0)
doBurnParticles();
if(supertile.getWorldObj().rand.nextInt(8) == 0) doBurnParticles();
burnTime--;
}
}
@@ -34,11 +34,10 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory {
public boolean collideEntityItem(EntityItem item) {
ItemStack stack = item.getEntityItem();
if (stack == null)
return false;
if(stack == null) return false;
if (!hasWater) {
if (stack.getItem() == Items.water_bucket) {
if(!hasWater) {
if(stack.getItem() == Items.water_bucket) {
hasWater = true;
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
stack.func_150996_a(Items.bucket); // Set item
@@ -48,17 +47,15 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory {
boolean didChange = false;
if (stack.getItem() instanceof IFlowerComponent) {
if (getStackInSlot(getSizeInventory() - 1) != null)
return false;
if(stack.getItem() instanceof IFlowerComponent) {
if(getStackInSlot(getSizeInventory() - 1) != null) return false;
if (!worldObj.isRemote) {
if(!worldObj.isRemote) {
stack.stackSize--;
if (stack.stackSize == 0)
item.setDead();
if(stack.stackSize == 0) item.setDead();
for (int i = 0; i < getSizeInventory(); i++)
if (getStackInSlot(i) == null) {
for(int i = 0; i < getSizeInventory(); i++)
if(getStackInSlot(i) == null) {
ItemStack stackToPut = stack.copy();
stackToPut.stackSize = 1;
setInventorySlotContents(i, stackToPut);
@@ -66,16 +63,15 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory {
break;
}
}
} else if (stack.getItem() == Items.wheat_seeds) {
for (RecipePetals recipe : BotaniaAPI.petalRecipes) {
if (recipe.matches(this)) {
for (int i = 0; i < getSizeInventory(); i++)
} else if(stack.getItem() == Items.wheat_seeds) {
for(RecipePetals recipe : BotaniaAPI.petalRecipes) {
if(recipe.matches(this)) {
for(int i = 0; i < getSizeInventory(); i++)
setInventorySlotContents(i, null);
if (!worldObj.isRemote) {
if(!worldObj.isRemote) {
stack.stackSize--;
if (stack.stackSize == 0)
item.setDead();
if(stack.stackSize == 0) item.setDead();
ItemStack output = recipe.getOutput().copy();
EntityItem outputItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, output);
@@ -96,7 +92,7 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory {
public void craftingFanciness() {
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.levelup", 1F, 1F);
for (int i = 0; i < 25; i++) {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
@@ -110,18 +106,16 @@ public class TileAltar extends TileSimpleInventory implements ISidedInventory {
boolean didChange = false;
for (EntityItem item : items)
for(EntityItem item : items)
didChange = collideEntityItem(item) || didChange;
if (didChange)
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
if(didChange) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
for (int i = 0; i < getSizeInventory(); i++) {
for(int i = 0; i < getSizeInventory(); i++) {
ItemStack stackAt = getStackInSlot(i);
if (stackAt == null)
break;
if(stackAt == null) break;
if (Math.random() >= 0.97) {
if(Math.random() >= 0.97) {
Color color = new Color(((IFlowerComponent) stackAt.getItem()).getParticleColor(stackAt));
float red = color.getRed() / 255F;
float green = color.getGreen() / 255F;
@@ -23,19 +23,16 @@ 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
};
static final ForgeDirection[] DIRECTIONS = new ForgeDirection[]{ForgeDirection.NORTH, ForgeDirection.SOUTH, ForgeDirection.EAST, ForgeDirection.WEST};
@Override
public void updateEntity() {
validPools.clear();
for (ForgeDirection dir : DIRECTIONS) {
for(ForgeDirection dir : DIRECTIONS) {
TileEntity tileAt = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ);
if (tileAt != null && tileAt instanceof IManaPool) {
if(tileAt != null && tileAt instanceof IManaPool) {
IManaReceiver receiver = (IManaReceiver) tileAt;
if (!receiver.isFull())
validPools.add(receiver);
if(!receiver.isFull()) validPools.add(receiver);
}
}
}
@@ -53,9 +50,9 @@ public class TileDistributor extends TileMod implements IManaReceiver {
@Override
public void recieveMana(int mana) {
int tiles = validPools.size();
if (tiles != 0) {
if(tiles != 0) {
int manaForEach = mana / tiles;
for (IManaReceiver pool : validPools) {
for(IManaReceiver pool : validPools) {
pool.recieveMana(manaForEach);
TileEntity tile = (TileEntity) pool;
worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
@@ -51,40 +51,27 @@ public class TileEnchanter extends TileMod implements IManaReceiver {
public ItemStack itemToEnchant = null;
List<EnchantmentData> enchants = new ArrayList();
private static final int[][] OBSIDIAN_LOCATIONS = new int[][]{
{0, -1, 0},
{0, -1, 1}, {0, -1, -1}, {1, -1, 0}, {-1, -1, 0},
{0, -1, 2}, {-1, -1, 2}, {1, -1, 2},
{0, -1, -2}, {-1, -1, -2}, {1, -1, -2},
{2, -1, 0}, {2, -1, 1}, {2, -1, -1},
{-2, -1, 0}, {-2, -1, 1}, {-2, -1, -1}
};
private static final int[][] OBSIDIAN_LOCATIONS = new int[][]{{0, -1, 0}, {0, -1, 1}, {0, -1, -1}, {1, -1, 0}, {-1, -1, 0}, {0, -1, 2}, {-1, -1, 2}, {1, -1, 2}, {0, -1, -2}, {-1, -1, -2}, {1, -1, -2}, {2, -1, 0}, {2, -1, 1}, {2, -1, -1}, {-2, -1, 0}, {-2, -1, 1}, {-2, -1, -1}};
private static final int[][][] PYLON_LOCATIONS = new int[][][]{
{{-5, 1, 0}, {5, 1, 0}, {-4, 1, 3}, {4, 1, 3}, {-4, 1, -3}, {4, 1, -3}},
{{0, 1, -5}, {0, 1, 5}, {3, 1, -4}, {3, 1, 4}, {-3, 1, -4}, {-3, 1, 4}}
};
private static final int[][][] PYLON_LOCATIONS = new int[][][]{{{-5, 1, 0}, {5, 1, 0}, {-4, 1, 3}, {4, 1, 3}, {-4, 1, -3}, {4, 1, -3}}, {{0, 1, -5}, {0, 1, 5}, {3, 1, -4}, {3, 1, 4}, {-3, 1, -4}, {-3, 1, 4}}};
private static final int[][] FLOWER_LOCATIONS = new int[][]{
{-1, 0, -1}, {1, 0, -1}, {-1, 0, 1}, {1, 0, 1}
};
private static final int[][] FLOWER_LOCATIONS = new int[][]{{-1, 0, -1}, {1, 0, -1}, {-1, 0, 1}, {1, 0, 1}};
public void onWanded(EntityPlayer player, ItemStack wand) {
if (stage != 0 || itemToEnchant == null || !itemToEnchant.isItemEnchantable())
return;
if(stage != 0 || itemToEnchant == null || !itemToEnchant.isItemEnchantable()) return;
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord - 2, yCoord, zCoord - 2, xCoord + 3, yCoord + 1, zCoord + 3));
int count = items.size();
if (count > 0 && !worldObj.isRemote) {
for (EntityItem entity : items) {
if(count > 0 && !worldObj.isRemote) {
for(EntityItem entity : items) {
ItemStack item = entity.getEntityItem();
if (item.getItem() == Items.enchanted_book) {
if(item.getItem() == Items.enchanted_book) {
NBTTagList enchants = Items.enchanted_book.func_92110_g(item);
if (enchants != null && enchants.tagCount() > 0) {
if(enchants != null && enchants.tagCount() > 0) {
NBTTagCompound enchant = (NBTTagCompound) enchants.getCompoundTagAt(0);
short id = enchant.getShort("id");
if (isEnchantmentValid(id)) {
if(isEnchantmentValid(id)) {
advanceStage();
return;
}
@@ -96,14 +83,13 @@ public class TileEnchanter extends TileMod implements IManaReceiver {
@Override
public void updateEntity() {
if (!canEnchanterExist(worldObj, xCoord, yCoord, zCoord, getBlockMetadata())) {
for (int[] pylon : PYLON_LOCATIONS[getBlockMetadata()]) {
if(!canEnchanterExist(worldObj, xCoord, yCoord, zCoord, getBlockMetadata())) {
for(int[] pylon : PYLON_LOCATIONS[getBlockMetadata()]) {
TilePylon pylonTile = (TilePylon) worldObj.getTileEntity(xCoord + pylon[0], yCoord + pylon[1], zCoord + pylon[2]);
if (pylonTile != null)
pylonTile.activated = false;
if(pylonTile != null) pylonTile.activated = false;
}
worldObj.setBlock(xCoord, yCoord, zCoord, Blocks.lapis_block, 0, 1 | 2);
for (int i = 0; i < 50; i++) {
for(int i = 0; i < 50; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
@@ -112,23 +98,23 @@ public class TileEnchanter extends TileMod implements IManaReceiver {
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "mob.blaze.breathe", 0.5F, 10F);
}
switch (stage) {
switch(stage) {
case 1: { // Get books
if (stageTicks % 20 == 0) {
if(stageTicks % 20 == 0) {
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord - 2, yCoord, zCoord - 2, xCoord + 3, yCoord + 1, zCoord + 3));
int count = items.size();
boolean addedEnch = false;
if (count > 0 && !worldObj.isRemote) {
for (EntityItem entity : items) {
if(count > 0 && !worldObj.isRemote) {
for(EntityItem entity : items) {
ItemStack item = entity.getEntityItem();
if (item.getItem() == Items.enchanted_book) {
if(item.getItem() == Items.enchanted_book) {
NBTTagList enchants = Items.enchanted_book.func_92110_g(item);
if (enchants != null && enchants.tagCount() > 0) {
if(enchants != null && enchants.tagCount() > 0) {
NBTTagCompound enchant = (NBTTagCompound) enchants.getCompoundTagAt(0);
short enchantId = enchant.getShort("id");
short enchantLvl = enchant.getShort("lvl");
if (!hasEnchantAlready(enchantId)) {
if(!hasEnchantAlready(enchantId)) {
this.enchants.add(new EnchantmentData(enchantId, enchantLvl));
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.orb", 1F, 1F);
addedEnch = true;
@@ -139,18 +125,17 @@ public class TileEnchanter extends TileMod implements IManaReceiver {
}
}
if (!addedEnch) {
if (enchants.isEmpty())
stage = 0;
if(!addedEnch) {
if(enchants.isEmpty()) stage = 0;
else advanceStage();
}
}
break;
}
case 2: { // Get Mana
for (int[] pylon : PYLON_LOCATIONS[getBlockMetadata()]) {
for(int[] pylon : PYLON_LOCATIONS[getBlockMetadata()]) {
TilePylon pylonTile = (TilePylon) worldObj.getTileEntity(xCoord + pylon[0], yCoord + pylon[1], zCoord + pylon[2]);
if (pylonTile != null) {
if(pylonTile != null) {
pylonTile.activated = true;
pylonTile.centerX = xCoord;
pylonTile.centerY = yCoord;
@@ -158,35 +143,34 @@ public class TileEnchanter extends TileMod implements IManaReceiver {
}
}
if (manaRequired == -1) {
if(manaRequired == -1) {
manaRequired = 0;
for (EnchantmentData data : enchants) {
for(EnchantmentData data : enchants) {
Enchantment ench = Enchantment.enchantmentsList[data.enchant];
manaRequired += (int) (3000F * ((15 - ench.getWeight()) * 1.45F) * ((3F + data.level * data.level) * 0.25F) * (0.9F + enchants.size() * 0.05F));
}
} else if (mana >= manaRequired) {
} else if(mana >= manaRequired) {
manaRequired = 0;
for (int[] pylon : PYLON_LOCATIONS[getBlockMetadata()])
for(int[] pylon : PYLON_LOCATIONS[getBlockMetadata()])
((TilePylon) worldObj.getTileEntity(xCoord + pylon[0], yCoord + pylon[1], zCoord + pylon[2])).activated = false;
advanceStage();
} else {
getManaFromPools:
{
for (int i = -4; i < 5; i++)
for (int j = -4; j < 5; j++) {
for(int i = -4; i < 5; i++)
for(int j = -4; j < 5; j++) {
TileEntity tile = worldObj.getTileEntity(xCoord + i, yCoord, zCoord + j);
if (tile instanceof IManaPool) {
if(tile instanceof IManaPool) {
IManaPool pool = (IManaPool) tile;
int manaToRemove = Math.min(pool.getCurrentMana(), Math.min(1000, manaRequired - mana + 1));
if (!worldObj.isRemote) {
if(!worldObj.isRemote) {
pool.recieveMana(-manaToRemove);
recieveMana((int) (manaToRemove * 0.9));
sync();
}
if (mana >= manaRequired)
break getManaFromPools;
if(mana >= manaRequired) break getManaFromPools;
}
}
}
@@ -195,8 +179,8 @@ public class TileEnchanter extends TileMod implements IManaReceiver {
break;
}
case 3: { // Enchant
if (stageTicks >= 100) {
for (EnchantmentData data : enchants)
if(stageTicks >= 100) {
for(EnchantmentData data : enchants)
itemToEnchant.addEnchantment(Enchantment.enchantmentsList[data.enchant], data.level);
enchants.clear();
@@ -209,23 +193,20 @@ public class TileEnchanter extends TileMod implements IManaReceiver {
break;
}
case 4: { // Reset
if (stageTicks >= 20)
advanceStage();
if(stageTicks >= 20) advanceStage();
break;
}
}
if (stage != 0)
stageTicks++;
if(stage != 0) stageTicks++;
}
public void advanceStage() {
stage++;
if (stage == 4)
stage3EndTicks = stageTicks;
else if (stage == 5) {
if(stage == 4) stage3EndTicks = stageTicks;
else if(stage == 5) {
stage = 0;
stage3EndTicks = 0;
}
@@ -236,7 +217,7 @@ public class TileEnchanter extends TileMod implements IManaReceiver {
public void craftingFanciness() {
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.levelup", 1F, 1F);
for (int i = 0; i < 25; i++) {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
@@ -277,12 +258,11 @@ public class TileEnchanter extends TileMod implements IManaReceiver {
cmp.setInteger(TAG_STAGE_3_END_TICKS, stage3EndTicks);
NBTTagCompound itemCmp = new NBTTagCompound();
if (itemToEnchant != null)
itemToEnchant.writeToNBT(itemCmp);
if(itemToEnchant != null) itemToEnchant.writeToNBT(itemCmp);
cmp.setTag(TAG_ITEM, itemCmp);
String enchStr = "";
for (EnchantmentData data : enchants)
for(EnchantmentData data : enchants)
enchStr = enchStr + data.enchant + ":" + data.level + ",";
cmp.setString(TAG_ENCHANTS, enchStr.isEmpty() ? enchStr : enchStr.substring(0, enchStr.length() - 1));
}
@@ -300,9 +280,9 @@ public class TileEnchanter extends TileMod implements IManaReceiver {
enchants.clear();
String enchStr = cmp.getString(TAG_ENCHANTS);
if (!enchStr.isEmpty()) {
if(!enchStr.isEmpty()) {
String[] enchTokens = enchStr.split(",");
for (String token : enchTokens) {
for(String token : enchTokens) {
String[] entryTokens = token.split(":");
int id = Integer.parseInt(entryTokens[0]);
int lvl = Integer.parseInt(entryTokens[1]);
@@ -312,40 +292,34 @@ public class TileEnchanter extends TileMod implements IManaReceiver {
}
private boolean hasEnchantAlready(int enchant) {
for (EnchantmentData data : enchants)
if (data.enchant == enchant)
return true;
for(EnchantmentData data : enchants)
if(data.enchant == enchant) return true;
return false;
}
public boolean isEnchantmentValid(short id) {
Enchantment ench = Enchantment.enchantmentsList[id];
if (!ench.canApply(itemToEnchant) || !ench.type.canEnchantItem(itemToEnchant.getItem()))
return false;
if(!ench.canApply(itemToEnchant) || !ench.type.canEnchantItem(itemToEnchant.getItem())) return false;
for (EnchantmentData data : enchants) {
for(EnchantmentData data : enchants) {
Enchantment otherEnch = Enchantment.enchantmentsList[data.enchant];
if (!otherEnch.canApplyTogether(ench) || !ench.canApplyTogether(otherEnch))
return false;
if(!otherEnch.canApplyTogether(ench) || !ench.canApplyTogether(otherEnch)) return false;
}
return true;
}
public static boolean canEnchanterExist(World world, int x, int y, int z, int meta) {
for (int[] obsidian : OBSIDIAN_LOCATIONS)
if (world.getBlock(obsidian[0] + x, obsidian[1] + y, obsidian[2] + z) != Blocks.obsidian)
for(int[] obsidian : OBSIDIAN_LOCATIONS)
if(world.getBlock(obsidian[0] + x, obsidian[1] + y, obsidian[2] + z) != Blocks.obsidian) return false;
for(int[] pylon : PYLON_LOCATIONS[meta])
if(world.getBlock(pylon[0] + x, pylon[1] + y, pylon[2] + z) != ModBlocks.pylon || world.getBlock(pylon[0] + x, pylon[1] + y - 1, pylon[2] + z) != ModBlocks.flower)
return false;
for (int[] pylon : PYLON_LOCATIONS[meta])
if (world.getBlock(pylon[0] + x, pylon[1] + y, pylon[2] + z) != ModBlocks.pylon ||
world.getBlock(pylon[0] + x, pylon[1] + y - 1, pylon[2] + z) != ModBlocks.flower)
return false;
for (int[] flower : FLOWER_LOCATIONS)
if (world.getBlock(flower[0] + x, flower[1] + y, flower[2] + z) != ModBlocks.flower)
return false;
for(int[] flower : FLOWER_LOCATIONS)
if(world.getBlock(flower[0] + x, flower[1] + y, flower[2] + z) != ModBlocks.flower) return false;
return true;
}
@@ -20,20 +20,19 @@ public class TileManaBeacon extends TileMod {
@Override
public void updateEntity() {
boolean redstone = false;
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
int redstoneSide = worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal());
if (redstoneSide > 0)
redstone = true;
if(redstoneSide > 0) redstone = true;
}
if (!redstone) {
if(!redstone) {
float[] color = EntitySheep.fleeceColorTable[worldObj.getBlockMetadata(xCoord, yCoord, zCoord)];
Botania.proxy.setWispFXDistanceLimit(false);
for (int i = 0; i < 3; i++)
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 - yCoord)), (float) (Math.random() - 0.5F));
for (int i = 0; i < 4; i++)
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);
}
@@ -19,11 +19,10 @@ public class TileManaDetector extends TileMod implements IManaCollisionGhost {
@Override
public void updateEntity() {
if (!worldObj.isRemote) {
if(!worldObj.isRemote) {
int meta = getBlockMetadata();
int expectedMeta = worldObj.getEntitiesWithinAABB(IManaBurst.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1)).size() != 0 ? 1 : 0;
if (meta != expectedMeta)
worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, expectedMeta, 1 | 2);
if(meta != expectedMeta) worldObj.setBlockMetadataWithNotify(xCoord, yCoord, zCoord, expectedMeta, 1 | 2);
}
}
@@ -60,8 +60,7 @@ public class TilePool extends TileMod implements IManaPool {
boolean full = this.mana >= MAX_MANA;
this.mana = Math.min(this.mana + mana, MAX_MANA);
if (!full)
worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
if(!full) worldObj.func_147453_f(xCoord, yCoord, zCoord, worldObj.getBlock(xCoord, yCoord, zCoord));
}
@Override
@@ -79,19 +78,17 @@ public class TilePool extends TileMod implements IManaPool {
public boolean collideEntityItem(EntityItem item) {
boolean didChange = false;
ItemStack stack = item.getEntityItem();
if (stack == null)
return false;
if(stack == null) return false;
for (RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
if (recipe.matches(stack)) {
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
if(recipe.matches(stack)) {
int mana = recipe.getManaToConsume();
if (getCurrentMana() >= mana) {
if(getCurrentMana() >= mana) {
recieveMana(-mana);
if (!worldObj.isRemote) {
if(!worldObj.isRemote) {
stack.stackSize--;
if (stack.stackSize == 0)
item.setDead();
if(stack.stackSize == 0) item.setDead();
ItemStack output = recipe.getOutput().copy();
EntityItem outputItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, output);
@@ -110,7 +107,7 @@ public class TilePool extends TileMod implements IManaPool {
public void craftingFanciness() {
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.levelup", 1F, 1F);
for (int i = 0; i < 25; i++) {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
@@ -120,44 +117,42 @@ public class TilePool extends TileMod implements IManaPool {
@Override
public void updateEntity() {
if (!added) {
if(!added) {
ManaNetworkEvent.addPool(this);
added = true;
}
if (worldObj.isRemote) {
if(worldObj.isRemote) {
double particleChance = 1F - (double) getCurrentMana() / (double) MAX_MANA * 0.1;
Color color = new Color(0x00C6FF);
if (Math.random() > particleChance)
if(Math.random() > particleChance)
Botania.proxy.wispFX(worldObj, xCoord + 0.3 + Math.random() * 0.5, yCoord + 0.6 + Math.random() * 0.25, zCoord + Math.random(), color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random() / 3F, (float) -Math.random() / 25F);
}
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1));
for (EntityItem item : items) {
for(EntityItem item : items) {
ItemStack stack = item.getEntityItem();
if (stack != null && stack.getItem() instanceof IManaItem) {
if(stack != null && stack.getItem() instanceof IManaItem) {
IManaItem mana = (IManaItem) stack.getItem();
if (outputting && mana.canReceiveManaFromPool(stack, this) || !outputting && mana.canExportManaToPool(stack, this)) {
if(outputting && mana.canReceiveManaFromPool(stack, this) || !outputting && mana.canExportManaToPool(stack, this)) {
boolean didSomething = false;
if (outputting) {
if (this.mana > 0)
didSomething = true;
if(outputting) {
if(this.mana > 0) didSomething = true;
int manaVal = Math.min(1000, Math.min(this.mana, mana.getMaxMana(stack) - mana.getMana(stack)));
mana.addMana(stack, manaVal);
recieveMana(-manaVal);
} else {
if (mana.getMana(stack) > 0)
didSomething = true;
if(mana.getMana(stack) > 0) didSomething = true;
int manaVal = Math.min(1000, Math.min(MAX_MANA - this.mana, mana.getMana(stack)));
mana.addMana(stack, -manaVal);
recieveMana(manaVal);
}
if (didSomething) {
if(didSomething) {
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
if (worldObj.isRemote) {
if(worldObj.isRemote) {
Color color = new Color(0x00C6FF);
Botania.proxy.wispFX(worldObj, item.posX + Math.random() * 0.5 - 0.25, item.posY + Math.random() * 0.5 - (outputting ? 0.65 : 0.25), item.posZ + Math.random() * 0.5 - 0.25, color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F, (float) Math.random() / 15F, (outputting ? -1F : 1) * (float) Math.random() / 25F);
}
@@ -178,21 +173,20 @@ public class TilePool extends TileMod implements IManaPool {
mana = cmp.getInteger(TAG_MANA);
outputting = cmp.getBoolean(TAG_OUTPUTTING);
if (cmp.hasKey(TAG_KNOWN_MANA))
knownMana = cmp.getInteger(TAG_KNOWN_MANA);
if(cmp.hasKey(TAG_KNOWN_MANA)) knownMana = cmp.getInteger(TAG_KNOWN_MANA);
}
public void onWanded(EntityPlayer player, ItemStack wand) {
if (player.isSneaking()) {
if(player.isSneaking()) {
outputting = !outputting;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
if (!worldObj.isRemote) {
if(!worldObj.isRemote) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeCustomNBT(nbttagcompound);
nbttagcompound.setInteger(TAG_KNOWN_MANA, getCurrentMana());
if (player instanceof EntityPlayerMP)
if(player instanceof EntityPlayerMP)
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound));
}
@@ -25,8 +25,8 @@ public class TilePylon extends TileEntity {
@Override
public void updateEntity() {
if (activated && worldObj.isRemote) {
if (worldObj.getBlock(centerX, centerY, centerZ) != ModBlocks.enchanter) {
if(activated && worldObj.isRemote) {
if(worldObj.getBlock(centerX, centerY, centerZ) != ModBlocks.enchanter) {
activated = false;
return;
}
@@ -34,11 +34,11 @@ public class TilePylon extends TileEntity {
Vector3 centerBlock = new Vector3(centerX + 0.5, centerY + 0.75 + (Math.random() - 0.5 * 0.25), centerZ + 0.5);
Block block = worldObj.getBlock(xCoord, yCoord - 1, zCoord);
if (block == ModBlocks.flower) {
if(block == ModBlocks.flower) {
int meta = worldObj.getBlockMetadata(xCoord, yCoord - 1, zCoord);
float[] color = EntitySheep.fleeceColorTable[meta];
if (worldObj.rand.nextInt(4) == 0)
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);
@@ -50,7 +50,7 @@ public class TilePylon extends TileEntity {
}
}
if (worldObj.rand.nextBoolean() && worldObj.isRemote)
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);
}
@@ -37,29 +37,27 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
int mana = 0;
public boolean addItem(EntityPlayer player, ItemStack stack) {
if (stack.getItem() == ModItems.twigWand || stack.getItem() == ModItems.lexicon || manaToGet != 0)
return false;
if(stack.getItem() == ModItems.twigWand || stack.getItem() == ModItems.lexicon || manaToGet != 0) return false;
boolean did = false;
for (int i = 0; i < getSizeInventory(); i++)
if (getStackInSlot(i) == null) {
for(int i = 0; i < getSizeInventory(); i++)
if(getStackInSlot(i) == null) {
did = true;
ItemStack stackToAdd = stack.copy();
stackToAdd.stackSize = 1;
setInventorySlotContents(i, stackToAdd);
if (!player.capabilities.isCreativeMode) {
if(!player.capabilities.isCreativeMode) {
stack.stackSize--;
if (stack.stackSize == 0)
if(stack.stackSize == 0)
player.inventory.setInventorySlotContents(player.inventory.currentItem, null);
}
break;
}
if (did)
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
if(did) worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
return true;
}
@@ -71,8 +69,8 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
// Update every tick.
recieveMana(0);
if (worldObj.isRemote && manaToGet > 0 && mana >= manaToGet) {
if (worldObj.rand.nextInt(20) == 0) {
if(worldObj.isRemote && manaToGet > 0 && mana >= manaToGet) {
if(worldObj.rand.nextInt(20) == 0) {
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "mob.creeper.live", 1F, 1F);
Vector3 vec = Vector3.fromTileEntityCenter(this);
@@ -88,15 +86,15 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
getMana:
{
for (RecipeRuneAltar recipe : BotaniaAPI.runeAltarRecipes)
if (recipe.matches(this)) {
for(RecipeRuneAltar recipe : BotaniaAPI.runeAltarRecipes)
if(recipe.matches(this)) {
this.manaToGet = recipe.getManaUsage();
break getMana;
}
this.manaToGet = 0;
}
if (manaToGet != this.manaToGet) {
if(manaToGet != this.manaToGet) {
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.orb", 1F, 1F);
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@@ -107,39 +105,38 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
RecipeRuneAltar recipe = null;
for (RecipeRuneAltar recipe_ : BotaniaAPI.runeAltarRecipes) {
if (recipe_.matches(this)) {
for(RecipeRuneAltar recipe_ : BotaniaAPI.runeAltarRecipes) {
if(recipe_.matches(this)) {
recipe = recipe_;
break;
}
}
if (manaToGet > 0 && mana >= manaToGet) {
if(manaToGet > 0 && mana >= manaToGet) {
List<EntityItem> items = worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(xCoord, yCoord, zCoord, xCoord + 1, yCoord + 1, zCoord + 1));
EntityItem livingrock = null;
for (EntityItem item : items)
if (item.getEntityItem() != null && item.getEntityItem().getItem() == Item.getItemFromBlock(ModBlocks.livingrock)) {
for(EntityItem item : items)
if(item.getEntityItem() != null && item.getEntityItem().getItem() == Item.getItemFromBlock(ModBlocks.livingrock)) {
livingrock = item;
break;
}
if (livingrock != null) {
if(livingrock != null) {
int mana = recipe.getManaUsage();
recieveMana(-mana);
if (!worldObj.isRemote) {
if(!worldObj.isRemote) {
ItemStack output = recipe.getOutput().copy();
EntityItem outputItem = new EntityItem(worldObj, xCoord + 0.5, yCoord + 1.5, zCoord + 0.5, output);
worldObj.spawnEntityInWorld(outputItem);
}
for (int i = 0; i < getSizeInventory(); i++)
for(int i = 0; i < getSizeInventory(); i++)
setInventorySlotContents(i, null);
if (!worldObj.isRemote) {
if(!worldObj.isRemote) {
ItemStack livingrockItem = livingrock.getEntityItem();
livingrockItem.stackSize--;
if (livingrockItem.stackSize == 0)
livingrock.setDead();
if(livingrockItem.stackSize == 0) livingrock.setDead();
}
craftingFanciness();
@@ -151,7 +148,7 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
public void craftingFanciness() {
worldObj.playSoundEffect(xCoord, yCoord, zCoord, "random.levelup", 1F, 1F);
for (int i = 0; i < 25; i++) {
for(int i = 0; i < 25; i++) {
float red = (float) Math.random();
float green = (float) Math.random();
float blue = (float) Math.random();
@@ -191,9 +188,8 @@ public class TileRuneAltar extends TileSimpleInventory implements ISidedInventor
@Override
public int[] getAccessibleSlotsFromSide(int var1) {
int accessibleSlot = -1;
for (int i = 0; i < getSizeInventory(); i++)
if (getStackInSlot(i) != null)
accessibleSlot = i;
for(int i = 0; i < getSizeInventory(); i++)
if(getStackInSlot(i) != null) accessibleSlot = i;
return accessibleSlot == -1 ? new int[0] : new int[]{accessibleSlot};
}
@@ -25,19 +25,18 @@ public abstract class TileSimpleInventory extends TileMod implements IInventory
public void readCustomNBT(NBTTagCompound par1NBTTagCompound) {
NBTTagList var2 = par1NBTTagCompound.getTagList("Items", 10);
inventorySlots = new ItemStack[getSizeInventory()];
for (int var3 = 0; var3 < var2.tagCount(); ++var3) {
for(int var3 = 0; var3 < var2.tagCount(); ++var3) {
NBTTagCompound var4 = (NBTTagCompound) var2.getCompoundTagAt(var3);
byte var5 = var4.getByte("Slot");
if (var5 >= 0 && var5 < inventorySlots.length)
inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
if(var5 >= 0 && var5 < inventorySlots.length) inventorySlots[var5] = ItemStack.loadItemStackFromNBT(var4);
}
}
@Override
public void writeCustomNBT(NBTTagCompound par1NBTTagCompound) {
NBTTagList var2 = new NBTTagList();
for (int var3 = 0; var3 < inventorySlots.length; ++var3) {
if (inventorySlots[var3] != null) {
for(int var3 = 0; var3 < inventorySlots.length; ++var3) {
if(inventorySlots[var3] != null) {
NBTTagCompound var4 = new NBTTagCompound();
var4.setByte("Slot", (byte) var3);
inventorySlots[var3].writeToNBT(var4);
@@ -54,18 +53,17 @@ public abstract class TileSimpleInventory extends TileMod implements IInventory
@Override
public ItemStack decrStackSize(int i, int j) {
if (inventorySlots[i] != null) {
if(inventorySlots[i] != null) {
ItemStack stackAt;
if (inventorySlots[i].stackSize <= j) {
if(inventorySlots[i].stackSize <= j) {
stackAt = inventorySlots[i];
inventorySlots[i] = null;
return stackAt;
} else {
stackAt = inventorySlots[i].splitStack(j);
if (inventorySlots[i].stackSize == 0)
inventorySlots[i] = null;
if(inventorySlots[i].stackSize == 0) inventorySlots[i] = null;
return stackAt;
}
@@ -49,15 +49,14 @@ public class TileSpecialFlower extends TileMod implements ITileBound {
try {
SubTileEntity tile = tileClass.newInstance();
setSubTile(tile);
} catch (Exception e) {
} catch(Exception e) {
e.printStackTrace();
}
}
@Override
public void updateEntity() {
if (subTile != null)
subTile.onUpdate();
if(subTile != null) subTile.onUpdate();
}
@Override
@@ -82,7 +81,7 @@ public class TileSpecialFlower extends TileMod implements ITileBound {
subTileName = cmp.getString(TAG_SUBTILE_NAME);
NBTTagCompound subCmp = cmp.getCompoundTag(TAG_SUBTILE_CMP);
if (subTile == null || !BotaniaAPI.getSubTileStringMapping(subTile.getClass()).equals(subTileName))
if(subTile == null || !BotaniaAPI.getSubTileStringMapping(subTile.getClass()).equals(subTileName))
provideSubTile(subTileName);
subTile.readFromPacketNBT(subCmp);
@@ -101,14 +100,12 @@ public class TileSpecialFlower extends TileMod implements ITileBound {
}
public void renderHUD(Minecraft mc, ScaledResolution res) {
if (subTile != null)
subTile.renderHUD(mc, res);
if(subTile != null) subTile.renderHUD(mc, res);
}
@Override
public ChunkCoordinates getBinding() {
if (subTile == null)
return null;
if(subTile == null) return null;
return subTile.getBinding();
}
}
@@ -19,16 +19,9 @@ public class TileSpiritShrine extends TileMod {
@Override
public void updateEntity() {
if (worldObj.isRemote) {
if (ticks >= 40) {
float[][] colors = new float[][]{
{0F, 0.25F, 1F},
{1F, 0F, 0.2F},
{0F, 1F, 0.25F},
{1F, 1F, 0.25F},
{1F, 0.25F, 1F},
{0.25F, 1F, 1F}
};
if(worldObj.isRemote) {
if(ticks >= 40) {
float[][] colors = new float[][]{{0F, 0.25F, 1F}, {1F, 0F, 0.2F}, {0F, 1F, 0.25F}, {1F, 1F, 0.25F}, {1F, 0.25F, 1F}, {0.25F, 1F, 1F}};
int totalSpiritCount = 6;
double tickIncrement = 360D / totalSpiritCount;
@@ -37,13 +30,13 @@ public class TileSpiritShrine extends TileMod {
int existTicks = liftTicks * 2;
int lowerTicks = existTicks + liftTicks;
if (ticks < lowerTicks) {
if(ticks < lowerTicks) {
int speed = 5;
double wticks = ticks * speed - tickIncrement;
double r = Math.sin((ticks >= liftTicks ? (ticks - liftTicks) * speed - tickIncrement : -tickIncrement) * Math.PI / 180 * 0.75) + 1 * 1.25 + 0.5;
double g = Math.sin(wticks * Math.PI / 180 * 0.55);
for (int i = 0; i < totalSpiritCount; i++) {
for(int i = 0; i < totalSpiritCount; i++) {
double x = xCoord + Math.sin(wticks * Math.PI / 180) * r + 0.5;
double y = yCoord + ((ticks > existTicks ? 40 - (double) (ticks - existTicks) : Math.min(80 + 40 * i, ticks) - 40 * (i + 1)) * 0.1);
double z = zCoord + Math.cos(wticks * Math.PI / 180) * r + 0.5;
@@ -88,19 +88,19 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
@Override
public void updateEntity() {
if (!added) {
if(!added) {
ManaNetworkEvent.addCollector(this);
added = true;
}
boolean redstone = false;
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
TileEntity tileAt = worldObj.getTileEntity(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ);
if (tileAt instanceof IManaPool) {
if(tileAt instanceof IManaPool) {
IManaPool pool = (IManaPool) tileAt;
int manaInPool = pool.getCurrentMana();
if (manaInPool > 0 && !isFull()) {
if(manaInPool > 0 && !isFull()) {
int manaMissing = MAX_MANA - mana;
int manaToRemove = Math.min(manaInPool, manaMissing);
pool.recieveMana(-manaToRemove);
@@ -109,20 +109,16 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
}
int redstoneSide = worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal());
if (redstoneSide > 0)
redstone = true;
if(redstoneSide > 0) redstone = true;
}
if (needsNewBurstSimulation())
checkForReceiver();
if(needsNewBurstSimulation()) checkForReceiver();
boolean shouldShoot = !redstone;
if (isRedstone())
shouldShoot = redstone && !redstoneLastTick;
if(isRedstone()) shouldShoot = redstone && !redstoneLastTick;
if (shouldShoot)
tryShootBurst();
if(shouldShoot) tryShootBurst();
redstoneLastTick = redstone;
}
@@ -145,11 +141,9 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
rotationY = cmp.getFloat(TAG_ROTATION_Y);
requestsClientUpdate = cmp.getBoolean(TAG_REQUEST_UPDATE);
if (cmp.hasKey(TAG_KNOWN_MANA))
knownMana = cmp.getInteger(TAG_KNOWN_MANA);
if(cmp.hasKey(TAG_KNOWN_MANA)) knownMana = cmp.getInteger(TAG_KNOWN_MANA);
if (worldObj != null && worldObj.isRemote)
hasReceivedInitialPacket = true;
if(worldObj != null && worldObj.isRemote) hasReceivedInitialPacket = true;
}
@Override
@@ -163,30 +157,29 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
}
public void onWanded(EntityPlayer player, ItemStack wand) {
if (!player.isSneaking()) {
if (!worldObj.isRemote) {
if(!player.isSneaking()) {
if(!worldObj.isRemote) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
writeCustomNBT(nbttagcompound);
nbttagcompound.setInteger(TAG_KNOWN_MANA, mana);
if (player instanceof EntityPlayerMP)
if(player instanceof EntityPlayerMP)
((EntityPlayerMP) player).playerNetServerHandler.sendPacket(new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, -999, nbttagcompound));
}
worldObj.playSoundAtEntity(player, "random.orb", 0.1F, 1F);
} else {
MovingObjectPosition pos = raytraceFromEntity(worldObj, player, true, 5);
if (pos != null && pos.hitVec != null && !worldObj.isRemote) {
if(pos != null && pos.hitVec != null && !worldObj.isRemote) {
double x = pos.hitVec.xCoord - xCoord - 0.5;
double y = pos.hitVec.yCoord - yCoord - 0.5;
double z = pos.hitVec.zCoord - zCoord - 0.5;
if (pos.sideHit != 0 && pos.sideHit != 1) {
if(pos.sideHit != 0 && pos.sideHit != 1) {
Vector3 clickVector = new Vector3(x, 0, z);
Vector3 relative = new Vector3(-0.5, 0, 0);
double angle = Math.acos(clickVector.dotProduct(relative) / (relative.mag() * clickVector.mag())) * 180D / Math.PI;
rotationX = (float) angle + 180F;
if (clickVector.z < 0)
rotationX = 360 - rotationX;
if(clickVector.z < 0) rotationX = 360 - rotationX;
}
double angle = y * 180;
@@ -200,30 +193,27 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
}
private boolean needsNewBurstSimulation() {
if (worldObj.isRemote && !hasReceivedInitialPacket)
return false;
if(worldObj.isRemote && !hasReceivedInitialPacket) return false;
if (lastTentativeBurst == null)
return true;
if(lastTentativeBurst == null) return true;
if (requestsClientUpdate) {
if(requestsClientUpdate) {
requestsClientUpdate = false;
return true;
}
for (PositionProperties props : lastTentativeBurst)
if (!props.contentsEqual(worldObj))
return true;
for(PositionProperties props : lastTentativeBurst)
if(!props.contentsEqual(worldObj)) return true;
return false;
}
public void tryShootBurst() {
if (receiver != null || isRedstone()) {
if (canShootBurst && (isRedstone() || (receiver.canRecieveManaFromBursts() && !receiver.isFull()))) {
if(receiver != null || isRedstone()) {
if(canShootBurst && (isRedstone() || (receiver.canRecieveManaFromBursts() && !receiver.isFull()))) {
EntityManaBurst burst = getBurst(false);
if (burst != null) {
if (!worldObj.isRemote) {
if(burst != null) {
if(!worldObj.isRemote) {
mana -= burst.getStartingMana();
worldObj.spawnEntityInWorld(burst);
}
@@ -244,8 +234,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
fakeBurst.setScanBeam();
TileEntity receiver = fakeBurst.getCollidedTile(true);
if (receiver != null && receiver instanceof IManaReceiver)
this.receiver = (IManaReceiver) receiver;
if(receiver != null && receiver instanceof IManaReceiver) this.receiver = (IManaReceiver) receiver;
else this.receiver = null;
lastTentativeBurst = fakeBurst.propsList;
}
@@ -262,11 +251,10 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
BurstProperties props = new BurstProperties(maxMana, ticksBeforeManaLoss, manaLossPerTick, gravity, motionModifier, color);
ItemStack lens = getStackInSlot(0);
if (lens != null)
((ILens) lens.getItem()).apply(lens, props);
if(lens != null) ((ILens) lens.getItem()).apply(lens, props);
burst.setSourceLens(lens);
if (getCurrentMana() >= props.maxMana || fake) {
if(getCurrentMana() >= props.maxMana || fake) {
burst.setColor(props.color);
burst.setMana(props.maxMana);
burst.setStartingMana(props.maxMana);
@@ -286,8 +274,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
float f2 = player.prevRotationYaw + (player.rotationYaw - player.prevRotationYaw) * f;
double d0 = player.prevPosX + (player.posX - player.prevPosX) * f;
double d1 = player.prevPosY + (player.posY - player.prevPosY) * f;
if (!world.isRemote && player instanceof EntityPlayer)
d1 += 1.62D;
if(!world.isRemote && player instanceof EntityPlayer) d1 += 1.62D;
double d2 = player.prevPosZ + (player.posZ - player.prevPosZ) * f;
Vec3 vec3 = world.getWorldVec3Pool().getVecFromPool(d0, d1, d2);
float f3 = MathHelper.cos(-f2 * 0.017453292F - (float) Math.PI);
@@ -297,7 +284,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
float f7 = f4 * f5;
float f8 = f3 * f5;
double d3 = range;
if (player instanceof EntityPlayerMP)
if(player instanceof EntityPlayerMP)
d3 = ((EntityPlayerMP) player).theItemInWorldManager.getBlockReachDistance();
Vec3 vec31 = vec3.addVector(f7 * d3, f6 * d3, f8 * d3);
return world.func_147447_a(vec3, vec31, par3, !par3, par3);
@@ -309,7 +296,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
HUDHandler.drawSimpleManaHUD(color, knownMana, MAX_MANA, name, res);
ItemStack lens = getStackInSlot(0);
if (lens != null) {
if(lens != null) {
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
String lensName = lens.getDisplayName();
@@ -325,12 +312,12 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
GL11.glDisable(GL11.GL_BLEND);
}
if (receiver != null) {
if(receiver != null) {
TileEntity receiverTile = (TileEntity) receiver;
ItemStack recieverStack = new ItemStack(worldObj.getBlock(receiverTile.xCoord, receiverTile.yCoord, receiverTile.zCoord), 1, receiverTile.getBlockMetadata());
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
if (recieverStack != null && recieverStack.getItem() != null) {
if(recieverStack != null && recieverStack.getItem() != null) {
String stackName = recieverStack.getDisplayName();
int width = 16 + mc.fontRenderer.getStringWidth(stackName) / 2;
int x = res.getScaledWidth() / 2 - width;
@@ -349,7 +336,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
@Override
public void onClientDisplayTick() {
if (worldObj != null) {
if(worldObj != null) {
EntityManaBurst burst = getBurst(true);
burst.getCollidedTile(false);
}
@@ -388,8 +375,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
@Override
public ChunkCoordinates getBinding() {
if (receiver == null)
return null;
if(receiver == null) return null;
TileEntity tile = (TileEntity) receiver;
return new ChunkCoordinates(tile.xCoord, tile.yCoord, tile.zCoord);
@@ -33,19 +33,17 @@ public class TileTurntable extends TileMod {
public void updateEntity() {
boolean redstone = false;
for (ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
for(ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
int redstoneSide = worldObj.getIndirectPowerLevelTo(xCoord + dir.offsetX, yCoord + dir.offsetY, zCoord + dir.offsetZ, dir.ordinal());
if (redstoneSide > 0)
redstone = true;
if(redstoneSide > 0) redstone = true;
}
if (!redstone) {
if(!redstone) {
TileEntity tile = worldObj.getTileEntity(xCoord, yCoord + 1, zCoord);
if (tile instanceof TileSpreader) {
if(tile instanceof TileSpreader) {
TileSpreader spreader = (TileSpreader) tile;
spreader.rotationX += speed * (backwards ? -1 : 1);
if (spreader.rotationX >= 360F)
spreader.rotationX -= 360F;
if(spreader.rotationX >= 360F) spreader.rotationX -= 360F;
spreader.checkForReceiver();
}
}
@@ -64,8 +62,7 @@ public class TileTurntable extends TileMod {
}
public void onWanded(EntityPlayer player, ItemStack wand) {
if (player.isSneaking())
backwards = !backwards;
if(player.isSneaking()) backwards = !backwards;
else speed = speed == 6 ? 1 : speed + 1;
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
}
@@ -75,7 +72,7 @@ public class TileTurntable extends TileMod {
char motion = backwards ? '<' : '>';
String speed = EnumChatFormatting.BOLD + "";
for (int i = 0; i < this.speed; i++)
for(int i = 0; i < this.speed; i++)
speed = speed + motion;
int x = res.getScaledWidth() / 2 - mc.fontRenderer.getStringWidth(speed) / 2;
@@ -22,18 +22,18 @@ public class BiomeDecorationHandler {
@SubscribeEvent(priority = EventPriority.LOWEST)
public void onWorldDecoration(DecorateBiomeEvent.Decorate event) {
if ((event.getResult() == Result.ALLOW || event.getResult() == Result.DEFAULT) && event.type == EventType.FLOWERS)
for (int i = 0; i < ConfigHandler.flowerQuantity; i++) {
if((event.getResult() == Result.ALLOW || event.getResult() == Result.DEFAULT) && event.type == EventType.FLOWERS)
for(int i = 0; i < ConfigHandler.flowerQuantity; i++) {
int x = event.chunkX + event.rand.nextInt(16) + 8;
int z = event.chunkZ + event.rand.nextInt(16) + 8;
int y = event.world.getTopSolidOrLiquidBlock(x, z);
for (int j = 0; j < ConfigHandler.flowerDensity; j++) {
for(int j = 0; j < ConfigHandler.flowerDensity; j++) {
int x1 = x + event.rand.nextInt(8) - event.rand.nextInt(8);
int y1 = y + event.rand.nextInt(4) - event.rand.nextInt(4);
int z1 = z + event.rand.nextInt(8) - event.rand.nextInt(8);
if (event.world.isAirBlock(x1, y1, z1) && (!event.world.provider.hasNoSky || y1 < 127) && ModBlocks.flower.canBlockStay(event.world, x1, y1, z1))
if(event.world.isAirBlock(x1, y1, z1) && (!event.world.provider.hasNoSky || y1 < 127) && ModBlocks.flower.canBlockStay(event.world, x1, y1, z1))
event.world.setBlock(x1, y1, z1, ModBlocks.flower, event.rand.nextInt(16), 2);
}
}
@@ -29,24 +29,22 @@ public final class CommonTickHandler {
@SubscribeEvent
public void onTick(WorldTickEvent event) {
if (event.phase == Phase.END) {
if(event.phase == Phase.END) {
List<Entity> entities = new ArrayList(event.world.loadedEntityList);
for (Entity entity : entities)
if (entity instanceof EntityItem)
TerrasteelCraftingHandler.onEntityUpdate((EntityItem) entity);
for(Entity entity : entities)
if(entity instanceof EntityItem) TerrasteelCraftingHandler.onEntityUpdate((EntityItem) entity);
}
}
@SideOnly(Side.CLIENT)
@SubscribeEvent
public void onTick(ClientTickEvent event) {
if (event.phase == Phase.END) {
if(event.phase == Phase.END) {
World world = Minecraft.getMinecraft().theWorld;
if (world != null) {
if(world != null) {
List<Entity> entities = new ArrayList(world.loadedEntityList);
for (Entity entity : entities)
if (entity instanceof EntityItem)
TerrasteelCraftingHandler.onEntityUpdate((EntityItem) entity);
for(Entity entity : entities)
if(entity instanceof EntityItem) TerrasteelCraftingHandler.onEntityUpdate((EntityItem) entity);
}
}
@@ -35,8 +35,7 @@ public final class ManaNetworkHandler implements IManaNetwork {
@SubscribeEvent
public void onNetworkEvent(ManaNetworkEvent event) {
Map<Integer, List<TileEntity>> map = event.type == ManaBlockType.COLLECTOR ? manaCollectors : manaPools;
if (event.action == Action.ADD)
add(map, event.tile);
if(event.action == Action.ADD) add(map, event.tile);
else remove(map, event.tile);
}
@@ -48,15 +47,13 @@ public final class ManaNetworkHandler implements IManaNetwork {
@Override
public TileEntity getClosestPool(ChunkCoordinates pos, int dimension, int limit) {
if (manaPools.containsKey(dimension))
return getClosest(manaPools.get(dimension), pos, limit);
if(manaPools.containsKey(dimension)) return getClosest(manaPools.get(dimension), pos, limit);
return null;
}
@Override
public TileEntity getClosestCollector(ChunkCoordinates pos, int dimension, int limit) {
if (manaCollectors.containsKey(dimension))
return getClosest(manaCollectors.get(dimension), pos, limit);
if(manaCollectors.containsKey(dimension)) return getClosest(manaCollectors.get(dimension), pos, limit);
return null;
}
@@ -64,12 +61,11 @@ public final class ManaNetworkHandler implements IManaNetwork {
float closest = Float.MAX_VALUE;
TileEntity closestTile = null;
for (TileEntity tile : tiles) {
for(TileEntity tile : tiles) {
float distance = MathHelper.pointDistanceSpace(tile.xCoord, tile.yCoord, tile.zCoord, pos.posX, pos.posY, pos.posZ);
if (distance > limit)
continue;
if(distance > limit) continue;
if (distance < closest) {
if(distance < closest) {
closest = distance;
closestTile = tile;
}
@@ -81,8 +77,7 @@ public final class ManaNetworkHandler implements IManaNetwork {
private synchronized void remove(Map<Integer, List<TileEntity>> map, TileEntity tile) {
int dim = tile.getWorldObj().provider.dimensionId;
if (!map.containsKey(dim))
return;
if(!map.containsKey(dim)) return;
List<TileEntity> tiles = map.get(dim);
tiles.remove(tile);
@@ -92,13 +87,11 @@ public final class ManaNetworkHandler implements IManaNetwork {
int dim = tile.getWorldObj().provider.dimensionId;
List<TileEntity> tiles;
if (!map.containsKey(dim))
map.put(dim, new ArrayList());
if(!map.containsKey(dim)) map.put(dim, new ArrayList());
tiles = map.get(dim);
if (!tiles.contains(tile))
tiles.add(tile);
if(!tiles.contains(tile)) tiles.add(tile);
}
@Override
@@ -112,8 +105,7 @@ public final class ManaNetworkHandler implements IManaNetwork {
}
private List<TileEntity> getAllInWorld(Map<Integer, List<TileEntity>> map, int dim) {
if (!map.containsKey(dim))
return new ArrayList();
if(!map.containsKey(dim)) return new ArrayList();
return map.get(dim);
}
}
@@ -33,10 +33,10 @@ public final class TerrasteelCraftingHandler {
public static void onEntityUpdate(EntityItem item) {
ItemStack stack = item.getEntityItem();
if (stack != null && stack.getItem() == ModItems.manaResource && stack.getItemDamage() == 0) {
if(stack != null && stack.getItem() == ModItems.manaResource && stack.getItemDamage() == 0) {
int time = validateCraftingItem(item);
if (time != -1) {
if(time != -1) {
doParticles(item, time);
getManaFromPools:
@@ -45,15 +45,15 @@ public final class TerrasteelCraftingHandler {
int y = (int) item.posY;
int z = (int) item.posZ;
for (int i = -4; i < 5; i++)
for (int j = -4; j < 5; j++)
for (int k = -4; k < 5; k++) {
for(int i = -4; i < 5; i++)
for(int j = -4; j < 5; j++)
for(int k = -4; k < 5; k++) {
TileEntity tile = item.worldObj.getTileEntity(x + i, y + j, z + k);
if (tile instanceof IManaPool) {
if(tile instanceof IManaPool) {
IManaPool pool = (IManaPool) tile;
if (!item.worldObj.isRemote && pool.getCurrentMana() >= MANA_PER_TICK) {
if(!item.worldObj.isRemote && pool.getCurrentMana() >= MANA_PER_TICK) {
pool.recieveMana(-MANA_PER_TICK);
item.worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
incrementCraftingTime(item, time);
@@ -71,32 +71,29 @@ public final class TerrasteelCraftingHandler {
int y = (int) item.posY;
int z = (int) item.posZ;
if (item.worldObj.getBlock(x, y - 1, z) != Blocks.beacon)
return -1;
if(item.worldObj.getBlock(x, y - 1, z) != Blocks.beacon) return -1;
TileEntityBeacon beacon = (TileEntityBeacon) item.worldObj.getTileEntity(x, y - 1, z);
if (beacon.getLevels() <= 0)
return -1;
if(beacon.getLevels() <= 0) return -1;
List<EntityItem> items = item.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1));
EntityItem diamond = null;
EntityItem pearl = null;
for (EntityItem otherItem : items) {
if (otherItem == item)
continue;
for(EntityItem otherItem : items) {
if(otherItem == item) continue;
ItemStack stack = otherItem.getEntityItem();
if (stack.getItem() == ModItems.manaResource) {
if(stack.getItem() == ModItems.manaResource) {
int meta = stack.getItemDamage();
if (meta == 1) {
if (pearl == null) {
if(meta == 1) {
if(pearl == null) {
pearl = otherItem;
continue;
} else return -1;
} else if (meta == 2) {
if (diamond == null) {
} else if(meta == 2) {
if(diamond == null) {
diamond = otherItem;
continue;
} else return -1;
@@ -104,9 +101,9 @@ public final class TerrasteelCraftingHandler {
} else return -1;
}
if (diamond != null && pearl != null) {
if(diamond != null && pearl != null) {
int time = getTimeInCrafting(item);
if (time > 0) {
if(time > 0) {
diamond.delayBeforeCanPickup = 1;
diamond.age = 0;
pearl.delayBeforeCanPickup = 1;
@@ -126,12 +123,8 @@ public final class TerrasteelCraftingHandler {
}
static void doParticles(EntityItem item, int ticks) {
if (item.worldObj.isRemote) {
float[][] colors = new float[][]{
{0F, 0F, 1F},
{0F, 0.5F, 0.5F},
{0F, 1F, 0F},
};
if(item.worldObj.isRemote) {
float[][] colors = new float[][]{{0F, 0F, 1F}, {0F, 0.5F, 0.5F}, {0F, 1F, 0F},};
int totalSpiritCount = 3;
double tickIncrement = 360D / totalSpiritCount;
@@ -142,7 +135,7 @@ public final class TerrasteelCraftingHandler {
double r = Math.sin((double) (ticks - TIME) / 10D) * 2;
double g = Math.sin(wticks * Math.PI / 180 * 0.55);
for (int i = 0; i < totalSpiritCount; i++) {
for(int i = 0; i < totalSpiritCount; i++) {
double x = (int) item.posX + Math.sin(wticks * Math.PI / 180) * r + 0.5;
double y = (int) item.posY + 0.25;
double z = (int) item.posZ + Math.cos(wticks * Math.PI / 180) * r + 0.5;
@@ -152,18 +145,15 @@ public final class TerrasteelCraftingHandler {
Botania.proxy.wispFX(item.worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], 0.85F, (float) g * 0.05F, 0.25F);
Botania.proxy.wispFX(item.worldObj, x, y, z, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.1F + 0.1F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, (float) (Math.random() - 0.5) * 0.05F, 0.9F);
if (ticks == TIME)
for (int j = 0; j < 15; j++)
Botania.proxy.wispFX(item.worldObj, item.posX, item.posY, item.posZ, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F);
if(ticks == TIME) for(int j = 0; j < 15; j++)
Botania.proxy.wispFX(item.worldObj, item.posX, item.posY, item.posZ, colorsfx[0], colorsfx[1], colorsfx[2], (float) Math.random() * 0.15F + 0.15F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F, (float) (Math.random() - 0.5F) * 0.125F);
}
if (ticks == TIME)
item.worldObj.playSoundAtEntity(item, "random.levelup", 1F, 1F);
if(ticks == TIME) item.worldObj.playSoundAtEntity(item, "random.levelup", 1F, 1F);
}
}
static void incrementCraftingTime(EntityItem item, int time) {
if (time >= TIME)
finalizeCraftingRecipe(item);
if(time >= TIME) finalizeCraftingRecipe(item);
else {
ItemStack stack = item.getEntityItem();
@@ -177,9 +167,8 @@ public final class TerrasteelCraftingHandler {
int z = (int) item.posZ;
List<EntityItem> items = item.worldObj.getEntitiesWithinAABB(EntityItem.class, AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1));
for (EntityItem otherItem : items)
if (otherItem != item)
otherItem.setDead();
for(EntityItem otherItem : items)
if(otherItem != item) otherItem.setDead();
else item.setEntityItemStack(new ItemStack(ModItems.manaResource, 1, 4));
}
@@ -32,7 +32,7 @@ public class WorldTreeGenerator {
}
public void generate() {
for (int i = 0; i < 116; i++)
for(int i = 0; i < 116; i++)
generateRing(i, (int) Math.sqrt(256 - (Math.min(i, 64) - 5) * 2));
System.out.println("Blocks Placed: " + blocksPlaced);
@@ -42,17 +42,16 @@ public class WorldTreeGenerator {
Block block = ModBlocks.livingwood;
y = yoff;
for (int i = 0; i < 360; i++) {
if (i % 90 == 0)
continue;
for(int i = 0; i < 360; i++) {
if(i % 90 == 0) continue;
int meta = world.rand.nextInt(200) == 0 ? 5 : 0;
generateRingVal(radius, i, block, meta);
}
int mul = 4;
for (int i = 0; i < mul; i++)
for (int j = 0; j < mul; j++) {
for(int i = 0; i < mul; i++)
for(int j = 0; j < mul; j++) {
int meta = world.rand.nextInt(4) == 0 ? 5 : 0;
int angle = (y - j) * mul % 360;
@@ -62,8 +61,8 @@ public class WorldTreeGenerator {
mul = 3;
for (int i = 0; i < mul; i++)
for (int j = 0; j < mul; j++) {
for(int i = 0; i < mul; i++)
for(int j = 0; j < mul; j++) {
int meta = world.rand.nextInt(20) == 0 ? 5 : 0;
int angle = (y - j) * mul % 360;
generateRingVal(radius + i - 1, angle + 90, block, meta);
@@ -75,7 +74,7 @@ public class WorldTreeGenerator {
int nx = (int) (Math.cos(angle * Math.PI / 180D) * radius);
int nz = (int) (Math.sin(angle * Math.PI / 180D) * radius);
if (x != nx || z != nz) {
if(x != nx || z != nz) {
x = nx;
z = nz;
place(srcx + x, srcy + y, srcz + z, block, meta);
@@ -33,20 +33,16 @@ public class ExperienceHelper {
}
public static int getExperienceForLevel(int level) {
if (level == 0)
return 0;
if(level == 0) return 0;
if (level > 0 && level < 16)
return level * 17;
else if (level > 15 && level < 31)
return (int) (1.5 * level * level - 29.5 * level + 360);
else
return (int) (3.5 * level * level - 151.5 * level + 2220);
if(level > 0 && level < 16) return level * 17;
else if(level > 15 && level < 31) return (int) (1.5 * level * level - 29.5 * level + 360);
else return (int) (3.5 * level * level - 151.5 * level + 2220);
}
public static int getLevelForExperience(int experience) {
int i = 0;
while (getExperienceForLevel(i) <= experience) {
while(getExperienceForLevel(i) <= experience) {
i++;
}
return i - 1;
@@ -34,13 +34,13 @@ import java.util.Set;
public class InventoryHelper {
public static void tryInsertStack(IInventory targetInventory, int slot, ItemStack stack, boolean canMerge) {
if (targetInventory.isItemValidForSlot(slot, stack)) {
if(targetInventory.isItemValidForSlot(slot, stack)) {
ItemStack targetStack = targetInventory.getStackInSlot(slot);
if (targetStack == null) {
if(targetStack == null) {
targetInventory.setInventorySlotContents(slot, stack.copy());
stack.stackSize = 0;
} else if (canMerge) {
if (targetInventory.isItemValidForSlot(slot, stack) && areMergeCandidates(stack, targetStack)) {
} else if(canMerge) {
if(targetInventory.isItemValidForSlot(slot, stack) && areMergeCandidates(stack, targetStack)) {
int space = targetStack.getMaxStackSize() - targetStack.stackSize;
int mergeAmount = Math.min(space, stack.stackSize);
ItemStack copy = targetStack.copy();
@@ -69,11 +69,11 @@ public class InventoryHelper {
}
public static void insertItemIntoInventory(IInventory inventory, ItemStack stack, ForgeDirection side, int intoSlot, boolean doMove, boolean canStack) {
if (stack == null) return;
if(stack == null) return;
IInventory targetInventory = inventory;
if (!doMove) {
if(!doMove) {
targetInventory = new GenericInventory("temporary.inventory", false, targetInventory.getSizeInventory());
((GenericInventory) targetInventory).copyFrom(inventory);
}
@@ -81,27 +81,25 @@ public class InventoryHelper {
int i = 0;
int[] attemptSlots = new int[0];
if (inventory instanceof ISidedInventory && side != ForgeDirection.UNKNOWN) {
if(inventory instanceof ISidedInventory && side != ForgeDirection.UNKNOWN) {
attemptSlots = ((ISidedInventory) inventory).getAccessibleSlotsFromSide(side.ordinal());
if (attemptSlots == null)
attemptSlots = new int[0];
if(attemptSlots == null) attemptSlots = new int[0];
} else {
attemptSlots = new int[inventory.getSizeInventory()];
for (int a = 0; a < inventory.getSizeInventory(); a++)
for(int a = 0; a < inventory.getSizeInventory(); a++)
attemptSlots[a] = a;
}
if (intoSlot > -1) {
if(intoSlot > -1) {
Set<Integer> x = new HashSet<Integer>();
for (int attemptedSlot : attemptSlots)
for(int attemptedSlot : attemptSlots)
x.add(attemptedSlot);
if (x.contains(intoSlot))
attemptSlots = new int[]{intoSlot};
if(x.contains(intoSlot)) attemptSlots = new int[]{intoSlot};
else attemptSlots = new int[0];
}
while (stack.stackSize > 0 && i < attemptSlots.length) {
if (side != ForgeDirection.UNKNOWN && inventory instanceof ISidedInventory)
if (!((ISidedInventory) inventory).canInsertItem(intoSlot, stack, side.ordinal())) {
while(stack.stackSize > 0 && i < attemptSlots.length) {
if(side != ForgeDirection.UNKNOWN && inventory instanceof ISidedInventory)
if(!((ISidedInventory) inventory).canInsertItem(intoSlot, stack, side.ordinal())) {
i++;
continue;
}
@@ -112,33 +110,29 @@ public class InventoryHelper {
}
public static int testInventoryInsertion(IInventory inventory, ItemStack item, ForgeDirection side) {
if (item == null || item.stackSize == 0)
return 0;
if(item == null || item.stackSize == 0) return 0;
item = item.copy();
if (inventory == null)
return 0;
if(inventory == null) return 0;
int slotCount = inventory.getSizeInventory();
int itemSizeCounter = item.stackSize;
for (int i = 0; i < slotCount && itemSizeCounter > 0; i++) {
if (!inventory.isItemValidForSlot(i, item))
continue;
for(int i = 0; i < slotCount && itemSizeCounter > 0; i++) {
if(!inventory.isItemValidForSlot(i, item)) continue;
if (side != ForgeDirection.UNKNOWN && inventory instanceof ISidedInventory)
if (!((ISidedInventory) inventory).canInsertItem(i, item, side.ordinal()))
continue;
if(side != ForgeDirection.UNKNOWN && inventory instanceof ISidedInventory)
if(!((ISidedInventory) inventory).canInsertItem(i, item, side.ordinal())) continue;
ItemStack inventorySlot = inventory.getStackInSlot(i);
if (inventorySlot == null)
if(inventorySlot == null)
itemSizeCounter -= Math.min(Math.min(itemSizeCounter, inventory.getInventoryStackLimit()), item.getMaxStackSize());
else if (areMergeCandidates(item, inventorySlot)) {
else if(areMergeCandidates(item, inventorySlot)) {
int space = inventorySlot.getMaxStackSize() - inventorySlot.stackSize;
itemSizeCounter -= Math.min(itemSizeCounter, space);
}
}
if (itemSizeCounter != item.stackSize) {
if(itemSizeCounter != item.stackSize) {
itemSizeCounter = Math.max(itemSizeCounter, 0);
return item.stackSize - itemSizeCounter;
}
@@ -148,22 +142,22 @@ public class InventoryHelper {
public static IInventory getInventory(World world, int x, int y, int z) {
TileEntity tileEntity = world.getTileEntity(x, y, z);
if (tileEntity instanceof TileEntityChest) {
if(tileEntity instanceof TileEntityChest) {
Block chestBlock = world.getBlock(x, y, z);
if (world.getBlock(x - 1, y, z) == chestBlock)
if(world.getBlock(x - 1, y, z) == chestBlock)
return new InventoryLargeChest("Large chest", (IInventory) world.getTileEntity(x - 1, y, z), (IInventory) tileEntity);
if (world.getBlock(x + 1, y, z) == chestBlock)
if(world.getBlock(x + 1, y, z) == chestBlock)
return new InventoryLargeChest("Large chest", (IInventory) tileEntity, (IInventory) world.getTileEntity(x + 1, y, z));
if (world.getBlock(x, y, z - 1) == chestBlock)
if(world.getBlock(x, y, z - 1) == chestBlock)
return new InventoryLargeChest("Large chest", (IInventory) world.getTileEntity(x, y, z - 1), (IInventory) tileEntity);
if (world.getBlock(x, y, z + 1) == chestBlock)
if(world.getBlock(x, y, z + 1) == chestBlock)
return new InventoryLargeChest("Large chest", (IInventory) tileEntity, (IInventory) world.getTileEntity(x, y, z + 1));
}
return tileEntity instanceof IInventory ? (IInventory) tileEntity : null;
}
public static IInventory getInventory(World world, int x, int y, int z, ForgeDirection direction) {
if (direction != null && direction != ForgeDirection.UNKNOWN) {
if(direction != null && direction != ForgeDirection.UNKNOWN) {
x += direction.offsetX;
y += direction.offsetY;
z += direction.offsetZ;
@@ -173,7 +167,7 @@ public class InventoryHelper {
}
public static IInventory getInventory(IInventory inventory) {
if (inventory instanceof TileEntityChest) {
if(inventory instanceof TileEntityChest) {
TileEntity te = (TileEntity) inventory;
return getInventory(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord);
}
@@ -196,18 +190,17 @@ public class InventoryHelper {
@Override
public ItemStack decrStackSize(int par1, int par2) {
if (inventoryContents[par1] != null) {
if(inventoryContents[par1] != null) {
ItemStack itemstack;
if (inventoryContents[par1].stackSize <= par2) {
if(inventoryContents[par1].stackSize <= par2) {
itemstack = inventoryContents[par1];
inventoryContents[par1] = null;
return itemstack;
}
itemstack = inventoryContents[par1].splitStack(par2);
if (inventoryContents[par1].stackSize == 0)
inventoryContents[par1] = null;
if(inventoryContents[par1].stackSize == 0) inventoryContents[par1] = null;
return itemstack;
}
@@ -235,10 +228,9 @@ public class InventoryHelper {
@Override
public ItemStack getStackInSlotOnClosing(int i) {
if (i >= inventoryContents.length)
return null;
if(i >= inventoryContents.length) return null;
if (inventoryContents[i] != null) {
if(inventoryContents[i] != null) {
ItemStack itemstack = inventoryContents[i];
inventoryContents[i] = null;
return itemstack;
@@ -267,15 +259,14 @@ public class InventoryHelper {
}
public void readFromNBT(NBTTagCompound tag) {
if (tag.hasKey("size"))
slotsCount = tag.getInteger("size");
if(tag.hasKey("size")) slotsCount = tag.getInteger("size");
NBTTagList nbttaglist = tag.getTagList("Items", 10);
inventoryContents = new ItemStack[slotsCount];
for (int i = 0; i < nbttaglist.tagCount(); i++) {
for(int i = 0; i < nbttaglist.tagCount(); i++) {
NBTTagCompound stacktag = (NBTTagCompound) nbttaglist.getCompoundTagAt(i);
int j = stacktag.getByte("Slot");
if (j >= 0 && j < inventoryContents.length)
if(j >= 0 && j < inventoryContents.length)
inventoryContents[j] = ItemStack.loadItemStackFromNBT(stacktag);
}
}
@@ -284,15 +275,15 @@ public class InventoryHelper {
public void setInventorySlotContents(int i, ItemStack itemstack) {
inventoryContents[i] = itemstack;
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
if(itemstack != null && itemstack.stackSize > getInventoryStackLimit())
itemstack.stackSize = getInventoryStackLimit();
}
public void writeToNBT(NBTTagCompound tag) {
tag.setInteger("size", getSizeInventory());
NBTTagList nbttaglist = new NBTTagList();
for (int i = 0; i < inventoryContents.length; i++) {
if (inventoryContents[i] != null) {
for(int i = 0; i < inventoryContents.length; i++) {
if(inventoryContents[i] != null) {
NBTTagCompound stacktag = new NBTTagCompound();
stacktag.setByte("Slot", (byte) i);
inventoryContents[i].writeToNBT(stacktag);
@@ -303,11 +294,10 @@ public class InventoryHelper {
}
public void copyFrom(IInventory inventory) {
for (int i = 0; i < inventory.getSizeInventory(); i++)
if (i < getSizeInventory()) {
for(int i = 0; i < inventory.getSizeInventory(); i++)
if(i < getSizeInventory()) {
ItemStack stack = inventory.getStackInSlot(i);
if (stack != null)
setInventorySlotContents(i, stack.copy());
if(stack != null) setInventorySlotContents(i, stack.copy());
else setInventorySlotContents(i, null);
}
}
@@ -32,8 +32,7 @@ public final class ItemNBTHelper {
* compound *
*/
public static void initNBT(ItemStack stack) {
if (!detectNBT(stack))
injectNBT(stack, new NBTTagCompound());
if(!detectNBT(stack)) injectNBT(stack, new NBTTagCompound());
}
/**
@@ -84,7 +83,7 @@ public final class ItemNBTHelper {
}
public static void setCompound(ItemStack stack, String tag, NBTTagCompound cmp) {
if (!tag.equalsIgnoreCase("ench")) // not override the enchantments
if(!tag.equalsIgnoreCase("ench")) // not override the enchantments
getNBT(stack).setTag(tag, cmp);
}
@@ -23,8 +23,7 @@ public final class MathHelper {
Vector3 entityVector = Vector3.fromEntityCenter(entity);
Vector3 finalVector = originalPosVector.copy().subtract(entityVector);
if (finalVector.mag() > 1)
finalVector.normalize();
if(finalVector.mag() > 1) finalVector.normalize();
entity.motionX = finalVector.x * modifier;
entity.motionY = finalVector.y * modifier;
@@ -83,7 +83,7 @@ public class Quat {
public void normalize() {
double d = mag();
if (d == 0.0D) {
if(d == 0.0D) {
return;
} else {
d = 1.0D / d;
@@ -91,10 +91,8 @@ public class Vector3 {
public double dotProduct(Vector3 vec) {
double d = vec.x * x + vec.y * y + vec.z * z;
if (d > 1 && d < 1.00001)
d = 1;
else if (d < -1 && d > -1.00001)
d = -1;
if(d > 1 && d < 1.00001) d = 1;
else if(d < -1 && d > -1.00001) d = -1;
return d;
}
@@ -179,8 +177,7 @@ public class Vector3 {
public Vector3 normalize() {
double d = mag();
if (d != 0)
multiply(1 / d);
if(d != 0) multiply(1 / d);
return this;
}
@@ -192,8 +189,7 @@ public class Vector3 {
}
public Vector3 perpendicular() {
if (z == 0)
return zCrossProduct();
if(z == 0) return zCrossProduct();
return xCrossProduct();
}
@@ -269,7 +265,7 @@ public class Vector3 {
public Vector3 project(Vector3 b) {
double l = b.magSquared();
if (l == 0) {
if(l == 0) {
set(0, 0, 0);
return this;
}
@@ -286,8 +282,7 @@ public class Vector3 {
@Override
public boolean equals(Object o) {
if (!(o instanceof Vector3))
return false;
if(!(o instanceof Vector3)) return false;
Vector3 v = (Vector3) o;
return x == v.x && y == v.y && z == v.z;
@@ -102,88 +102,61 @@ public final class ModCrafingRecipes {
recipeLexicon = BotaniaAPI.getLatestAddedRecipe();
// Petal/Dye Recipes
for (int i = 0; i < 16; i++)
for(int i = 0; i < 16; i++)
addShapelessOreDictRecipe(new ItemStack(ModItems.petal, 2, i), LibOreDict.FLOWER[i]);
recipesPetals = BotaniaAPI.getLatestAddedRecipes(16);
for (int i = 0; i < 16; i++)
for(int i = 0; i < 16; i++)
addShapelessOreDictRecipe(new ItemStack(ModItems.dye, 1, i), LibOreDict.PETAL[i], LibOreDict.PESTLE_AND_MORTAR);
recipesDyes = BotaniaAPI.getLatestAddedRecipes(16);
// Pestle and Mortar Recipe
addOreDictRecipe(new ItemStack(ModItems.pestleAndMortar),
" S", "W ", "B ",
'S', "stickWood",
'W', "plankWood",
'B', Items.bowl);
addOreDictRecipe(new ItemStack(ModItems.pestleAndMortar), " S", "W ", "B ", 'S', "stickWood", 'W', "plankWood", 'B', Items.bowl);
recipePestleAndMortar = BotaniaAPI.getLatestAddedRecipe();
// Wand of the Forest Recipes
for (int i = 0; i < 16; i++)
for (int j = 0; j < 16; j++) {
addOreDictRecipe(ItemTwigWand.forColors(i, j),
" AS", " SB", "S ",
'A', LibOreDict.PETAL[i],
'B', LibOreDict.PETAL[j],
'S', "stickWood");
for(int i = 0; i < 16; i++)
for(int j = 0; j < 16; j++) {
addOreDictRecipe(ItemTwigWand.forColors(i, j), " AS", " SB", "S ", 'A', LibOreDict.PETAL[i], 'B', LibOreDict.PETAL[j], 'S', "stickWood");
}
recipesTwigWand = BotaniaAPI.getLatestAddedRecipes(256);
// Petal Apothecary Recipes
for (int i = 0; i < 16; i++)
addOreDictRecipe(new ItemStack(ModBlocks.altar),
"SPS", " C ", "CCC",
'S', new ItemStack(Blocks.stone_slab, 1, 3),
'P', LibOreDict.PETAL[i],
'C', "cobblestone");
for(int i = 0; i < 16; i++)
addOreDictRecipe(new ItemStack(ModBlocks.altar), "SPS", " C ", "CCC", 'S', new ItemStack(Blocks.stone_slab, 1, 3), 'P', LibOreDict.PETAL[i], 'C', "cobblestone");
recipesApothecary = BotaniaAPI.getLatestAddedRecipes(16);
// Mana Spreader Recipes
for (int i = 0; i < 16; i++)
addOreDictRecipe(new ItemStack(ModBlocks.spreader),
"WWW", "GP ", "WWW",
'W', LibOreDict.LIVING_WOOD,
'P', LibOreDict.PETAL[i],
'G', "ingotGold");
for(int i = 0; i < 16; i++)
addOreDictRecipe(new ItemStack(ModBlocks.spreader), "WWW", "GP ", "WWW", 'W', LibOreDict.LIVING_WOOD, 'P', LibOreDict.PETAL[i], 'G', "ingotGold");
recipesSpreader = BotaniaAPI.getLatestAddedRecipes(16);
// Mana Lens Recipe
addOreDictRecipe(new ItemStack(ModItems.lens),
" S ", "SGS", " S ",
'S', LibOreDict.MANA_STEEL,
'G', new ItemStack(Blocks.glass_pane));
addOreDictRecipe(new ItemStack(ModItems.lens), " S ", "SGS", " S ", 'S', LibOreDict.MANA_STEEL, 'G', new ItemStack(Blocks.glass_pane));
recipeManaLens = BotaniaAPI.getLatestAddedRecipe();
// Mana Lens Dying Recipes
for (int j = 0; j < 16; j++)
for(int j = 0; j < 16; j++)
addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens), j), new ItemStack(ModItems.lens), LibOreDict.DYE[j]);
recipesLensDying = BotaniaAPI.getLatestAddedRecipes(16);
for (int i = 1; i < ItemLens.SUBTYPES; i++)
for (int j = 0; j < 16; j++)
for(int i = 1; i < ItemLens.SUBTYPES; i++)
for(int j = 0; j < 16; j++)
addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens, 1, i), j), new ItemStack(ModItems.lens, 1, i), LibOreDict.DYE[j]);
// Rainbow Lens Recipe
addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens), 16), new ItemStack(ModItems.lens), LibOreDict.MANA_PEARL);
recipeRainbowLens = BotaniaAPI.getLatestAddedRecipe();
for (int i = 1; i < ItemLens.SUBTYPES; i++)
for(int i = 1; i < ItemLens.SUBTYPES; i++)
addShapelessOreDictRecipe(ItemLens.setLensColor(new ItemStack(ModItems.lens, 1, i), 16), new ItemStack(ModItems.lens, 1, i), LibOreDict.MANA_PEARL);
// Mana Pool Recipe
addOreDictRecipe(new ItemStack(ModBlocks.pool),
"R R", "RRR",
'R', LibOreDict.LIVING_ROCK);
addOreDictRecipe(new ItemStack(ModBlocks.pool), "R R", "RRR", 'R', LibOreDict.LIVING_ROCK);
recipePool = BotaniaAPI.getLatestAddedRecipe();
// Runic Altar Recipe
addOreDictRecipe(new ItemStack(ModBlocks.runeAltar),
"SSS", "SPS",
'S', LibOreDict.LIVING_ROCK,
'P', LibOreDict.MANA_PEARL);
addOreDictRecipe(new ItemStack(ModBlocks.runeAltar),
"SSS", "SDS",
'S', LibOreDict.LIVING_ROCK,
'D', LibOreDict.MANA_DIAMOND);
addOreDictRecipe(new ItemStack(ModBlocks.runeAltar), "SSS", "SPS", 'S', LibOreDict.LIVING_ROCK, 'P', LibOreDict.MANA_PEARL);
addOreDictRecipe(new ItemStack(ModBlocks.runeAltar), "SSS", "SDS", 'S', LibOreDict.LIVING_ROCK, 'D', LibOreDict.MANA_DIAMOND);
recipesRuneAltar = BotaniaAPI.getLatestAddedRecipes(2);
// Lens Recipes
@@ -221,41 +194,26 @@ public final class ModCrafingRecipes {
recipeLensExplosive = BotaniaAPI.getLatestAddedRecipe();
// Unstable Block Recipes
for (int i = 0; i < 16; i++)
addOreDictRecipe(new ItemStack(ModBlocks.unstableBlock, 2, i),
"OPO", "PMP", "OPO",
'O', new ItemStack(Blocks.obsidian),
'P', LibOreDict.PETAL[i],
'M', new ItemStack(Items.ender_pearl));
for(int i = 0; i < 16; i++)
addOreDictRecipe(new ItemStack(ModBlocks.unstableBlock, 2, i), "OPO", "PMP", "OPO", 'O', new ItemStack(Blocks.obsidian), 'P', LibOreDict.PETAL[i], 'M', new ItemStack(Items.ender_pearl));
recipesUnstableBlocks = BotaniaAPI.getLatestAddedRecipes(16);
// Mana Pylon Recipe
addOreDictRecipe(new ItemStack(ModBlocks.pylon),
" G ", "MDM", " G ",
'G', "ingotGold",
'M', LibOreDict.MANA_STEEL,
'D', LibOreDict.MANA_DIAMOND);
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),
"RRR", "S S", "RRR",
'R', LibOreDict.LIVING_ROCK,
'S', LibOreDict.MANA_STEEL);
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",
'R', LibOreDict.LIVING_ROCK);
addOreDictRecipe(new ItemStack(ModBlocks.livingrock, 4, 1), "RR", "RR", 'R', LibOreDict.LIVING_ROCK);
recipeLivingrockDecor1 = BotaniaAPI.getLatestAddedRecipe();
addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingrock, 1, 2), new ItemStack(ModBlocks.livingrock, 1, 1), new ItemStack(Items.wheat_seeds));
recipeLivingrockDecor2 = BotaniaAPI.getLatestAddedRecipe();
addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingrock, 2, 3), new ItemStack(ModBlocks.livingrock, 1, 1), "cobblestone");
recipeLivingrockDecor3 = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModBlocks.livingrock, 4, 4),
"RR", "RR",
'R', new ItemStack(ModBlocks.livingrock, 1, 1));
addOreDictRecipe(new ItemStack(ModBlocks.livingrock, 4, 4), "RR", "RR", 'R', new ItemStack(ModBlocks.livingrock, 1, 1));
recipeLivingrockDecor4 = BotaniaAPI.getLatestAddedRecipe();
// Livingwood Decorative Blocks
@@ -263,76 +221,42 @@ public final class ModCrafingRecipes {
recipeLivingwoodDecor1 = BotaniaAPI.getLatestAddedRecipe();
addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingwood, 1, 2), new ItemStack(ModBlocks.livingwood, 1, 1), new ItemStack(Items.wheat_seeds));
recipeLivingwoodDecor2 = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 3),
"WW", "WW",
'W', new ItemStack(ModBlocks.livingwood, 1, 1));
addOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 3), "WW", "WW", 'W', new ItemStack(ModBlocks.livingwood, 1, 1));
recipeLivingwoodDecor3 = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 4),
" W ", "W W", " W ",
'W', new ItemStack(ModBlocks.livingwood, 1, 1));
addOreDictRecipe(new ItemStack(ModBlocks.livingwood, 4, 4), " W ", "W W", " W ", 'W', new ItemStack(ModBlocks.livingwood, 1, 1));
recipeLivingwoodDecor4 = BotaniaAPI.getLatestAddedRecipe();
addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingwood, 1, 5),
LibOreDict.LIVING_WOOD, new ItemStack(Items.glowstone_dust));
addShapelessOreDictRecipe(new ItemStack(ModBlocks.livingwood, 1, 5), LibOreDict.LIVING_WOOD, new ItemStack(Items.glowstone_dust));
recipeLivingwoodDecor5 = BotaniaAPI.getLatestAddedRecipe();
// Mana Beacon Recipe
for (int i = 0; i < 16; i++)
addOreDictRecipe(new ItemStack(ModBlocks.manaBeacon, 1, i),
" B ", "BPB", " B ",
'B', new ItemStack(ModBlocks.unstableBlock, 1, i),
'P', LibOreDict.MANA_PEARL);
for(int i = 0; i < 16; i++)
addOreDictRecipe(new ItemStack(ModBlocks.manaBeacon, 1, i), " B ", "BPB", " B ", 'B', new ItemStack(ModBlocks.unstableBlock, 1, i), 'P', LibOreDict.MANA_PEARL);
recipesManaBeacons = BotaniaAPI.getLatestAddedRecipes(16);
// Signal Flare Recipe
for (int i = 0; i < 16; i++)
addOreDictRecipe(ItemSignalFlare.forColor(i),
"I ", " B", "W ",
'B', new ItemStack(ModBlocks.manaBeacon, 1, i),
'I', "ingotIron",
'W', LibOreDict.LIVING_WOOD);
for(int i = 0; i < 16; i++)
addOreDictRecipe(ItemSignalFlare.forColor(i), "I ", " B", "W ", 'B', new ItemStack(ModBlocks.manaBeacon, 1, i), 'I', "ingotIron", 'W', LibOreDict.LIVING_WOOD);
recipesSignalFlares = BotaniaAPI.getLatestAddedRecipes(16);
// Mana Void Recipe
addOreDictRecipe(new ItemStack(ModBlocks.manaVoid),
"SSS", "O O", "SSS",
'S', LibOreDict.LIVING_ROCK,
'O', new ItemStack(Blocks.obsidian));
addOreDictRecipe(new ItemStack(ModBlocks.manaVoid), "SSS", "O O", "SSS", 'S', LibOreDict.LIVING_ROCK, 'O', new ItemStack(Blocks.obsidian));
recipeManaVoid = BotaniaAPI.getLatestAddedRecipe();
// Mana Tablet Recipe
addOreDictRecipe(new ItemStack(ModItems.manaTablet, 1, 10000),
"SSS", "SPS", "SSS",
'S', LibOreDict.LIVING_ROCK,
'P', LibOreDict.MANA_PEARL);
addOreDictRecipe(new ItemStack(ModItems.manaTablet, 1, 10000),
"SSS", "SDS", "SSS",
'S', LibOreDict.LIVING_ROCK,
'D', LibOreDict.MANA_DIAMOND);
addOreDictRecipe(new ItemStack(ModItems.manaTablet, 1, 10000), "SSS", "SPS", "SSS", 'S', LibOreDict.LIVING_ROCK, 'P', LibOreDict.MANA_PEARL);
addOreDictRecipe(new ItemStack(ModItems.manaTablet, 1, 10000), "SSS", "SDS", "SSS", 'S', LibOreDict.LIVING_ROCK, 'D', LibOreDict.MANA_DIAMOND);
recipesManaTablet = BotaniaAPI.getLatestAddedRecipes(2);
// Mana Detector Recipe
addOreDictRecipe(new ItemStack(ModBlocks.manaDetector),
"RSR", "SCS", "RSR",
'R', new ItemStack(Items.redstone),
'C', new ItemStack(Items.comparator),
'S', LibOreDict.LIVING_ROCK);
addOreDictRecipe(new ItemStack(ModBlocks.manaDetector), "RSR", "SCS", "RSR", 'R', new ItemStack(Items.redstone), 'C', new ItemStack(Items.comparator), 'S', LibOreDict.LIVING_ROCK);
recipeManaDetector = BotaniaAPI.getLatestAddedRecipe();
// Mana Blaster Recipe
addOreDictRecipe(new ItemStack(ModItems.manaGun),
"SMD", " WT", " W",
'S', new ItemStack(ModBlocks.spreader, 1, 1),
'M', LibOreDict.RUNE[8],
'D', LibOreDict.MANA_DIAMOND,
'T', new ItemStack(Blocks.tnt),
'W', LibOreDict.LIVING_WOOD);
addOreDictRecipe(new ItemStack(ModItems.manaGun), "SMD", " WT", " W", 'S', new ItemStack(ModBlocks.spreader, 1, 1), 'M', LibOreDict.RUNE[8], 'D', LibOreDict.MANA_DIAMOND, 'T', new ItemStack(Blocks.tnt), 'W', LibOreDict.LIVING_WOOD);
recipeManaBlaster = BotaniaAPI.getLatestAddedRecipe();
// Spreader Turntable Recipe
addOreDictRecipe(new ItemStack(ModBlocks.turntable),
"WWW", "WPW", "WWW",
'W', LibOreDict.LIVING_WOOD,
'P', Blocks.sticky_piston);
addOreDictRecipe(new ItemStack(ModBlocks.turntable), "WWW", "WPW", "WWW", 'W', LibOreDict.LIVING_WOOD, 'P', Blocks.sticky_piston);
recipeTurntable = BotaniaAPI.getLatestAddedRecipe();
// Fertilizer Recipes
@@ -342,118 +266,61 @@ public final class ModCrafingRecipes {
recipeFerilizerDye = BotaniaAPI.getLatestAddedRecipe();
// Livingwood Twig Recipe
addOreDictRecipe(new ItemStack(ModItems.manaResource, 1, 3),
"W", "W",
'W', LibOreDict.LIVING_WOOD);
addOreDictRecipe(new ItemStack(ModItems.manaResource, 1, 3), "W", "W", 'W', LibOreDict.LIVING_WOOD);
recipeLivingwoodTwig = BotaniaAPI.getLatestAddedRecipe();
// Rod of the Lands Recipe
addOreDictRecipe(new ItemStack(ModItems.dirtRod),
" D", " T ", "E ",
'D', new ItemStack(Blocks.dirt),
'T', LibOreDict.LIVINGWOOD_TWIG,
'E', LibOreDict.RUNE[2]);
addOreDictRecipe(new ItemStack(ModItems.dirtRod), " D", " T ", "E ", 'D', new ItemStack(Blocks.dirt), 'T', LibOreDict.LIVINGWOOD_TWIG, 'E', LibOreDict.RUNE[2]);
recipeDirtRod = BotaniaAPI.getLatestAddedRecipe();
// Terra Firma Rod Recipe
addOreDictRecipe(new ItemStack(ModItems.terraformRod),
" WT", "ARS", "GM ",
'T', LibOreDict.TERRA_STEEL,
'R', new ItemStack(ModItems.dirtRod),
'G', new ItemStack(ModItems.grassSeeds),
'W', LibOreDict.RUNE[7],
'S', LibOreDict.RUNE[4],
'M', LibOreDict.RUNE[5],
'A', LibOreDict.RUNE[6]);
addOreDictRecipe(new ItemStack(ModItems.terraformRod), " WT", "ARS", "GM ", 'T', LibOreDict.TERRA_STEEL, 'R', new ItemStack(ModItems.dirtRod), 'G', new ItemStack(ModItems.grassSeeds), 'W', LibOreDict.RUNE[7], 'S', LibOreDict.RUNE[4], 'M', LibOreDict.RUNE[5], 'A', LibOreDict.RUNE[6]);
recipeTerraformRod = BotaniaAPI.getLatestAddedRecipe();
// Redstone Mana Spreader Recipe
GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.spreader, 1, 1),
new ItemStack(ModBlocks.spreader), new ItemStack(Items.redstone));
GameRegistry.addShapelessRecipe(new ItemStack(ModBlocks.spreader, 1, 1), new ItemStack(ModBlocks.spreader), new ItemStack(Items.redstone));
recipeRedstoneSpreader = BotaniaAPI.getLatestAddedRecipe();
// Mana Miror Recipe
addOreDictRecipe(new ItemStack(ModItems.manaMirror),
" PR", " SI", "T ",
'P', LibOreDict.MANA_PEARL,
'R', LibOreDict.LIVING_ROCK,
'S', LibOreDict.LIVINGWOOD_TWIG,
'I', LibOreDict.TERRA_STEEL,
'T', new ItemStack(ModItems.manaTablet, 1, -1));
addOreDictRecipe(new ItemStack(ModItems.manaMirror), " PR", " SI", "T ", 'P', LibOreDict.MANA_PEARL, 'R', LibOreDict.LIVING_ROCK, 'S', LibOreDict.LIVINGWOOD_TWIG, 'I', LibOreDict.TERRA_STEEL, 'T', new ItemStack(ModItems.manaTablet, 1, -1));
recipeManaMirror = BotaniaAPI.getLatestAddedRecipe();
// Mana Armor & Tools Recipes
addOreDictRecipe(new ItemStack(ModItems.manasteelHelm),
"SSS", "S S",
'S', LibOreDict.MANA_STEEL);
addOreDictRecipe(new ItemStack(ModItems.manasteelHelm), "SSS", "S S", 'S', LibOreDict.MANA_STEEL);
recipeManasteelHelm = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModItems.manasteelChest),
"S S", "SSS", "SSS",
'S', LibOreDict.MANA_STEEL);
addOreDictRecipe(new ItemStack(ModItems.manasteelChest), "S S", "SSS", "SSS", 'S', LibOreDict.MANA_STEEL);
recipeManasteelChest = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModItems.manasteelLegs),
"SSS", "S S", "S S",
'S', LibOreDict.MANA_STEEL);
addOreDictRecipe(new ItemStack(ModItems.manasteelLegs), "SSS", "S S", "S S", 'S', LibOreDict.MANA_STEEL);
recipeManasteelLegs = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModItems.manasteelBoots),
"S S", "S S",
'S', LibOreDict.MANA_STEEL);
addOreDictRecipe(new ItemStack(ModItems.manasteelBoots), "S S", "S S", 'S', LibOreDict.MANA_STEEL);
recipeManasteelBoots = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModItems.manasteelPick),
"SSS", " T ", " T ",
'S', LibOreDict.MANA_STEEL,
'T', LibOreDict.LIVINGWOOD_TWIG);
addOreDictRecipe(new ItemStack(ModItems.manasteelPick), "SSS", " T ", " T ", 'S', LibOreDict.MANA_STEEL, 'T', LibOreDict.LIVINGWOOD_TWIG);
recipeManasteelPick = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModItems.manasteelShovel),
"S", "T", "T",
'S', LibOreDict.MANA_STEEL,
'T', LibOreDict.LIVINGWOOD_TWIG);
addOreDictRecipe(new ItemStack(ModItems.manasteelShovel), "S", "T", "T", 'S', LibOreDict.MANA_STEEL, 'T', LibOreDict.LIVINGWOOD_TWIG);
recipeManasteelShovel = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModItems.manasteelAxe),
"SS", "TS", "T ",
'S', LibOreDict.MANA_STEEL,
'T', LibOreDict.LIVINGWOOD_TWIG);
addOreDictRecipe(new ItemStack(ModItems.manasteelAxe), "SS", "TS", "T ", 'S', LibOreDict.MANA_STEEL, 'T', LibOreDict.LIVINGWOOD_TWIG);
recipeManasteelAxe = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModItems.manasteelSword),
"S", "S", "T",
'S', LibOreDict.MANA_STEEL,
'T', LibOreDict.LIVINGWOOD_TWIG);
addOreDictRecipe(new ItemStack(ModItems.manasteelSword), "S", "S", "T", 'S', LibOreDict.MANA_STEEL, 'T', LibOreDict.LIVINGWOOD_TWIG);
recipeManasteelSword = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModItems.manasteelShears),
"S ", " S",
'S', LibOreDict.MANA_STEEL);
addOreDictRecipe(new ItemStack(ModItems.manasteelShears), "S ", " S", 'S', LibOreDict.MANA_STEEL);
recipeManasteelShears = BotaniaAPI.getLatestAddedRecipe();
// Horn of the Wild Recipe
addOreDictRecipe(new ItemStack(ModItems.grassHorn),
" W ", "WSW", "WW ",
'W', LibOreDict.LIVING_WOOD,
'S', new ItemStack(ModItems.grassSeeds));
addOreDictRecipe(new ItemStack(ModItems.grassHorn), " W ", "WSW", "WW ", 'W', LibOreDict.LIVING_WOOD, 'S', new ItemStack(ModItems.grassSeeds));
recipeGrassHorn = BotaniaAPI.getLatestAddedRecipe();
// Terrasteel Armor Recipes
addOreDictRecipe(new ItemStack(ModItems.terrasteelHelm),
"SSS", "S S",
'S', LibOreDict.TERRA_STEEL);
addOreDictRecipe(new ItemStack(ModItems.terrasteelHelm), "SSS", "S S", 'S', LibOreDict.TERRA_STEEL);
recipeTerrasteelHelm = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModItems.terrasteelChest),
"S S", "SSS", "SSS",
'S', LibOreDict.TERRA_STEEL);
addOreDictRecipe(new ItemStack(ModItems.terrasteelChest), "S S", "SSS", "SSS", 'S', LibOreDict.TERRA_STEEL);
recipeTerrasteelChest = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModItems.terrasteelLegs),
"SSS", "S S", "S S",
'S', LibOreDict.TERRA_STEEL);
addOreDictRecipe(new ItemStack(ModItems.terrasteelLegs), "SSS", "S S", "S S", 'S', LibOreDict.TERRA_STEEL);
recipeTerrasteelLegs = BotaniaAPI.getLatestAddedRecipe();
addOreDictRecipe(new ItemStack(ModItems.terrasteelBoots),
"S S", "S S",
'S', LibOreDict.TERRA_STEEL);
addOreDictRecipe(new ItemStack(ModItems.terrasteelBoots), "S S", "S S", 'S', LibOreDict.TERRA_STEEL);
recipeTerrasteelBoots = BotaniaAPI.getLatestAddedRecipe();
// Terra Blade Recipe
addOreDictRecipe(new ItemStack(ModItems.terraSword),
"I", "I", "S",
'I', LibOreDict.TERRA_STEEL,
'S', LibOreDict.LIVINGWOOD_TWIG);
addOreDictRecipe(new ItemStack(ModItems.terraSword), "I", "I", "S", 'I', LibOreDict.TERRA_STEEL, 'S', LibOreDict.LIVINGWOOD_TWIG);
recipeTerraSword = BotaniaAPI.getLatestAddedRecipe();
}
@@ -37,7 +37,7 @@ public final class ModManaInfusionRecipes {
public static void init() {
manaPetalRecipes = new ArrayList();
for (int i = 0; i < 16; i++)
for(int i = 0; i < 16; i++)
manaPetalRecipes.add(BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaPetal, 1, i), LibOreDict.PETAL[i], 1000));
manasteelRecipe = BotaniaAPI.registerManaInfusionRecipe(new ItemStack(ModItems.manaResource, 1, 0), "ingotIron", 3000);
@@ -28,15 +28,13 @@ public class CompositeLensRecipe implements IRecipe {
boolean foundSecondLens = false;
boolean foundSlimeball = false;
for (int i = 0; i < var1.getSizeInventory(); i++) {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if (stack != null) {
if (stack.getItem() instanceof ILens && !foundSecondLens) {
if (foundLens)
foundSecondLens = true;
if(stack != null) {
if(stack.getItem() instanceof ILens && !foundSecondLens) {
if(foundLens) foundSecondLens = true;
else foundLens = true;
} else if (stack.getItem() == Items.slime_ball)
foundSlimeball = true;
} else if(stack.getItem() == Items.slime_ball) foundSlimeball = true;
else return false; // Found an invalid item, breaking the recipe
}
}
@@ -49,19 +47,17 @@ public class CompositeLensRecipe implements IRecipe {
ItemStack lens = null;
ItemStack secondLens = null;
for (int i = 0; i < var1.getSizeInventory(); i++) {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if (stack != null) {
if (stack.getItem() instanceof ILens)
if (lens == null)
lens = stack;
else secondLens = stack;
if(stack != null) {
if(stack.getItem() instanceof ILens) if(lens == null) lens = stack;
else secondLens = stack;
}
}
if (lens.getItem() instanceof ILens) {
if(lens.getItem() instanceof ILens) {
ILens lensItem = (ILens) lens.getItem();
if (secondLens == null || !lensItem.canCombineLenses(lens, secondLens) || lensItem.getCompositeLens(lens) != null || lensItem.getCompositeLens(secondLens) != null)
if(secondLens == null || !lensItem.canCombineLenses(lens, secondLens) || lensItem.getCompositeLens(lens) != null || lensItem.getCompositeLens(secondLens) != null)
return null;
ItemStack lensCopy = lens.copy();
@@ -25,14 +25,12 @@ public class ManaGunLensRecipe implements IRecipe {
boolean foundLens = false;
boolean foundGun = false;
for (int i = 0; i < var1.getSizeInventory(); i++) {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if (stack != null) {
if (stack.getItem() instanceof ItemManaGun && ItemManaGun.getLens(stack) == null)
foundGun = true;
if(stack != null) {
if(stack.getItem() instanceof ItemManaGun && ItemManaGun.getLens(stack) == null) foundGun = true;
else if (stack.getItem() instanceof ILens)
foundLens = true;
else if(stack.getItem() instanceof ILens) foundLens = true;
else return false; // Found an invalid item, breaking the recipe
}
@@ -46,18 +44,15 @@ public class ManaGunLensRecipe implements IRecipe {
ItemStack lens = null;
ItemStack gun = null;
for (int i = 0; i < var1.getSizeInventory(); i++) {
for(int i = 0; i < var1.getSizeInventory(); i++) {
ItemStack stack = var1.getStackInSlot(i);
if (stack != null) {
if (stack.getItem() instanceof ItemManaGun)
gun = stack;
else if (stack.getItem() instanceof ILens)
lens = stack;
if(stack != null) {
if(stack.getItem() instanceof ItemManaGun) gun = stack;
else if(stack.getItem() instanceof ILens) lens = stack;
}
}
if (lens == null || gun == null)
return null;
if(lens == null || gun == null) return null;
ItemStack gunCopy = gun.copy();
ItemManaGun.setLens(gunCopy, lens);
@@ -67,12 +67,10 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
public EntityManaBurst(World world) {
super(world);
setSize(0F, 0F);
for (int i = 0; i < dataWatcherEntries; i++) {
for(int i = 0; i < dataWatcherEntries; i++) {
int j = dataWatcherStart + i;
if (i == 4 || i == 5 || i == 10 || i == 11 || i == 12)
dataWatcher.addObject(j, 0F);
else if (i == 9)
dataWatcher.addObject(j, new ItemStack(Blocks.stone, 0, 0));
if(i == 4 || i == 5 || i == 10 || i == 11 || i == 12) dataWatcher.addObject(j, 0F);
else if(i == 9) dataWatcher.addObject(j, new ItemStack(Blocks.stone, 0, 0));
else dataWatcher.addObject(j, 0);
dataWatcher.setObjectWatched(j);
@@ -125,34 +123,33 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
lastTickPosZ = posZ;
onEntityUpdate();
if (throwableShake > 0)
--throwableShake;
if(throwableShake > 0) --throwableShake;
Vec3 vec3 = new Vector3(posX, posY, posZ).toVec3D();
Vec3 vec31 = new Vector3(posX + motionX, posY + motionY, posZ + motionZ).toVec3D();
MovingObjectPosition movingobjectposition = clip(vec3, vec31);
if (movingobjectposition != null)
if(movingobjectposition != null)
vec31 = new Vector3(movingobjectposition.hitVec.xCoord, movingobjectposition.hitVec.yCoord, movingobjectposition.hitVec.zCoord).toVec3D();
if (!worldObj.isRemote) {
if(!worldObj.isRemote) {
Entity entity = null;
List list = worldObj.getEntitiesWithinAABBExcludingEntity(this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
EntityLivingBase entitylivingbase = getThrower();
for (int j = 0; j < list.size(); ++j) {
for(int j = 0; j < list.size(); ++j) {
Entity entity1 = (Entity) list.get(j);
if (entity1.canBeCollidedWith() && (entity1 != entitylivingbase || ticksInAir >= 5)) {
if(entity1.canBeCollidedWith() && (entity1 != entitylivingbase || ticksInAir >= 5)) {
float f = 0.3F;
AxisAlignedBB axisalignedbb = entity1.boundingBox.expand(f, f, f);
MovingObjectPosition movingobjectposition1 = axisalignedbb.calculateIntercept(vec3, vec31);
if (movingobjectposition1 != null) {
if(movingobjectposition1 != null) {
double d1 = vec3.distanceTo(movingobjectposition1.hitVec);
if (d1 < d0 || d0 == 0.0D) {
if(d1 < d0 || d0 == 0.0D) {
entity = entity1;
d0 = d1;
}
@@ -160,12 +157,10 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
}
}
if (entity != null)
movingobjectposition = new MovingObjectPosition(entity);
if(entity != null) movingobjectposition = new MovingObjectPosition(entity);
}
if (movingobjectposition != null)
onImpact(movingobjectposition);
if(movingobjectposition != null) onImpact(movingobjectposition);
posX += motionX;
posY += motionY;
@@ -173,17 +168,14 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
float f1 = MathHelper.sqrt_double(motionX * motionX + motionZ * motionZ);
rotationYaw = (float) (Math.atan2(motionX, motionZ) * 180.0D / Math.PI);
for (rotationPitch = (float) (Math.atan2(motionY, f1) * 180.0D / Math.PI); rotationPitch - prevRotationPitch < -180.0F; prevRotationPitch -= 360.0F)
for(rotationPitch = (float) (Math.atan2(motionY, f1) * 180.0D / Math.PI); rotationPitch - prevRotationPitch < -180.0F; prevRotationPitch -= 360.0F)
;
while (rotationPitch - prevRotationPitch >= 180.0F)
prevRotationPitch += 360.0F;
while(rotationPitch - prevRotationPitch >= 180.0F) prevRotationPitch += 360.0F;
while (rotationYaw - prevRotationYaw < -180.0F)
prevRotationYaw -= 360.0F;
while(rotationYaw - prevRotationYaw < -180.0F) prevRotationYaw -= 360.0F;
while (rotationYaw - prevRotationYaw >= 180.0F)
prevRotationYaw += 360.0F;
while(rotationYaw - prevRotationYaw >= 180.0F) prevRotationYaw += 360.0F;
rotationPitch = prevRotationPitch + (rotationPitch - prevRotationPitch) * 0.2F;
rotationYaw = prevRotationYaw + (rotationYaw - prevRotationYaw) * 0.2F;
@@ -196,8 +188,8 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
public MovingObjectPosition clip(Vec3 par1Vec3, Vec3 par2Vec3) {
boolean par3 = false;
boolean par4 = false;
if (!Double.isNaN(par1Vec3.xCoord) && !Double.isNaN(par1Vec3.yCoord) && !Double.isNaN(par1Vec3.zCoord)) {
if (!Double.isNaN(par2Vec3.xCoord) && !Double.isNaN(par2Vec3.yCoord) && !Double.isNaN(par2Vec3.zCoord)) {
if(!Double.isNaN(par1Vec3.xCoord) && !Double.isNaN(par1Vec3.yCoord) && !Double.isNaN(par1Vec3.zCoord)) {
if(!Double.isNaN(par2Vec3.xCoord) && !Double.isNaN(par2Vec3.yCoord) && !Double.isNaN(par2Vec3.zCoord)) {
int i = MathHelper.floor_double(par2Vec3.xCoord);
int j = MathHelper.floor_double(par2Vec3.yCoord);
int k = MathHelper.floor_double(par2Vec3.zCoord);
@@ -207,21 +199,19 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
Block block = worldObj.getBlock(l, i1, j1);
int l1 = worldObj.getBlockMetadata(l, i1, j1);
if (block != null && (!par4 || block == null || block.getCollisionBoundingBoxFromPool(worldObj, l, i1, j1) != null) && block != Blocks.air && block.canCollideCheck(l1, par3)) {
if(block != null && (!par4 || block == null || block.getCollisionBoundingBoxFromPool(worldObj, l, i1, j1) != null) && block != Blocks.air && block.canCollideCheck(l1, par3)) {
MovingObjectPosition movingobjectposition = block.collisionRayTrace(worldObj, l, i1, j1, par1Vec3, par2Vec3);
if (movingobjectposition != null)
return movingobjectposition;
if(movingobjectposition != null) return movingobjectposition;
}
int k1 = 200;
while (k1-- >= 0) {
if (Double.isNaN(par1Vec3.xCoord) || Double.isNaN(par1Vec3.yCoord) || Double.isNaN(par1Vec3.zCoord))
while(k1-- >= 0) {
if(Double.isNaN(par1Vec3.xCoord) || Double.isNaN(par1Vec3.yCoord) || Double.isNaN(par1Vec3.zCoord))
return null;
if (l == i && i1 == j && j1 == k)
return null;
if(l == i && i1 == j && j1 == k) return null;
boolean flag2 = true;
boolean flag3 = true;
@@ -230,22 +220,16 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
double d1 = 999.0D;
double d2 = 999.0D;
if (i > l)
d0 = l + 1.0D;
else if (i < l)
d0 = l + 0.0D;
if(i > l) d0 = l + 1.0D;
else if(i < l) d0 = l + 0.0D;
else flag2 = false;
if (j > i1)
d1 = i1 + 1.0D;
else if (j < i1)
d1 = i1 + 0.0D;
if(j > i1) d1 = i1 + 1.0D;
else if(j < i1) d1 = i1 + 0.0D;
else flag3 = false;
if (k > j1)
d2 = j1 + 1.0D;
else if (k < j1)
d2 = j1 + 0.0D;
if(k > j1) d2 = j1 + 1.0D;
else if(k < j1) d2 = j1 + 0.0D;
else flag4 = false;
double d3 = 999.0D;
@@ -255,36 +239,30 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
double d7 = par2Vec3.yCoord - par1Vec3.yCoord;
double d8 = par2Vec3.zCoord - par1Vec3.zCoord;
if (flag2)
d3 = (d0 - par1Vec3.xCoord) / d6;
if(flag2) d3 = (d0 - par1Vec3.xCoord) / d6;
if (flag3)
d4 = (d1 - par1Vec3.yCoord) / d7;
if(flag3) d4 = (d1 - par1Vec3.yCoord) / d7;
if (flag4)
d5 = (d2 - par1Vec3.zCoord) / d8;
if(flag4) d5 = (d2 - par1Vec3.zCoord) / d8;
byte b0;
if (d3 < d4 && d3 < d5) {
if (i > l)
b0 = 4;
if(d3 < d4 && d3 < d5) {
if(i > l) b0 = 4;
else b0 = 5;
par1Vec3.xCoord = d0;
par1Vec3.yCoord += d7 * d3;
par1Vec3.zCoord += d8 * d3;
} else if (d4 < d5) {
if (j > i1)
b0 = 0;
} else if(d4 < d5) {
if(j > i1) b0 = 0;
else b0 = 1;
par1Vec3.xCoord += d6 * d4;
par1Vec3.yCoord = d1;
par1Vec3.zCoord += d8 * d4;
} else {
if (k > j1)
b0 = 2;
if(k > j1) b0 = 2;
else b0 = 3;
par1Vec3.xCoord += d6 * d5;
@@ -295,21 +273,21 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
Vec3 vec32 = new Vector3(par1Vec3.xCoord, par1Vec3.yCoord, par1Vec3.zCoord).toVec3D();
l = (int) (vec32.xCoord = MathHelper.floor_double(par1Vec3.xCoord));
if (b0 == 5) {
if(b0 == 5) {
--l;
++vec32.xCoord;
}
i1 = (int) (vec32.yCoord = MathHelper.floor_double(par1Vec3.yCoord));
if (b0 == 1) {
if(b0 == 1) {
--i1;
++vec32.yCoord;
}
j1 = (int) (vec32.zCoord = MathHelper.floor_double(par1Vec3.zCoord));
if (b0 == 3) {
if(b0 == 3) {
--j1;
++vec32.zCoord;
}
@@ -317,11 +295,10 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
Block block1 = worldObj.getBlock(l, i1, j1);
int j2 = worldObj.getBlockMetadata(l, i1, j1);
if ((!par4 || block1 == null || block1.getCollisionBoundingBoxFromPool(worldObj, l, i1, j1) != null) && block1 != Blocks.air && block1.canCollideCheck(j2, par3)) {
if((!par4 || block1 == null || block1.getCollisionBoundingBoxFromPool(worldObj, l, i1, j1) != null) && block1 != Blocks.air && block1.canCollideCheck(j2, par3)) {
MovingObjectPosition movingobjectposition1 = block1.collisionRayTrace(worldObj, l, i1, j1, par1Vec3, par2Vec3);
if (movingobjectposition1 != null)
return movingobjectposition1;
if(movingobjectposition1 != null) return movingobjectposition1;
}
}
@@ -335,18 +312,16 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
superUpdate();
ILensEffect lens = getLensInstance();
if (lens != null)
lens.updateBurst(this, getSourceLens());
if(lens != null) lens.updateBurst(this, getSourceLens());
int mana = getMana();
if (ticksExisted >= getMinManaLoss()) {
if(ticksExisted >= getMinManaLoss()) {
accumulatedManaLoss += getManaLossPerTick();
int loss = (int) accumulatedManaLoss;
setMana(mana - loss);
accumulatedManaLoss -= loss;
if (getMana() <= 0)
setDead();
if(getMana() <= 0) setDead();
}
particles();
@@ -355,14 +330,12 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
fullManaLastTick = getMana() == getStartingMana();
if (scanBeam) {
if(scanBeam) {
PositionProperties props = new PositionProperties(this);
if (propsList.isEmpty())
propsList.add(props);
if(propsList.isEmpty()) propsList.add(props);
else {
PositionProperties lastProps = propsList.get(propsList.size() - 1);
if (!props.coordsEqual(lastProps))
propsList.add(props);
if(!props.coordsEqual(lastProps)) propsList.add(props);
}
}
}
@@ -378,13 +351,12 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
public TileEntity getCollidedTile(boolean noParticles) {
this.noParticles = noParticles;
while (!isDead) {
while(!isDead) {
++ticksExisted;
onUpdate();
}
if (fake)
incrementFakeParticleTick();
if(fake) incrementFakeParticleTick();
return collidedTile;
}
@@ -433,12 +405,10 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
}
public void particles() {
if (isDead || !worldObj.isRemote)
return;
if(isDead || !worldObj.isRemote) return;
ILensEffect lens = getLensInstance();
if (lens != null && !lens.doParticles(this, getSourceLens()))
return;
if(lens != null && !lens.doParticles(this, getSourceLens())) return;
Color color = new Color(getColor());
float r = color.getRed() / 255F;
@@ -449,18 +419,15 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
int maxMana = getStartingMana();
float size = (float) mana / (float) maxMana;
if (fake) {
if (getMana() == getStartingMana())
size = 2F;
else if (fullManaLastTick)
size = 4F;
if(fake) {
if(getMana() == getStartingMana()) size = 2F;
else if(fullManaLastTick) size = 4F;
if (!noParticles && shouldDoFakeParticles())
if(!noParticles && shouldDoFakeParticles())
Botania.proxy.sparkleFX(worldObj, posX, posY, posZ, r, g, b, 0.4F * size, 1, true);
} else {
if (ConfigHandler.subtlePowerSystem)
for (int i = 0; i < 1; i++)
Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.1F * size, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.01F);
if(ConfigHandler.subtlePowerSystem) for(int i = 0; i < 1; i++)
Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.1F * size, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.02F, (float) (Math.random() - 0.5F) * 0.01F);
else {
posX += motionX;
posY += motionY;
@@ -487,22 +454,21 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
boolean collided = false;
boolean dead = false;
if (movingobjectposition.entityHit == null) {
if(movingobjectposition.entityHit == null) {
TileEntity tile = worldObj.getTileEntity(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ);
Block block = worldObj.getBlock(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ);
if ((tile instanceof IManaCollisionGhost && ((IManaCollisionGhost) tile).isGhost()) || block instanceof BlockBush)
if((tile instanceof IManaCollisionGhost && ((IManaCollisionGhost) tile).isGhost()) || block instanceof BlockBush)
return;
ChunkCoordinates coords = getBurstSourceChunkCoordinates();
if (tile != null && (tile.xCoord != coords.posX || tile.yCoord != coords.posY || tile.zCoord != coords.posZ))
if(tile != null && (tile.xCoord != coords.posX || tile.yCoord != coords.posY || tile.zCoord != coords.posZ))
collidedTile = tile;
if (tile == null || tile.xCoord != coords.posX || tile.yCoord != coords.posY || tile.zCoord != coords.posZ) {
if (!fake && !noParticles && !worldObj.isRemote && tile != null && tile instanceof IManaReceiver && ((IManaReceiver) tile).canRecieveManaFromBursts()) {
if(tile == null || tile.xCoord != coords.posX || tile.yCoord != coords.posY || tile.zCoord != coords.posZ) {
if(!fake && !noParticles && !worldObj.isRemote && tile != null && tile instanceof IManaReceiver && ((IManaReceiver) tile).canRecieveManaFromBursts()) {
int mana = getMana();
if (tile instanceof IManaCollector)
mana *= ((IManaCollector) tile).getManaYieldMultiplier(this);
if(tile instanceof IManaCollector) mana *= ((IManaCollector) tile).getManaYieldMultiplier(this);
((IManaReceiver) tile).recieveMana(mana);
worldObj.markBlockForUpdate(tile.xCoord, tile.yCoord, tile.zCoord);
@@ -515,14 +481,14 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
}
ILensEffect lens = getLensInstance();
if (lens != null)
if(lens != null)
dead = lens.collideBurst(this, movingobjectposition, collidedTile != null && collidedTile instanceof IManaReceiver && ((IManaReceiver) collidedTile).canRecieveManaFromBursts(), dead, getSourceLens());
if (collided && !hasAlreadyCollidedAt(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ))
if(collided && !hasAlreadyCollidedAt(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ))
alreadyCollidedAt.add(getCollisionLocString(movingobjectposition.blockX, movingobjectposition.blockY, movingobjectposition.blockZ));
if (dead && !isDead) {
if (!fake) {
if(dead && !isDead) {
if(!fake) {
Color color = new Color(getColor());
float r = color.getRed() / 255F;
float g = color.getGreen() / 255F;
@@ -532,9 +498,8 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
int maxMana = getStartingMana();
float size = (float) mana / (float) maxMana;
if (!ConfigHandler.subtlePowerSystem)
for (int i = 0; i < 4; i++)
Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.15F * size, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F);
if(!ConfigHandler.subtlePowerSystem) for(int i = 0; i < 4; i++)
Botania.proxy.wispFX(worldObj, posX, posY, posZ, r, g, b, 0.15F * size, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F, (float) (Math.random() - 0.5F) * 0.04F);
Botania.proxy.sparkleFX(worldObj, (float) posX, (float) posY, (float) posZ, r, g, b, 4, 2);
}
@@ -546,11 +511,10 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
public void setDead() {
super.setDead();
if (!fake) {
if(!fake) {
ChunkCoordinates coords = getBurstSourceChunkCoordinates();
TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ);
if (tile != null && tile instanceof TileSpreader)
((TileSpreader) tile).canShootBurst = true;
if(tile != null && tile instanceof TileSpreader) ((TileSpreader) tile).canShootBurst = true;
} else setDeathTicksForFakeParticle();
}
@@ -658,8 +622,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
public ILensEffect getLensInstance() {
ItemStack lens = getSourceLens();
if (lens != null && lens.getItem() instanceof ILensEffect)
return (ILensEffect) lens.getItem();
if(lens != null && lens.getItem() instanceof ILensEffect) return (ILensEffect) lens.getItem();
return null;
}
@@ -683,12 +646,11 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
}
private boolean shouldDoFakeParticles() {
if (ConfigHandler.staticWandBeam)
return true;
if(ConfigHandler.staticWandBeam) return true;
ChunkCoordinates coords = getBurstSourceChunkCoordinates();
TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ);
if (tile != null && tile instanceof TileSpreader)
if(tile != null && tile instanceof TileSpreader)
return getMana() != getStartingMana() && fullManaLastTick || Math.abs(((TileSpreader) tile).burstParticleTick - ticksExisted) < 4;
return false;
}
@@ -696,10 +658,10 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
private void incrementFakeParticleTick() {
ChunkCoordinates coords = getBurstSourceChunkCoordinates();
TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ);
if (tile != null && tile instanceof TileSpreader) {
if(tile != null && tile instanceof TileSpreader) {
TileSpreader spreader = (TileSpreader) tile;
spreader.burstParticleTick += 2;
if (spreader.lastBurstDeathTick != -1 && spreader.burstParticleTick > spreader.lastBurstDeathTick)
if(spreader.lastBurstDeathTick != -1 && spreader.burstParticleTick > spreader.lastBurstDeathTick)
spreader.burstParticleTick = 0;
}
}
@@ -707,8 +669,7 @@ public class EntityManaBurst extends EntityThrowable implements IManaBurst {
private void setDeathTicksForFakeParticle() {
ChunkCoordinates coords = getBurstSourceChunkCoordinates();
TileEntity tile = worldObj.getTileEntity(coords.posX, coords.posY, coords.posZ);
if (tile != null && tile instanceof TileSpreader)
((TileSpreader) tile).lastBurstDeathTick = ticksExisted;
if(tile != null && tile instanceof TileSpreader) ((TileSpreader) tile).lastBurstDeathTick = ticksExisted;
}
public static class PositionProperties {
@@ -36,22 +36,20 @@ public class EntitySignalFlare extends Entity {
@Override
public void onEntityUpdate() {
super.onEntityUpdate();
if (ticksExisted++ >= 100)
setDead();
if(ticksExisted++ >= 100) setDead();
if (!isDead) {
if (ticksExisted % 10 == 0)
playSound("creeper.primed", 1F, 1F);
if(!isDead) {
if(ticksExisted % 10 == 0) playSound("creeper.primed", 1F, 1F);
int color = getColor();
if (color < 16 && color >= 0) {
if(color < 16 && color >= 0) {
float[] colorArray = EntitySheep.fleeceColorTable[color];
Botania.proxy.setWispFXDistanceLimit(false);
for (int i = 0; i < 3; i++)
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));
for (int i = 0; i < 4; i++)
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);
Botania.proxy.setWispFXDistanceLimit(true);
}
@@ -35,7 +35,7 @@ public class Item16Colors extends ItemMod {
@Override
public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List par3List) {
for (int i = 0; i < 16; i++)
for(int i = 0; i < 16; i++)
par3List.add(new ItemStack(item, 1, i));
}
@@ -32,14 +32,14 @@ public class ItemDirtRod extends ItemMod {
@Override
public boolean onItemUse(ItemStack par1ItemStack, EntityPlayer par2EntityPlayer, World par3World, int par4, int par5, int par6, int par7, float par8, float par9, float par10) {
if (ManaItemHandler.requestManaExact(par1ItemStack, par2EntityPlayer, COST, false)) {
if(ManaItemHandler.requestManaExact(par1ItemStack, par2EntityPlayer, COST, false)) {
ItemStack stackToPlace = new ItemStack(Blocks.dirt);
stackToPlace.tryPlaceItemIntoWorld(par2EntityPlayer, par3World, par4, par5, par6, par7, par8, par9, par10);
if (stackToPlace.stackSize == 0) {
if(stackToPlace.stackSize == 0) {
ManaItemHandler.requestManaExact(par1ItemStack, par2EntityPlayer, COST, true);
ForgeDirection dir = ForgeDirection.getOrientation(par7);
for (int i = 0; i < 6; i++)
for(int i = 0; i < 6; i++)
Botania.proxy.sparkleFX(par3World, par4 + dir.offsetX + Math.random(), par5 + dir.offsetY + Math.random(), par6 + dir.offsetZ + Math.random(), 0.35F, 0.2F, 0.05F, 1F, 5);
}
}
Loaded 100 of 134 files, more files were not shown because too many files have changed in this diff. Show more