Some cleanup...

This commit is contained in:
Lizbeth Rika committed 2014-09-25 15:23:39 +01:00
1 parent 0ef3cf1381
commit e27ea7e340
15 files changed
+48 -54

No files matched your search

@@ -19,7 +19,7 @@ public abstract class LexiconPage {
public String unlocalizedName;
public boolean skipRegistry;
public LexiconPage(String unlocalizedName) {
this.unlocalizedName = unlocalizedName;
}
@@ -59,7 +59,7 @@ public abstract class LexiconPage {
public String getUnlocalizedName() {
return unlocalizedName;
}
public LexiconPage setSkipRegistry() {
skipRegistry = true;
return this;
@@ -63,7 +63,7 @@ public final class HUDHandler {
Block block = mc.theWorld.getBlock(pos.blockX, pos.blockY, pos.blockZ);
TileEntity tile = mc.theWorld.getTileEntity(pos.blockX, pos.blockY, pos.blockZ);
ItemStack stack = mc.thePlayer.getCurrentEquippedItem();
if(stack != null) {
if(pos != null && stack.getItem() == ModItems.twigWand) {
if(block instanceof IWandHUD)
@@ -145,7 +145,7 @@ public final class HUDHandler {
RenderHelper.drawTexturedModalRect(x, y, 0, 0, 251, width, 5);
GL11.glDisable(GL11.GL_BLEND);
}
private void renderPoolRecipeHUD(ScaledResolution res, TilePool tile, ItemStack stack) {
for(RecipeManaInfusion recipe : BotaniaAPI.manaInfusionRecipes) {
if(recipe.matches(stack)) {
@@ -153,10 +153,10 @@ public final class HUDHandler {
mc.renderEngine.bindTexture(manaBar);
int x = res.getScaledWidth() / 2 - 11;
int y = res.getScaledHeight() / 2 + 10;
int u = tile.getCurrentMana() >= recipe.getManaToConsume() ? 0 : 22;
int v = mc.thePlayer.getCommandSenderName().equals("haighyorkie") && mc.thePlayer.isSneaking() ? 23 : 8;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
RenderHelper.drawTexturedModalRect(x, y, 0, u, v, 22, 15);
@@ -189,7 +189,7 @@ public final class HUDHandler {
if(entry != null) {
if(!((ILexicon) stack.getItem()).isKnowledgeUnlocked(stack, entry.getKnowledgeType()))
font = mc.standardGalacticFontRenderer;
drawStr = StatCollector.translateToLocal(entry.getUnlocalizedName());
draw = true;
}
@@ -211,7 +211,7 @@ public final class HUDHandler {
drawStr = "?";
font = mc.fontRenderer;
}
RenderItem.getInstance().renderItemIntoGUI(mc.fontRenderer, mc.renderEngine, new ItemStack(ModItems.lexicon), sx, sy);
GL11.glDisable(GL11.GL_LIGHTING);
font.drawStringWithShadow(drawStr, sx + 10, sy + 8, 0xFFFFFFFF);
@@ -103,7 +103,7 @@ public class GuiLexicon extends GuiScreen {
GL11.glScalef(0.5F, 0.5F, 0.5F);
drawTexturedModalRect((left - 92) * 2, (top + 40) * 2, 0, 0, 184, 248);
GL11.glScalef(2F, 2F, 2F);
RenderHelper.renderTooltip(par1, par2, Arrays.asList(EnumChatFormatting.GOLD + "#goldfishchris", EnumChatFormatting.AQUA + "CONGRATS ON YOUR NEW COMPUTER!!", "vazkii.us/goldfish"));
}
}
@@ -108,15 +108,15 @@ public class GuiLexiconEntry extends GuiLexicon implements IGuiLexiconEntry, IPa
page++;
ClientTickHandler.notifyPageChange();
break;
case 3 :
case 3 :
Minecraft mc = Minecraft.getMinecraft();
String cmd = "/botania-share " + entry.unlocalizedName;
mc.ingameGUI.getChatGUI().addToSentMessages(cmd);
mc.thePlayer.sendChatMessage(cmd);
mc.ingameGUI.getChatGUI().addToSentMessages(cmd);
mc.thePlayer.sendChatMessage(cmd);
break;
}
updatePageButtons();
}
@@ -55,10 +55,10 @@ public class RenderTileSpreader extends TileEntitySpecialRenderer {
Minecraft.getMinecraft().renderEngine.bindTexture(spreader.isRedstone() ? textureRs : spreader.isDreamwood() ? textureDw : texture);
GL11.glScalef(1F, -1F, -1F);
if(spreader.isULTRA_SPREADER()) {
Color color = Color.getHSBColor((float) ((((double) System.currentTimeMillis() / 10) + new Random(spreader.xCoord ^ spreader.yCoord ^ spreader.zCoord).nextInt(10000)) % 360) / 360F, 0.4F, 0.9F);
GL11.glColor3f((float) color.getRed() / 255F, (float) color.getGreen() / 255F, (float) color.getBlue() / 255F);
Color color = Color.getHSBColor((float) (((double) System.currentTimeMillis() / 10 + new Random(spreader.xCoord ^ spreader.yCoord ^ spreader.zCoord).nextInt(10000)) % 360) / 360F, 0.4F, 0.9F);
GL11.glColor3f(color.getRed() / 255F, color.getGreen() / 255F, color.getBlue() / 255F);
}
model.render();
GL11.glColor3f(1F, 1F, 1F);
@@ -32,7 +32,7 @@ public class BlockElfGlass extends BlockMod implements IElvenItem, ILexiconable
private static final int ICON_COUNT = 4;
IIcon[] icons;
public BlockElfGlass() {
super(Material.glass);
setHardness(0.3F);
@@ -40,7 +40,7 @@ public class BlockElfGlass extends BlockMod implements IElvenItem, ILexiconable
setLightLevel(1.0F);
setBlockName(LibBlockNames.ELF_GLASS);
}
@Override
public void registerBlockIcons(IIconRegister par1IconRegister) {
icons = new IIcon[ICON_COUNT];
@@ -49,13 +49,14 @@ public class BlockElfGlass extends BlockMod implements IElvenItem, ILexiconable
blockIcon = icons[0];
}
@Override
public boolean isOpaqueCube() {
return false;
}
@Override
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int s) {
int v = (int) Math.floor((double) new Random((x * 10) ^ (y * 20) ^ (z * 30)).nextInt(ICON_COUNT * 100) / 100.0);
int v = (int) Math.floor(new Random(x * 10 ^ y * 20 ^ z * 30).nextInt(ICON_COUNT * 100) / 100.0);
return icons[v];
}
@@ -107,7 +107,7 @@ public class TileEnchanter extends TileMod implements ISparkAttachable {
if(tile != null && tile instanceof TilePylon)
((TilePylon) tile).activated = false;
}
worldObj.setBlock(xCoord, yCoord, zCoord, Blocks.lapis_block, 0, 1 | 2);
for(int i = 0; i < 50; i++) {
float red = (float) Math.random();
@@ -344,7 +344,7 @@ public class TileSpreader extends TileSimpleInventory implements IManaCollector,
public boolean isDreamwood() {
return worldObj == null ? staticDreamwood : getBlockMetadata() == 2 || getBlockMetadata() == 3;
}
public boolean isULTRA_SPREADER() {
return worldObj == null ? staticUltra : getBlockMetadata() == 3;
}
@@ -11,13 +11,13 @@
*/
package vazkii.botania.common.core.command;
import vazkii.botania.common.core.version.ThreadDownloadMod;
import vazkii.botania.common.core.version.VersionChecker;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import vazkii.botania.common.core.version.ThreadDownloadMod;
import vazkii.botania.common.core.version.VersionChecker;
public class CommandDownloadLatest extends CommandBase {
@@ -18,12 +18,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.EnumChatFormatting;
import vazkii.botania.api.BotaniaAPI;
import vazkii.botania.api.lexicon.LexiconEntry;
import vazkii.botania.common.Botania;
import vazkii.botania.common.item.ItemLexicon;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibGuiIDs;
public class CommandOpen extends CommandBase {
@@ -1219,13 +1219,13 @@ public final class ModCrafingRecipes {
recipeRegenIvy = BotaniaAPI.getLatestAddedRecipe();
// Gaia Mana Spreader Recipe
addOreDictRecipe(new ItemStack(ModBlocks.spreader, 1, 3),
addOreDictRecipe(new ItemStack(ModBlocks.spreader, 1, 3),
"ESD",
'E', LibOreDict.LIFE_ESSENCE,
'S', new ItemStack(ModBlocks.spreader, 1, 2),
'D', LibOreDict.DRAGONSTONE);
recipeUltraSpreader = BotaniaAPI.getLatestAddedRecipe();
// Wing Recipes
GameRegistry.addShapelessRecipe(new ItemStack(ModItems.flightTiara, 1, 1), new ItemStack(ModItems.flightTiara, 1, Short.MAX_VALUE), new ItemStack(Items.quartz));
for(int i = 0; i < 6; i++)
@@ -21,7 +21,6 @@ import net.minecraftforge.common.util.ForgeDirection;
import vazkii.botania.api.mana.IManaUsingItem;
import vazkii.botania.api.mana.ManaItemHandler;
import vazkii.botania.common.Botania;
import vazkii.botania.common.block.ModBlocks;
import vazkii.botania.common.lib.LibItemNames;
public class ItemDirtRod extends ItemMod implements IManaUsingItem {
@@ -55,7 +54,7 @@ public class ItemDirtRod extends ItemMod implements IManaUsingItem {
}
}
}
return true;
}
@@ -38,7 +38,6 @@ import vazkii.botania.api.recipe.IElvenItem;
import vazkii.botania.common.Botania;
import vazkii.botania.common.core.helper.ItemNBTHelper;
import vazkii.botania.common.core.helper.MathHelper;
import vazkii.botania.common.lexicon.LexiconData;
import vazkii.botania.common.lib.LibGuiIDs;
import vazkii.botania.common.lib.LibItemNames;
import vazkii.botania.common.lib.LibMisc;
@@ -49,7 +48,7 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
private static final String TAG_FORCED_MESSAGE = "forcedMessage";
private static final String TAG_QUEUE_TICKS = "queueTicks";
boolean skipSound = false;
public ItemLexicon() {
super();
setMaxStackSize(1);
@@ -135,22 +134,22 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
else par3EntityPlayer.addChatMessage(new ChatComponentTranslation("botaniamisc.cantOpen").setChatStyle(new ChatStyle().setColor(EnumChatFormatting.RED)));
setForcedPage(par1ItemStack, "");
}
par3EntityPlayer.openGui(Botania.instance, LibGuiIDs.LEXICON, par2World, 0, 0, 0);
if(!par2World.isRemote && !skipSound)
par2World.playSoundAtEntity(par3EntityPlayer, "botania:lexiconOpen", 0.5F, 1F);
skipSound = false;
return par1ItemStack;
}
@Override
public void onUpdate(ItemStack stack, World world, Entity entity, int idk, boolean something) {
int ticks = getQueueTicks(stack);
if(ticks > 0 && entity instanceof EntityPlayer) {
skipSound = ticks < 3;
onItemRightClick(stack, world, (EntityPlayer) entity);
onItemRightClick(stack, world, (EntityPlayer) entity);
setQueueTicks(stack, ticks - 1);
}
}
@@ -177,26 +176,26 @@ public class ItemLexicon extends ItemMod implements ILexicon, IElvenItem {
public static String getForcedPage(ItemStack stack) {
return ItemNBTHelper.getString(stack, TAG_FORCED_MESSAGE, "");
}
private static LexiconEntry getEntryFromForce(ItemStack stack) {
String force = getForcedPage(stack);
for(LexiconEntry entry : BotaniaAPI.getAllEntries())
if(entry.unlocalizedName.equals(force))
if(entry != null && ((ItemLexicon) stack.getItem()).isKnowledgeUnlocked(stack, entry.getKnowledgeType()))
if(entry != null && ((ItemLexicon) stack.getItem()).isKnowledgeUnlocked(stack, entry.getKnowledgeType()))
return entry;
return null;
}
public static int getQueueTicks(ItemStack stack) {
return ItemNBTHelper.getInt(stack, TAG_QUEUE_TICKS, 0);
}
public static void setQueueTicks(ItemStack stack, int ticks) {
ItemNBTHelper.setInt(stack, TAG_QUEUE_TICKS, ticks);
}
@Override
public boolean isElvenItem(ItemStack stack) {
return isKnowledgeUnlocked(stack, BotaniaAPI.elvenKnowledge);
@@ -11,9 +11,9 @@
*/
package vazkii.botania.common.item.block;
import vazkii.botania.api.recipe.IElvenItem;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import vazkii.botania.api.recipe.IElvenItem;
public class ItemBlockElven extends ItemBlockMod implements IElvenItem {
@@ -26,6 +26,6 @@ public class ItemBlockElven extends ItemBlockMod implements IElvenItem {
return ((IElvenItem) field_150939_a).isElvenItem(stack);
}
}
@@ -38,7 +38,7 @@ import vazkii.botania.common.lib.LibItemNames;
public class ItemTerraSword extends ItemManasteelSword implements ILensEffect {
private static final String TAG_ATTACKER_USERNAME = "attackerUsername";
public ItemTerraSword() {
super(BotaniaAPI.terrasteelToolMaterial, LibItemNames.TERRA_SWORD);
}
@@ -94,9 +94,9 @@ public class ItemTerraSword extends ItemManasteelSword implements ILensEffect {
AxisAlignedBB axis = AxisAlignedBB.getBoundingBox(entity.posX, entity.posY, entity.posZ, entity.lastTickPosX, entity.lastTickPosY, entity.lastTickPosZ).expand(1, 1, 1);
List<EntityLivingBase> entities = entity.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axis);
String attacker = ItemNBTHelper.getString(burst.getSourceLens(), TAG_ATTACKER_USERNAME, "");
for(EntityLivingBase living : entities) {
if(living instanceof EntityPlayer && (((EntityPlayer) living).getCommandSenderName().equals(attacker) || (MinecraftServer.getServer() != null && !MinecraftServer.getServer().isPVPEnabled())))
if(living instanceof EntityPlayer && (((EntityPlayer) living).getCommandSenderName().equals(attacker) || MinecraftServer.getServer() != null && !MinecraftServer.getServer().isPVPEnabled()))
continue;
if(living.hurtTime == 0) {