Merge remote-tracking branch 'origin/fixes' into dev

This commit is contained in:
Martin Robertz committed 2023-01-27 21:59:43 +01:00
commit bdbe296f4a
307 files changed
+1907 -2386

No files matched your search

@@ -20,40 +20,40 @@ public interface UBOreTexturizer {
// Overlay name is the fully qualified name, e.g. modname:overlayName
// that static vars are fully qualified names for all the textures in the UB pack, just pass as is
// the event isn't needed per se, but if this is called anytime else, the blocks will not "stick"
public void setupUBOre(Block oreBlock, String overlayName, FMLPreInitializationEvent event);
void setupUBOre(Block oreBlock, String overlayName, FMLPreInitializationEvent event);
public void setupUBOre(Block oreBlock, int metadata, String overlayName, FMLPreInitializationEvent event);
void setupUBOre(Block oreBlock, int metadata, String overlayName, FMLPreInitializationEvent event);
public void setupUBOre(
void setupUBOre(
Block oreBlock, int metadata, String overlayName, String blockName, FMLPreInitializationEvent event);
public void requestUBOreSetup(Block oreBlock, String overlayName) throws BlocksAreAlreadySet;
void requestUBOreSetup(Block oreBlock, String overlayName) throws BlocksAreAlreadySet;
public void requestUBOreSetup(Block oreBlock, int metadata, String overlayName) throws BlocksAreAlreadySet;
void requestUBOreSetup(Block oreBlock, int metadata, String overlayName) throws BlocksAreAlreadySet;
public void requestUBOreSetup(Block oreBlock, int metadata, String overlayName, String blockName)
void requestUBOreSetup(Block oreBlock, int metadata, String overlayName, String blockName)
throws BlocksAreAlreadySet;
public void redoOres(int xInBlockCoordinates, int zInBlockCoordinates, World serverSideWorld);
void redoOres(int xInBlockCoordinates, int zInBlockCoordinates, World serverSideWorld);
public static String amber_overlay = "undergroundbiomes:amber_overlay";
public static String cinnabar_overlay = "undergroundbiomes:cinnabar_overlay";
public static String coal_overlay = "undergroundbiomes:coal_overlay";
public static String copper_overlay = "undergroundbiomes:copper_overlay";
public static String diamond_overlay = "undergroundbiomes:diamond_overlay";
public static String emerald_overlay = "undergroundbiomes:emerald_overlay";
public static String gold_overlay = "undergroundbiomes:gold_overlay";
public static String iron_overlay = "undergroundbiomes:iron_overlay";
public static String lapis_overlay = "undergroundbiomes:lapis_overlay";
public static String lead_overlay = "undergroundbiomes:lead_overlay";
public static String olivine_peridot_overlay = "undergroundbiomes:olivine-peridot_overlay";
public static String redstone_overlay = "undergroundbiomes:redstone_overlay";
public static String ruby_overlay = "undergroundbiomes:ruby_overlay";
public static String sapphire_overlay = "undergroundbiomes:sapphire_overlay";
public static String tin_overlay = "undergroundbiomes:tin_overlay";
public static String uranium_overlay = "undergroundbiomes:uranium_overlay";
String amber_overlay = "undergroundbiomes:amber_overlay";
String cinnabar_overlay = "undergroundbiomes:cinnabar_overlay";
String coal_overlay = "undergroundbiomes:coal_overlay";
String copper_overlay = "undergroundbiomes:copper_overlay";
String diamond_overlay = "undergroundbiomes:diamond_overlay";
String emerald_overlay = "undergroundbiomes:emerald_overlay";
String gold_overlay = "undergroundbiomes:gold_overlay";
String iron_overlay = "undergroundbiomes:iron_overlay";
String lapis_overlay = "undergroundbiomes:lapis_overlay";
String lead_overlay = "undergroundbiomes:lead_overlay";
String olivine_peridot_overlay = "undergroundbiomes:olivine-peridot_overlay";
String redstone_overlay = "undergroundbiomes:redstone_overlay";
String ruby_overlay = "undergroundbiomes:ruby_overlay";
String sapphire_overlay = "undergroundbiomes:sapphire_overlay";
String tin_overlay = "undergroundbiomes:tin_overlay";
String uranium_overlay = "undergroundbiomes:uranium_overlay";
public class BlocksAreAlreadySet extends RuntimeException {
class BlocksAreAlreadySet extends RuntimeException {
// this is thrown if UB has already run its pre-initialization step and can no longer register blocks
public final Block oreBlock;
public final String overlayName;
+3 -6
View File
@@ -51,7 +51,6 @@ import tconstruct.plugins.ubc.TinkerUBC;
import tconstruct.plugins.waila.TinkerWaila;
import tconstruct.smeltery.TinkerSmeltery;
import tconstruct.tools.TinkerTools;
import tconstruct.util.EnvironmentChecks;
import tconstruct.util.IMCHandler;
import tconstruct.util.config.DimensionBlacklist;
import tconstruct.util.config.PHConstruct;
@@ -122,8 +121,6 @@ public class TConstruct {
} else {
logger.info("Preparing to take over the world");
}
EnvironmentChecks.verifyEnvironmentSanity();
}
// Force the client and server to have or not have this mod
@@ -206,9 +203,9 @@ public class TConstruct {
@EventHandler
public void init(FMLInitializationEvent event) {
packetPipeline.initalise();
if (event.getSide() == Side.CLIENT) {
// MinecraftForge.EVENT_BUS.register(new EventCloakRender());
}
// if (event.getSide() == Side.CLIENT) {
// MinecraftForge.EVENT_BUS.register(new EventCloakRender());
// }
DimensionBlacklist.getBadBimensions();
GameRegistry.registerWorldGenerator(new SlimeIslandGen(TinkerWorld.slimePool, 2), 2);
@@ -24,8 +24,7 @@ public class AchievementEvents {
TAchievements.triggerAchievement(event.player, "tconstruct.preparedFight");
}
if (event.inventory != null
&& event.inventory instanceof ToolForgeLogic
if (event.inventory instanceof ToolForgeLogic
&& event.tool.getItem() instanceof ToolCore
&& ((ToolCore) event.tool.getItem()).durabilityTypeExtra() != 0) {
TAchievements.triggerAchievement(event.player, "tconstruct.proTinkerer");
@@ -13,7 +13,7 @@ import tconstruct.util.config.PHConstruct;
public class TAchievements {
private static AchievementPage achievementsPage;
private static HashMap<String, Achievement> achievementsList = new HashMap<String, Achievement>();
private static final HashMap<String, Achievement> achievementsList = new HashMap<>();
/**
* Adds an achievement and registers it, so there is no need to call .registerStat
@@ -8,7 +8,7 @@ import net.minecraft.world.World;
import tconstruct.achievements.TAchievements;
public class CraftAchievementItem extends CraftingItem {
public String grantedAchievement = "";
public String grantedAchievement;
public CraftAchievementItem(
String[] names,
@@ -4,7 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
public interface IPlayerExtendedInventoryWrapper {
public IInventory getKnapsackInventory(EntityPlayer player);
IInventory getKnapsackInventory(EntityPlayer player);
public IInventory getAccessoryInventory(EntityPlayer player);
IInventory getAccessoryInventory(EntityPlayer player);
}
@@ -16,7 +16,7 @@ import tconstruct.library.modifier.IModifyable;
import tconstruct.util.network.HealthUpdatePacket;
public class ArmorAbilities {
public static List<String> stepBoostedPlayers = new ArrayList();
public static List<String> stepBoostedPlayers = new ArrayList<>();
// ItemStack prevFeet;
double prevMotionY;
@@ -77,7 +77,7 @@ public class ArmorAbilities {
@SubscribeEvent
public void dimensionChanged(PlayerEvent.PlayerChangedDimensionEvent event) {
if (event.player == null || !(event.player instanceof EntityPlayerMP)) return;
if (!(event.player instanceof EntityPlayerMP)) return;
// this callback is only called serverside
float oldHealth = event.player.getHealth();
@@ -6,7 +6,6 @@ import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import java.util.Random;
import mantle.lib.client.MantleClientRegistry;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.gui.inventory.GuiInventory;
import net.minecraft.client.model.ModelBiped;
import net.minecraft.client.renderer.Tessellator;
@@ -199,8 +198,7 @@ public class ArmorProxyClient extends ArmorProxyCommon {
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if (ID == ArmorProxyCommon.inventoryGui) {
GuiInventory inventory = new GuiInventory(player);
return inventory;
return new GuiInventory(player);
}
if (ID == ArmorProxyCommon.armorGuiID) {
ArmorProxyClient.armorExtended.init(Minecraft.getMinecraft().thePlayer);
@@ -256,123 +254,123 @@ public class ArmorProxyClient extends ArmorProxyCommon {
/* HUD */
@SubscribeEvent
public void renderHealthbar(RenderGameOverlayEvent.Pre event) {
if (Loader.isModLoaded("rpghud")) // uses different display, displays health correctly by itself.
return;
if (!Loader.isModLoaded("tukmc_Vz") || Loader.isModLoaded("borderlands")) // Loader check to avoid conflicting
// with a GUI mod (thanks Vazkii!)
{
if (event.type == ElementType.HEALTH) {
updateCounter++;
if (event.type != ElementType.HEALTH) {
return;
}
ScaledResolution scaledresolution =
new ScaledResolution(this.mc, this.mc.displayWidth, this.mc.displayHeight);
int scaledWidth = scaledresolution.getScaledWidth();
int scaledHeight = scaledresolution.getScaledHeight();
int xBasePos = scaledWidth / 2 - 91;
int yBasePos = scaledHeight - 39;
// uses different display, displays health correctly by itself.
if (Loader.isModLoaded("rpghud")) {
return;
}
boolean highlight = mc.thePlayer.hurtResistantTime / 3 % 2 == 1;
if (Loader.isModLoaded("tukmc_Vz") && !Loader.isModLoaded("borderlands")) {
// Loader check to avoid conflicting
// with a GUI mod (thanks Vazkii!)
return;
}
if (mc.thePlayer.hurtResistantTime < 10) {
highlight = false;
}
updateCounter++;
IAttributeInstance attrMaxHealth =
this.mc.thePlayer.getEntityAttribute(SharedMonsterAttributes.maxHealth);
int health = MathHelper.ceiling_float_int(mc.thePlayer.getHealth());
int healthLast = MathHelper.ceiling_float_int(mc.thePlayer.prevHealth);
float healthMax = (float) attrMaxHealth.getAttributeValue();
if (healthMax > 20) healthMax = 20;
float absorb = this.mc.thePlayer.getAbsorptionAmount();
int scaledWidth = event.resolution.getScaledWidth();
int scaledHeight = event.resolution.getScaledHeight();
int xBasePos = scaledWidth / 2 - 91;
int yBasePos = scaledHeight - 39;
int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F);
int rowHeight = Math.max(10 - (healthRows - 2), 3);
boolean highlight = mc.thePlayer.hurtResistantTime / 3 % 2 == 1;
this.rand.setSeed((long) (updateCounter * 312871));
if (mc.thePlayer.hurtResistantTime < 10) {
highlight = false;
}
int left = scaledWidth / 2 - 91;
int top = scaledHeight - GuiIngameForge.left_height;
IAttributeInstance attrMaxHealth = this.mc.thePlayer.getEntityAttribute(SharedMonsterAttributes.maxHealth);
int health = MathHelper.ceiling_float_int(mc.thePlayer.getHealth());
int healthLast = MathHelper.ceiling_float_int(mc.thePlayer.prevHealth);
float healthMax = (float) attrMaxHealth.getAttributeValue();
if (healthMax > 20) healthMax = 20;
float absorb = this.mc.thePlayer.getAbsorptionAmount();
if (!GuiIngameForge.renderExperiance) {
top += 7;
yBasePos += 7;
}
int healthRows = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F / 10.0F);
int rowHeight = Math.max(10 - (healthRows - 2), 3);
int regen = -1;
if (mc.thePlayer.isPotionActive(Potion.regeneration)) {
regen = updateCounter % 25;
}
this.rand.setSeed(updateCounter * 312871L);
final int TOP = 9 * (mc.theWorld.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0);
final int BACKGROUND = (highlight ? 25 : 16);
int MARGIN = 16;
if (mc.thePlayer.isPotionActive(Potion.poison)) MARGIN += 36;
else if (mc.thePlayer.isPotionActive(Potion.wither)) MARGIN += 72;
float absorbRemaining = absorb;
int left = scaledWidth / 2 - 91;
int top = scaledHeight - GuiIngameForge.left_height;
for (int i = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F) - 1; i >= 0; --i) {
int b0 = (highlight ? 1 : 0);
int row = MathHelper.ceiling_float_int((float) (i + 1) / 10.0F) - 1;
int x = left + i % 10 * 8;
int y = top - row * rowHeight;
if (!GuiIngameForge.renderExperiance) {
top += 7;
yBasePos += 7;
}
if (health <= 4) y += rand.nextInt(2);
if (i == regen) y -= 2;
int regen = -1;
if (mc.thePlayer.isPotionActive(Potion.regeneration)) {
regen = updateCounter % 25;
}
drawTexturedModalRect(x, y, BACKGROUND, TOP, 9, 9);
final int TOP = 9 * (mc.theWorld.getWorldInfo().isHardcoreModeEnabled() ? 5 : 0);
final int BACKGROUND = (highlight ? 25 : 16);
int MARGIN = 16;
if (mc.thePlayer.isPotionActive(Potion.poison)) MARGIN += 36;
else if (mc.thePlayer.isPotionActive(Potion.wither)) MARGIN += 72;
float absorbRemaining = absorb;
if (highlight) {
if (i * 2 + 1 < healthLast) drawTexturedModalRect(x, y, MARGIN + 54, TOP, 9, 9); // 6
else if (i * 2 + 1 == healthLast) drawTexturedModalRect(x, y, MARGIN + 63, TOP, 9, 9); // 7
}
for (int i = MathHelper.ceiling_float_int((healthMax + absorb) / 2.0F) - 1; i >= 0; --i) {
int b0 = (highlight ? 1 : 0);
int row = MathHelper.ceiling_float_int((float) (i + 1) / 10.0F) - 1;
int x = left + i % 10 * 8;
int y = top - row * rowHeight;
if (absorbRemaining > 0.0F) {
if (absorbRemaining == absorb && absorb % 2.0F == 1.0F)
drawTexturedModalRect(x, y, MARGIN + 153, TOP, 9, 9); // 17
else drawTexturedModalRect(x, y, MARGIN + 144, TOP, 9, 9); // 16
absorbRemaining -= 2.0F;
} else {
if (i * 2 + 1 < health) drawTexturedModalRect(x, y, MARGIN + 36, TOP, 9, 9); // 4
else if (i * 2 + 1 == health) drawTexturedModalRect(x, y, MARGIN + 45, TOP, 9, 9); // 5
}
}
if (health <= 4) y += rand.nextInt(2);
if (i == regen) y -= 2;
int potionOffset = 0;
PotionEffect potion = mc.thePlayer.getActivePotionEffect(Potion.wither);
if (potion != null) potionOffset = 18;
potion = mc.thePlayer.getActivePotionEffect(Potion.poison);
if (potion != null) potionOffset = 9;
if (mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) potionOffset += 27;
drawTexturedModalRect(x, y, BACKGROUND, TOP, 9, 9);
// Extra hearts
this.mc.getTextureManager().bindTexture(hearts);
if (highlight) {
if (i * 2 + 1 < healthLast) drawTexturedModalRect(x, y, MARGIN + 54, TOP, 9, 9); // 6
else if (i * 2 + 1 == healthLast) drawTexturedModalRect(x, y, MARGIN + 63, TOP, 9, 9); // 7
}
int hp = MathHelper.ceiling_float_int(this.mc.thePlayer.getHealth());
for (int iter = 0; iter < hp / 20; iter++) {
int renderHearts = (hp - 20 * (iter + 1)) / 2;
if (renderHearts > 10) renderHearts = 10;
for (int i = 0; i < renderHearts; i++) {
int y = 0;
if (i == regen) y -= 2;
this.drawTexturedModalRect(xBasePos + 8 * i, yBasePos + y, 0 + 18 * iter, potionOffset, 9, 9);
}
if (hp % 2 == 1 && renderHearts < 10) {
this.drawTexturedModalRect(
xBasePos + 8 * renderHearts, yBasePos, 9 + 18 * iter, potionOffset, 9, 9);
}
}
this.mc.getTextureManager().bindTexture(icons);
GuiIngameForge.left_height += 10;
if (absorb > 0) GuiIngameForge.left_height += 10;
event.setCanceled(true);
if (event.type == ElementType.CROSSHAIRS && gs.thirdPersonView != 0) {
event.setCanceled(true);
}
if (absorbRemaining > 0.0F) {
if (absorbRemaining == absorb && absorb % 2.0F == 1.0F)
drawTexturedModalRect(x, y, MARGIN + 153, TOP, 9, 9); // 17
else drawTexturedModalRect(x, y, MARGIN + 144, TOP, 9, 9); // 16
absorbRemaining -= 2.0F;
} else {
if (i * 2 + 1 < health) drawTexturedModalRect(x, y, MARGIN + 36, TOP, 9, 9); // 4
else if (i * 2 + 1 == health) drawTexturedModalRect(x, y, MARGIN + 45, TOP, 9, 9); // 5
}
}
int potionOffset = 0;
PotionEffect potion = mc.thePlayer.getActivePotionEffect(Potion.wither);
if (potion != null) potionOffset = 18;
potion = mc.thePlayer.getActivePotionEffect(Potion.poison);
if (potion != null) potionOffset = 9;
if (mc.theWorld.getWorldInfo().isHardcoreModeEnabled()) potionOffset += 27;
// Extra hearts
this.mc.getTextureManager().bindTexture(hearts);
int hp = MathHelper.ceiling_float_int(this.mc.thePlayer.getHealth());
for (int iter = 0; iter < hp / 20; iter++) {
int renderHearts = (hp - 20 * (iter + 1)) / 2;
if (renderHearts > 10) renderHearts = 10;
for (int i = 0; i < renderHearts; i++) {
int y = 0;
if (i == regen) y -= 2;
this.drawTexturedModalRect(xBasePos + 8 * i, yBasePos + y, 0 + 18 * iter, potionOffset, 9, 9);
}
if (hp % 2 == 1 && renderHearts < 10) {
this.drawTexturedModalRect(xBasePos + 8 * renderHearts, yBasePos, 9 + 18 * iter, potionOffset, 9, 9);
}
}
this.mc.getTextureManager().bindTexture(icons);
GuiIngameForge.left_height += 10;
if (absorb > 0) GuiIngameForge.left_height += 10;
event.setCanceled(true);
}
public void drawTexturedModalRect(int par1, int par2, int par3, int par4, int par5, int par6) {
@@ -381,29 +379,12 @@ public class ArmorProxyClient extends ArmorProxyCommon {
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(
(double) (par1 + 0),
(double) (par2 + par6),
(double) this.zLevel,
(double) ((float) (par3 + 0) * f),
(double) ((float) (par4 + par6) * f1));
par1 + 0, par2 + par6, this.zLevel, (float) (par3 + 0) * f, (float) (par4 + par6) * f1);
tessellator.addVertexWithUV(
(double) (par1 + par5),
(double) (par2 + par6),
(double) this.zLevel,
(double) ((float) (par3 + par5) * f),
(double) ((float) (par4 + par6) * f1));
par1 + par5, par2 + par6, this.zLevel, (float) (par3 + par5) * f, (float) (par4 + par6) * f1);
tessellator.addVertexWithUV(
(double) (par1 + par5),
(double) (par2 + 0),
(double) this.zLevel,
(double) ((float) (par3 + par5) * f),
(double) ((float) (par4 + 0) * f1));
tessellator.addVertexWithUV(
(double) (par1 + 0),
(double) (par2 + 0),
(double) this.zLevel,
(double) ((float) (par3 + 0) * f),
(double) ((float) (par4 + 0) * f1));
par1 + par5, par2 + 0, this.zLevel, (float) (par3 + par5) * f, (float) (par4 + 0) * f1);
tessellator.addVertexWithUV(par1 + 0, par2 + 0, this.zLevel, (float) (par3 + 0) * f, (float) (par4 + 0) * f1);
tessellator.draw();
}
@@ -537,8 +518,9 @@ public class ArmorProxyClient extends ArmorProxyCommon {
private float interpolateRotation(float par1, float par2, float par3) {
float f3;
for (f3 = par2 - par1; f3 < -180.0F; f3 += 360.0F) {
;
f3 = par2 - par1;
while (f3 < -180.0F) {
f3 += 360.0F;
}
while (f3 >= 180.0F) {
@@ -2,14 +2,13 @@ package tconstruct.armor;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
import cpw.mods.fml.relauncher.*;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.Minecraft;
import tconstruct.client.ArmorControls;
public class ArmorTickHandler {
Minecraft mc = Minecraft.getMinecraft();
ArmorControls controlInstance = ((ArmorProxyClient) TinkerArmor.proxy).controlInstance;
private final Minecraft mc = Minecraft.getMinecraft();
@SideOnly(Side.CLIENT)
@SubscribeEvent
@@ -17,7 +16,7 @@ public class ArmorTickHandler {
/*TinkerWorld.oreBerry.setGraphicsLevel(Blocks.leaves.field_150121_P);
TinkerWorld.oreBerrySecond.setGraphicsLevel(Blocks.leaves.field_150121_P);
TinkerWorld.slimeLeaves.setGraphicsLevel(Blocks.leaves.field_150121_P);*/
if (mc.thePlayer != null && mc.thePlayer.onGround) controlInstance.landOnGround();
if (mc.thePlayer != null && mc.thePlayer.onGround) ArmorProxyClient.controlInstance.landOnGround();
}
/*
@@ -74,7 +74,7 @@ public class PlayerAbilityHelper {
entity.boundingBox.maxY = entity.boundingBox.minY + (double) entity.height;
if (entity.width > f2 && !entity.worldObj.isRemote) {
entity.moveEntity((double) (f2 - entity.width), 0.0D, (double) (f2 - entity.width));
entity.moveEntity(f2 - entity.width, 0.0D, f2 - entity.width);
}
}
@@ -78,10 +78,7 @@ public class TinkerArmor {
GameRegistry.registerTileEntity(DryingRackLogic.class, "Armor.DryingRack");
TinkerArmor.diamondApple = new DiamondApple().setUnlocalizedName("tconstruct.apple.diamond");
GameRegistry.registerItem(TinkerArmor.diamondApple, "diamondApple");
boolean foodOverhaul = false;
if (Loader.isModLoaded("HungerOverhaul") || Loader.isModLoaded("fc_food")) {
foodOverhaul = true;
}
boolean foodOverhaul = Loader.isModLoaded("HungerOverhaul") || Loader.isModLoaded("fc_food");
TinkerArmor.jerky = new Jerky(foodOverhaul).setUnlocalizedName("tconstruct.jerky");
GameRegistry.registerItem(TinkerArmor.jerky, "jerky");
@@ -189,7 +189,7 @@ public class DryingRack extends InventoryBlock {
@Override
public String[] getTextureNames() {
String[] textureNames = {
return new String[] {
"castingtable_top",
"castingtable_side",
"castingtable_bottom",
@@ -198,8 +198,6 @@ public class DryingRack extends InventoryBlock {
"blockcast_side",
"blockcast_bottom"
};
return textureNames;
}
@Override
@@ -120,10 +120,10 @@ public class ArmorExtendedGui extends InventoryEffectRenderer {
GL11.glRotatef(135.0F, 0.0F, 1.0F, 0.0F);
RenderHelper.enableStandardItemLighting();
GL11.glRotatef(-135.0F, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(-((float) Math.atan((double) (par5 / 40.0F))) * 20.0F, 1.0F, 0.0F, 0.0F);
par0Minecraft.thePlayer.renderYawOffset = (float) Math.atan((double) (par4 / 40.0F)) * 20.0F;
par0Minecraft.thePlayer.rotationYaw = (float) Math.atan((double) (par4 / 40.0F)) * 40.0F;
par0Minecraft.thePlayer.rotationPitch = -((float) Math.atan((double) (par5 / 40.0F))) * 20.0F;
GL11.glRotatef(-((float) Math.atan(par5 / 40.0F)) * 20.0F, 1.0F, 0.0F, 0.0F);
par0Minecraft.thePlayer.renderYawOffset = (float) Math.atan(par4 / 40.0F) * 20.0F;
par0Minecraft.thePlayer.rotationYaw = (float) Math.atan(par4 / 40.0F) * 40.0F;
par0Minecraft.thePlayer.rotationPitch = -((float) Math.atan(par5 / 40.0F)) * 20.0F;
par0Minecraft.thePlayer.rotationYawHead = par0Minecraft.thePlayer.rotationYaw;
GL11.glTranslatef(0.0F, par0Minecraft.thePlayer.yOffset, 0.0F);
RenderManager.instance.playerViewY = 180.0F;
@@ -55,7 +55,7 @@ public class KnapsackContainer extends Container {
}
if (slotStack.stackSize == 0) {
slot.putStack((ItemStack) null);
slot.putStack(null);
} else {
slot.onSlotChanged();
}
@@ -27,8 +27,6 @@ public class SlotAccessory extends Slot {
*/
public boolean isItemValid(ItemStack par1ItemStack) {
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
return item != null
&& (item instanceof IAccessory)
&& ((IAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
return (item instanceof IAccessory) && ((IAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
}
}
@@ -20,18 +20,13 @@ public class SlotBehavedOnly extends Slot {
int stackL = b.getStackLimit(par1ItemStack);
if (b != null
&& this.inventory.getStackInSlot(this.slotNumber) != null
if (this.inventory.getStackInSlot(this.slotNumber) != null
&& !this.inventory.getStackInSlot(this.slotNumber).isItemEqual(par1ItemStack)) {
ItemStack is = this.inventory.getStackInSlot(this.slotNumber);
if (is.stackSize + par1ItemStack.stackSize <= stackL) {
return true;
}
return is.stackSize + par1ItemStack.stackSize <= stackL;
} else {
return par1ItemStack.stackSize <= stackL;
}
return false;
// return b != null;
}
@@ -28,8 +28,7 @@ public class SlotCanister extends Slot {
@Override
public boolean isItemValid(ItemStack par1ItemStack) {
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
return item != null
&& (item instanceof IHealthAccessory)
return (item instanceof IHealthAccessory)
&& ((IHealthAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
}
}
@@ -25,6 +25,6 @@ public class SlotKnapsack extends Slot {
@Override
public boolean isItemValid(ItemStack par1ItemStack) {
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
return item != null && (item instanceof Knapsack);
return (item instanceof Knapsack);
}
}
@@ -63,12 +63,10 @@ public class DiamondApple extends ItemFood {
/* Name override */
@Override
public String getUnlocalizedName(ItemStack itemstack) {
return (new StringBuilder())
.append("item.food.")
.append(itemNames[
return "item.food."
+ itemNames[
(itemstack.getItemDamage() >= itemNames.length || itemstack.getItemDamage() < 0)
? (0)
: (itemstack.getItemDamage())])
.toString();
: (itemstack.getItemDamage())];
}
}
@@ -19,10 +19,8 @@ public class Knapsack extends CraftingItem implements IAccessory {
@Override
@SideOnly(Side.CLIENT)
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
switch (stack.getItemDamage()) {
case 0:
list.add(StatCollector.translateToLocal("knapsack.tooltip"));
break;
if (stack.getItemDamage() == 0) {
list.add(StatCollector.translateToLocal("knapsack.tooltip"));
}
}
@@ -66,7 +66,6 @@ public class TravelGear extends ArmorCore implements IRevealer, IGoggles {
case Chest:
return 4;
case Legs:
return 2;
case Feet:
return 2;
}
@@ -43,8 +43,7 @@ public class TravelWings extends TravelGear {
float terminalVelocity = -0.4f + (feather * 0.08f);
if (terminalVelocity > -0.05f) terminalVelocity = -0.05f;
if (player.isSneaking() && terminalVelocity > -0.8f) terminalVelocity = -0.8F;
boolean flying = false;
flying = player.capabilities.isFlying;
boolean flying = player.capabilities.isFlying;
if (!flying && player.motionY < terminalVelocity) {
player.motionY = terminalVelocity;
}
@@ -1,7 +1,6 @@
package tconstruct.armor.model;
import java.util.*;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.*;
import net.minecraft.client.renderer.texture.TextureManager;
@@ -23,13 +22,9 @@ public class RenderArmorCast implements IItemRenderer {
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
switch (helper) {
case BLOCK_3D:
return true;
case ENTITY_BOBBING:
return true;
case ENTITY_ROTATION:
return true;
case EQUIPPED_BLOCK:
return true;
case INVENTORY_BLOCK:
return true;
default:
@@ -55,8 +50,6 @@ public class RenderArmorCast implements IItemRenderer {
GL11.glTranslatef(0F, -0.1F, 0F);
break;
case EQUIPPED:
GL11.glScalef(1F, 0.6F, 1F);
break;
case EQUIPPED_FIRST_PERSON:
GL11.glScalef(1F, 0.6F, 1F);
break;
@@ -66,7 +59,7 @@ public class RenderArmorCast implements IItemRenderer {
renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 0.83F, 0.9F);
renderCube(tessellator, renderer, baseIcon);
renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 1.0F, 0.9F);
ArrayList<ForgeDirection> sides = new ArrayList<ForgeDirection>();
ArrayList<ForgeDirection> sides = new ArrayList<>();
sides.add(ForgeDirection.NORTH);
sides.add(ForgeDirection.SOUTH);
sides.add(ForgeDirection.EAST);
@@ -80,17 +73,17 @@ public class RenderArmorCast implements IItemRenderer {
public void renderCube(Tessellator tessellator, RenderBlocks renderer, IIcon icon) {
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0F, 0F);
renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
renderer.renderFaceXNeg(null, 0F, 0F, 0F, icon);
tessellator.setNormal(1F, 0F, 0F);
renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon);
renderer.renderFaceXPos(null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, -1F, 0F);
renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon);
renderer.renderFaceYNeg(null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 1F, 0F);
renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon);
renderer.renderFaceYPos(null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 0F, -1F);
renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon);
renderer.renderFaceZNeg(null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 0F, 1F);
renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon);
renderer.renderFaceZPos(null, 0F, 0F, 0F, icon);
tessellator.draw();
}
@@ -98,17 +91,17 @@ public class RenderArmorCast implements IItemRenderer {
Tessellator tessellator, RenderBlocks renderer, IIcon icon, List<ForgeDirection> sidesToRender) {
tessellator.startDrawingQuads();
tessellator.setNormal(-1F, 0F, 0F);
if (sidesToRender.contains(ForgeDirection.WEST)) renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
if (sidesToRender.contains(ForgeDirection.WEST)) renderer.renderFaceXNeg(null, 0F, 0F, 0F, icon);
tessellator.setNormal(1F, 0F, 0F);
if (sidesToRender.contains(ForgeDirection.EAST)) renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon);
if (sidesToRender.contains(ForgeDirection.EAST)) renderer.renderFaceXPos(null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, -1F, 0F);
if (sidesToRender.contains(ForgeDirection.DOWN)) renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon);
if (sidesToRender.contains(ForgeDirection.DOWN)) renderer.renderFaceYNeg(null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 1F, 0F);
if (sidesToRender.contains(ForgeDirection.UP)) renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon);
if (sidesToRender.contains(ForgeDirection.UP)) renderer.renderFaceYPos(null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 0F, -1F);
if (sidesToRender.contains(ForgeDirection.SOUTH)) renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon);
if (sidesToRender.contains(ForgeDirection.SOUTH)) renderer.renderFaceZNeg(null, 0F, 0F, 0F, icon);
tessellator.setNormal(0F, 0F, 1F);
if (sidesToRender.contains(ForgeDirection.NORTH)) renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon);
if (sidesToRender.contains(ForgeDirection.NORTH)) renderer.renderFaceZPos(null, 0F, 0F, 0F, icon);
tessellator.draw();
}
@@ -156,20 +149,20 @@ public class RenderArmorCast implements IItemRenderer {
float par7) {
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(0.0F, 0.0F, 1.0F);
par0Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, (double) par1, (double) par4);
par0Tessellator.addVertexWithUV(1.0D, 0.0D, 0.0D, (double) par3, (double) par4);
par0Tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, (double) par3, (double) par2);
par0Tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, (double) par1, (double) par2);
par0Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, par1, par4);
par0Tessellator.addVertexWithUV(1.0D, 0.0D, 0.0D, par3, par4);
par0Tessellator.addVertexWithUV(1.0D, 1.0D, 0.0D, par3, par2);
par0Tessellator.addVertexWithUV(0.0D, 1.0D, 0.0D, par1, par2);
par0Tessellator.draw();
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(0.0F, 0.0F, -1.0F);
par0Tessellator.addVertexWithUV(0.0D, 1.0D, (double) (0.0F - par7), (double) par1, (double) par2);
par0Tessellator.addVertexWithUV(1.0D, 1.0D, (double) (0.0F - par7), (double) par3, (double) par2);
par0Tessellator.addVertexWithUV(1.0D, 0.0D, (double) (0.0F - par7), (double) par3, (double) par4);
par0Tessellator.addVertexWithUV(0.0D, 0.0D, (double) (0.0F - par7), (double) par1, (double) par4);
par0Tessellator.addVertexWithUV(0.0D, 1.0D, 0.0F - par7, par1, par2);
par0Tessellator.addVertexWithUV(1.0D, 1.0D, 0.0F - par7, par3, par2);
par0Tessellator.addVertexWithUV(1.0D, 0.0D, 0.0F - par7, par3, par4);
par0Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0F - par7, par1, par4);
par0Tessellator.draw();
float f5 = 0.5F * (par1 - par3) / (float) par5;
float f6 = 0.5F * (par4 - par2) / (float) par6;
float f5 = 0.5F * (par1 - par3) / par5;
float f6 = 0.5F * (par4 - par2) / par6;
par0Tessellator.startDrawingQuads();
par0Tessellator.setNormal(-1.0F, 0.0F, 0.0F);
int k;
@@ -177,12 +170,12 @@ public class RenderArmorCast implements IItemRenderer {
float f8;
for (k = 0; k < par5; ++k) {
f7 = (float) k / (float) par5;
f7 = (float) k / par5;
f8 = par1 + (par3 - par1) * f7 - f5;
par0Tessellator.addVertexWithUV((double) f7, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4);
par0Tessellator.addVertexWithUV((double) f7, 0.0D, 0.0D, (double) f8, (double) par4);
par0Tessellator.addVertexWithUV((double) f7, 1.0D, 0.0D, (double) f8, (double) par2);
par0Tessellator.addVertexWithUV((double) f7, 1.0D, (double) (0.0F - par7), (double) f8, (double) par2);
par0Tessellator.addVertexWithUV(f7, 0.0D, 0.0F - par7, f8, par4);
par0Tessellator.addVertexWithUV(f7, 0.0D, 0.0D, f8, par4);
par0Tessellator.addVertexWithUV(f7, 1.0D, 0.0D, f8, par2);
par0Tessellator.addVertexWithUV(f7, 1.0D, 0.0F - par7, f8, par2);
}
par0Tessellator.draw();
@@ -191,13 +184,13 @@ public class RenderArmorCast implements IItemRenderer {
float f9;
for (k = 0; k < par5; ++k) {
f7 = (float) k / (float) par5;
f7 = (float) k / par5;
f8 = par1 + (par3 - par1) * f7 - f5;
f9 = f7 + 1.0F / (float) par5;
par0Tessellator.addVertexWithUV((double) f9, 1.0D, (double) (0.0F - par7), (double) f8, (double) par2);
par0Tessellator.addVertexWithUV((double) f9, 1.0D, 0.0D, (double) f8, (double) par2);
par0Tessellator.addVertexWithUV((double) f9, 0.0D, 0.0D, (double) f8, (double) par4);
par0Tessellator.addVertexWithUV((double) f9, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4);
f9 = f7 + 1.0F / par5;
par0Tessellator.addVertexWithUV(f9, 1.0D, 0.0F - par7, f8, par2);
par0Tessellator.addVertexWithUV(f9, 1.0D, 0.0D, f8, par2);
par0Tessellator.addVertexWithUV(f9, 0.0D, 0.0D, f8, par4);
par0Tessellator.addVertexWithUV(f9, 0.0D, 0.0F - par7, f8, par4);
}
par0Tessellator.draw();
@@ -205,13 +198,13 @@ public class RenderArmorCast implements IItemRenderer {
par0Tessellator.setNormal(0.0F, 1.0F, 0.0F);
for (k = 0; k < par6; ++k) {
f7 = (float) k / (float) par6;
f7 = (float) k / par6;
f8 = par4 + (par2 - par4) * f7 - f6;
f9 = f7 + 1.0F / (float) par6;
par0Tessellator.addVertexWithUV(0.0D, (double) f9, 0.0D, (double) par1, (double) f8);
par0Tessellator.addVertexWithUV(1.0D, (double) f9, 0.0D, (double) par3, (double) f8);
par0Tessellator.addVertexWithUV(1.0D, (double) f9, (double) (0.0F - par7), (double) par3, (double) f8);
par0Tessellator.addVertexWithUV(0.0D, (double) f9, (double) (0.0F - par7), (double) par1, (double) f8);
f9 = f7 + 1.0F / par6;
par0Tessellator.addVertexWithUV(0.0D, f9, 0.0D, par1, f8);
par0Tessellator.addVertexWithUV(1.0D, f9, 0.0D, par3, f8);
par0Tessellator.addVertexWithUV(1.0D, f9, 0.0F - par7, par3, f8);
par0Tessellator.addVertexWithUV(0.0D, f9, 0.0F - par7, par1, f8);
}
par0Tessellator.draw();
@@ -219,12 +212,12 @@ public class RenderArmorCast implements IItemRenderer {
par0Tessellator.setNormal(0.0F, -1.0F, 0.0F);
for (k = 0; k < par6; ++k) {
f7 = (float) k / (float) par6;
f7 = (float) k / par6;
f8 = par4 + (par2 - par4) * f7 - f6;
par0Tessellator.addVertexWithUV(1.0D, (double) f7, 0.0D, (double) par3, (double) f8);
par0Tessellator.addVertexWithUV(0.0D, (double) f7, 0.0D, (double) par1, (double) f8);
par0Tessellator.addVertexWithUV(0.0D, (double) f7, (double) (0.0F - par7), (double) par1, (double) f8);
par0Tessellator.addVertexWithUV(1.0D, (double) f7, (double) (0.0F - par7), (double) par3, (double) f8);
par0Tessellator.addVertexWithUV(1.0D, f7, 0.0D, par3, f8);
par0Tessellator.addVertexWithUV(0.0D, f7, 0.0D, par1, f8);
par0Tessellator.addVertexWithUV(0.0D, f7, 0.0F - par7, par1, f8);
par0Tessellator.addVertexWithUV(1.0D, f7, 0.0F - par7, par3, f8);
}
par0Tessellator.draw();
@@ -4,7 +4,6 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.relauncher.Side;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import java.lang.ref.WeakReference;
import java.util.UUID;
import net.minecraft.enchantment.Enchantment;
@@ -24,7 +23,7 @@ public class ArmorExtended implements IInventory {
public UUID globalID = UUID.fromString("B243BE32-DC1B-4C53-8D13-8752D5C69D5B");
public void init(EntityPlayer player) {
parent = new WeakReference<EntityPlayer>(player);
parent = new WeakReference<>(player);
}
@Override
@@ -130,7 +129,7 @@ public class ArmorExtended implements IInventory {
player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth);
try {
attributeinstance.removeModifier(attributeinstance.getModifier(globalID));
} catch (Exception e) {
} catch (Exception ignored) {
}
attributeinstance.applyModifier(
new AttributeModifier(globalID, "tconstruct.heartCanister", bonusHP, 0));
@@ -145,7 +144,7 @@ public class ArmorExtended implements IInventory {
player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth);
try {
attributeinstance.removeModifier(attributeinstance.getModifier(globalID));
} catch (Exception e) {
} catch (Exception ignored) {
}
}
}
@@ -186,7 +185,7 @@ public class ArmorExtended implements IInventory {
if (tagCompound != null) {
NBTTagList tagList = tagCompound.getTagList("Inventory", 10);
for (int i = 0; i < tagList.tagCount(); ++i) {
NBTTagCompound nbttagcompound = (NBTTagCompound) tagList.getCompoundTagAt(i);
NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i);
int j = nbttagcompound.getByte("Slot") & 255;
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);
@@ -248,11 +247,11 @@ public class ArmorExtended implements IInventory {
@Override
public void closeInventory() {}
public void writeInventoryToStream(ByteBuf os) throws IOException {
for (int i = 0; i < inventory.length; i++) ByteBufUtils.writeItemStack(os, inventory[i]);
public void writeInventoryToStream(ByteBuf os) {
for (ItemStack itemStack : inventory) ByteBufUtils.writeItemStack(os, itemStack);
}
public void readInventoryFromStream(ByteBuf is) throws IOException {
public void readInventoryFromStream(ByteBuf is) {
for (int i = 0; i < inventory.length; i++) inventory[i] = ByteBufUtils.readItemStack(is);
}
}
@@ -2,7 +2,6 @@ package tconstruct.armor.player;
import cpw.mods.fml.common.network.ByteBufUtils;
import io.netty.buffer.ByteBuf;
import java.io.IOException;
import java.lang.ref.WeakReference;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
@@ -17,7 +16,7 @@ public class KnapsackInventory implements IInventory {
public WeakReference<EntityPlayer> parent;
public void init(EntityPlayer player) {
parent = new WeakReference<EntityPlayer>(player);
parent = new WeakReference<>(player);
}
@Override
@@ -121,7 +120,7 @@ public class KnapsackInventory implements IInventory {
NBTTagList tagList = tagCompound.getTagList("Knapsack", 10);
for (int i = 0; i < tagList.tagCount(); ++i) {
NBTTagCompound nbttagcompound = (NBTTagCompound) tagList.getCompoundTagAt(i);
NBTTagCompound nbttagcompound = tagList.getCompoundTagAt(i);
int j = nbttagcompound.getByte("Slot") & 255;
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);
@@ -171,11 +170,11 @@ public class KnapsackInventory implements IInventory {
@Override
public void closeInventory() {}
public void writeInventoryToStream(ByteBuf os) throws IOException {
public void writeInventoryToStream(ByteBuf os) {
for (int i = 0; i < 27; i++) ByteBufUtils.writeItemStack(os, inventory[i]);
}
public void readInventoryFromStream(ByteBuf is) throws IOException {
public void readInventoryFromStream(ByteBuf is) {
for (int i = 0; i < 27; i++) inventory[i] = ByteBufUtils.readItemStack(is);
}
}
@@ -30,7 +30,7 @@ public class TPlayerHandler {
/* Player */
// public int hunger;
private ConcurrentHashMap<UUID, TPlayerStats> playerStats = new ConcurrentHashMap<UUID, TPlayerStats>();
private final ConcurrentHashMap<UUID, TPlayerStats> playerStats = new ConcurrentHashMap<>();
@SubscribeEvent
public void PlayerLoggedInEvent(PlayerLoggedInEvent event) {
@@ -71,7 +71,7 @@ public class TPlayerHandler {
}
}
if (player.getDisplayName().toLowerCase().equals("fractuality")) {
if (player.getDisplayName().equalsIgnoreCase("fractuality")) {
ItemStack pattern = new ItemStack(TinkerTools.woodPattern, 1, 22);
NBTTagCompound compound = new NBTTagCompound();
@@ -86,7 +86,7 @@ public class TPlayerHandler {
AbilityHelper.spawnItemAtPlayer(player, pattern);
}
if (player.getDisplayName().toLowerCase().equals("zerokyuuni")) {
if (player.getDisplayName().equalsIgnoreCase("zerokyuuni")) {
ItemStack pattern = new ItemStack(Items.stick);
NBTTagCompound compound = new NBTTagCompound();
@@ -99,7 +99,7 @@ public class TPlayerHandler {
AbilityHelper.spawnItemAtPlayer(player, pattern);
}
if (player.getDisplayName().toLowerCase().equals("zisteau")) {
if (player.getDisplayName().equalsIgnoreCase("zisteau")) {
spawnPigmanModifier(player);
}
@@ -140,7 +140,7 @@ public class TPlayerHandler {
AbilityHelper.spawnItemAtPlayer(player, modifier);
if (player.getDisplayName().toLowerCase().equals("zisteau")) {
if (player.getDisplayName().equalsIgnoreCase("zisteau")) {
spawnPigmanModifier(player);
}
}
@@ -215,7 +215,7 @@ public class TPlayerHandler {
if (!event.entity.worldObj.isRemote) {
TPlayerStats properties = (TPlayerStats) event.entity.getExtendedProperties(TPlayerStats.PROP_NAME);
properties.hunger = ((EntityPlayer) event.entity).getFoodStats().getFoodLevel();
playerStats.put(((EntityPlayer) event.entity).getPersistentID(), properties);
playerStats.put(event.entity.getPersistentID(), properties);
}
}
@@ -284,7 +284,7 @@ public class TPlayerHandler {
private final String serverLocation = "https://dl.dropboxusercontent.com/u/42769935/sticks.txt";
private final int timeout = 1000;
private HashSet<String> stickUsers = new HashSet<String>();
private final HashSet<String> stickUsers = new HashSet<>();
public void buildStickURLDatabase(String location) {
URL url;
@@ -44,7 +44,7 @@ public class TPlayerStats
}
public TPlayerStats(EntityPlayer entityplayer) {
this.player = new WeakReference<EntityPlayer>(entityplayer);
this.player = new WeakReference<>(entityplayer);
this.armor = new ArmorExtended();
this.armor.init(entityplayer);
@@ -85,7 +85,7 @@ public class TPlayerStats
@Override
public void init(Entity entity, World world) {
this.player = new WeakReference<EntityPlayer>((EntityPlayer) entity);
this.player = new WeakReference<>((EntityPlayer) entity);
this.armor.init((EntityPlayer) entity);
this.knapsack.init((EntityPlayer) entity);
}
@@ -108,11 +108,11 @@ public class TPlayerStats
}
}
public static final void register(EntityPlayer player) {
public static void register(EntityPlayer player) {
player.registerExtendedProperties(TPlayerStats.PROP_NAME, new TPlayerStats(player));
}
public static final TPlayerStats get(EntityPlayer player) {
public static TPlayerStats get(EntityPlayer player) {
return (TPlayerStats) player.getExtendedProperties(PROP_NAME);
}
@@ -50,17 +50,17 @@ public class BlockFalling extends Block {
p_149830_2_ + b0,
p_149830_3_ + b0,
p_149830_4_ + b0)) {
if (!p_149830_1_.isRemote) {
// EntityFallingBlock entityfallingblock = new
// EntityFallingBlock(p_149830_1_,
// (double)((float)p_149830_2_ + 0.5F),
// (double)((float)p_149830_3_ + 0.5F),
// (double)((float)p_149830_4_ + 0.5F), this,
// p_149830_1_.getBlockMetadata(p_149830_2_, p_149830_3_,
// p_149830_4_));
// this.func_149829_a(entityfallingblock);
// p_149830_1_.spawnEntityInWorld(entityfallingblock);
}
// if (!p_149830_1_.isRemote) {
// EntityFallingBlock entityfallingblock = new
// EntityFallingBlock(p_149830_1_,
// (double)((float)p_149830_2_ + 0.5F),
// (double)((float)p_149830_3_ + 0.5F),
// (double)((float)p_149830_4_ + 0.5F), this,
// p_149830_1_.getBlockMetadata(p_149830_2_, p_149830_3_,
// p_149830_4_));
// this.func_149829_a(entityfallingblock);
// p_149830_1_.spawnEntityInWorld(entityfallingblock);
// }
} else {
p_149830_1_.setBlockToAir(p_149830_2_, p_149830_3_, p_149830_4_);
@@ -101,9 +101,7 @@ public class DryingRackLogic extends InventoryLogic {
@Override
@SideOnly(Side.CLIENT)
public AxisAlignedBB getRenderBoundingBox() {
AxisAlignedBB cbb =
AxisAlignedBB.getBoundingBox(xCoord, yCoord - 1, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
return cbb;
return AxisAlignedBB.getBoundingBox(xCoord, yCoord - 1, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
}
@Override
@@ -38,7 +38,7 @@ public class SlimeGel extends TConstructBlock {
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
if (entity.motionY < 0) {
if (entity.motionY < -0.08F) {
Block var9 = (Block) this;
Block var9 = this;
world.playSoundEffect(
x + 0.5F,
y + 0.5F,
@@ -100,12 +100,12 @@ public class SlimeGrass extends MantleBlock {
&& blockAbove != this) {
Block block = world.getBlock(posX, posY, posZ);
if (block == Blocks.dirt) {
world.setBlock(posX, posY, posZ, (Block) this, 1, 3);
world.setBlock(posX, posY, posZ, this, 1, 3);
return;
}
int blockMeta = world.getBlockMetadata(posX, posY, posZ);
if (block == TinkerTools.craftedSoil) {
if (blockMeta == 5) world.setBlock(posX, posY, posZ, (Block) this, 0, 3);
if (blockMeta == 5) world.setBlock(posX, posY, posZ, this, 0, 3);
}
}
}
@@ -85,7 +85,7 @@ public class SlimeSapling extends BlockSapling {
public void growTree(World world, int x, int y, int z, Random random) {
int md = world.getBlockMetadata(x, y, z) % 8;
world.setBlock(x, y, z, Blocks.air);
WorldGenerator obj = null;
WorldGenerator obj;
obj = new SlimeTreeGen(true, 5, 4, 1, 0);
@@ -86,7 +86,7 @@ public class SlimeTallGrass extends BlockBush implements IShearable {
@Override
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune) {
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ArrayList<ItemStack> ret = new ArrayList<>();
if (world.rand.nextInt(8) != 0) {
return ret;
}
@@ -105,7 +105,7 @@ public class SlimeTallGrass extends BlockBush implements IShearable {
@Override
public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) {
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
ArrayList<ItemStack> ret = new ArrayList<>();
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z)));
return ret;
}
@@ -63,10 +63,8 @@ public class BarricadeBlock extends MantleBlock {
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
if (meta % 4 > 0) {
world.setBlock(x, y, z, this, meta - 1, 3);
dropBlockAsItem(world, x, y, z, new ItemStack(this));
} else {
dropBlockAsItem(world, x, y, z, new ItemStack(this));
}
dropBlockAsItem(world, x, y, z, new ItemStack(this));
}
@Override
@@ -1,21 +1,28 @@
package tconstruct.blocks.traps;
import cpw.mods.fml.relauncher.*;
import java.util.*;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.List;
import java.util.Random;
import mantle.blocks.MantleBlock;
import mantle.world.WorldHelper;
import net.minecraft.block.*;
import net.minecraft.block.Block;
import net.minecraft.block.BlockFence;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.*;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EnumCreatureType;
import net.minecraft.init.Blocks;
import net.minecraft.util.*;
import net.minecraft.world.*;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.IIcon;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import tconstruct.library.TConstructRegistry;
public class Landmine extends MantleBlock {
/** The mob type that can trigger this pressure plate. */
private EnumCreatureType triggerMobType;
private final EnumCreatureType triggerMobType;
public Landmine(EnumCreatureType par3EnumCreatureType, Material par4Material) {
super(par4Material);
@@ -91,7 +98,7 @@ public class Landmine extends MantleBlock {
*/
@Override
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
return par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4)
return World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4)
|| BlockFence.func_149825_a(par1World.getBlock(par2, par3 - 1, par4));
}
@@ -101,12 +108,8 @@ public class Landmine extends MantleBlock {
* neighbor blockID
*/
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
boolean var6 = false;
if (!par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4)
&& !BlockFence.func_149825_a(par1World.getBlock(par2, par3 - 1, par4))) {
var6 = true;
}
boolean var6 = !World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4)
&& !BlockFence.func_149825_a(par1World.getBlock(par2, par3 - 1, par4));
if (var6) {
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
@@ -147,30 +150,30 @@ public class Landmine extends MantleBlock {
boolean var5 = world.getBlockMetadata(posX, posY, posZ) == 1;
boolean var6 = false;
float var7 = 0.125F;
List var8 = null;
List<Entity> var8 = null;
if (this.triggerMobType == EnumCreatureType.creature) {
var8 = world.getEntitiesWithinAABBExcludingEntity(
(Entity) null,
null,
AxisAlignedBB.getBoundingBox(
(double) ((float) posX + var7),
(double) posY,
(double) ((float) posZ + var7),
(double) ((float) (posX + 1) - var7),
(float) posX + var7,
posY,
(float) posZ + var7,
(float) (posX + 1) - var7,
(double) posY + 0.25D,
(double) ((float) (posZ + 1) - var7)));
(float) (posZ + 1) - var7));
}
if (this.triggerMobType == EnumCreatureType.monster) {
var8 = world.getEntitiesWithinAABB(
EntityLiving.class,
AxisAlignedBB.getBoundingBox(
(double) ((float) posX + var7),
(double) posY,
(double) ((float) posZ + var7),
(double) ((float) (posX + 1) - var7),
(float) posX + var7,
posY,
(float) posZ + var7,
(float) (posX + 1) - var7,
(double) posY + 0.25D,
(double) ((float) (posZ + 1) - var7)));
(float) (posZ + 1) - var7));
}
/*
@@ -182,12 +185,8 @@ public class Landmine extends MantleBlock {
* 1) - var7))); }
*/
if (!var8.isEmpty()) {
Iterator var9 = var8.iterator();
while (var9.hasNext()) {
Entity var10 = (Entity) var9.next();
if (var8 != null && !var8.isEmpty()) {
for (Entity var10 : var8) {
if (!var10.doesEntityNotTriggerPressurePlate()) {
var6 = true;
break;
@@ -197,7 +196,7 @@ public class Landmine extends MantleBlock {
if (var6 && !var5) {
WorldHelper.setBlockToAir(world, posX, posY, posZ);
world.createExplosion((Entity) null, posX, posY, posZ, 2.0F, true);
world.createExplosion(null, posX, posY, posZ, 2.0F, true);
/*
* par1World.setBlockMetadataWithNotify(posX, posY, posZ, 1);
* par1World.notifyBlocksOfNeighborChange(posX, posY, posZ,
@@ -50,9 +50,9 @@ public class Punji extends MantleBlock {
if (stack != null && stack.getItem() == Item.getItemFromBlock(TinkerWorld.punji)) {
world.setBlockMetadataWithNotify(x, y, z, meta + 1, 3);
world.playSoundEffect(
(double) ((float) x + 0.5F),
(double) ((float) y + 0.5F),
(double) ((float) z + 0.5F),
(float) x + 0.5F,
(float) y + 0.5F,
(float) z + 0.5F,
this.stepSound.soundName,
(this.stepSound.getVolume() + 1.0F) / 2.0F,
this.stepSound.getPitch() * 0.8F);
@@ -44,10 +44,10 @@ public class BlockSkinRenderHelper {
IBlockAccess world) {
render.enableAO = true;
boolean flag = false;
float f3 = 0.0F;
float f4 = 0.0F;
float f5 = 0.0F;
float f6 = 0.0F;
float f3;
float f4;
float f5;
float f6;
boolean flag1 = true;
int l = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos);
Tessellator tessellator = Tessellator.instance;
@@ -193,7 +193,7 @@ public class BlockSkinRenderHelper {
render.colorRedTopRight *= f6;
render.colorGreenTopRight *= f6;
render.colorBlueTopRight *= f6;
render.renderFaceYNeg(block, (double) xPos, (double) yPos, (double) zPos, block.getIcon(0, metadata));
render.renderFaceYNeg(block, xPos, yPos, zPos, block.getIcon(0, metadata));
flag = true;
}
@@ -313,7 +313,7 @@ public class BlockSkinRenderHelper {
render.colorRedTopRight *= f6;
render.colorGreenTopRight *= f6;
render.colorBlueTopRight *= f6;
render.renderFaceYPos(block, (double) xPos, (double) yPos, (double) zPos, block.getIcon(1, metadata));
render.renderFaceYPos(block, xPos, yPos, zPos, block.getIcon(1, metadata));
flag = true;
}
@@ -447,7 +447,7 @@ public class BlockSkinRenderHelper {
render.colorGreenTopRight *= f6;
render.colorBlueTopRight *= f6;
icon = block.getIcon(2, metadata);
render.renderFaceZNeg(block, (double) xPos, (double) yPos, (double) zPos, icon);
render.renderFaceZNeg(block, xPos, yPos, zPos, icon);
flag = true;
}
@@ -580,7 +580,7 @@ public class BlockSkinRenderHelper {
render.colorGreenTopRight *= f6;
render.colorBlueTopRight *= f6;
icon = block.getIcon(3, metadata);
render.renderFaceZPos(block, (double) xPos, (double) yPos, (double) zPos, icon);
render.renderFaceZPos(block, xPos, yPos, zPos, icon);
flag = true;
}
@@ -713,7 +713,7 @@ public class BlockSkinRenderHelper {
render.colorGreenTopRight *= f6;
render.colorBlueTopRight *= f6;
icon = block.getIcon(4, metadata);
render.renderFaceXNeg(block, (double) xPos, (double) yPos, (double) zPos, icon);
render.renderFaceXNeg(block, xPos, yPos, zPos, icon);
flag = true;
}
@@ -846,7 +846,7 @@ public class BlockSkinRenderHelper {
render.colorGreenTopRight *= f6;
render.colorBlueTopRight *= f6;
icon = block.getIcon(5, metadata);
render.renderFaceXPos(block, (double) xPos, (double) yPos, (double) zPos, icon);
render.renderFaceXPos(block, xPos, yPos, zPos, icon);
flag = true;
}
@@ -906,7 +906,7 @@ public class BlockSkinRenderHelper {
? l
: block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos));
tessellator.setColorOpaque_F(f10, f13, f16);
render.renderFaceYNeg(block, (double) xPos, (double) yPos, (double) zPos, block.getIcon(0, metadata));
render.renderFaceYNeg(block, xPos, yPos, zPos, block.getIcon(0, metadata));
flag = true;
}
@@ -916,7 +916,7 @@ public class BlockSkinRenderHelper {
? l
: block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos));
tessellator.setColorOpaque_F(f7, f8, f9);
render.renderFaceYPos(block, (double) xPos, (double) yPos, (double) zPos, block.getIcon(1, metadata));
render.renderFaceYPos(block, xPos, yPos, zPos, block.getIcon(1, metadata));
flag = true;
}
@@ -928,7 +928,7 @@ public class BlockSkinRenderHelper {
? l
: block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos - 1));
tessellator.setColorOpaque_F(f11, f14, f17);
render.renderFaceZNeg(block, (double) xPos, (double) yPos, (double) zPos, block.getIcon(2, metadata));
render.renderFaceZNeg(block, xPos, yPos, zPos, block.getIcon(2, metadata));
flag = true;
}
@@ -939,7 +939,7 @@ public class BlockSkinRenderHelper {
? l
: block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos + 1));
tessellator.setColorOpaque_F(f11, f14, f17);
render.renderFaceZPos(block, (double) xPos, (double) yPos, (double) zPos, block.getIcon(3, metadata));
render.renderFaceZPos(block, xPos, yPos, zPos, block.getIcon(3, metadata));
flag = true;
}
@@ -950,7 +950,7 @@ public class BlockSkinRenderHelper {
? l
: block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos));
tessellator.setColorOpaque_F(f12, f15, f18);
render.renderFaceXNeg(block, (double) xPos, (double) yPos, (double) zPos, block.getIcon(4, metadata));
render.renderFaceXNeg(block, xPos, yPos, zPos, block.getIcon(4, metadata));
flag = true;
}
@@ -961,7 +961,7 @@ public class BlockSkinRenderHelper {
? l
: block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos));
tessellator.setColorOpaque_F(f12, f15, f18);
render.renderFaceXPos(block, (double) xPos, (double) yPos, (double) zPos, block.getIcon(5, metadata));
render.renderFaceXPos(block, xPos, yPos, zPos, block.getIcon(5, metadata));
flag = true;
}
@@ -1055,10 +1055,10 @@ public class BlockSkinRenderHelper {
Block block = Blocks.stone;
render.enableAO = true;
boolean flag = false;
float f3 = 0.0F;
float f4 = 0.0F;
float f5 = 0.0F;
float f6 = 0.0F;
float f3;
float f4;
float f5;
float f6;
boolean flag1 = true;
int l = block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos);
Tessellator tessellator = Tessellator.instance;
@@ -1204,7 +1204,7 @@ public class BlockSkinRenderHelper {
render.colorRedTopRight *= f6;
render.colorGreenTopRight *= f6;
render.colorBlueTopRight *= f6;
render.renderFaceYNeg(block, (double) xPos, (double) yPos, (double) zPos, stillIcon);
render.renderFaceYNeg(block, xPos, yPos, zPos, stillIcon);
flag = true;
}
@@ -1324,7 +1324,7 @@ public class BlockSkinRenderHelper {
render.colorRedTopRight *= f6;
render.colorGreenTopRight *= f6;
render.colorBlueTopRight *= f6;
render.renderFaceYPos(block, (double) xPos, (double) yPos, (double) zPos, stillIcon);
render.renderFaceYPos(block, xPos, yPos, zPos, stillIcon);
flag = true;
}
@@ -1455,7 +1455,7 @@ public class BlockSkinRenderHelper {
render.colorRedTopRight *= f6;
render.colorGreenTopRight *= f6;
render.colorBlueTopRight *= f6;
render.renderFaceZNeg(block, (double) xPos, (double) yPos, (double) zPos, flowingIcon);
render.renderFaceZNeg(block, xPos, yPos, zPos, flowingIcon);
flag = true;
}
@@ -1587,7 +1587,7 @@ public class BlockSkinRenderHelper {
render.colorRedTopRight *= f6;
render.colorGreenTopRight *= f6;
render.colorBlueTopRight *= f6;
render.renderFaceZPos(block, (double) xPos, (double) yPos, (double) zPos, flowingIcon);
render.renderFaceZPos(block, xPos, yPos, zPos, flowingIcon);
flag = true;
}
@@ -1719,7 +1719,7 @@ public class BlockSkinRenderHelper {
render.colorRedTopRight *= f6;
render.colorGreenTopRight *= f6;
render.colorBlueTopRight *= f6;
render.renderFaceXNeg(block, (double) xPos, (double) yPos, (double) zPos, flowingIcon);
render.renderFaceXNeg(block, xPos, yPos, zPos, flowingIcon);
flag = true;
}
@@ -1851,7 +1851,7 @@ public class BlockSkinRenderHelper {
render.colorRedTopRight *= f6;
render.colorGreenTopRight *= f6;
render.colorBlueTopRight *= f6;
render.renderFaceXPos(block, (double) xPos, (double) yPos, (double) zPos, flowingIcon);
render.renderFaceXPos(block, xPos, yPos, zPos, flowingIcon);
flag = true;
}
@@ -1912,7 +1912,7 @@ public class BlockSkinRenderHelper {
? l
: block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos - 1, zPos));
tessellator.setColorOpaque_F(f10, f13, f16);
render.renderFaceYNeg(block, (double) xPos, (double) yPos, (double) zPos, stillIcon);
render.renderFaceYNeg(block, xPos, yPos, zPos, stillIcon);
flag = true;
}
@@ -1922,7 +1922,7 @@ public class BlockSkinRenderHelper {
? l
: block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos + 1, zPos));
tessellator.setColorOpaque_F(f7, f8, f9);
render.renderFaceYPos(block, (double) xPos, (double) yPos, (double) zPos, stillIcon);
render.renderFaceYPos(block, xPos, yPos, zPos, stillIcon);
flag = true;
}
@@ -1934,7 +1934,7 @@ public class BlockSkinRenderHelper {
? l
: block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos - 1));
tessellator.setColorOpaque_F(f11, f14, f17);
render.renderFaceZNeg(block, (double) xPos, (double) yPos, (double) zPos, flowingIcon);
render.renderFaceZNeg(block, xPos, yPos, zPos, flowingIcon);
flag = true;
}
@@ -1945,7 +1945,7 @@ public class BlockSkinRenderHelper {
? l
: block.getMixedBrightnessForBlock(render.blockAccess, xPos, yPos, zPos + 1));
tessellator.setColorOpaque_F(f11, f14, f17);
render.renderFaceZPos(block, (double) xPos, (double) yPos, (double) zPos, flowingIcon);
render.renderFaceZPos(block, xPos, yPos, zPos, flowingIcon);
flag = true;
}
@@ -1956,7 +1956,7 @@ public class BlockSkinRenderHelper {
? l
: block.getMixedBrightnessForBlock(render.blockAccess, xPos - 1, yPos, zPos));
tessellator.setColorOpaque_F(f12, f15, f18);
render.renderFaceXNeg(block, (double) xPos, (double) yPos, (double) zPos, flowingIcon);
render.renderFaceXNeg(block, xPos, yPos, zPos, flowingIcon);
flag = true;
}
@@ -1967,7 +1967,7 @@ public class BlockSkinRenderHelper {
? l
: block.getMixedBrightnessForBlock(render.blockAccess, xPos + 1, yPos, zPos));
tessellator.setColorOpaque_F(f12, f15, f18);
render.renderFaceXPos(block, (double) xPos, (double) yPos, (double) zPos, flowingIcon);
render.renderFaceXPos(block, xPos, yPos, zPos, flowingIcon);
flag = true;
}
@@ -55,10 +55,10 @@ public class BreakingFX extends EntityFX {
float f10 = 0.1F * this.particleScale;
if (this.particleIcon != null) {
f6 = this.particleIcon.getInterpolatedU((double) (this.particleTextureJitterX / 4.0F * 16.0F));
f7 = this.particleIcon.getInterpolatedU((double) ((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F));
f8 = this.particleIcon.getInterpolatedV((double) (this.particleTextureJitterY / 4.0F * 16.0F));
f9 = this.particleIcon.getInterpolatedV((double) ((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F));
f6 = this.particleIcon.getInterpolatedU(this.particleTextureJitterX / 4.0F * 16.0F);
f7 = this.particleIcon.getInterpolatedU((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F);
f8 = this.particleIcon.getInterpolatedV(this.particleTextureJitterY / 4.0F * 16.0F);
f9 = this.particleIcon.getInterpolatedV((this.particleTextureJitterY + 1.0F) / 4.0F * 16.0F);
}
float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) par2 - interpPosX);
@@ -67,28 +67,12 @@ public class BreakingFX extends EntityFX {
float f14 = 1.0F;
par1Tessellator.setColorOpaque_F(f14 * this.particleRed, f14 * this.particleGreen, f14 * this.particleBlue);
par1Tessellator.addVertexWithUV(
(double) (f11 - par3 * f10 - par6 * f10),
(double) (f12 - par4 * f10),
(double) (f13 - par5 * f10 - par7 * f10),
(double) f6,
(double) f9);
f11 - par3 * f10 - par6 * f10, f12 - par4 * f10, f13 - par5 * f10 - par7 * f10, f6, f9);
par1Tessellator.addVertexWithUV(
(double) (f11 - par3 * f10 + par6 * f10),
(double) (f12 + par4 * f10),
(double) (f13 - par5 * f10 + par7 * f10),
(double) f6,
(double) f8);
f11 - par3 * f10 + par6 * f10, f12 + par4 * f10, f13 - par5 * f10 + par7 * f10, f6, f8);
par1Tessellator.addVertexWithUV(
(double) (f11 + par3 * f10 + par6 * f10),
(double) (f12 + par4 * f10),
(double) (f13 + par5 * f10 + par7 * f10),
(double) f7,
(double) f8);
f11 + par3 * f10 + par6 * f10, f12 + par4 * f10, f13 + par5 * f10 + par7 * f10, f7, f8);
par1Tessellator.addVertexWithUV(
(double) (f11 + par3 * f10 - par6 * f10),
(double) (f12 - par4 * f10),
(double) (f13 + par5 * f10 - par7 * f10),
(double) f7,
(double) f9);
f11 + par3 * f10 - par6 * f10, f12 - par4 * f10, f13 + par5 * f10 - par7 * f10, f7, f9);
}
}
@@ -13,7 +13,7 @@ import org.lwjgl.opengl.*;
public class CustomBowRenderer implements IItemRenderer {
Minecraft mc = Minecraft.getMinecraft();
private RenderBlocks renderBlocksInstance = new RenderBlocks();
private final RenderBlocks renderBlocksInstance = new RenderBlocks();
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
@@ -36,7 +36,7 @@ public class CustomBowRenderer implements IItemRenderer {
public void renderItem(EntityLivingBase living, ItemStack stack, int renderPass, ItemRenderType type) {
GL11.glPushMatrix();
IIcon icon = null;
IIcon icon;
if (living instanceof EntityPlayer) {
EntityPlayer player = (EntityPlayer) living;
if (player.getItemInUse() != null)
@@ -18,11 +18,11 @@ import org.lwjgl.opengl.GL11;
*/
public class CustomFont {
private int texID;
private int[] xPos;
private int[] yPos;
private int startChar;
private int endChar;
private FontMetrics metrics;
private final int[] xPos;
private final int[] yPos;
private final int startChar;
private final int endChar;
private final FontMetrics metrics;
/**
* Instantiates the font, filling in default start and end character
@@ -33,13 +33,12 @@ public class ToolCoreRenderer implements IItemRenderer {
switch (type) {
case ENTITY:
case INVENTORY:
return true;
case EQUIPPED:
GL11.glTranslatef(0.03f, 0F, -0.09375F);
case EQUIPPED_FIRST_PERSON:
return !isEntity;
case INVENTORY:
return true;
default:
TConstruct.logger.warn("[TCon] Unhandled render case!");
case FIRST_PERSON_MAP:
@@ -13,7 +13,7 @@ import tconstruct.world.TinkerWorld;
@SideOnly(Side.CLIENT)
public class ExplosiveRender extends Render {
private RenderBlocks blockRenderer = new RenderBlocks();
private final RenderBlocks blockRenderer = new RenderBlocks();
public ExplosiveRender() {
this.shadowSize = 0.5F;
@@ -19,10 +19,10 @@ import tconstruct.tools.entity.ArrowEntity;
public class ArrowRender extends Render {
private static final ResourceLocation RES_ITEM_GLINT =
new ResourceLocation("textures/misc/enchanted_item_glint.png");
private RenderBlocks itemRenderBlocks = new RenderBlocks();
private final RenderBlocks itemRenderBlocks = new RenderBlocks();
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
private Random random = new Random();
private final Random random = new Random();
public boolean renderWithColor = true;
@@ -58,7 +58,7 @@ public class ArrowRender extends Render {
float f6;
int i;
Block block = null;
Block block;
block = BlockUtils.getBlockFromItem(itemstack.getItem());
if (itemstack.getItemSpriteNumber() == 0
@@ -159,10 +159,10 @@ public class ArrowRender extends Render {
par2Icon = ((TextureMap) texturemanager.getTexture(resourcelocation)).getAtlasSprite("missingno");
}
float f4 = ((IIcon) par2Icon).getMinU();
float f5 = ((IIcon) par2Icon).getMaxU();
float f6 = ((IIcon) par2Icon).getMinV();
float f7 = ((IIcon) par2Icon).getMaxV();
float f4 = par2Icon.getMinU();
float f5 = par2Icon.getMaxU();
float f6 = par2Icon.getMinV();
float f7 = par2Icon.getMaxV();
float f8 = 1.0F;
float f9 = 0.5F;
float f10 = 0.25F;
@@ -211,14 +211,7 @@ public class ArrowRender extends Render {
GL11.glColor4f(par5, par6, par7, 1.0F);
ItemRenderer.renderItemIn2D(
tessellator,
f5,
f6,
f4,
f7,
((IIcon) par2Icon).getIconWidth(),
((IIcon) par2Icon).getIconHeight(),
f12);
tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(), f12);
if (itemstack.hasEffect(pass)) {
GL11.glDepthFunc(GL11.GL_EQUAL);
@@ -15,8 +15,8 @@ import tconstruct.tools.entity.ArrowEntity;
@SideOnly(Side.CLIENT)
@Deprecated
public class ArrowRenderCustom extends Render {
private static RenderItem renderer = new RenderItem();
private Random random = new Random();
private static final RenderItem renderer = new RenderItem();
private final Random random = new Random();
public ArrowRenderCustom() {}
@@ -21,10 +21,10 @@ import tconstruct.tools.entity.DaggerEntity;
public class DaggerRender extends Render {
private static final ResourceLocation RES_ITEM_GLINT =
new ResourceLocation("textures/misc/enchanted_item_glint.png");
private RenderBlocks itemRenderBlocks = new RenderBlocks();
private final RenderBlocks itemRenderBlocks = new RenderBlocks();
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
private Random random = new Random();
private final Random random = new Random();
public boolean renderWithColor = true;
@@ -176,10 +176,10 @@ public class DaggerRender extends Render {
par2Icon = ((TextureMap) texturemanager.getTexture(resourcelocation)).getAtlasSprite("missingno");
}
float f4 = ((IIcon) par2Icon).getMinU();
float f5 = ((IIcon) par2Icon).getMaxU();
float f6 = ((IIcon) par2Icon).getMinV();
float f7 = ((IIcon) par2Icon).getMaxV();
float f4 = par2Icon.getMinU();
float f5 = par2Icon.getMaxU();
float f6 = par2Icon.getMinV();
float f7 = par2Icon.getMaxV();
float f8 = 1.0F;
float f9 = 0.5F;
float f10 = 0.25F;
@@ -222,14 +222,7 @@ public class DaggerRender extends Render {
GL11.glRotatef(90, 0.0F, 1.0F, 0.0F);
GL11.glRotatef(rotation, 0.0F, 0.0F, 1.0F);
ItemRenderer.renderItemIn2D(
tessellator,
f5,
f6,
f4,
f7,
((IIcon) par2Icon).getIconWidth(),
((IIcon) par2Icon).getIconHeight(),
f12);
tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(), f12);
/*
* if (itemstack.hasEffect(pass)) { GL11.glDepthFunc(GL11.GL_EQUAL);
@@ -279,7 +272,7 @@ public class DaggerRender extends Render {
boolean renderEffect) {
Item k = par3ItemStack.getItem();
int l = par3ItemStack.getItemDamage();
Object object = par3ItemStack.getIconIndex();
IIcon iIcon = par3ItemStack.getIconIndex();
float f;
int i1;
float f1;
@@ -343,8 +336,8 @@ public class DaggerRender extends Render {
par2TextureManager.getResourceLocation(par3ItemStack.getItemSpriteNumber());
par2TextureManager.bindTexture(resourcelocation);
if (object == null) {
object = ((TextureMap)
if (iIcon == null) {
iIcon = ((TextureMap)
Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation))
.getAtlasSprite("missingno");
}
@@ -358,7 +351,7 @@ public class DaggerRender extends Render {
GL11.glColor4f(f, f1, f2, 1.0F);
}
this.renderIcon(par4, par5, (IIcon) object, 16, 16);
this.renderIcon(par4, par5, iIcon, 16, 16);
GL11.glEnable(GL11.GL_LIGHTING);
if (par3ItemStack.hasEffect(0)) {
@@ -444,26 +437,15 @@ public class DaggerRender extends Render {
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(
(double) (par2 + 0),
(double) (par3 + par5),
(double) this.zLevel,
(double) ((f2 + (float) par5 * f4) * f),
(double) ((f3 + (float) par5) * f1));
par2 + 0, par3 + par5, this.zLevel, (f2 + (float) par5 * f4) * f, (f3 + (float) par5) * f1);
tessellator.addVertexWithUV(
(double) (par2 + par4),
(double) (par3 + par5),
(double) this.zLevel,
(double) ((f2 + (float) par4 + (float) par5 * f4) * f),
(double) ((f3 + (float) par5) * f1));
tessellator.addVertexWithUV(
(double) (par2 + par4),
(double) (par3 + 0),
(double) this.zLevel,
(double) ((f2 + (float) par4) * f),
(double) ((f3 + 0.0F) * f1));
tessellator.addVertexWithUV(
(double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double)
((f3 + 0.0F) * f1));
par2 + par4,
par3 + par5,
this.zLevel,
(f2 + (float) par4 + (float) par5 * f4) * f,
(f3 + (float) par5) * f1);
tessellator.addVertexWithUV(par2 + par4, par3 + 0, this.zLevel, (f2 + (float) par4) * f, (f3 + 0.0F) * f1);
tessellator.addVertexWithUV(par2 + 0, par3 + 0, this.zLevel, (f2 + 0.0F) * f, (f3 + 0.0F) * f1);
tessellator.draw();
}
}
@@ -478,7 +460,7 @@ public class DaggerRender extends Render {
ItemStack par3ItemStack,
int par4,
int par5) {
this.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, (String) null);
this.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, null);
}
public void renderItemOverlayIntoGUI(
@@ -532,31 +514,20 @@ public class DaggerRender extends Render {
private void renderQuad(Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6) {
par1Tessellator.startDrawingQuads();
par1Tessellator.setColorOpaque_I(par6);
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + 0), 0.0D);
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + par5), 0.0D);
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + par5), 0.0D);
par1Tessellator.addVertex((double) (par2 + par4), (double) (par3 + 0), 0.0D);
par1Tessellator.addVertex(par2 + 0, par3 + 0, 0.0D);
par1Tessellator.addVertex(par2 + 0, par3 + par5, 0.0D);
par1Tessellator.addVertex(par2 + par4, par3 + par5, 0.0D);
par1Tessellator.addVertex(par2 + par4, par3 + 0, 0.0D);
par1Tessellator.draw();
}
public void renderIcon(int par1, int par2, IIcon par3Icon, int par4, int par5) {
Tessellator tessellator = Tessellator.instance;
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(
(double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double)
par3Icon.getMaxV());
tessellator.addVertexWithUV(
(double) (par1 + par4),
(double) (par2 + par5),
(double) this.zLevel,
(double) par3Icon.getMaxU(),
(double) par3Icon.getMaxV());
tessellator.addVertexWithUV(
(double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double)
par3Icon.getMinV());
tessellator.addVertexWithUV(
(double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double)
par3Icon.getMinV());
tessellator.addVertexWithUV(par1 + 0, par2 + par5, this.zLevel, par3Icon.getMinU(), par3Icon.getMaxV());
tessellator.addVertexWithUV(par1 + par4, par2 + par5, this.zLevel, par3Icon.getMaxU(), par3Icon.getMaxV());
tessellator.addVertexWithUV(par1 + par4, par2 + 0, this.zLevel, par3Icon.getMaxU(), par3Icon.getMinV());
tessellator.addVertexWithUV(par1 + 0, par2 + 0, this.zLevel, par3Icon.getMinU(), par3Icon.getMinV());
tessellator.draw();
}
@@ -16,9 +16,9 @@ import tconstruct.tools.entity.DaggerEntity;
@SideOnly(Side.CLIENT)
@Deprecated
public class DaggerRenderCustom extends Render {
private static RenderItem renderer = new RenderItem();
private static ToolCoreRenderer toolCoreRenderer = new ToolCoreRenderer(true, true);
private Random random = new Random();
private static final RenderItem renderer = new RenderItem();
private static final ToolCoreRenderer toolCoreRenderer = new ToolCoreRenderer(true, true);
private final Random random = new Random();
public DaggerRenderCustom() {
this.shadowSize = 0.15F;
@@ -13,8 +13,8 @@ import tconstruct.tools.entity.LaunchedPotion;
@SideOnly(Side.CLIENT)
public class LaunchedItemRender extends Render {
private Item field_94151_a;
private int field_94150_f;
private final Item field_94151_a;
private final int field_94150_f;
public LaunchedItemRender(Item par1Item, int par2) {
this.field_94151_a = par1Item;
@@ -80,10 +80,10 @@ public class LaunchedItemRender extends Render {
GL11.glRotatef(-this.renderManager.playerViewX, 1.0F, 0.0F, 0.0F);
par1Tessellator.startDrawingQuads();
par1Tessellator.setNormal(0.0F, 1.0F, 0.0F);
par1Tessellator.addVertexWithUV((double) (0.0F - f5), (double) (0.0F - f6), 0.0D, (double) f, (double) f3);
par1Tessellator.addVertexWithUV((double) (f4 - f5), (double) (0.0F - f6), 0.0D, (double) f1, (double) f3);
par1Tessellator.addVertexWithUV((double) (f4 - f5), (double) (f4 - f6), 0.0D, (double) f1, (double) f2);
par1Tessellator.addVertexWithUV((double) (0.0F - f5), (double) (f4 - f6), 0.0D, (double) f, (double) f2);
par1Tessellator.addVertexWithUV(0.0F - f5, 0.0F - f6, 0.0D, f, f3);
par1Tessellator.addVertexWithUV(f4 - f5, 0.0F - f6, 0.0D, f1, f3);
par1Tessellator.addVertexWithUV(f4 - f5, f4 - f6, 0.0D, f1, f2);
par1Tessellator.addVertexWithUV(0.0F - f5, f4 - f6, 0.0D, f, f2);
par1Tessellator.draw();
}
}
@@ -29,8 +29,8 @@ public class ModifierPage extends BookPage {
icons = MantleClientRegistry.getRecipeIcons(recipe);
if (type.equals("travelmulti")) {
List<ItemStack[]> stacks = new LinkedList<ItemStack[]>();
List<String> tools = new LinkedList<String>();
List<ItemStack[]> stacks = new LinkedList<>();
List<String> tools = new LinkedList<>();
String[] suffixes = new String[] {"goggles", "vest", "wings", "boots", "glove", "belt"};
for (String suffix : suffixes) {
ItemStack[] icons2 =
@@ -5,7 +5,6 @@ import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.lang.reflect.*;
import java.util.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.inventory.GuiInventory;
@@ -13,7 +12,7 @@ import net.minecraft.network.play.client.C0DPacketCloseWindow;
import net.minecraftforge.client.event.GuiScreenEvent;
public class TabRegistry {
private static ArrayList<AbstractTab> tabList = new ArrayList<AbstractTab>();
private static final ArrayList<AbstractTab> tabList = new ArrayList<>();
public static void registerTab(AbstractTab tab) {
tabList.add(tab);
@@ -38,7 +37,7 @@ public class TabRegistry {
}
}
private static Minecraft mc = FMLClientHandler.instance().getClient();
private static final Minecraft mc = FMLClientHandler.instance().getClient();
public static void openInventoryGui() {
mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(mc.thePlayer.openContainer.windowId));
@@ -48,9 +47,7 @@ public class TabRegistry {
public static void updateTabValues(int cornerX, int cornerY, Class<?> selectedButton) {
int count = 2;
for (int i = 0; i < tabList.size(); i++) {
AbstractTab t = tabList.get(i);
for (AbstractTab t : tabList) {
if (t.shouldAddToList()) {
t.id = count;
t.xPosition = cornerX + (count - 2) * 28;
@@ -78,13 +75,13 @@ public class TabRegistry {
Class<?> c = Class.forName("codechicken.nei.NEIClientConfig");
Object hidden = c.getMethod("isHidden").invoke(null);
Object enabled = c.getMethod("isEnabled").invoke(null);
if (hidden != null && hidden instanceof Boolean && enabled != null && enabled instanceof Boolean) {
if (hidden instanceof Boolean && enabled instanceof Boolean) {
if ((Boolean) hidden || !((Boolean) enabled)) {
// If NEI is disabled or hidden, offset the tabs by 60
return 60;
}
}
} catch (Exception e) {
} catch (Exception ignored) {
}
} else {
// If NEI is not installed, offset the tabs
@@ -22,8 +22,8 @@ public class TProxyCommon implements IGuiHandler {
return null;
}
private static HashMap<Integer, IGuiHandler> serverGuiHandlers = new HashMap<Integer, IGuiHandler>();
private static HashMap<Integer, IGuiHandler> clientGuiHandlers = new HashMap<Integer, IGuiHandler>();
private static final HashMap<Integer, IGuiHandler> serverGuiHandlers = new HashMap<>();
private static final HashMap<Integer, IGuiHandler> clientGuiHandlers = new HashMap<>();
public static void registerServerGuiHandler(int gui, IGuiHandler handler) {
serverGuiHandlers.put(gui, handler);
@@ -61,14 +61,13 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
ItemStack itemstack = playerIn.getEquipmentInSlot(slot);
if (itemstack == null) {
playerIn.setCurrentItemOrArmor(slot, itemStackIn.copy());
itemStackIn.stackSize--;
} else {
itemstack = itemstack.copy();
playerIn.setCurrentItemOrArmor(1, itemStackIn.copy());
// playerIn.setCurrentItemOrArmor(0, itemstack);
playerIn.entityDropItem(itemstack, 0);
itemStackIn.stackSize--;
}
itemStackIn.stackSize--;
return itemStackIn;
}
@@ -185,11 +184,7 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
}
@Override
public void damageArmor(EntityLivingBase entity, ItemStack armor, DamageSource source, int damage, int slot) {
if (source == DamageSource.fall) {
return;
}
}
public void damageArmor(EntityLivingBase entity, ItemStack armor, DamageSource source, int damage, int slot) {}
@Override
@SideOnly(Side.CLIENT)
@@ -224,7 +219,7 @@ public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
list.add("Boooounce!");
list.add("Hold "
+ (I18n.format(
Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyDescription(), new Object[0]))
Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyDescription()))
+ " to stop bouncing.");
}
@@ -183,13 +183,7 @@ public class Arrow extends ToolCore {
else color = "\u00a76";
}
String energy = new StringBuilder()
.append(color)
.append(tags.getInteger("Energy"))
.append("/")
.append(getMaxEnergyStored(stack))
.append(" RF")
.toString();
String energy = color + tags.getInteger("Energy") + "/" + getMaxEnergyStored(stack) + " RF";
list.add(energy);
}
if (tags.hasKey("InfiTool")) {
@@ -188,12 +188,12 @@ public class Battleaxe extends AOEHarvestTool implements IBattlegearWeapon {
if (increase > 0.56f) increase = 0.56f;
player.motionY += increase;
player.motionX = (double) (-MathHelper.sin(player.rotationYaw / 180.0F * (float) Math.PI)
player.motionX = -MathHelper.sin(player.rotationYaw / 180.0F * (float) Math.PI)
* MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI)
* speed);
player.motionZ = (double) (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI)
* speed;
player.motionZ = MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI)
* MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI)
* speed);
* speed;
}
}
}
@@ -1,6 +1,5 @@
package tconstruct.items.tools;
import cpw.mods.fml.relauncher.*;
import java.util.*;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.enchantment.*;
@@ -65,7 +64,7 @@ public abstract class BowBase extends ToolCore {
speedBase = flightSpeed;
}
EntityArrow arrowEntity = null;
EntityArrow arrowEntity;
// if (tinkerArrow != null)
if (slotID != -1 && (arrowID == -1 || slotID < arrowID)) {
ItemStack arrowStack = tinkerArrow.copy();
@@ -234,40 +233,39 @@ public abstract class BowBase extends ToolCore {
accessoryIcons1.clear();
extraIcons1.clear();
effectIcons1.clear();
Iterator iterOne = headStrings.entrySet().iterator();
Iterator<Map.Entry<Integer, String>> iterOne =
headStrings.entrySet().iterator();
while (iterOne.hasNext()) {
Map.Entry pairs = (Map.Entry) iterOne.next();
headIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
Map.Entry<Integer, String> pairs = iterOne.next();
headIcons1.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_1"));
}
iterOne = handleStrings.entrySet().iterator();
while (iterOne.hasNext()) {
Map.Entry pairs = (Map.Entry) iterOne.next();
handleIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
Map.Entry<Integer, String> pairs = iterOne.next();
handleIcons1.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_1"));
}
if (getPartAmount() > 2) {
iterOne = accessoryStrings.entrySet().iterator();
while (iterOne.hasNext()) {
Map.Entry pairs = (Map.Entry) iterOne.next();
accessoryIcons1.put(
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
Map.Entry<Integer, String> pairs = iterOne.next();
accessoryIcons1.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_1"));
}
}
if (getPartAmount() > 3) {
iterOne = extraStrings.entrySet().iterator();
while (iterOne.hasNext()) {
Map.Entry pairs = (Map.Entry) iterOne.next();
extraIcons1.put(
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
Map.Entry<Integer, String> pairs = iterOne.next();
extraIcons1.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_1"));
}
}
iterOne = effectStrings.entrySet().iterator();
while (iterOne.hasNext()) {
Map.Entry pairs = (Map.Entry) iterOne.next();
effectIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
Map.Entry<Integer, String> pairs = iterOne.next();
effectIcons1.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_1"));
}
headIcons2.clear();
@@ -275,40 +273,39 @@ public abstract class BowBase extends ToolCore {
accessoryIcons2.clear();
extraIcons2.clear();
effectIcons2.clear();
Iterator iterTwo = headStrings.entrySet().iterator();
Iterator<Map.Entry<Integer, String>> iterTwo =
headStrings.entrySet().iterator();
while (iterTwo.hasNext()) {
Map.Entry pairs = (Map.Entry) iterTwo.next();
headIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
Map.Entry<Integer, String> pairs = iterTwo.next();
headIcons2.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_2"));
}
iterTwo = handleStrings.entrySet().iterator();
while (iterTwo.hasNext()) {
Map.Entry pairs = (Map.Entry) iterTwo.next();
handleIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
Map.Entry<Integer, String> pairs = iterTwo.next();
handleIcons2.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_2"));
}
if (getPartAmount() > 2) {
iterTwo = accessoryStrings.entrySet().iterator();
while (iterTwo.hasNext()) {
Map.Entry pairs = (Map.Entry) iterTwo.next();
accessoryIcons2.put(
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
Map.Entry<Integer, String> pairs = iterTwo.next();
accessoryIcons2.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_2"));
}
}
if (getPartAmount() > 3) {
iterTwo = extraStrings.entrySet().iterator();
while (iterTwo.hasNext()) {
Map.Entry pairs = (Map.Entry) iterTwo.next();
extraIcons2.put(
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
Map.Entry<Integer, String> pairs = iterTwo.next();
extraIcons2.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_2"));
}
}
iterTwo = effectStrings.entrySet().iterator();
while (iterTwo.hasNext()) {
Map.Entry pairs = (Map.Entry) iterTwo.next();
effectIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
Map.Entry<Integer, String> pairs = iterTwo.next();
effectIcons2.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_2"));
}
headIcons3.clear();
@@ -316,40 +313,39 @@ public abstract class BowBase extends ToolCore {
accessoryIcons3.clear();
extraIcons3.clear();
effectIcons3.clear();
Iterator iterThree = headStrings.entrySet().iterator();
Iterator<Map.Entry<Integer, String>> iterThree =
headStrings.entrySet().iterator();
while (iterThree.hasNext()) {
Map.Entry pairs = (Map.Entry) iterThree.next();
headIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
Map.Entry<Integer, String> pairs = iterThree.next();
headIcons3.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_3"));
}
iterThree = handleStrings.entrySet().iterator();
while (iterThree.hasNext()) {
Map.Entry pairs = (Map.Entry) iterThree.next();
handleIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
Map.Entry<Integer, String> pairs = iterThree.next();
handleIcons3.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_3"));
}
if (getPartAmount() > 2) {
iterThree = accessoryStrings.entrySet().iterator();
while (iterThree.hasNext()) {
Map.Entry pairs = (Map.Entry) iterThree.next();
accessoryIcons3.put(
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
Map.Entry<Integer, String> pairs = iterThree.next();
accessoryIcons3.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_3"));
}
}
if (getPartAmount() > 3) {
iterThree = extraStrings.entrySet().iterator();
while (iterThree.hasNext()) {
Map.Entry pairs = (Map.Entry) iterThree.next();
extraIcons3.put(
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
Map.Entry<Integer, String> pairs = iterThree.next();
extraIcons3.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_3"));
}
}
iterThree = effectStrings.entrySet().iterator();
while (iterThree.hasNext()) {
Map.Entry pairs = (Map.Entry) iterThree.next();
effectIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
Map.Entry<Integer, String> pairs = iterThree.next();
effectIcons3.put(pairs.getKey(), iconRegister.registerIcon(pairs.getValue() + "_3"));
}
}
registerArrows(iconRegister);
@@ -428,23 +424,23 @@ public abstract class BowBase extends ToolCore {
public IIcon arrow2;
public IIcon arrow3;
public HashMap<Integer, IIcon> headIcons1 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> handleIcons1 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> accessoryIcons1 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> extraIcons1 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> effectIcons1 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> headIcons1 = new HashMap<>();
public HashMap<Integer, IIcon> handleIcons1 = new HashMap<>();
public HashMap<Integer, IIcon> accessoryIcons1 = new HashMap<>();
public HashMap<Integer, IIcon> extraIcons1 = new HashMap<>();
public HashMap<Integer, IIcon> effectIcons1 = new HashMap<>();
public HashMap<Integer, IIcon> headIcons2 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> handleIcons2 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> accessoryIcons2 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> extraIcons2 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> effectIcons2 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> headIcons2 = new HashMap<>();
public HashMap<Integer, IIcon> handleIcons2 = new HashMap<>();
public HashMap<Integer, IIcon> accessoryIcons2 = new HashMap<>();
public HashMap<Integer, IIcon> extraIcons2 = new HashMap<>();
public HashMap<Integer, IIcon> effectIcons2 = new HashMap<>();
public HashMap<Integer, IIcon> headIcons3 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> handleIcons3 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> accessoryIcons3 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> extraIcons3 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> effectIcons3 = new HashMap<Integer, IIcon>();
public HashMap<Integer, IIcon> headIcons3 = new HashMap<>();
public HashMap<Integer, IIcon> handleIcons3 = new HashMap<>();
public HashMap<Integer, IIcon> accessoryIcons3 = new HashMap<>();
public HashMap<Integer, IIcon> extraIcons3 = new HashMap<>();
public HashMap<Integer, IIcon> effectIcons3 = new HashMap<>();
@Override
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
@@ -45,8 +45,7 @@ public class Chisel extends ToolCore {
}
boolean performDetailing(World world, int x, int y, int z, int blockID, int blockMeta) {
boolean detailed = false;
return detailed;
return false;
}
@Override
@@ -1,6 +1,5 @@
package tconstruct.items.tools;
import cpw.mods.fml.relauncher.*;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.*;
@@ -1,9 +1,7 @@
package tconstruct.items.tools;
import cpw.mods.fml.relauncher.*;
import net.minecraft.block.material.Material;
import net.minecraft.item.*;
import tconstruct.library.*;
import tconstruct.library.tools.*;
import tconstruct.tools.TinkerTools;
@@ -1,6 +1,5 @@
package tconstruct.items.tools;
import cpw.mods.fml.relauncher.*;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.*;
@@ -1,13 +1,11 @@
package tconstruct.items.tools;
import cpw.mods.fml.relauncher.*;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.*;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import tconstruct.library.*;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.library.tools.*;
import tconstruct.tools.TinkerTools;
@@ -1,6 +1,5 @@
package tconstruct.items.tools;
import cpw.mods.fml.relauncher.*;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
@@ -64,12 +64,12 @@ public class Longsword extends Weapon {
float speed = 0.05F * time;
if (speed > 0.925f) speed = 0.925f;
player.motionX = (double) (-MathHelper.sin(player.rotationYaw / 180.0F * (float) Math.PI)
player.motionX = -MathHelper.sin(player.rotationYaw / 180.0F * (float) Math.PI)
* MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI)
* speed);
player.motionZ = (double) (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI)
* speed;
player.motionZ = MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI)
* MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI)
* speed);
* speed;
}
}
@@ -5,7 +5,6 @@ import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.FMLLog;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent;
import cpw.mods.fml.relauncher.*;
import gnu.trove.set.hash.THashSet;
import java.util.Queue;
import java.util.Set;
@@ -92,8 +91,7 @@ public class LumberAxe extends AOEHarvestTool {
if (wood.isWood(world, x, y, z) || wood.getMaterial() == Material.sponge)
if (detectTree(world, x, y, z)) {
TreeChopTask chopper =
new TreeChopTask((AOEHarvestTool) this, stack, new ChunkPosition(x, y, z), player, 128);
TreeChopTask chopper = new TreeChopTask(this, stack, new ChunkPosition(x, y, z), player, 128);
try {
FMLCommonHandler.instance().bus().register(chopper);
} catch (LinkageError l) {
@@ -109,8 +109,8 @@ public class Mattock extends DualHarvestTool {
private boolean allowCrafting(int head) {
int[] nonMetals = {0, 1, 3, 4, 5, 6, 7, 8, 9, 17};
for (int i = 0; i < nonMetals.length; i++) {
if (head == nonMetals[i]) return false;
for (int nonMetal : nonMetals) {
if (head == nonMetal) return false;
}
return true;
}
@@ -26,12 +26,12 @@ public class Rapier extends Weapon {
player.addExhaustion(0.1f);
player.motionY += 0.32;
float f = 0.5F;
player.motionX = (double) (MathHelper.sin(player.rotationYaw / 180.0F * (float) Math.PI)
player.motionX = MathHelper.sin(player.rotationYaw / 180.0F * (float) Math.PI)
* MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI)
* f);
player.motionZ = (double) (-MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI)
* f;
player.motionZ = -MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI)
* MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI)
* f);
* f;
}
return stack;
}
@@ -1,7 +1,6 @@
package tconstruct.items.tools;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.*;
import java.util.*;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
@@ -157,8 +156,8 @@ public class Scythe extends Weapon {
!= null) // && (block.blockMaterial == Material.leaves || block.isLeaves(world,
// xPos, yPos, zPos)))
{
for (int iter = 0; iter < materials.length; iter++) {
if (materials[iter] == localBlock.getMaterial()) {
for (Material material : materials) {
if (material == localBlock.getMaterial()) {
if (!player.capabilities.isCreativeMode) {
if (butter
&& localBlock instanceof IShearable
@@ -219,7 +218,7 @@ public class Scythe extends Weapon {
if (world.isRemote) {
INetHandler handler = FMLClientHandler.instance()
.getClientPlayHandler();
if (handler != null && handler instanceof NetHandlerPlayClient) {
if (handler instanceof NetHandlerPlayClient) {
NetHandlerPlayClient handlerClient =
(NetHandlerPlayClient) handler;
handlerClient.addToSendQueue(new C07PacketPlayerDigging(
@@ -266,9 +265,9 @@ public class Scythe extends Weapon {
entity.posY + 1.0D,
entity.posZ + 1.0D)
.expand(1.0D, 1.0D, 1.0D);
List list = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, box);
for (Object o : list) {
AbilityHelper.onLeftClickEntity(stack, player, (Entity) o, this);
List<Entity> list = player.worldObj.getEntitiesWithinAABBExcludingEntity(player, box);
for (Entity e : list) {
AbilityHelper.onLeftClickEntity(stack, player, e, this);
}
return true;
}
@@ -110,13 +110,7 @@ public class Shortbow extends BowBase {
else color = "\u00a76";
}
String energy = new StringBuilder()
.append(color)
.append(tags.getInteger("Energy"))
.append("/")
.append(getMaxEnergyStored(stack))
.append(" RF")
.toString();
String energy = color + tags.getInteger("Energy") + "/" + getMaxEnergyStored(stack) + " RF";
list.add(energy);
}
if (tags.hasKey("InfiTool")) {
@@ -169,10 +163,9 @@ public class Shortbow extends BowBase {
public String getBowstringName(int type) {
switch (type) {
case 0:
return "";
case 1:
return "\u00A7bEnchanted";
case 0:
default:
return "";
}
@@ -1,6 +1,5 @@
package tconstruct.items.tools;
import cpw.mods.fml.relauncher.*;
import net.minecraft.block.material.Material;
import net.minecraft.item.Item;
import tconstruct.library.tools.HarvestTool;
@@ -16,17 +16,12 @@ import tconstruct.gadgets.item.ItemSlimeBoots;
public class SlimeBounceHandler {
public static final float SQRT_2 = sqrt(2.0F);
private static final float[] SIN_TABLE = new float[65536];
private static final double FRAC_BIAS;
private static final double[] ASINE_TAB;
private static final double[] COS_TAB;
public static final IdentityHashMap<EntityLivingBase, BounceInfo> BOUNCING_ENTITIES =
new IdentityHashMap<EntityLivingBase, BounceInfo>();
public static final IdentityHashMap<EntityLivingBase, BounceInfo> BOUNCING_ENTITIES = new IdentityHashMap<>();
static {
for (int i = 0; i < 65536; ++i) {
SIN_TABLE[i] = (float) Math.sin(i * Math.PI * 2.0D / 65536.0D);
}
FRAC_BIAS = Double.longBitsToDouble(4805340802404319232L);
ASINE_TAB = new double[257];
COS_TAB = new double[257];
@@ -45,7 +45,7 @@ public class TConstructRegistry {
* chiselHead scytheBlade, broadAxeHead, excavatorHead, largeSwordBlade,
* hammerHead bowstring, fletching, arrowhead
*/
public static HashMap<String, Item> itemDirectory = new HashMap<String, Item>();
public static HashMap<String, Item> itemDirectory = new HashMap<>();
/**
* Adds an item to the directory
@@ -95,7 +95,7 @@ public class TConstructRegistry {
* scytheHead, excavatorHead, largeBlade, hammerHead, fullGuard, bowString,
* fletching, arrowHead
*/
static HashMap<String, ItemStack> itemstackDirectory = new HashMap<String, ItemStack>();
static HashMap<String, ItemStack> itemstackDirectory = new HashMap<>();
/**
* Adds an itemstack to the directory
@@ -126,7 +126,7 @@ public class TConstructRegistry {
return ret;
}
public static ArrayList<ToolCore> tools = new ArrayList<ToolCore>(20);
public static ArrayList<ToolCore> tools = new ArrayList<>(20);
// Parts
@@ -134,7 +134,7 @@ public class TConstructRegistry {
* List: Item ID, metadata, material ID ItemStack: Output. Ex: Cactus
* Binding
*/
public static HashMap<List, ItemStack> patternPartMapping = new HashMap<List, ItemStack>();
public static HashMap<List, ItemStack> patternPartMapping = new HashMap<>();
/**
* Maps an item and a material ID to an output part
@@ -193,14 +193,14 @@ public class TConstructRegistry {
ToolBuilder tb = ToolBuilder.instance;
if (parts.length < 2 || parts.length > 4) logger.warn("Wrong amount of items to craft into a tool");
tb.addToolRecipe(output, parts);
ToolBuilder.addToolRecipe(output, parts);
}
// Materials
public static HashMap<Integer, ToolMaterial> toolMaterials = new HashMap<Integer, ToolMaterial>(40);
public static HashMap<String, ToolMaterial> toolMaterialStrings = new HashMap<String, ToolMaterial>(40);
public static List<Integer> defaultToolPartMaterials = new LinkedList<Integer>();
public static List<Integer> defaultShardMaterials = new LinkedList<Integer>();
public static HashMap<Integer, ToolMaterial> toolMaterials = new HashMap<>(40);
public static HashMap<String, ToolMaterial> toolMaterialStrings = new HashMap<>(40);
public static List<Integer> defaultToolPartMaterials = new LinkedList<>();
public static List<Integer> defaultShardMaterials = new LinkedList<>();
public static void addDefaultToolPartMaterial(int materialID) {
if (!toolMaterials.containsKey(materialID))
@@ -465,7 +465,7 @@ public class TConstructRegistry {
}
// Bow materials
public static HashMap<Integer, BowMaterial> bowMaterials = new HashMap<Integer, BowMaterial>(40);
public static HashMap<Integer, BowMaterial> bowMaterials = new HashMap<>(40);
@Deprecated
public static void addBowMaterial(int materialID, int durability, int drawSpeed, float speedMax) {
@@ -488,7 +488,7 @@ public class TConstructRegistry {
return bowMaterials.get(materialID);
}
public static HashMap<Integer, ArrowMaterial> arrowMaterials = new HashMap<Integer, ArrowMaterial>(40);
public static HashMap<Integer, ArrowMaterial> arrowMaterials = new HashMap<>(40);
@Deprecated
public static void addArrowMaterial(int materialID, float mass, float breakChance, float accuracy) {
@@ -513,7 +513,7 @@ public class TConstructRegistry {
}
// Custom materials - bowstrings, fletching, etc
public static ArrayList<CustomMaterial> customMaterials = new ArrayList<CustomMaterial>();
public static ArrayList<CustomMaterial> customMaterials = new ArrayList<>();
public static void addCustomMaterial(CustomMaterial mat) {
if (mat != null) customMaterials.add(mat);
@@ -616,10 +616,9 @@ public class TConstructRegistry {
LiquidCasting tableCasting() {
try {
Class clazz = Class.forName("tconstruct.TConstruct");
Class<?> clazz = Class.forName("tconstruct.TConstruct");
Method method = clazz.getMethod("getTableCasting");
LiquidCasting lc = (LiquidCasting) method.invoke(this);
return lc;
return (LiquidCasting) method.invoke(this);
} catch (Exception e) {
logger.warn("Could not find casting table recipes.");
return null;
@@ -632,10 +631,9 @@ public class TConstructRegistry {
LiquidCasting basinCasting() {
try {
Class clazz = Class.forName("tconstruct.TConstruct");
Class<?> clazz = Class.forName("tconstruct.TConstruct");
Method method = clazz.getMethod("getBasinCasting");
LiquidCasting lc = (LiquidCasting) method.invoke(this);
return lc;
return (LiquidCasting) method.invoke(this);
} catch (Exception e) {
logger.warn("Could not find casting basin recipes.");
return null;
@@ -648,18 +646,17 @@ public class TConstructRegistry {
Detailing chiselDetailing() {
try {
Class clazz = Class.forName("tconstruct.TConstruct");
Class<?> clazz = Class.forName("tconstruct.TConstruct");
Method method = clazz.getMethod("getChiselDetailing");
Detailing lc = (Detailing) method.invoke(this);
return lc;
return (Detailing) method.invoke(this);
} catch (Exception e) {
logger.warn("Could not find chisel detailing recipes.");
return null;
}
}
public static ArrayList<ActiveToolMod> activeModifiers = new ArrayList<ActiveToolMod>();
public static LinkedList<ActiveArmorMod> activeArmorModifiers = new LinkedList<ActiveArmorMod>();
public static ArrayList<ActiveToolMod> activeModifiers = new ArrayList<>();
public static LinkedList<ActiveArmorMod> activeArmorModifiers = new LinkedList<>();
public static void registerActiveToolMod(ActiveToolMod mod) {
activeModifiers.add(mod);
@@ -9,5 +9,5 @@ public interface IAccessory {
* @param slot Accessory slot
* @return Whether the accessory can be inserted into the slot
*/
public boolean canEquipAccessory(ItemStack item, int slot);
boolean canEquipAccessory(ItemStack item, int slot);
}
@@ -14,5 +14,5 @@ public interface IAccessoryModel {
* @return Resource location of the texture. Return null for none
*/
@SideOnly(Side.CLIENT)
public ResourceLocation getWearbleTexture(Entity entity, ItemStack stack, int slot);
ResourceLocation getWearbleTexture(Entity entity, ItemStack stack, int slot);
}
@@ -3,5 +3,5 @@ package tconstruct.library.accessory;
import net.minecraft.item.ItemStack;
public interface IHealthAccessory extends IAccessory {
public int getHealthBoost(ItemStack item);
int getHealthBoost(ItemStack item);
}
@@ -12,7 +12,6 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.*;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.ISpecialArmor;
import tconstruct.library.TConstructRegistry;
@@ -180,9 +179,7 @@ public abstract class ArmorCore extends ItemArmor implements ISpecialArmor, IMod
float ratio = currentDurability / maxDurability;
double base = tags.getDouble("BaseDefense");
double max = tags.getDouble("MaxDefense");
double current = (max - base) * ratio + base;
return current;
return (max - base) * ratio + base;
}
@Override
@@ -347,7 +344,7 @@ public abstract class ArmorCore extends ItemArmor implements ISpecialArmor, IMod
return tags.getCompoundTag(getBaseTagName()).getInteger("Damage");
}
private DecimalFormat df = new DecimalFormat("##.#");
private final DecimalFormat df = new DecimalFormat("##.#");
@Override
@SideOnly(Side.CLIENT)
@@ -11,9 +11,9 @@ public abstract class ArmorModTypeFilter extends ArmorMod {
super(effect, dataKey, armorTypes, items);
assert items.length == values.length
: "Itemstacks and their values for armor modifiers must be the same length";
this.increase = new ArrayList<Integer>();
for (int i = 0; i < values.length; i++) {
increase.add(values[i]);
this.increase = new ArrayList<>();
for (int value : values) {
increase.add(value);
}
}
@@ -54,8 +54,7 @@ public abstract class ArmorModTypeFilter extends ArmorMod {
public int matchingAmount(ItemStack[] input) {
int amount = 0;
for (ItemStack inputStack : input) {
if (inputStack == null) continue;
else {
if (inputStack != null) {
for (int iter = 0; iter < stacks.size(); iter++) {
ItemStack stack = (ItemStack) stacks.get(iter);
if (stack.getItemDamage() == Short.MAX_VALUE) {
@@ -8,7 +8,7 @@ public enum ArmorPart {
private final int partID;
private ArmorPart(int partID) {
ArmorPart(int partID) {
this.partID = partID;
}
@@ -20,15 +20,14 @@ final class BehaviorDispenseArmorCopy extends BehaviorDefaultDispenseItem {
int i = par1IBlockSource.getXInt() + enumfacing.getFrontOffsetX();
int j = par1IBlockSource.getYInt() + enumfacing.getFrontOffsetY();
int k = par1IBlockSource.getZInt() + enumfacing.getFrontOffsetZ();
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(
(double) i, (double) j, (double) k, (double) (i + 1), (double) (j + 1), (double) (k + 1));
List list = par1IBlockSource
AxisAlignedBB axisalignedbb = AxisAlignedBB.getBoundingBox(i, j, k, i + 1, j + 1, k + 1);
List<EntityLivingBase> list = par1IBlockSource
.getWorld()
.selectEntitiesWithinAABB(
EntityLivingBase.class, axisalignedbb, new IEntitySelector.ArmoredMob(par2ItemStack));
if (list.size() > 0) {
EntityLivingBase entitylivingbase = (EntityLivingBase) list.get(0);
EntityLivingBase entitylivingbase = list.get(0);
int l = entitylivingbase instanceof EntityPlayer ? 1 : 0;
int i1 = EntityLiving.getArmorPosition(par2ItemStack);
ItemStack itemstack1 = par2ItemStack.copy();
@@ -37,7 +37,7 @@ public class FluidRenderProperties {
this(defaults.minHeight, defaults.maxHeight, defaults.minX, defaults.maxX, defaults.minZ, defaults.maxZ);
}
public static enum Applications {
public enum Applications {
TABLE(0.9375F, 1F, 0.0625F, 0.9375F, 0.062F, 0.9375F),
BASIN(0.25F, 0.95F, 0.0625F, 0.9375F, 0.0625F, 0.9375F);
public float minHeight, maxHeight, minX, maxX, minZ, maxZ;
@@ -9,11 +9,11 @@ import tconstruct.library.crafting.ModifyBuilder;
import tconstruct.library.tools.ToolCore;
public class TConstructClientRegistry {
public static ArrayList<StencilGuiElement> stencilButtons = new ArrayList<StencilGuiElement>();
public static ArrayList<StencilGuiElement> stencilButtons2 = new ArrayList<StencilGuiElement>();
public static ArrayList<ToolGuiElement> toolButtons = new ArrayList<ToolGuiElement>(20);
public static ArrayList<ToolGuiElement> tierTwoButtons = new ArrayList<ToolGuiElement>();
public static Map<String, ItemStack> manualIcons = new HashMap<String, ItemStack>();
public static ArrayList<StencilGuiElement> stencilButtons = new ArrayList<>();
public static ArrayList<StencilGuiElement> stencilButtons2 = new ArrayList<>();
public static ArrayList<ToolGuiElement> toolButtons = new ArrayList<>(20);
public static ArrayList<ToolGuiElement> tierTwoButtons = new ArrayList<>();
public static Map<String, ItemStack> manualIcons = new HashMap<>();
public static ItemStack defaultStack = new ItemStack(Items.iron_ingot);
public static void addMaterialRenderMapping(
@@ -3,5 +3,5 @@ package tconstruct.library.component;
import java.util.List;
public interface IComponentHolder {
public List<LogicComponent> getComponents();
List<LogicComponent> getComponents();
}
@@ -6,7 +6,7 @@ import net.minecraftforge.fluids.*;
import tconstruct.library.crafting.Smeltery;
public class MultiFluidTank extends LogicComponent implements IFluidTank {
public ArrayList<FluidStack> fluidlist = new ArrayList<FluidStack>();
public ArrayList<FluidStack> fluidlist = new ArrayList<>();
protected int maxLiquid;
protected int currentLiquid;
@@ -63,9 +63,8 @@ public class MultiFluidTank extends LogicComponent implements IFluidTank {
if (doFill) {
if (addFluidToTank(resource, false)) {
ArrayList alloys = Smeltery.mixMetals(fluidlist);
for (int al = 0; al < alloys.size(); al++) {
FluidStack liquid = (FluidStack) alloys.get(al);
ArrayList<FluidStack> alloys = Smeltery.mixMetals(fluidlist);
for (FluidStack liquid : alloys) {
addFluidToTank(liquid, true);
}
}
@@ -78,7 +77,6 @@ public class MultiFluidTank extends LogicComponent implements IFluidTank {
if (fluidlist.size() == 0) {
fluidlist.add(liquid.copy());
currentLiquid += liquid.amount;
return true;
} else {
if (liquid.amount + currentLiquid > maxLiquid) return false;
@@ -99,8 +97,8 @@ public class MultiFluidTank extends LogicComponent implements IFluidTank {
if (first) fluidlist.add(0, liquid.copy());
else fluidlist.add(liquid.copy());
}
return true;
}
return true;
}
@Override
@@ -136,7 +134,7 @@ public class MultiFluidTank extends LogicComponent implements IFluidTank {
fluidlist.clear();
for (int iter = 0; iter < liquidTag.tagCount(); iter++) {
NBTTagCompound nbt = (NBTTagCompound) liquidTag.getCompoundTagAt(iter);
NBTTagCompound nbt = liquidTag.getCompoundTagAt(iter);
FluidStack fluid = FluidStack.loadFluidStackFromNBT(nbt);
if (fluid != null) fluidlist.add(fluid);
}
@@ -19,18 +19,19 @@ public class TankLayerScan extends LogicComponent {
protected int bricks = 0;
protected int airBlocks = 0;
protected int structureTop = 0;
protected HashSet<CoordTuple> layerBlockCoords = new HashSet<CoordTuple>();
protected HashSet<CoordTuple> layerAirCoords = new HashSet<CoordTuple>();
protected HashSet<CoordTuple> layerBlockCoords = new HashSet<>();
protected HashSet<CoordTuple> layerAirCoords = new HashSet<>();
public ArrayList<CoordTuple> blockCoords = new ArrayList<CoordTuple>();
public ArrayList<CoordTuple> airCoords = new ArrayList<CoordTuple>();
protected ArrayList<int[]> validAirCoords = new ArrayList<int[]>();
public ArrayList<CoordTuple> blockCoords = new ArrayList<>();
public ArrayList<CoordTuple> airCoords = new ArrayList<>();
protected ArrayList<int[]> validAirCoords = new ArrayList<>();
protected CoordTuple returnStone;
private static boolean debug = System.getenv("DBG_MANTLE_TankLayerScan") != null;
private static int MAX_LAYER_RECURSION_DEPTH = System.getProperty("os.arch").equals("amd64")
? 4000
: 2000; // Recursion causes overflows on 32-bit, so reduce if not 64-bit
private static final boolean debug = System.getenv("DBG_MANTLE_TankLayerScan") != null;
private static final int MAX_LAYER_RECURSION_DEPTH =
System.getProperty("os.arch").equals("amd64")
? 4000
: 2000; // Recursion causes overflows on 32-bit, so reduce if not 64-bit
public TankLayerScan(TileEntity te, Block... ids) {
assert te instanceof IMasterLogic : "TileEntity must be an instance of IMasterLogic";
@@ -110,8 +111,8 @@ public class TankLayerScan extends LogicComponent {
if (sealed) {
blockCoords.add(new CoordTuple(master.xCoord, master.yCoord, master.zCoord)); // Don't forget me!
layerAirCoords = new HashSet<CoordTuple>(airCoords);
layerBlockCoords = new HashSet<CoordTuple>(blockCoords);
layerAirCoords = new HashSet<>(airCoords);
layerBlockCoords = new HashSet<>(blockCoords);
int lowY = recurseStructureDown(master.yCoord - 1);
if (lowY != -1) {
@@ -130,8 +131,8 @@ public class TankLayerScan extends LogicComponent {
// @SuppressWarnings({ "unchecked" })
protected void finalizeStructure() {
Collections.sort(blockCoords, new CoordTupleSort());
Collections.sort(airCoords, new CoordTupleSort());
blockCoords.sort(new CoordTupleSort());
airCoords.sort(new CoordTupleSort());
for (CoordTuple coord : blockCoords) {
TileEntity servant = world.getTileEntity(coord.x, coord.y, coord.z);
@@ -165,10 +166,8 @@ public class TankLayerScan extends LogicComponent {
protected boolean checkAir(int x, int y, int z) {
Block block = world.getBlock(x, y, z);
if (block == null || world.isAirBlock(x, y, z)) // || block == TContent.tankAir)
return true;
return false;
// || block == TContent.tankAir)
return block == null || world.isAirBlock(x, y, z);
}
protected boolean checkServant(int x, int y, int z) {
@@ -209,8 +208,8 @@ public class TankLayerScan extends LogicComponent {
protected boolean isValidBlock(int x, int y, int z) {
Block block = world.getBlock(x, y, z);
if (block != null) {
for (int i = 0; i < scanBlocks.length; i++) {
if (block == scanBlocks[i]) return true;
for (Block scanBlock : scanBlocks) {
if (block == scanBlock) return true;
}
}
return false;
@@ -235,16 +234,16 @@ public class TankLayerScan extends LogicComponent {
}
public int recurseStructureDown(int y) {
Iterator i = layerAirCoords.iterator();
Iterator<CoordTuple> i = layerAirCoords.iterator();
if (i.hasNext()) {
CoordTuple coord = (CoordTuple) i.next();
CoordTuple coord = i.next();
if (checkAir(coord.x, y, coord.z)) {
boolean valid = true;
addAirBlock(coord.x, y, coord.z); // Don't skip first one
// Air blocks
while (i.hasNext()) {
coord = (CoordTuple) i.next();
coord = i.next();
if (checkAir(coord.x, y, coord.z)) {
addAirBlock(coord.x, y, coord.z);
} else {
@@ -256,7 +255,7 @@ public class TankLayerScan extends LogicComponent {
// Bricks
i = layerBlockCoords.iterator();
while (i.hasNext()) {
coord = (CoordTuple) i.next();
coord = i.next();
if (checkServant(coord.x, y, coord.z)) blockCoords.add(new CoordTuple(coord.x, y, coord.z));
else {
valid = false;
@@ -269,7 +268,7 @@ public class TankLayerScan extends LogicComponent {
// Bottom floor. All blocks, please vacate the elevator
boolean valid = true;
while (i.hasNext()) {
coord = (CoordTuple) i.next();
coord = i.next();
if (checkServant(coord.x, y, coord.z)) blockCoords.add(new CoordTuple(coord.x, y, coord.z));
else {
@@ -285,15 +284,15 @@ public class TankLayerScan extends LogicComponent {
}
public int recurseStructureUp(int y) {
Iterator i = layerBlockCoords.iterator();
Iterator<CoordTuple> i = layerBlockCoords.iterator();
if (i.hasNext()) {
CoordTuple coord = (CoordTuple) i.next();
CoordTuple coord = i.next();
if (checkServant(coord.x, y, coord.z)) {
boolean valid = true;
// Bricks
while (i.hasNext()) {
coord = (CoordTuple) i.next();
coord = i.next();
if (checkServant(coord.x, y, coord.z)) blockCoords.add(new CoordTuple(coord.x, y, coord.z));
else {
valid = false;
@@ -305,7 +304,7 @@ public class TankLayerScan extends LogicComponent {
if (valid) {
i = layerAirCoords.iterator();
while (i.hasNext()) {
coord = (CoordTuple) i.next();
coord = i.next();
if (checkAir(coord.x, y, coord.z)) {
addAirBlock(coord.x, y, coord.z);
} else {
@@ -381,11 +380,9 @@ public class TankLayerScan extends LogicComponent {
/** Do any necessary cleanup here. Remove air blocks, invalidate servants, etc */
public void cleanup() {
Iterator i = blockCoords.iterator();
while (i.hasNext()) {
CoordTuple coord = (CoordTuple) i.next();
for (CoordTuple coord : blockCoords) {
TileEntity te = world.getTileEntity(coord.x, coord.y, coord.z);
if (te != null && te instanceof IServantLogic) {
if (te instanceof IServantLogic) {
((IServantLogic) te).invalidateMaster(imaster, world, master.xCoord, master.yCoord, master.zCoord);
}
}
@@ -18,14 +18,11 @@ public class AlloyMix {
*/
public FluidStack mix(ArrayList<FluidStack> liquids) {
ArrayList<FluidStack> copyMix = new ArrayList(mixers);
ArrayList effectiveAmount = new ArrayList();
ArrayList<FluidStack> copyMix = new ArrayList<>(mixers);
ArrayList<Integer> effectiveAmount = new ArrayList<>();
for (int i = 0; i < liquids.size(); i++) {
FluidStack liquid = liquids.get(i);
Iterator iter = copyMix.iterator();
while (iter.hasNext()) {
FluidStack mixer = (FluidStack) iter.next();
for (FluidStack liquid : liquids) {
for (FluidStack mixer : copyMix) {
if (mixer.isFluidEqual(liquid)) {
// do we actually have enough of that liquid?
if (liquid.amount < mixer.amount) break;
@@ -42,13 +39,11 @@ public class AlloyMix {
// Remove old liquids
int low = getLowestAmount(effectiveAmount);
ArrayList<FluidStack> copyMix2 = new ArrayList(mixers);
ArrayList<FluidStack> copyMix2 = new ArrayList<>(mixers);
for (int i = 0; i < liquids.size(); i++) {
FluidStack liquid = liquids.get(i);
Iterator iter = copyMix2.iterator();
while (iter.hasNext()) {
FluidStack mixer = (FluidStack) iter.next();
for (FluidStack mixer : copyMix2) {
// if (mixer.itemID == liquid.itemID && mixer.itemMeta ==
// liquid.itemMeta)
if (mixer.isFluidEqual(liquid)) {
@@ -69,12 +64,14 @@ public class AlloyMix {
return ret;
}
int getLowestAmount(ArrayList list) {
int frist = (Integer) list.get(0); // FRIST!!!
int getLowestAmount(ArrayList<Integer> list) {
int first = list.get(0);
for (int i = 1; i < list.size(); i++) {
int compare = (Integer) list.get(i);
if (frist > compare) frist = compare;
int compare = list.get(i);
if (first > compare) {
first = compare;
}
}
return frist;
return first;
}
}
@@ -49,9 +49,7 @@ public class CastingRecipe {
return true;
} else if (!ignoreNBT && ItemStack.areItemStacksEqual(cast, inputCast)) {
return true;
} else if (ignoreNBT && cast != null && inputCast != null && cast.isItemEqual(inputCast)) {
return true;
}
} else return ignoreNBT && cast != null && inputCast != null && cast.isItemEqual(inputCast);
}
return false;
}
@@ -8,11 +8,10 @@ import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.tools.ToolCore;
public class Detailing {
public List<DetailInput> detailing = new ArrayList<DetailInput>();
public List<DetailInput> detailing = new ArrayList<>();
public void addDetailing(Object input, int inputMeta, Object output, int outputMeta, ToolCore tool) {
ItemStack iID, oID;
int iMeta = inputMeta, oMeta = outputMeta;
if (input instanceof Block) iID = new ItemStack(((Block) input));
else if (input instanceof Item) iID = new ItemStack(((Item) input));
@@ -24,7 +23,7 @@ public class Detailing {
else if (output instanceof ItemStack) oID = (ItemStack) output;
else throw new RuntimeException("Invalid detail output!");
this.addDetailing(new DetailInput(iID, iMeta, oID, oMeta), tool);
this.addDetailing(new DetailInput(iID, inputMeta, oID, outputMeta), tool);
}
public void addDetailing(DetailInput details, ToolCore tool) {
@@ -47,13 +46,8 @@ public class Detailing {
}
public void addShapelessToolRecipe(ItemStack par1ItemStack, Object... par2ArrayOfObj) {
ArrayList arraylist = new ArrayList();
Object[] aobject = par2ArrayOfObj;
int i = par2ArrayOfObj.length;
for (int j = 0; j < i; ++j) {
Object object1 = aobject[j];
ArrayList<ItemStack> arraylist = new ArrayList<>();
for (Object object1 : par2ArrayOfObj) {
if (object1 instanceof ItemStack) {
arraylist.add(((ItemStack) object1).copy());
} else if (object1 instanceof Item) {
@@ -66,13 +60,11 @@ public class Detailing {
arraylist.add(new ItemStack((Block) object1));
}
}
GameRegistry.addRecipe(new ShapelessToolRecipe(par1ItemStack, arraylist));
}
public DetailInput getDetailing(Block block, int inputMeta) {
for (int i = 0; i < detailing.size(); i++) {
DetailInput detail = (DetailInput) detailing.get(i);
for (DetailInput detail : detailing) {
if (Item.getItemFromBlock(block) == detail.input.getItem() && inputMeta == detail.inputMeta) {
return detail;
}
@@ -80,7 +72,7 @@ public class Detailing {
return null;
}
public class DetailInput {
public static class DetailInput {
public ItemStack input;
public int inputMeta;
public ItemStack output;
@@ -5,11 +5,11 @@ import net.minecraft.block.Block;
import net.minecraft.item.*;
public class DryingRackRecipes {
public static ArrayList<DryingRecipe> recipes = new ArrayList<DryingRecipe>();
public static ArrayList<DryingRecipe> recipes = new ArrayList<>();
public static void addDryingRecipe(Object input, int time, Object output) {
ItemStack inputItem = null;
ItemStack outputItem = null;
ItemStack inputItem;
ItemStack outputItem;
if (input instanceof ItemStack) inputItem = (ItemStack) input;
else if (input instanceof Item) inputItem = new ItemStack((Item) input, 1, 0);
@@ -11,7 +11,7 @@ public class FluidType {
public final Fluid fluid;
public final boolean isToolpart;
public static HashMap<String, FluidType> fluidTypes = new HashMap<String, FluidType>();
public static HashMap<String, FluidType> fluidTypes = new HashMap<>();
public FluidType(Block block, int meta, int baseTemperature, Fluid fluid, boolean isToolpart) {
this.renderBlock = block;
@@ -36,20 +36,19 @@ public class FluidType {
}
public static FluidType getFluidType(Fluid searchedFluid) {
Iterator iter = fluidTypes.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry pairs = (Map.Entry) iter.next();
if (((FluidType) pairs.getValue()).fluid.equals(searchedFluid)) return (FluidType) pairs.getValue();
for (Map.Entry<String, FluidType> stringFluidTypeEntry : fluidTypes.entrySet()) {
if (stringFluidTypeEntry.getValue().fluid.equals(searchedFluid)) {
return stringFluidTypeEntry.getValue();
}
}
return null;
}
public static int getTemperatureByFluid(Fluid searchedFluid) {
Iterator iter = fluidTypes.entrySet().iterator();
while (iter.hasNext()) {
Map.Entry pairs = (Map.Entry) iter.next();
if (((FluidType) pairs.getValue()).fluid.equals(searchedFluid))
return ((FluidType) pairs.getValue()).baseTemperature;
for (Map.Entry<String, FluidType> stringFluidTypeEntry : fluidTypes.entrySet()) {
if (stringFluidTypeEntry.getValue().fluid.equals(searchedFluid)) {
return stringFluidTypeEntry.getValue().baseTemperature;
}
}
return 800;
}
@@ -8,7 +8,7 @@ import tconstruct.library.client.FluidRenderProperties;
/* Melting becomes hardened */
public class LiquidCasting {
// public static LiquidCasting instance = new LiquidCasting();
private final ArrayList<CastingRecipe> casts = new ArrayList<CastingRecipe>();
private final ArrayList<CastingRecipe> casts = new ArrayList<>();
private boolean contains(CastingRecipe recipe) {
for (CastingRecipe c : casts) {
@@ -8,7 +8,7 @@ import tconstruct.library.modifier.*;
public class ModifyBuilder {
public static ModifyBuilder instance = new ModifyBuilder();
public List<ItemModifier> itemModifiers = new ArrayList<ItemModifier>();
public List<ItemModifier> itemModifiers = new ArrayList<>();
public ItemStack modifyItem(ItemStack input, ItemStack[] modifiers) {
ItemStack copy = input.copy(); // Prevent modifying the original
@@ -14,11 +14,11 @@ import tconstruct.library.util.IPattern;
public class PatternBuilder {
public static PatternBuilder instance = new PatternBuilder();
// Map items to their parts with a hashmap
public List<ItemKey> materials = new ArrayList<ItemKey>();
public HashMap<String, MaterialSet> materialSets = new HashMap<String, MaterialSet>();
public List<ItemKey> materials = new ArrayList<>();
public HashMap<String, MaterialSet> materialSets = new HashMap<>();
// We could use IRecipe if it wasn't tied to InventoryCrafting
public List<IPattern> toolPatterns = new ArrayList<IPattern>();
public List<IPattern> toolPatterns = new ArrayList<>();
/* Register methods */
public void registerMaterial(ItemStack material, int value, String key) {
@@ -55,7 +55,7 @@ public class PatternBuilder {
ItemKey key = getItemKey(material);
if (key != null) {
MaterialSet mat = (MaterialSet) materialSets.get(key.key);
MaterialSet mat = materialSets.get(key.key);
ItemStack toolPart = getMatchingPattern(pattern, material, mat);
if (toolPart != null) {
@@ -99,7 +99,7 @@ public class PatternBuilder {
if (material != null) {
ItemKey key = getItemKey(material);
if (key != null) {
MaterialSet set = (MaterialSet) materialSets.get(key.key);
MaterialSet set = materialSets.get(key.key);
return set.materialID;
}
}
@@ -136,20 +136,20 @@ public class PatternBuilder {
}
public ItemStack getShardFromSet(String materialset) {
MaterialSet set = (MaterialSet) materialSets.get(materialset);
MaterialSet set = materialSets.get(materialset);
if (set != null && set.shard != null) return set.shard.copy();
return null;
}
public ItemStack getRodFromSet(String materialset) {
MaterialSet set = (MaterialSet) materialSets.get(materialset);
MaterialSet set = materialSets.get(materialset);
if (set != null) return set.rod.copy();
return null;
}
// Small data classes. I would prefer the struct from C#, but we do what we
// can.
public class ItemKey {
public static class ItemKey {
public final Item item;
public final int damage;
public final int value;
@@ -163,7 +163,7 @@ public class PatternBuilder {
}
}
public class MaterialSet {
public static class MaterialSet {
public final ItemStack shard;
public final ItemStack rod;
public final int materialID;
@@ -22,7 +22,7 @@ public class ShapelessToolRecipe extends ShapelessRecipes {
@Override
public boolean matches(InventoryCrafting par1InventoryCrafting, World par2World) {
ArrayList arraylist = new ArrayList(this.recipeItems);
ArrayList<ItemStack> arraylist = new ArrayList<>(this.recipeItems);
for (int i = 0; i < 3; ++i) {
for (int j = 0; j < 3; ++j) {
@@ -30,11 +30,8 @@ public class ShapelessToolRecipe extends ShapelessRecipes {
if (itemstack != null) {
boolean flag = false;
Iterator iterator = arraylist.iterator();
while (iterator.hasNext()) {
ItemStack itemstack1 = (ItemStack) iterator.next();
for (ItemStack itemstack1 : arraylist) {
// TConstruct.logger.info("Rawr! "+itemstack1.getItemDamage());
if (itemstack.getItem() == itemstack1.getItem()) {
if (itemstack.getItem() instanceof ToolCore) {
@@ -11,11 +11,11 @@ import net.minecraftforge.oredict.OreDictionary;
public class Smeltery {
public static Smeltery instance = new Smeltery();
private final Map<ItemMetaWrapper, FluidStack> smeltingList = new HashMap<ItemMetaWrapper, FluidStack>();
private final Map<ItemMetaWrapper, Integer> temperatureList = new HashMap<ItemMetaWrapper, Integer>();
private final Map<ItemMetaWrapper, ItemStack> renderIndex = new HashMap<ItemMetaWrapper, ItemStack>();
private final List<AlloyMix> alloys = new ArrayList<AlloyMix>();
private final Map<Fluid, Integer[]> smelteryFuels = new HashMap<Fluid, Integer[]>(); // fluid -> [power, duration]
private final Map<ItemMetaWrapper, FluidStack> smeltingList = new HashMap<>();
private final Map<ItemMetaWrapper, Integer> temperatureList = new HashMap<>();
private final Map<ItemMetaWrapper, ItemStack> renderIndex = new HashMap<>();
private final List<AlloyMix> alloys = new ArrayList<>();
private final Map<Fluid, Integer[]> smelteryFuels = new HashMap<>(); // fluid -> [power, duration]
/**
* Add a new fluid as a valid Smeltery fuel.
@@ -108,9 +108,7 @@ public class Smeltery {
* @param mixers the liquids to be mixed. Quantities are used as ratios
*/
public static void addAlloyMixing(FluidStack result, FluidStack... mixers) {
ArrayList inputs = new ArrayList();
for (FluidStack liquid : mixers) inputs.add(liquid);
final ArrayList<FluidStack> inputs = new ArrayList<>(Arrays.asList(mixers));
instance.alloys.add(new AlloyMix(result, inputs));
}
@@ -135,7 +133,7 @@ public class Smeltery {
* @return The result ItemStack
*/
public static Integer getLiquifyTemperature(Block block, int metadata) {
return instance.getLiquifyTemperature(new ItemStack(block, 1, metadata));
return getLiquifyTemperature(new ItemStack(block, 1, metadata));
}
/**
@@ -159,18 +157,20 @@ public class Smeltery {
* @return The result ItemStack
*/
public static FluidStack getSmelteryResult(Block block, int metadata) {
return instance.getSmelteryResult(new ItemStack(block, 1, metadata));
return getSmelteryResult(new ItemStack(block, 1, metadata));
}
public static ItemStack getRenderIndex(ItemStack input) {
return instance.renderIndex.get(new ItemMetaWrapper(input));
}
public static ArrayList mixMetals(ArrayList<FluidStack> moltenMetal) {
ArrayList liquids = new ArrayList();
public static ArrayList<FluidStack> mixMetals(ArrayList<FluidStack> moltenMetal) {
ArrayList<FluidStack> liquids = new ArrayList<>();
for (AlloyMix alloy : instance.alloys) {
FluidStack liquid = alloy.mix(moltenMetal);
if (liquid != null) liquids.add(liquid);
if (liquid != null) {
liquids.add(liquid);
}
}
return liquids;
}
@@ -8,8 +8,8 @@ public class StencilBuilder {
public static StencilBuilder instance = new StencilBuilder();
public List<ItemStack> blanks =
new LinkedList<ItemStack>(); // i wish ItemStack would support equals so i could use a Set here...
public Map<Integer, ItemStack> stencils = new TreeMap<Integer, ItemStack>();
new LinkedList<>(); // i wish ItemStack would support equals so i could use a Set here...
public Map<Integer, ItemStack> stencils = new TreeMap<>();
/**
* Returns whether the given ItemStack is a blank pattern and therefore usable for stencil crafting.
@@ -16,9 +16,9 @@ import tconstruct.library.util.IToolPart;
public class ToolBuilder {
public static ToolBuilder instance = new ToolBuilder();
public HashMap<String, ToolRecipe> recipeList = new HashMap<String, ToolRecipe>();
public List<ToolRecipe> combos = new ArrayList<ToolRecipe>();
public HashMap<String, String> modifiers = new HashMap<String, String>();
public HashMap<String, ToolRecipe> recipeList = new HashMap<>();
public List<ToolRecipe> combos = new ArrayList<>();
public HashMap<String, String> modifiers = new HashMap<>();
/* Build tools */
public static void addNormalToolRecipe(ToolCore output, Item head, Item handle) {
@@ -148,7 +148,7 @@ public class ToolBuilder {
if (item == null) return null;
ToolMaterial headMat = null, handleMat = null, accessoryMat = null, extraMat = null;
ToolMaterial headMat, handleMat, accessoryMat = null, extraMat = null;
headMat = TConstructRegistry.getMaterial(head);
handleMat = TConstructRegistry.getMaterial(handle);
@@ -11,10 +11,10 @@ import tconstruct.library.tools.ToolCore;
*/
public class ToolRecipe {
protected LinkedList<Item> headList = new LinkedList<Item>();
protected LinkedList<Item> handleList = new LinkedList<Item>();
protected LinkedList<Item> accessoryList = new LinkedList<Item>();
protected LinkedList<Item> extraList = new LinkedList<Item>();
protected LinkedList<Item> headList = new LinkedList<>();
protected LinkedList<Item> handleList = new LinkedList<>();
protected LinkedList<Item> accessoryList = new LinkedList<>();
protected LinkedList<Item> extraList = new LinkedList<>();
protected ToolCore result;
protected Item toolRod = TConstructRegistry.getItem("toolRod");
@@ -72,8 +72,7 @@ public class ToolRecipe {
public boolean validAccessory(Item input) {
if (input == null) {
if (accessoryList.size() < 1) return true;
return false;
return accessoryList.size() < 1;
}
for (Item part : accessoryList) {
if (part == input) return true;
@@ -84,8 +83,7 @@ public class ToolRecipe {
public boolean validExtra(Item input) {
if (input == null) {
if (extraList.size() < 1) return true;
return false;
return extraList.size() < 1;
}
for (Item part : extraList) {
if (part == input) return true;
@@ -135,7 +135,7 @@ public abstract class ProjectileBase extends EntityArrow implements IEntityAddit
entityHit.addVelocity(
this.motionX * (double) knockback * 0.6000000238418579D / horizontalSpeed,
0.1D,
this.motionZ * (double) knockback * 0.6000000238418579D / (double) horizontalSpeed);
this.motionZ * (double) knockback * 0.6000000238418579D / horizontalSpeed);
}
}
@@ -323,7 +323,7 @@ public abstract class ProjectileBase extends EntityArrow implements IEntityAddit
// returns true if it was successful
public boolean dealDamage(float damage, ToolCore ammo, NBTTagCompound tags, Entity entityHit) {
boolean dealtDamage = false;
boolean dealtDamage;
// deal regular damage
DamageSource damagesource;
@@ -358,8 +358,7 @@ public abstract class ProjectileBase extends EntityArrow implements IEntityAddit
float f = MathHelper.sqrt_double(this.motionX * this.motionX + this.motionZ * this.motionZ);
this.prevRotationYaw =
this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D / Math.PI);
this.prevRotationPitch =
this.rotationPitch = (float) (Math.atan2(this.motionY, (double) f) * 180.0D / Math.PI);
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, f) * 180.0D / Math.PI);
}
// we previously hit something. Check if the block is still there.
@@ -394,9 +393,9 @@ public abstract class ProjectileBase extends EntityArrow implements IEntityAddit
}
} else {
this.inGround = false;
this.motionX *= (double) (this.rand.nextFloat() * 0.2F);
this.motionY *= (double) (this.rand.nextFloat() * 0.2F);
this.motionZ *= (double) (this.rand.nextFloat() * 0.2F);
this.motionX *= this.rand.nextFloat() * 0.2F;
this.motionY *= this.rand.nextFloat() * 0.2F;
this.motionZ *= this.rand.nextFloat() * 0.2F;
this.ticksInGround = 0;
this.ticksInAir = 0;
}
@@ -443,7 +442,7 @@ public abstract class ProjectileBase extends EntityArrow implements IEntityAddit
if (ent == this.shootingEntity && this.ticksInAir < 5) continue;
f1 = 0.3F;
AxisAlignedBB axisalignedbb1 = ent.boundingBox.expand((double) f1, (double) f1, (double) f1);
AxisAlignedBB axisalignedbb1 = ent.boundingBox.expand(f1, f1, f1);
MovingObjectPosition movingobjectposition1 = axisalignedbb1.calculateIntercept(curPos, newPos);
// did we actually collide with the entity, or was it just really close nearby?
@@ -462,9 +461,7 @@ public abstract class ProjectileBase extends EntityArrow implements IEntityAddit
if (entity != null) movingobjectposition = new MovingObjectPosition(entity);
// did we hit a player?
if (movingobjectposition != null
&& movingobjectposition.entityHit != null
&& movingobjectposition.entityHit instanceof EntityPlayer) {
if (movingobjectposition != null && movingobjectposition.entityHit instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit;
// can we attack said player?
@@ -4,9 +4,9 @@ public interface IModifyable {
/**
* @return The base tag to modify. Ex: InfiTool
*/
public String getBaseTagName();
String getBaseTagName();
public String getModifyType();
String getModifyType();
public String[] getTraits();
String[] getTraits();
}
@@ -6,7 +6,7 @@ import net.minecraft.nbt.NBTTagCompound;
public abstract class ItemModifier {
public final String key;
public final List stacks;
public final List<ItemStack> stacks;
public final int effectIndex;
public static Random random = new Random();
@@ -17,9 +17,7 @@ public abstract class ItemModifier {
* @param dataKey NBT string to put on the item
*/
public ItemModifier(ItemStack[] recipe, int effect, String dataKey) {
List<ItemStack> itemstacks = new ArrayList<ItemStack>();
for (int iter = 0; iter < recipe.length; iter++) itemstacks.add(recipe[iter]);
stacks = itemstacks;
stacks = new ArrayList<>(Arrays.asList(recipe));
effectIndex = effect;
key = dataKey;
}
@@ -34,18 +32,13 @@ public abstract class ItemModifier {
public boolean matches(ItemStack[] recipe, ItemStack input) {
if (!canModify(input, recipe)) return false;
ArrayList list = new ArrayList(this.stacks);
for (int iter = 0; iter < recipe.length; ++iter) {
ItemStack craftingStack = recipe[iter];
ArrayList<ItemStack> list = new ArrayList<>(this.stacks);
for (ItemStack craftingStack : recipe) {
if (craftingStack != null) {
boolean canCraft = false;
Iterator iterate = list.iterator();
while (iterate.hasNext()) {
ItemStack removeStack = (ItemStack) iterate.next();
for (ItemStack removeStack : list) {
if (craftingStack.getItem() == removeStack.getItem()
&& (removeStack.getItemDamage() == Short.MAX_VALUE
|| craftingStack.getItemDamage() == removeStack.getItemDamage())) {
@@ -3,7 +3,6 @@ package tconstruct.library.tools;
import cofh.api.energy.IEnergyContainerItem;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.Event.Result;
import java.util.Iterator;
import java.util.List;
import java.util.Random;
import net.minecraft.block.Block;
@@ -110,7 +109,7 @@ public class AbilityHelper {
if (baseDamage > 0) damage = baseDamage;
else damage = 1;
}
boolean causedDamage = false;
boolean causedDamage;
boolean isAlive = entity.isEntityAlive();
if (tool.pierceArmor() && !broken && entity instanceof EntityLivingBase) {
@@ -145,13 +144,9 @@ public class AbilityHelper {
if (knockback > 0) {
entity.addVelocity(
(double) (-MathHelper.sin(player.rotationYaw * (float) Math.PI / 180.0F)
* (float) knockback
* 0.5F),
-MathHelper.sin(player.rotationYaw * (float) Math.PI / 180.0F) * knockback * 0.5F,
0.1D,
(double) (MathHelper.cos(player.rotationYaw * (float) Math.PI / 180.0F)
* (float) knockback
* 0.5F));
MathHelper.cos(player.rotationYaw * (float) Math.PI / 180.0F) * knockback * 0.5F);
player.motionX *= 0.6D;
player.motionZ *= 0.6D;
player.setSprinting(false);
@@ -196,7 +191,7 @@ public class AbilityHelper {
}
if (entity instanceof EntityPlayer) ((EntityPlayer) player).addExhaustion(0.3F);
if (causedDamage) return true;
return causedDamage;
}
}
}
@@ -310,7 +305,7 @@ public class AbilityHelper {
}
if (!(living instanceof EntityPlayer) || player.canAttackPlayer((EntityPlayer) living)) {
List var6 = player.worldObj.getEntitiesWithinAABB(
List<EntityWolf> var6 = player.worldObj.getEntitiesWithinAABB(
EntityWolf.class,
AxisAlignedBB.getBoundingBox(
player.posX,
@@ -320,11 +315,8 @@ public class AbilityHelper {
player.posY + 1.0D,
player.posZ + 1.0D)
.expand(16.0D, 4.0D, 16.0D));
Iterator var4 = var6.iterator();
while (var4.hasNext()) {
EntityWolf var5 = (EntityWolf) var4.next();
for (EntityWolf var5 : var6) {
if (var5.isTamed()
&& var5.getEntityToAttack() == null
&& player.getDisplayName().equals(var5.func_152113_b())
@@ -354,7 +346,7 @@ public class AbilityHelper {
return;
// calculate in reinforced/unbreaking
int reinforced = 0;
int reinforced;
if (tags.hasKey("InfiTool") && dam > 0) // unbreaking only affects damage, not healing
{
NBTTagCompound toolTags = tags.getCompoundTag("InfiTool");
@@ -390,9 +382,9 @@ public class AbilityHelper {
tags.getCompoundTag("InfiTool").setInteger("Damage", damage + dam);
int toolDamage = (damage * 100 / maxDamage) + 1;
int stackDamage = stack.getItemDamage();
if (toolDamage != stackDamage) {
// stack.setItemDamage((damage * 100 / maxDamage) + 1);
}
// if (toolDamage != stackDamage) {
// // stack.setItemDamage((damage * 100 / maxDamage) + 1);
// }
}
}
}
@@ -488,7 +480,7 @@ public class AbilityHelper {
tags.setInteger("Energy", max - missing);
}
private static boolean equalityOverrideLoaded =
private static final boolean equalityOverrideLoaded =
Loader.isModLoaded("CoFHCore"); // Mods should be loaded far enough before this is ever initialized
public static void breakTool(ItemStack stack, NBTTagCompound tags, Entity entity) {
@@ -538,20 +530,18 @@ public class AbilityHelper {
&& (block == Blocks.grass || block == Blocks.dirt)) {
Block block1 = Blocks.farmland;
world.playSoundEffect(
(double) ((float) x + 0.5F),
(double) ((float) y + 0.5F),
(double) ((float) z + 0.5F),
(float) x + 0.5F,
(float) y + 0.5F,
(float) z + 0.5F,
block1.stepSound.getStepResourcePath(),
(block1.stepSound.getVolume() + 1.0F) / 2.0F,
block1.stepSound.getPitch() * 0.8F);
if (world.isRemote) {
return true;
} else {
if (!world.isRemote) {
world.setBlock(x, y, z, block1);
damageTool(stack, 1, player, false);
return true;
}
return true;
} else {
return false;
}
@@ -4,7 +4,6 @@ import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.*;
/* Base class for harvest tools with each head having a different purpose */
@@ -38,16 +37,16 @@ public abstract class DualHarvestTool extends HarvestTool {
if (tags.getBoolean("Broken")) return 0.1f;
Material[] materials = getEffectiveMaterials();
for (int i = 0; i < materials.length; i++) {
if (materials[i] == block.getMaterial()) {
for (Material value : materials) {
if (value == block.getMaterial()) {
if (block.getHarvestLevel(meta) <= tags.getInteger("HarvestLevel"))
return AbilityHelper.calcDualToolSpeed(this, tags, false);
return 0.1f;
}
}
materials = getEffectiveSecondaryMaterials();
for (int i = 0; i < materials.length; i++) {
if (materials[i] == block.getMaterial()) {
for (Material material : materials) {
if (material == block.getMaterial()) {
if (block.getHarvestLevel(meta) <= tags.getInteger("HarvestLevel2"))
return AbilityHelper.calcDualToolSpeed(this, tags, true);
return 0.1f;
@@ -37,11 +37,8 @@ public class DualMaterialToolPart extends DynamicToolPart {
public int getMaterialID2(ItemStack stack) {
if (!stack.hasTagCompound()) return -1;
int id = stack.getTagCompound().getCompoundTag("DualMat").getInteger("Material2");
if (TConstructRegistry.toolMaterials.keySet().contains(id)) return id;
if (TConstructRegistry.toolMaterials.containsKey(id)) return id;
return -1;
}
Loaded 100 of 307 files, more files were not shown because too many files have changed in this diff. Show more