[ci skip] spotlessApply with the new settings

This commit is contained in:
Jason Mitchell committed 2023-01-28 18:04:28 -08:00
1 parent 83698cb73c
commit 84c2239244
561 files changed
+8872 -9300

No files matched your search

@@ -2,6 +2,7 @@ package tconstruct.tools;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import tconstruct.library.crafting.ToolRecipe;
import tconstruct.library.tools.ToolCore;
@@ -1,6 +1,7 @@
package tconstruct.tools;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.enchantment.*;
import net.minecraft.entity.*;
@@ -13,6 +14,7 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import tconstruct.library.ActiveToolMod;
import tconstruct.library.tools.*;
import tconstruct.library.weaponry.IAmmo;
@@ -21,28 +23,28 @@ import tconstruct.world.TinkerWorld;
import tconstruct.world.entity.BlueSlime;
public class TActiveOmniMod extends ActiveToolMod {
Random random = new Random();
/* Updating */
@Override
public void updateTool(ToolCore tool, ItemStack stack, World world, Entity entity) {
if (!world.isRemote
&& entity instanceof EntityLivingBase
if (!world.isRemote && entity instanceof EntityLivingBase
&& !((EntityLivingBase) entity).isSwingInProgress
&& stack.getTagCompound() != null) {
if (entity instanceof EntityPlayer && (((EntityPlayer) entity).isUsingItem())) return;
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
if (tags.hasKey("Moss")) {
int chance = tags.getInteger("Moss");
int check =
world.canBlockSeeTheSky((int) entity.posX, (int) entity.posY, (int) entity.posZ) ? 350 : 1150;
int check = world.canBlockSeeTheSky((int) entity.posX, (int) entity.posY, (int) entity.posZ) ? 350
: 1150;
// REGROWING AMMO :OOoo
if (tool instanceof IAmmo
&& random.nextInt(check * 3) < chance) // ammo regenerates at a much slower rate
if (tool instanceof IAmmo && random.nextInt(check * 3) < chance) // ammo regenerates at a much slower
// rate
{
IAmmo ammothing = (IAmmo) tool;
if (ammothing.getAmmoCount(stack) > 0) // must have ammo
ammothing.addAmmo(1, stack);
ammothing.addAmmo(1, stack);
}
// selfrepairing tool. LAAAAAME
else if (random.nextInt(check) < chance) {
@@ -63,14 +65,14 @@ public class TActiveOmniMod extends ActiveToolMod {
}
@Override
public void afterBlockBreak(
ToolCore tool, ItemStack stack, Block block, int x, int y, int z, EntityLivingBase entity) {
public void afterBlockBreak(ToolCore tool, ItemStack stack, Block block, int x, int y, int z,
EntityLivingBase entity) {
NBTTagCompound tags = stack.getTagCompound().getCompoundTag("InfiTool");
slimify(tool, tags, block, x, y, z, entity.worldObj);
}
private boolean autoSmelt(
ToolCore tool, NBTTagCompound tags, ItemStack stack, int x, int y, int z, EntityLivingBase entity) {
private boolean autoSmelt(ToolCore tool, NBTTagCompound tags, ItemStack stack, int x, int y, int z,
EntityLivingBase entity) {
World world = entity.worldObj;
Block block = world.getBlock(x, y, z);
if (block == null) return false;
@@ -98,8 +100,10 @@ public class TActiveOmniMod extends ActiveToolMod {
if (entity instanceof EntityPlayer && !((EntityPlayer) entity).capabilities.isCreativeMode)
tool.onBlockDestroyed(stack, world, block, x, y, z, entity);
if (!world.isRemote) {
ItemStack spawnme =
new ItemStack(result.getItem(), amount * result.stackSize, result.getItemDamage());
ItemStack spawnme = new ItemStack(
result.getItem(),
amount * result.stackSize,
result.getItemDamage());
if (result.hasTagCompound()) spawnme.setTagCompound(result.getTagCompound());
if (!(result.getItem() instanceof ItemBlock) && PHConstruct.lavaFortuneInteraction) {
int loot = EnchantmentHelper.getEnchantmentLevel(Enchantment.fortune.effectId, stack);
@@ -163,15 +167,8 @@ public class TActiveOmniMod extends ActiveToolMod {
/* Attacking */
@Override
public int baseAttackDamage(
int earlyModDamage,
int damage,
ToolCore tool,
NBTTagCompound tags,
NBTTagCompound toolTags,
ItemStack stack,
EntityLivingBase player,
Entity entity) {
public int baseAttackDamage(int earlyModDamage, int damage, ToolCore tool, NBTTagCompound tags,
NBTTagCompound toolTags, ItemStack stack, EntityLivingBase player, Entity entity) {
TinkerTools.modLapis.midStreamModify(stack, tool);
baconator(tool, stack, player, tags);
return 0;
@@ -231,15 +228,8 @@ public class TActiveOmniMod extends ActiveToolMod {
}
@Override
public int attackDamage(
int modDamage,
int currentDamage,
ToolCore tool,
NBTTagCompound tags,
NBTTagCompound toolTags,
ItemStack stack,
EntityLivingBase player,
Entity entity) {
public int attackDamage(int modDamage, int currentDamage, ToolCore tool, NBTTagCompound tags,
NBTTagCompound toolTags, ItemStack stack, EntityLivingBase player, Entity entity) {
int bonus = modDamage;
if (entity instanceof EntityLivingBase) {
EnumCreatureAttribute attribute = ((EntityLivingBase) entity).getCreatureAttribute();
@@ -266,15 +256,8 @@ public class TActiveOmniMod extends ActiveToolMod {
}
@Override
public float knockback(
float modKnockback,
float currentKnockback,
ToolCore tool,
NBTTagCompound tags,
NBTTagCompound toolTags,
ItemStack stack,
EntityLivingBase player,
Entity entity) {
public float knockback(float modKnockback, float currentKnockback, ToolCore tool, NBTTagCompound tags,
NBTTagCompound toolTags, ItemStack stack, EntityLivingBase player, Entity entity) {
float bonus = modKnockback;
if (toolTags.hasKey("Knockback")) {
float level = toolTags.getFloat("Knockback");
@@ -284,13 +267,8 @@ public class TActiveOmniMod extends ActiveToolMod {
}
@Override
public boolean doesCriticalHit(
ToolCore tool,
NBTTagCompound tags,
NBTTagCompound toolTags,
ItemStack stack,
EntityLivingBase player,
Entity entity) {
public boolean doesCriticalHit(ToolCore tool, NBTTagCompound tags, NBTTagCompound toolTags, ItemStack stack,
EntityLivingBase player, Entity entity) {
return tool == TinkerTools.cutlass && random.nextInt(10) == 0;
}
}
@@ -1,9 +1,7 @@
package tconstruct.tools;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
import java.util.List;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.monster.EntityCreeper;
@@ -23,6 +21,7 @@ import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
import net.minecraftforge.oredict.OreDictionary;
import net.minecraftforge.oredict.OreDictionary.OreRegisterEvent;
import tconstruct.TConstruct;
import tconstruct.armor.player.TPlayerStats;
import tconstruct.library.TConstructRegistry;
@@ -34,14 +33,18 @@ import tconstruct.library.tools.*;
import tconstruct.util.ItemHelper;
import tconstruct.util.config.PHConstruct;
import tconstruct.util.network.MovementUpdatePacket;
import cpw.mods.fml.common.eventhandler.Event.Result;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.PlayerEvent.ItemCraftedEvent;
public class TinkerToolEvents {
@SubscribeEvent
public void onCrafting(ItemCraftedEvent event) {
if (event.crafting == null
|| event.player == null
if (event.crafting == null || event.player == null
|| event.player.worldObj == null
|| event.craftMatrix == null) return;
|| event.craftMatrix == null)
return;
Item item = event.crafting.getItem();
if (!event.player.worldObj.isRemote) {
@@ -84,11 +87,10 @@ public class TinkerToolEvents {
// check if the handle is a stick
List<ItemStack> sticks = OreDictionary.getOres("stickWood");
for (ItemStack stick : sticks)
if (OreDictionary.itemMatches(stick, event.handleStack, false)) {
event.handleStack = new ItemStack(TinkerTools.toolRod, 1, 0); // wooden tool rod
return;
}
for (ItemStack stick : sticks) if (OreDictionary.itemMatches(stick, event.handleStack, false)) {
event.handleStack = new ItemStack(TinkerTools.toolRod, 1, 0); // wooden tool rod
return;
}
}
@SubscribeEvent
@@ -149,7 +151,7 @@ public class TinkerToolEvents {
}
private boolean allowCrafting(int head, int handle, int accessory) {
int[] nonMetals = {0, 1, 3, 4, 5, 6, 7, 8, 9, 17};
int[] nonMetals = { 0, 1, 3, 4, 5, 6, 7, 8, 9, 17 };
for (int nonMetal : nonMetals) {
if (head == nonMetal || handle == nonMetal || accessory == nonMetal) return false;
}
@@ -162,7 +164,7 @@ public class TinkerToolEvents {
if (event.pattern.getItem() == TinkerTools.woodPattern && event.pattern.getItemDamage() == 23) {
ItemStack result = craftBowString(event.material);
if (result != null) {
event.overrideResult(new ItemStack[] {result, null});
event.overrideResult(new ItemStack[] { result, null });
}
}
@@ -170,7 +172,7 @@ public class TinkerToolEvents {
if (event.pattern.getItem() == TinkerTools.woodPattern && event.pattern.getItemDamage() == 24) {
ItemStack result = craftFletching(event.material);
if (result != null) {
event.overrideResult(new ItemStack[] {result, null});
event.overrideResult(new ItemStack[] { result, null });
}
}
}
@@ -178,15 +180,15 @@ public class TinkerToolEvents {
public static ItemStack craftBowString(ItemStack stack) {
if (stack.stackSize < 3) return null;
BowstringMaterial mat =
(BowstringMaterial) TConstructRegistry.getCustomMaterial(stack, BowstringMaterial.class);
BowstringMaterial mat = (BowstringMaterial) TConstructRegistry
.getCustomMaterial(stack, BowstringMaterial.class);
if (mat != null) return mat.craftingItem.copy();
return null;
}
public static ItemStack craftFletching(ItemStack stack) {
FletchingMaterial mat =
(FletchingMaterial) TConstructRegistry.getCustomMaterial(stack, FletchingMaterial.class);
FletchingMaterial mat = (FletchingMaterial) TConstructRegistry
.getCustomMaterial(stack, FletchingMaterial.class);
// maybe it's a leaf fletchling
if (mat == null)
mat = (FletchingMaterial) TConstructRegistry.getCustomMaterial(stack, FletchlingLeafMaterial.class);
@@ -203,16 +205,16 @@ public class TinkerToolEvents {
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.getItem() == TinkerTools.battlesign) {
// broken battlesign?
if (!stack.hasTagCompound()
|| stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Broken")) return;
if (!stack.hasTagCompound() || stack.getTagCompound().getCompoundTag("InfiTool").getBoolean("Broken"))
return;
DamageSource source = event.source;
if (!source.isUnblockable() && !source.isMagicDamage() && !source.isExplosion()) {
if (source.isProjectile()) {
Entity projectile = source.getSourceOfDamage();
if (projectile == null) return;
Vec3 motion =
Vec3.createVectorHelper(projectile.motionX, projectile.motionY, projectile.motionZ);
Vec3 motion = Vec3
.createVectorHelper(projectile.motionX, projectile.motionY, projectile.motionZ);
Vec3 look = player.getLookVec();
// this gives a factor of how much we're looking at the incoming arrow
@@ -223,8 +225,7 @@ public class TinkerToolEvents {
// no damage, hooraaay
event.setCanceled(true);
double speed = projectile.motionX * projectile.motionX
+ projectile.motionY * projectile.motionY
double speed = projectile.motionX * projectile.motionX + projectile.motionY * projectile.motionY
+ projectile.motionZ * projectile.motionZ;
speed = Math.sqrt(speed);
@@ -235,8 +236,8 @@ public class TinkerToolEvents {
projectile.motionY = look.yCoord * speed;
projectile.motionZ = look.zCoord * speed;
projectile.rotationYaw =
(float) (Math.atan2(projectile.motionX, projectile.motionZ) * 180.0D / Math.PI);
projectile.rotationYaw = (float) (Math.atan2(projectile.motionX, projectile.motionZ) * 180.0D
/ Math.PI);
projectile.rotationPitch = (float) (Math.atan2(projectile.motionY, speed) * 180.0D / Math.PI);
// send the current status to the client
@@ -250,8 +251,8 @@ public class TinkerToolEvents {
projectile.motionX /= -0.10000000149011612D;
projectile.motionY /= -0.10000000149011612D;
projectile.motionZ /= -0.10000000149011612D;
// projectile.rotationYaw -= 180.0F;
// projectile.prevRotationYaw -= 180.0F;
// projectile.rotationYaw -= 180.0F;
// projectile.prevRotationYaw -= 180.0F;
// not needed at the client since it gets the absolute values sent
@@ -285,9 +286,7 @@ public class TinkerToolEvents {
EntityPlayer player = (EntityPlayer) event.source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore) {
int beheading = stack.getTagCompound()
.getCompoundTag("InfiTool")
.getInteger("Beheading");
int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
if (stack.getItem() == TinkerTools.cleaver) beheading += 2;
if (beheading > 0 && TConstruct.random.nextInt(100) < beheading * 10) {
ItemHelper.addDrops(event, new ItemStack(Items.skull, 1, enemy.getSkeletonType()));
@@ -308,9 +307,7 @@ public class TinkerToolEvents {
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore) {
int beheading = stack.getTagCompound()
.getCompoundTag("InfiTool")
.getInteger("Beheading");
int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
if (stack != null && stack.hasTagCompound() && stack.getItem() == TinkerTools.cleaver)
beheading += 2;
if (beheading > 0 && TConstruct.random.nextInt(100) < beheading * 10) {
@@ -318,8 +315,7 @@ public class TinkerToolEvents {
}
}
if (stack != null
&& stack.hasTagCompound()
if (stack != null && stack.hasTagCompound()
&& stack.getItem() == TinkerTools.cleaver
&& TConstruct.random.nextInt(100) < 10) {
ItemHelper.addDrops(event, new ItemStack(Items.skull, 1, 2));
@@ -334,9 +330,7 @@ public class TinkerToolEvents {
EntityPlayer player = (EntityPlayer) event.source.getEntity();
ItemStack stack = player.getCurrentEquippedItem();
if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore) {
int beheading = stack.getTagCompound()
.getCompoundTag("InfiTool")
.getInteger("Beheading");
int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
if (stack.getItem() == TinkerTools.cleaver) beheading += 2;
if (beheading > 0 && TConstruct.random.nextInt(100) < beheading * 5) {
ItemHelper.addDrops(event, new ItemStack(Items.skull, 1, 4));
@@ -359,8 +353,7 @@ public class TinkerToolEvents {
EntityPlayer source = (EntityPlayer) event.source.getEntity();
ItemStack stack = source.getCurrentEquippedItem();
if (stack != null && stack.hasTagCompound() && stack.getItem() instanceof ToolCore) {
int beheading =
stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
int beheading = stack.getTagCompound().getCompoundTag("InfiTool").getInteger("Beheading");
if (stack.getItem() == TinkerTools.cleaver) beheading += 2;
if (beheading > 0 && TConstruct.random.nextInt(100) < beheading * 50) {
ItemStack dropStack = new ItemStack(Items.skull, 1, 3);
@@ -408,8 +401,8 @@ public class TinkerToolEvents {
boolean damaged = false;
for (EntityItem drop : event.drops) {
// we're only interested in tools
if (!(drop.getEntityItem().getItem() instanceof ToolCore)
|| !drop.getEntityItem().hasTagCompound()) continue;
if (!(drop.getEntityItem().getItem() instanceof ToolCore) || !drop.getEntityItem().hasTagCompound())
continue;
// damage tools by 10% of their total durability!
NBTTagCompound tags = drop.getEntityItem().getTagCompound().getCompoundTag("InfiTool");
File diff suppressed because it is too large. Load diff
@@ -2,10 +2,9 @@ package tconstruct.tools;
import static tconstruct.tools.TinkerTools.*;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import mantle.client.MProxyClient;
import mantle.lib.client.MantleClientRegistry;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.*;
@@ -15,6 +14,7 @@ import net.minecraft.world.World;
import net.minecraftforge.client.MinecraftForgeClient;
import net.minecraftforge.client.event.sound.SoundLoadEvent;
import net.minecraftforge.common.MinecraftForge;
import tconstruct.client.FlexibleToolRenderer;
import tconstruct.client.entity.projectile.*;
import tconstruct.client.pages.*;
@@ -30,8 +30,11 @@ import tconstruct.tools.gui.*;
import tconstruct.tools.logic.*;
import tconstruct.tools.model.*;
import tconstruct.weaponry.TinkerWeaponry;
import cpw.mods.fml.client.registry.RenderingRegistry;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
public class ToolProxyClient extends ToolProxyCommon {
@Override
public void initialize() {
MinecraftForge.EVENT_BUS.register(this);
@@ -49,8 +52,8 @@ public class ToolProxyClient extends ToolProxyCommon {
RenderingRegistry.registerBlockHandler(new FrypanRender());
RenderingRegistry.registerBlockHandler(new BattlesignRender());
RenderingRegistry.registerEntityRenderingHandler(
LaunchedPotion.class, new LaunchedItemRender(Items.potionitem, 16384));
RenderingRegistry
.registerEntityRenderingHandler(LaunchedPotion.class, new LaunchedItemRender(Items.potionitem, 16384));
RenderingRegistry.registerEntityRenderingHandler(DaggerEntity.class, new DaggerEntityRenderer());
// RenderingRegistry.registerEntityRenderingHandler(DaggerEntity.class, new DaggerRenderCustom());
// RenderingRegistry.registerEntityRenderingHandler(ArrowEntity.class, new ArrowRenderCustom());
@@ -334,13 +337,33 @@ public class ToolProxyClient extends ToolProxyCommon {
null);
MantleClientRegistry.registerManualSmallRecipe("blankpattern", pattern, plank, stick, stick, plank);
MantleClientRegistry.registerManualSmallRecipe(
"toolstation", new ItemStack(TinkerTools.toolStationWood, 1, 0), null, pattern, null, workbench);
"toolstation",
new ItemStack(TinkerTools.toolStationWood, 1, 0),
null,
pattern,
null,
workbench);
MantleClientRegistry.registerManualSmallRecipe(
"partcrafter", new ItemStack(TinkerTools.toolStationWood, 1, 1), null, pattern, null, log);
"partcrafter",
new ItemStack(TinkerTools.toolStationWood, 1, 1),
null,
pattern,
null,
log);
MantleClientRegistry.registerManualSmallRecipe(
"patternchest", new ItemStack(TinkerTools.toolStationWood, 1, 5), null, pattern, null, chest);
"patternchest",
new ItemStack(TinkerTools.toolStationWood, 1, 5),
null,
pattern,
null,
chest);
MantleClientRegistry.registerManualSmallRecipe(
"stenciltable", new ItemStack(TinkerTools.toolStationWood, 1, 10), null, pattern, null, plank);
"stenciltable",
new ItemStack(TinkerTools.toolStationWood, 1, 10),
null,
pattern,
null,
plank);
MantleClientRegistry.registerManualLargeRecipe(
"toolforge",
@@ -356,11 +379,26 @@ public class ToolProxyClient extends ToolProxyCommon {
ironblock); // TODO: Alternate recipe for Smeltery disabled
MantleClientRegistry.registerManualLargeRecipe(
"slimymud", slimyMud, null, slimeball, slimeball, null, slimeball, slimeball, null, dirt, sand);
MantleClientRegistry.registerManualFurnaceRecipe(
"slimecrystal", new ItemStack(TinkerTools.materials, 1, 1), slimyMud);
"slimymud",
slimyMud,
null,
slimeball,
slimeball,
null,
slimeball,
slimeball,
null,
dirt,
sand);
MantleClientRegistry
.registerManualFurnaceRecipe("slimecrystal", new ItemStack(TinkerTools.materials, 1, 1), slimyMud);
MantleClientRegistry.registerManualSmallRecipe(
"paperstack", new ItemStack(TinkerTools.materials, 1, 0), paper, paper, paper, paper);
"paperstack",
new ItemStack(TinkerTools.materials, 1, 0),
paper,
paper,
paper,
paper);
MantleClientRegistry.registerManualLargeRecipe(
"mossball",
new ItemStack(TinkerTools.materials, 1, 6),
@@ -427,46 +465,63 @@ public class ToolProxyClient extends ToolProxyCommon {
TConstructClientRegistry.registerManualModifier("diamondmod", ironpick.copy(), new ItemStack(Items.diamond));
TConstructClientRegistry.registerManualModifier("emeraldmod", ironpick.copy(), new ItemStack(Items.emerald));
TConstructClientRegistry.registerManualModifier(
"redstonemod", ironpick.copy(), new ItemStack(Items.redstone), new ItemStack(Blocks.redstone_block));
"redstonemod",
ironpick.copy(),
new ItemStack(Items.redstone),
new ItemStack(Blocks.redstone_block));
TConstructClientRegistry
.registerManualModifier("lavacrystalmod", ironpick.copy(), new ItemStack(TinkerTools.materials, 1, 7));
TConstructClientRegistry.registerManualModifier(
"lavacrystalmod", ironpick.copy(), new ItemStack(TinkerTools.materials, 1, 7));
"lapismod",
ironpick.copy(),
new ItemStack(Items.dye, 1, 4),
new ItemStack(Blocks.lapis_block));
TConstructClientRegistry
.registerManualModifier("mossmod", ironpick.copy(), new ItemStack(TinkerTools.materials, 1, 6));
TConstructClientRegistry.registerManualModifier(
"lapismod", ironpick.copy(), new ItemStack(Items.dye, 1, 4), new ItemStack(Blocks.lapis_block));
"quartzmod",
ironlongsword.copy(),
new ItemStack(Items.quartz),
new ItemStack(Blocks.quartz_block));
TConstructClientRegistry
.registerManualModifier("blazemod", ironlongsword.copy(), new ItemStack(Items.blaze_powder));
TConstructClientRegistry.registerManualModifier(
"mossmod", ironpick.copy(), new ItemStack(TinkerTools.materials, 1, 6));
TConstructClientRegistry.registerManualModifier(
"quartzmod", ironlongsword.copy(), new ItemStack(Items.quartz), new ItemStack(Blocks.quartz_block));
TConstructClientRegistry.registerManualModifier(
"blazemod", ironlongsword.copy(), new ItemStack(Items.blaze_powder));
TConstructClientRegistry.registerManualModifier(
"necroticmod", ironlongsword.copy(), new ItemStack(TinkerTools.materials, 1, 8));
TConstructClientRegistry.registerManualModifier(
"silkymod", ironpick.copy(), new ItemStack(TinkerTools.materials, 1, 26));
TConstructClientRegistry.registerManualModifier(
"reinforcedmod", ironpick.copy(), new ItemStack(TinkerTools.largePlate, 1, 6));
"necroticmod",
ironlongsword.copy(),
new ItemStack(TinkerTools.materials, 1, 8));
TConstructClientRegistry
.registerManualModifier("silkymod", ironpick.copy(), new ItemStack(TinkerTools.materials, 1, 26));
TConstructClientRegistry
.registerManualModifier("reinforcedmod", ironpick.copy(), new ItemStack(TinkerTools.largePlate, 1, 6));
TConstructClientRegistry
.registerManualModifier("pistonmod", ironlongsword.copy(), new ItemStack(Blocks.piston));
TConstructClientRegistry.registerManualModifier(
"pistonmod", ironlongsword.copy(), new ItemStack(Blocks.piston));
TConstructClientRegistry.registerManualModifier(
"beheadingmod", ironlongsword.copy(), new ItemStack(Items.ender_pearl), new ItemStack(Blocks.obsidian));
TConstructClientRegistry.registerManualModifier(
"spidermod", ironlongsword.copy(), new ItemStack(Items.fermented_spider_eye));
TConstructClientRegistry.registerManualModifier(
"smitemod", ironlongsword.copy(), new ItemStack(TinkerTools.craftedSoil, 1, 4));
"beheadingmod",
ironlongsword.copy(),
new ItemStack(Items.ender_pearl),
new ItemStack(Blocks.obsidian));
TConstructClientRegistry
.registerManualModifier("spidermod", ironlongsword.copy(), new ItemStack(Items.fermented_spider_eye));
TConstructClientRegistry
.registerManualModifier("smitemod", ironlongsword.copy(), new ItemStack(TinkerTools.craftedSoil, 1, 4));
TConstructClientRegistry.registerManualModifier("fluxmod", ironpick.copy(), new ItemStack(Blocks.dirt));
TConstructClientRegistry.registerManualModifier("fluxmod2", ironpick.copy(), new ItemStack(Blocks.dirt));
TConstructClientRegistry.registerManualModifier(
"tier1free", ironpick.copy(), new ItemStack(Items.diamond), new ItemStack(Blocks.gold_block));
"tier1free",
ironpick.copy(),
new ItemStack(Items.diamond),
new ItemStack(Blocks.gold_block));
TConstructClientRegistry.registerManualModifier(
"tier1.5free",
ironpick.copy(),
new ItemStack(Items.golden_apple, 1, 1),
new ItemStack(Blocks.diamond_block));
TConstructClientRegistry.registerManualModifier("tier2free", ironpick.copy(), new ItemStack(Items.nether_star));
TConstructClientRegistry.registerManualModifier(
"creativefree", ironpick.copy(), new ItemStack(TinkerTools.creativeModifier));
TConstructClientRegistry
.registerManualModifier("creativefree", ironpick.copy(), new ItemStack(TinkerTools.creativeModifier));
TConstructClientRegistry.registerManualSmeltery(
"brownstone",
@@ -511,28 +566,48 @@ public class ToolProxyClient extends ToolProxyCommon {
@Override
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
if (ID == ToolProxyCommon.toolStationID)
return new ToolStationGui(
player.inventory, (ToolStationLogic) world.getTileEntity(x, y, z), world, x, y, z);
if (ID == ToolProxyCommon.partBuilderID)
return new PartCrafterGui(
player.inventory, (PartBuilderLogic) world.getTileEntity(x, y, z), world, x, y, z);
if (ID == ToolProxyCommon.patternChestID)
return new PatternChestGui(
player.inventory, (PatternChestLogic) world.getTileEntity(x, y, z), world, x, y, z);
if (ID == ToolProxyCommon.toolStationID) return new ToolStationGui(
player.inventory,
(ToolStationLogic) world.getTileEntity(x, y, z),
world,
x,
y,
z);
if (ID == ToolProxyCommon.partBuilderID) return new PartCrafterGui(
player.inventory,
(PartBuilderLogic) world.getTileEntity(x, y, z),
world,
x,
y,
z);
if (ID == ToolProxyCommon.patternChestID) return new PatternChestGui(
player.inventory,
(PatternChestLogic) world.getTileEntity(x, y, z),
world,
x,
y,
z);
if (ID == ToolProxyCommon.frypanGuiID)
return new FrypanGui(player.inventory, (FrypanLogic) world.getTileEntity(x, y, z), world, x, y, z);
if (ID == ToolProxyCommon.battlesignTextID)
return new BattlesignGui((BattlesignLogic) world.getTileEntity(x, y, z));
if (ID == ToolProxyCommon.stencilTableID)
return new StencilTableGui(
player.inventory, (StencilTableLogic) world.getTileEntity(x, y, z), world, x, y, z);
if (ID == ToolProxyCommon.stencilTableID) return new StencilTableGui(
player.inventory,
(StencilTableLogic) world.getTileEntity(x, y, z),
world,
x,
y,
z);
if (ID == ToolProxyCommon.toolForgeID)
return new ToolForgeGui(player.inventory, (ToolForgeLogic) world.getTileEntity(x, y, z), world, x, y, z);
if (ID == ToolProxyCommon.craftingStationID)
return new CraftingStationGui(
player.inventory, (CraftingStationLogic) world.getTileEntity(x, y, z), world, x, y, z);
if (ID == ToolProxyCommon.craftingStationID) return new CraftingStationGui(
player.inventory,
(CraftingStationLogic) world.getTileEntity(x, y, z),
world,
x,
y,
z);
if (ID == ToolProxyCommon.furnaceID)
return new FurnaceGui(player.inventory, (FurnaceLogic) world.getTileEntity(x, y, z));
@@ -544,42 +619,39 @@ public class ToolProxyClient extends ToolProxyCommon {
public void onSound(SoundLoadEvent event) {
// try {
/*
* SoundManager soundmanager = event.manager;
* soundmanager.addSound("tinker:frypan_hit.ogg");
* soundmanager.addSound("tinker:little_saw.ogg");
* soundmanager.addSound("tinker:launcher_clank.ogg");
* SoundManager soundmanager = event.manager; soundmanager.addSound("tinker:frypan_hit.ogg");
* soundmanager.addSound("tinker:little_saw.ogg"); soundmanager.addSound("tinker:launcher_clank.ogg");
* TConstruct.logger.info("Successfully loaded sounds.");
*/
// } catch (Exception e) {
// TConstruct.logger.error("Failed to register one or more sounds");
// TConstruct.logger.error("Failed to register one or more sounds");
// }
MinecraftForge.EVENT_BUS.unregister(this);
}
void addStencilButtons() {
int[][] icons = {
{0, 3}, // tool rod
{1, 3}, // binding
{8, 3}, // large tool rod
{9, 3}, // large binding
{0, 2}, // pickaxe head
{3, 2}, // shovel head
{2, 2}, // hatchet head
{8, 2}, // scythe
{11, 2}, // hammer head
{10, 2}, // excavator head
{6, 2}, // lumberaxe head
{9, 2}, // large plate
{}, {4, 2}, // frying pan
{5, 2}, // battlesign
{7, 3}, // chisel
{}, {7, 2}, // knifeblade
{1, 2}, // swordblade
{6, 3}, // cleaver blade
{}, {4, 3}, // crossbar
{3, 3}, // small guard
{2, 3}, // wide guard
int[][] icons = { { 0, 3 }, // tool rod
{ 1, 3 }, // binding
{ 8, 3 }, // large tool rod
{ 9, 3 }, // large binding
{ 0, 2 }, // pickaxe head
{ 3, 2 }, // shovel head
{ 2, 2 }, // hatchet head
{ 8, 2 }, // scythe
{ 11, 2 }, // hammer head
{ 10, 2 }, // excavator head
{ 6, 2 }, // lumberaxe head
{ 9, 2 }, // large plate
{}, { 4, 2 }, // frying pan
{ 5, 2 }, // battlesign
{ 7, 3 }, // chisel
{}, { 7, 2 }, // knifeblade
{ 1, 2 }, // swordblade
{ 6, 3 }, // cleaver blade
{}, { 4, 3 }, // crossbar
{ 3, 3 }, // small guard
{ 2, 3 }, // wide guard
};
int i = 0;
@@ -595,84 +667,66 @@ public class ToolProxyClient extends ToolProxyCommon {
TConstructClientRegistry.addStencilButton(xButton, yButton, index, "tinker", "textures/gui/icons.png");
}
static int[][] itemIconsT1 = {
new int[] {1, 4, 0}, // Pickaxe
new int[] {2, 5, 0}, // Shovel
new int[] {2, 6, 0}, // Hatchet
new int[] {3, 8, 0}, // Mattock
new int[] {1, 0, 1}, // Broadsword
new int[] {1, 1, 1}, // Longsword
new int[] {1, 2, 1}, // Rapier
new int[] {1, 5, 1}, // Dagger
new int[] {2, 3, 1}, // Frying pan
new int[] {2, 4, 1}, // Battlesign
new int[] {2, 6, 1} // Chisel
static int[][] itemIconsT1 = { new int[] { 1, 4, 0 }, // Pickaxe
new int[] { 2, 5, 0 }, // Shovel
new int[] { 2, 6, 0 }, // Hatchet
new int[] { 3, 8, 0 }, // Mattock
new int[] { 1, 0, 1 }, // Broadsword
new int[] { 1, 1, 1 }, // Longsword
new int[] { 1, 2, 1 }, // Rapier
new int[] { 1, 5, 1 }, // Dagger
new int[] { 2, 3, 1 }, // Frying pan
new int[] { 2, 4, 1 }, // Battlesign
new int[] { 2, 6, 1 } // Chisel
};
static int[][] iconCoordsT1 = {
new int[] {0, 0, 1, 13}, new int[] {2, 3, 3, 13}, // Pickaxe
new int[] {3, 0, 13, 13}, new int[] {2, 3, 13, 13}, // Shovel
new int[] {2, 0, 13, 13}, new int[] {2, 3, 13, 13}, // Hatchet
new int[] {2, 0, 3, 13}, new int[] {2, 3, 2, 13}, // Mattock
new int[] {1, 0, 2, 13}, new int[] {2, 3, 3, 13}, // Broadsword
new int[] {1, 0, 3, 13}, new int[] {2, 3, 3, 13}, // Longsword
new int[] {1, 0, 4, 13}, new int[] {2, 3, 3, 13}, // Rapier
new int[] {7, 0, 4, 13}, new int[] {2, 3, 3, 13}, // Dagger
new int[] {4, 0, 13, 13}, new int[] {2, 3, 13, 13}, // Frying Pan
new int[] {5, 0, 13, 13}, new int[] {2, 3, 13, 13}, // Battlesign
new int[] {7, 0, 13, 13}, new int[] {3, 3, 13, 13} // Chisel
static int[][] iconCoordsT1 = { new int[] { 0, 0, 1, 13 }, new int[] { 2, 3, 3, 13 }, // Pickaxe
new int[] { 3, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Shovel
new int[] { 2, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Hatchet
new int[] { 2, 0, 3, 13 }, new int[] { 2, 3, 2, 13 }, // Mattock
new int[] { 1, 0, 2, 13 }, new int[] { 2, 3, 3, 13 }, // Broadsword
new int[] { 1, 0, 3, 13 }, new int[] { 2, 3, 3, 13 }, // Longsword
new int[] { 1, 0, 4, 13 }, new int[] { 2, 3, 3, 13 }, // Rapier
new int[] { 7, 0, 4, 13 }, new int[] { 2, 3, 3, 13 }, // Dagger
new int[] { 4, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Frying Pan
new int[] { 5, 0, 13, 13 }, new int[] { 2, 3, 13, 13 }, // Battlesign
new int[] { 7, 0, 13, 13 }, new int[] { 3, 3, 13, 13 } // Chisel
};
static int[][] itemIconsT2 = {
new int[] {
6, 13, 0,
}, // Hammer
new int[] {
5, 11, 0,
}, // Lumberaxe
new int[] {
5, 12, 0,
}, // Excavator
new int[] {
4, 10, 0,
}, // Scythe
new int[] {
5, 7, 1,
}, // Cleaver
new int[] {
5, 8, 1,
}, // Battleaxe
static int[][] itemIconsT2 = { new int[] { 6, 13, 0, }, // Hammer
new int[] { 5, 11, 0, }, // Lumberaxe
new int[] { 5, 12, 0, }, // Excavator
new int[] { 4, 10, 0, }, // Scythe
new int[] { 5, 7, 1, }, // Cleaver
new int[] { 5, 8, 1, }, // Battleaxe
};
static int[][] iconCoordsT2 = {
new int[] {11, 8, 9, 9}, new int[] {2, 3, 2, 2}, // Hammer
new int[] {6, 8, 9, 9}, new int[] {2, 3, 2, 3}, // Lumberaxe
new int[] {10, 8, 9, 9}, new int[] {2, 3, 2, 3}, // Excavator
new int[] {8, 8, 9, 8}, new int[] {2, 3, 3, 3}, // Scythe
new int[] {6, 8, 9, 8}, new int[] {3, 3, 2, 3}, // Cleaver
new int[] {6, 8, 6, 9}, new int[] {2, 3, 2, 3}, // Battleaxe
static int[][] iconCoordsT2 = { new int[] { 11, 8, 9, 9 }, new int[] { 2, 3, 2, 2 }, // Hammer
new int[] { 6, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, // Lumberaxe
new int[] { 10, 8, 9, 9 }, new int[] { 2, 3, 2, 3 }, // Excavator
new int[] { 8, 8, 9, 8 }, new int[] { 2, 3, 3, 3 }, // Scythe
new int[] { 6, 8, 9, 8 }, new int[] { 3, 3, 2, 3 }, // Cleaver
new int[] { 6, 8, 6, 9 }, new int[] { 2, 3, 2, 3 }, // Battleaxe
};
void addToolButtons() {
final ToolCore[] tier1Tools = {
pickaxe, shovel, hatchet, mattock, broadsword, longsword, rapier, dagger, frypan, battlesign, chisel
};
final ToolCore[] tier2Tools = {hammer, lumberaxe, excavator, scythe, cleaver, battleaxe};
final ToolCore[] tier1Tools = { pickaxe, shovel, hatchet, mattock, broadsword, longsword, rapier, dagger,
frypan, battlesign, chisel };
final ToolCore[] tier2Tools = { hammer, lumberaxe, excavator, scythe, cleaver, battleaxe };
// repair
addToolButton(
0,
3,
0,
new int[] {0, 1, 2, 13},
new int[] {13, 13, 13, 13},
new int[] { 0, 1, 2, 13 },
new int[] { 13, 13, 13, 13 },
StatCollector.translateToLocal("gui.toolforge1"),
"gui.toolforge2");
// tier 1 tools
for (int i = 0; i < tier1Tools.length; i++) {
String locString = String.format(
"gui.toolstation.%s.desc", tier1Tools[i].getToolName().toLowerCase());
String locString = String.format("gui.toolstation.%s.desc", tier1Tools[i].getToolName().toLowerCase());
addToolButton(
itemIconsT1[i][0],
itemIconsT1[i][1],
@@ -685,8 +739,7 @@ public class ToolProxyClient extends ToolProxyCommon {
// tier 2 tools
for (int i = 0; i < tier2Tools.length; i++) {
String locString = String.format(
"gui.toolstation.%s.desc", tier2Tools[i].getToolName().toLowerCase());
String locString = String.format("gui.toolstation.%s.desc", tier2Tools[i].getToolName().toLowerCase());
addTierTwoButton(
itemIconsT2[i][0],
itemIconsT2[i][1],
@@ -699,62 +752,44 @@ public class ToolProxyClient extends ToolProxyCommon {
}
void addToolButton(int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body) {
TConstructClientRegistry.addToolButton(new ToolGuiElement(
slotType, xButton, yButton, xIcons, yIcons, title, body, "tinker", "textures/gui/icons.png"));
TConstructClientRegistry.addToolButton(
new ToolGuiElement(
slotType,
xButton,
yButton,
xIcons,
yIcons,
title,
body,
"tinker",
"textures/gui/icons.png"));
}
void addTierTwoButton(
int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title, String body) {
TConstructClientRegistry.addTierTwoButton(new ToolGuiElement(
slotType, xButton, yButton, xIcons, yIcons, title, body, "tinker", "textures/gui/icons.png"));
void addTierTwoButton(int slotType, int xButton, int yButton, int[] xIcons, int[] yIcons, String title,
String body) {
TConstructClientRegistry.addTierTwoButton(
new ToolGuiElement(
slotType,
xButton,
yButton,
xIcons,
yIcons,
title,
body,
"tinker",
"textures/gui/icons.png"));
}
void addToolRenderMappings() {
String[] partTypes = {
"wood",
"stone",
"iron",
"flint",
"cactus",
"bone",
"obsidian",
"netherrack",
"slime",
"paper",
"cobalt",
"ardite",
"manyullyn",
"copper",
"bronze",
"alumite",
"steel",
"blueslime",
"pigiron"
};
String[] effectTypes = {
"diamond",
"emerald",
"redstone",
"piston",
"moss",
"ice",
"lava",
"blaze",
"necrotic",
"flux",
"lapis",
"quartz",
"silk",
"beheading",
"smite",
"spider",
"reinforced",
"flux"
};
int[] universalEffects = {0, 1, 4, 9, 16};
int[] weaponEffects = {3, 5, 7, 13, 14, 15};
int[] harvestEffects = {2};
int[] nonUtility = {6, 8, 10, 11, 12};
String[] partTypes = { "wood", "stone", "iron", "flint", "cactus", "bone", "obsidian", "netherrack", "slime",
"paper", "cobalt", "ardite", "manyullyn", "copper", "bronze", "alumite", "steel", "blueslime",
"pigiron" };
String[] effectTypes = { "diamond", "emerald", "redstone", "piston", "moss", "ice", "lava", "blaze", "necrotic",
"flux", "lapis", "quartz", "silk", "beheading", "smite", "spider", "reinforced", "flux" };
int[] universalEffects = { 0, 1, 4, 9, 16 };
int[] weaponEffects = { 3, 5, 7, 13, 14, 15 };
int[] harvestEffects = { 2 };
int[] nonUtility = { 6, 8, 10, 11, 12 };
for (int partIter = 0; partIter < partTypes.length; partIter++) {
TConstructClientRegistry.addMaterialRenderMapping(partIter, "tinker", partTypes[partIter], true);
@@ -1,13 +1,16 @@
package tconstruct.tools;
import cpw.mods.fml.common.network.IGuiHandler;
import mantle.blocks.abstracts.InventoryLogic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import tconstruct.common.TProxyCommon;
import cpw.mods.fml.common.network.IGuiHandler;
public class ToolProxyCommon implements IGuiHandler {
public static final int toolStationID = 0;
public static final int partBuilderID = 1;
public static final int patternChestID = 2;
@@ -1,7 +1,7 @@
package tconstruct.tools.blocks;
import cpw.mods.fml.relauncher.*;
import java.util.List;
import net.minecraft.block.material.Material;
import net.minecraft.entity.*;
import net.minecraft.entity.player.EntityPlayer;
@@ -9,8 +9,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.world.*;
import tconstruct.tools.logic.BattlesignLogic;
import tconstruct.tools.model.BattlesignRender;
import cpw.mods.fml.relauncher.*;
public class BattlesignBlock extends EquipBlock {
@@ -27,23 +29,14 @@ public class BattlesignBlock extends EquipBlock {
@SideOnly(Side.CLIENT)
@Override
public boolean shouldSideBeRendered(
IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_, int p_149646_5_) {
return p_149646_5_ == 0 && this.minY > 0.0D
|| (p_149646_5_ == 1 && this.maxY < 1.0D
|| (p_149646_5_ == 2 && this.minZ > 0.0D
|| (p_149646_5_ == 3 && this.maxZ < 1.0D
|| (p_149646_5_ == 4 && this.minX > 0.0D
|| (p_149646_5_ == 5 && this.maxX < 1.0D
|| !(p_149646_1_
.getBlock(p_149646_2_, p_149646_3_, p_149646_4_)
.isOpaqueCube()
&& p_149646_1_
.getBlock(
p_149646_2_,
p_149646_3_ + 1,
p_149646_4_)
.isOpaqueCube()))))));
public boolean shouldSideBeRendered(IBlockAccess p_149646_1_, int p_149646_2_, int p_149646_3_, int p_149646_4_,
int p_149646_5_) {
return p_149646_5_ == 0 && this.minY > 0.0D || (p_149646_5_ == 1 && this.maxY < 1.0D || (p_149646_5_ == 2
&& this.minZ > 0.0D
|| (p_149646_5_ == 3 && this.maxZ < 1.0D || (p_149646_5_ == 4 && this.minX > 0.0D || (p_149646_5_ == 5
&& this.maxX < 1.0D
|| !(p_149646_1_.getBlock(p_149646_2_, p_149646_3_, p_149646_4_).isOpaqueCube()
&& p_149646_1_.getBlock(p_149646_2_, p_149646_3_ + 1, p_149646_4_).isOpaqueCube()))))));
}
@Override
@@ -52,12 +45,7 @@ public class BattlesignBlock extends EquipBlock {
}
@Override
public void onBlockPlacedBy(
World par1World,
int par2,
int par3,
int par4,
EntityLivingBase par5EntityLivingBase,
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase,
ItemStack par6ItemStack) {
super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack);
int i3 = MathHelper.floor_double((par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
@@ -100,8 +88,8 @@ public class BattlesignBlock extends EquipBlock {
}
@Override
public void addCollisionBoxesToList(
World world, int x, int y, int z, AxisAlignedBB aabb, List list, Entity entity) {
public void addCollisionBoxesToList(World world, int x, int y, int z, AxisAlignedBB aabb, List list,
Entity entity) {
setBlockBoundsBasedOnState(world, x, y, z);
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
@@ -1,8 +1,9 @@
package tconstruct.tools.blocks;
import cpw.mods.fml.relauncher.*;
import java.util.List;
import mantle.blocks.abstracts.InventorySlab;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
@@ -14,13 +15,16 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.world.World;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.tools.*;
import tconstruct.tools.logic.*;
import tconstruct.util.config.PHConstruct;
import cpw.mods.fml.relauncher.*;
public class CraftingSlab extends InventorySlab {
public CraftingSlab(Material material) {
super(material);
this.setCreativeTab(TConstructRegistry.blockTab);
@@ -31,26 +35,11 @@ public class CraftingSlab extends InventorySlab {
/* Rendering */
@Override
public String[] getTextureNames() {
return new String[] {
"craftingstation_top",
"craftingstation_slab_side",
"craftingstation_bottom",
"toolstation_top",
"toolstation_slab_side",
"toolstation_bottom",
"partbuilder_oak_top",
"partbuilder_slab_side",
"partbuilder_oak_bottom",
"stenciltable_oak_top",
"stenciltable_slab_side",
"stenciltable_oak_bottom",
"patternchest_top",
"patternchest_slab_side",
"patternchest_bottom",
"toolforge_top",
"toolforge_slab_side",
"toolforge_top"
};
return new String[] { "craftingstation_top", "craftingstation_slab_side", "craftingstation_bottom",
"toolstation_top", "toolstation_slab_side", "toolstation_bottom", "partbuilder_oak_top",
"partbuilder_slab_side", "partbuilder_oak_bottom", "stenciltable_oak_top", "stenciltable_slab_side",
"stenciltable_oak_bottom", "patternchest_top", "patternchest_slab_side", "patternchest_bottom",
"toolforge_top", "toolforge_slab_side", "toolforge_top" };
}
@Override
@@ -74,14 +63,13 @@ public class CraftingSlab extends InventorySlab {
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 5)
return AxisAlignedBB.getBoundingBox(
(double) x + this.minX,
(double) y + this.minY,
(double) z + this.minZ,
(double) x + this.maxX,
(double) y + this.maxY - 0.125,
(double) z + this.maxZ);
if (metadata == 5) return AxisAlignedBB.getBoundingBox(
(double) x + this.minX,
(double) y + this.minY,
(double) z + this.minZ,
(double) x + this.maxX,
(double) y + this.maxY - 0.125,
(double) z + this.maxZ);
return AxisAlignedBB.getBoundingBox(
(double) x + this.minX,
(double) y + this.minY,
@@ -218,8 +206,12 @@ public class CraftingSlab extends InventorySlab {
double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
EntityItem entityitem =
new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, chest);
EntityItem entityitem = new EntityItem(
world,
(double) x + d0,
(double) y + d1,
(double) z + d2,
chest);
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
@@ -1,8 +1,9 @@
package tconstruct.tools.blocks;
import cpw.mods.fml.relauncher.*;
import java.util.List;
import mantle.blocks.abstracts.InventoryBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
@@ -11,13 +12,16 @@ import net.minecraft.item.*;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.*;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.tools.ToolProxyCommon;
import tconstruct.tools.logic.CraftingStationLogic;
import tconstruct.tools.model.TableRender;
import cpw.mods.fml.relauncher.*;
public class CraftingStationBlock extends InventoryBlock {
public CraftingStationBlock(Material material) {
super(material);
this.setCreativeTab(TConstructRegistry.blockTab);
@@ -30,7 +34,7 @@ public class CraftingStationBlock extends InventoryBlock {
/* Rendering */
@Override
public String[] getTextureNames() {
return new String[] {"craftingstation_top", "craftingstation_side", "craftingstation_bottom"};
return new String[] { "craftingstation_top", "craftingstation_side", "craftingstation_bottom" };
}
@Override
@@ -1,8 +1,9 @@
package tconstruct.tools.blocks;
import cpw.mods.fml.relauncher.*;
import java.util.Random;
import mantle.blocks.abstracts.InventoryBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -15,11 +16,13 @@ import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.world.*;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.tools.ToolProxyCommon;
import tconstruct.tools.logic.*;
import tconstruct.tools.model.FrypanRender;
import cpw.mods.fml.relauncher.*;
public class EquipBlock extends InventoryBlock {
@@ -32,7 +35,7 @@ public class EquipBlock extends InventoryBlock {
@Override
public String[] getTextureNames() {
return new String[] {"toolstation_top"};
return new String[] { "toolstation_top" };
}
@Override
@@ -91,12 +94,7 @@ public class EquipBlock extends InventoryBlock {
}
@Override
public void onBlockPlacedBy(
World par1World,
int par2,
int par3,
int par4,
EntityLivingBase par5EntityLivingBase,
public void onBlockPlacedBy(World par1World, int par2, int par3, int par4, EntityLivingBase par5EntityLivingBase,
ItemStack par6ItemStack) {
super.onBlockPlacedBy(par1World, par2, par3, par4, par5EntityLivingBase, par6ItemStack);
int i3 = MathHelper.floor_double((par5EntityLivingBase.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
@@ -150,8 +148,7 @@ public class EquipBlock extends InventoryBlock {
new ItemStack(stack.getItem(), itemSize, stack.getItemDamage()));
if (stack.hasTagCompound()) {
entityitem.getEntityItem().setTagCompound((NBTTagCompound)
stack.getTagCompound().copy());
entityitem.getEntityItem().setTagCompound((NBTTagCompound) stack.getTagCompound().copy());
}
float offset = 0.05F;
@@ -190,9 +187,7 @@ public class EquipBlock extends InventoryBlock {
if (te instanceof EquipLogic) {
EquipLogic logic = (EquipLogic) te;
ItemStack stack = logic.getEquipmentItem();
if (stack != null
&& stack.hasTagCompound()
&& stack.getTagCompound().hasKey("InfiTool")) {
if (stack != null && stack.hasTagCompound() && stack.getTagCompound().hasKey("InfiTool")) {
NBTTagCompound tag = stack.getTagCompound().getCompoundTag("InfiTool");
if (tag != null) {
@@ -1,19 +1,22 @@
package tconstruct.tools.blocks;
import cpw.mods.fml.relauncher.*;
import java.util.Random;
import mantle.blocks.abstracts.InventorySlab;
import mantle.blocks.iface.*;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.*;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.tools.ToolProxyCommon;
import tconstruct.tools.logic.FurnaceLogic;
import cpw.mods.fml.relauncher.*;
public class FurnaceSlab extends InventorySlab {
@@ -43,7 +46,7 @@ public class FurnaceSlab extends InventorySlab {
@Override
public String[] getTextureNames() {
return new String[] {"furnaceslab_front", "furnaceslab_front_active", "furnaceslab_side", "furnace_top"};
return new String[] { "furnaceslab_front", "furnaceslab_front_active", "furnaceslab_side", "furnace_top" };
}
@Override
@@ -1,31 +1,20 @@
package tconstruct.tools.blocks;
import cpw.mods.fml.relauncher.*;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.*;
import net.minecraft.world.*;
import tconstruct.blocks.TConstructBlock;
import cpw.mods.fml.relauncher.*;
public class MultiBrick extends TConstructBlock {
static String[] blockTextures = {
"brick_obsidian",
"brick_sandstone",
"brick_netherrack",
"brick_stone_refined",
"brick_iron",
"brick_gold",
"brick_lapis",
"brick_diamond",
"brick_redstone",
"brick_bone",
"brick_slime",
"brick_blueslime",
"brick_endstone",
"brick_obsidian_ingot"
};
static String[] blockTextures = { "brick_obsidian", "brick_sandstone", "brick_netherrack", "brick_stone_refined",
"brick_iron", "brick_gold", "brick_lapis", "brick_diamond", "brick_redstone", "brick_bone", "brick_slime",
"brick_blueslime", "brick_endstone", "brick_obsidian_ingot" };
public MultiBrick() {
super(Material.rock, 3f, blockTextures);
@@ -67,46 +56,46 @@ public class MultiBrick extends TConstructBlock {
}
@Override
public float getExplosionResistance(
Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) {
public float getExplosionResistance(Entity entity, World world, int x, int y, int z, double explosionX,
double explosionY, double explosionZ) {
int meta = world.getBlockMetadata(x, y, z);
switch (meta) {
case 0:
case 13:
return Blocks.obsidian.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.obsidian
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 1:
return Blocks.sandstone.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.sandstone
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 2:
return Blocks.netherrack.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.netherrack
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 3:
return Blocks.stone.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.stone
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 4:
return Blocks.iron_block.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.iron_block
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 5:
return Blocks.gold_block.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.gold_block
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 6:
return Blocks.lapis_block.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.lapis_block
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 7:
return Blocks.diamond_block.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.diamond_block
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 8:
return Blocks.redstone_block.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.redstone_block
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 9:
return 1.0F;
case 10:
case 11:
return 1.5F;
case 12:
return Blocks.end_stone.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.end_stone
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
default:
return getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
}
@@ -1,33 +1,21 @@
package tconstruct.tools.blocks;
import cpw.mods.fml.relauncher.*;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.*;
import net.minecraft.world.*;
import tconstruct.blocks.TConstructBlock;
import cpw.mods.fml.relauncher.*;
public class MultiBrickFancy extends TConstructBlock {
static String[] blockTextures = {
"fancybrick_obsidian",
"fancybrick_sandstone",
"fancybrick_netherrack",
"fancybrick_stone_refined",
"fancybrick_iron",
"fancybrick_gold",
"fancybrick_lapis",
"fancybrick_diamond",
"fancybrick_redstone",
"fancybrick_bone",
"fancybrick_slime",
"fancybrick_blueslime",
"fancybrick_endstone",
"fancybrick_obsidian_ingot",
"fancybrick_stone",
"road_stone"
};
static String[] blockTextures = { "fancybrick_obsidian", "fancybrick_sandstone", "fancybrick_netherrack",
"fancybrick_stone_refined", "fancybrick_iron", "fancybrick_gold", "fancybrick_lapis", "fancybrick_diamond",
"fancybrick_redstone", "fancybrick_bone", "fancybrick_slime", "fancybrick_blueslime", "fancybrick_endstone",
"fancybrick_obsidian_ingot", "fancybrick_stone", "road_stone" };
public MultiBrickFancy() {
super(Material.rock, 3f, blockTextures);
@@ -72,48 +60,48 @@ public class MultiBrickFancy extends TConstructBlock {
}
@Override
public float getExplosionResistance(
Entity entity, World world, int x, int y, int z, double explosionX, double explosionY, double explosionZ) {
public float getExplosionResistance(Entity entity, World world, int x, int y, int z, double explosionX,
double explosionY, double explosionZ) {
int meta = world.getBlockMetadata(x, y, z);
switch (meta) {
case 0:
case 13:
return Blocks.obsidian.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.obsidian
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 1:
return Blocks.sandstone.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.sandstone
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 2:
return Blocks.netherrack.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.netherrack
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 4:
return Blocks.iron_block.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.iron_block
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 5:
return Blocks.gold_block.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.gold_block
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 6:
return Blocks.lapis_block.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.lapis_block
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 7:
return Blocks.diamond_block.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.diamond_block
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 8:
return Blocks.redstone_block.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.redstone_block
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 9:
return 1.0F;
case 10:
case 11:
return 1.5F;
case 12:
return Blocks.end_stone.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.end_stone
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
case 3:
case 14:
case 15:
return Blocks.stone.getExplosionResistance(
entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
return Blocks.stone
.getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
default:
return getExplosionResistance(entity, world, meta, meta, meta, explosionZ, explosionZ, explosionZ);
}
@@ -1,24 +1,18 @@
package tconstruct.tools.blocks;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.util.IIcon;
import tconstruct.blocks.TConstructBlock;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class MultiBrickMetal extends TConstructBlock {
static String[] blockTextures = {
"brick_alumite",
"brick_ardite",
"brick_cobalt",
"brick_manyullyn",
"fancybrick_alumite",
"fancybrick_ardite",
"fancybrick_cobalt",
"fancybrick_manyullyn"
};
static String[] blockTextures = { "brick_alumite", "brick_ardite", "brick_cobalt", "brick_manyullyn",
"fancybrick_alumite", "fancybrick_ardite", "fancybrick_cobalt", "fancybrick_manyullyn" };
public MultiBrickMetal() {
super(Material.iron, 10f, blockTextures);
@@ -1,8 +1,9 @@
package tconstruct.tools.blocks;
import cpw.mods.fml.relauncher.*;
import java.util.List;
import mantle.blocks.abstracts.InventoryBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.client.renderer.texture.IIconRegister;
@@ -14,12 +15,14 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon;
import net.minecraft.world.*;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.tools.ToolProxyCommon;
import tconstruct.tools.logic.ToolForgeLogic;
import tconstruct.tools.model.TableRender;
import tconstruct.world.TinkerWorld;
import cpw.mods.fml.relauncher.*;
public class ToolForgeBlock extends InventoryBlock {
@@ -30,22 +33,9 @@ public class ToolForgeBlock extends InventoryBlock {
this.setStepSound(Block.soundTypeMetal);
}
String[] textureNames = {
"toolforge_iron",
"toolforge_gold",
"toolforge_diamond",
"toolforge_emerald",
"toolforge_cobalt",
"toolforge_ardite",
"toolforge_manyullyn",
"toolforge_copper",
"toolforge_bronze",
"toolforge_tin",
"toolforge_aluminum",
"toolforge_alubrass",
"toolforge_alumite",
"toolforge_steel"
};
String[] textureNames = { "toolforge_iron", "toolforge_gold", "toolforge_diamond", "toolforge_emerald",
"toolforge_cobalt", "toolforge_ardite", "toolforge_manyullyn", "toolforge_copper", "toolforge_bronze",
"toolforge_tin", "toolforge_aluminum", "toolforge_alubrass", "toolforge_alumite", "toolforge_steel" };
/* Rendering */
@Override
@@ -1,8 +1,9 @@
package tconstruct.tools.blocks;
import cpw.mods.fml.relauncher.*;
import java.util.List;
import mantle.blocks.abstracts.InventoryBlock;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.creativetab.CreativeTabs;
@@ -15,14 +16,17 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.*;
import net.minecraft.world.*;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.tools.TinkerTools;
import tconstruct.tools.logic.*;
import tconstruct.tools.model.TableRender;
import tconstruct.util.config.PHConstruct;
import cpw.mods.fml.relauncher.*;
public class ToolStationBlock extends InventoryBlock {
public ToolStationBlock(Material material) {
super(material);
this.setCreativeTab(TConstructRegistry.blockTab);
@@ -35,38 +39,15 @@ public class ToolStationBlock extends InventoryBlock {
/* Rendering */
@Override
public String[] getTextureNames() {
return new String[] {
"toolstation_top",
"toolstation_side",
"toolstation_bottom",
"partbuilder_oak_top",
"partbuilder_oak_side",
"partbuilder_oak_bottom",
"partbuilder_spruce_top",
"partbuilder_spruce_side",
"partbuilder_spruce_bottom",
"partbuilder_birch_top",
"partbuilder_birch_side",
"partbuilder_birch_bottom",
"partbuilder_jungle_top",
"partbuilder_jungle_side",
"partbuilder_jungle_bottom",
"patternchest_top",
"patternchest_side",
"patternchest_bottom",
"stenciltable_oak_top",
"stenciltable_oak_side",
"stenciltable_oak_bottom",
"stenciltable_spruce_top",
"stenciltable_spruce_side",
"stenciltable_spruce_bottom",
"stenciltable_birch_top",
"stenciltable_birch_side",
"stenciltable_birch_bottom",
"stenciltable_jungle_top",
"stenciltable_jungle_side",
"stenciltable_jungle_bottom"
};
return new String[] { "toolstation_top", "toolstation_side", "toolstation_bottom", "partbuilder_oak_top",
"partbuilder_oak_side", "partbuilder_oak_bottom", "partbuilder_spruce_top", "partbuilder_spruce_side",
"partbuilder_spruce_bottom", "partbuilder_birch_top", "partbuilder_birch_side",
"partbuilder_birch_bottom", "partbuilder_jungle_top", "partbuilder_jungle_side",
"partbuilder_jungle_bottom", "patternchest_top", "patternchest_side", "patternchest_bottom",
"stenciltable_oak_top", "stenciltable_oak_side", "stenciltable_oak_bottom", "stenciltable_spruce_top",
"stenciltable_spruce_side", "stenciltable_spruce_bottom", "stenciltable_birch_top",
"stenciltable_birch_side", "stenciltable_birch_bottom", "stenciltable_jungle_top",
"stenciltable_jungle_side", "stenciltable_jungle_bottom" };
}
@Override
@@ -116,14 +97,13 @@ public class ToolStationBlock extends InventoryBlock {
@Override
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
int metadata = world.getBlockMetadata(x, y, z);
if (metadata == 5)
return AxisAlignedBB.getBoundingBox(
(double) x + this.minX,
(double) y + this.minY,
(double) z + this.minZ,
(double) x + this.maxX,
(double) y + this.maxY - 0.125,
(double) z + this.maxZ);
if (metadata == 5) return AxisAlignedBB.getBoundingBox(
(double) x + this.minX,
(double) y + this.minY,
(double) z + this.minZ,
(double) x + this.maxX,
(double) y + this.maxY - 0.125,
(double) z + this.maxZ);
return AxisAlignedBB.getBoundingBox(
(double) x + this.minX,
(double) y + this.minY,
@@ -154,8 +134,9 @@ public class ToolStationBlock extends InventoryBlock {
case 12:
case 11:
return new StencilTableLogic();
/*case 14:
return new CastingTableLogic();*/
/*
* case 14: return new CastingTableLogic();
*/
default:
return null;
}
@@ -188,24 +169,14 @@ public class ToolStationBlock extends InventoryBlock {
}
}
/*@Override
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase par5EntityLiving, ItemStack par6ItemStack)
{
if (PHConstruct.freePatterns)
{
int meta = world.getBlockMetadata(x, y, z);
if (meta == 5)
{
PatternChestLogic logic = (PatternChestLogic) world.getTileEntity(x, y, z);
for (int i = 1; i <= 13; i++)
{
logic.setInventorySlotContents(i - 1, new ItemStack(TinkerTools.woodPattern, 1, i));
}
logic.setInventorySlotContents(13, new ItemStack(TinkerTools.woodPattern, 1, 22));
}
}
super.onBlockPlacedBy(world, x, y, z, par5EntityLiving, par6ItemStack);
}*/
/*
* @Override public void onBlockPlacedBy (World world, int x, int y, int z, EntityLivingBase par5EntityLiving,
* ItemStack par6ItemStack) { if (PHConstruct.freePatterns) { int meta = world.getBlockMetadata(x, y, z); if (meta
* == 5) { PatternChestLogic logic = (PatternChestLogic) world.getTileEntity(x, y, z); for (int i = 1; i <= 13; i++)
* { logic.setInventorySlotContents(i - 1, new ItemStack(TinkerTools.woodPattern, 1, i)); }
* logic.setInventorySlotContents(13, new ItemStack(TinkerTools.woodPattern, 1, 22)); } }
* super.onBlockPlacedBy(world, x, y, z, par5EntityLiving, par6ItemStack); }
*/
@Override
public String getTextureDomain(int textureNameIndex) {
@@ -238,8 +209,12 @@ public class ToolStationBlock extends InventoryBlock {
double d0 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double d1 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
double d2 = (double) (world.rand.nextFloat() * f) + (double) (1.0F - f) * 0.5D;
EntityItem entityitem =
new EntityItem(world, (double) x + d0, (double) y + d1, (double) z + d2, chest);
EntityItem entityitem = new EntityItem(
world,
(double) x + d0,
(double) y + d1,
(double) z + d2,
chest);
entityitem.delayBeforeCanPickup = 10;
world.spawnEntityInWorld(entityitem);
}
@@ -1,10 +1,12 @@
package tconstruct.tools.client;
import org.lwjgl.opengl.GL11;
import tconstruct.tools.entity.DaggerEntity;
import tconstruct.weaponry.client.entity.ProjectileBaseRenderer;
public class DaggerEntityRenderer extends ProjectileBaseRenderer<DaggerEntity> {
@Override
public void customRendering(DaggerEntity entity, double x, double y, double z, float p_76986_8_, float p_76986_9_) {
@@ -1,9 +1,7 @@
package tconstruct.tools.entity;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import io.netty.buffer.ByteBuf;
import java.util.*;
import net.minecraft.block.Block;
import net.minecraft.crash.*;
import net.minecraft.entity.*;
@@ -17,8 +15,13 @@ import net.minecraft.network.play.server.S2BPacketChangeGameState;
import net.minecraft.util.*;
import net.minecraft.world.World;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import io.netty.buffer.ByteBuf;
@Deprecated
public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnData {
public ItemStack returnStack;
public float mass;
public int baseDamage;
@@ -48,8 +51,8 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
@Override
public void onCollideWithPlayer(EntityPlayer par1EntityPlayer) {
if (!this.worldObj.isRemote && this.inGround && this.arrowShake <= 0) {
boolean flag =
this.canBePickedUp == 1 || this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode;
boolean flag = this.canBePickedUp == 1
|| this.canBePickedUp == 2 && par1EntityPlayer.capabilities.isCreativeMode;
if (this.canBePickedUp == 1 && !par1EntityPlayer.inventory.addItemStackToInventory(returnStack)) {
flag = false;
@@ -57,7 +60,9 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
if (flag) {
this.playSound(
"random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
"random.pop",
0.2F,
((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
par1EntityPlayer.onItemPickup(this, 1);
if (returnStack.stackSize <= 0 || this.canBePickedUp == 2) this.setDead();
}
@@ -73,8 +78,8 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
if (this.prevRotationPitch == 0.0F && this.prevRotationYaw == 0.0F) {
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.prevRotationYaw = this.rotationYaw = (float) (Math.atan2(this.motionX, this.motionZ) * 180.0D
/ Math.PI);
this.prevRotationPitch = this.rotationPitch = (float) (Math.atan2(this.motionY, f) * 180.0D / Math.PI);
}
@@ -82,7 +87,10 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
i.setBlockBoundsBasedOnState(this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
AxisAlignedBB axisalignedbb = i.getCollisionBoundingBoxFromPool(
this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f);
this.worldObj,
this.field_145791_d,
this.field_145792_e,
this.field_145789_f);
if (axisalignedbb != null
&& axisalignedbb.isVecInside(Vec3.createVectorHelper(this.posX, this.posY, this.posZ))) {
@@ -116,12 +124,12 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
} else {
++this.ticksInAir;
Vec3 vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
Vec3 vec31 = Vec3.createVectorHelper(
this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
Vec3 vec31 = Vec3
.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
MovingObjectPosition movingobjectposition = this.worldObj.func_147447_a(vec3, vec31, false, true, false);
vec3 = Vec3.createVectorHelper(this.posX, this.posY, this.posZ);
vec31 = Vec3.createVectorHelper(
this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
vec31 = Vec3
.createVectorHelper(this.posX + this.motionX, this.posY + this.motionY, this.posZ + this.motionZ);
if (movingobjectposition != null) {
vec31 = Vec3.createVectorHelper(
@@ -133,9 +141,7 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
Entity entity = null;
List<Entity> list = this.worldObj.getEntitiesWithinAABBExcludingEntity(
this,
this.boundingBox
.addCoord(this.motionX, this.motionY, this.motionZ)
.expand(1.0D, 1.0D, 1.0D));
this.boundingBox.addCoord(this.motionX, this.motionY, this.motionZ).expand(1.0D, 1.0D, 1.0D));
double d0 = 0.0D;
int l;
float ySpeed;
@@ -166,9 +172,8 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
if (movingobjectposition != null && movingobjectposition.entityHit instanceof EntityPlayer) {
EntityPlayer entityplayer = (EntityPlayer) movingobjectposition.entityHit;
if (entityplayer.capabilities.disableDamage
|| this.shootingEntity instanceof EntityPlayer
&& !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) {
if (entityplayer.capabilities.disableDamage || this.shootingEntity instanceof EntityPlayer
&& !((EntityPlayer) this.shootingEntity).canAttackPlayer(entityplayer)) {
movingobjectposition = null;
}
}
@@ -234,8 +239,7 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
if (f3 > 0.0F) {
float knockback = knockbackStrength + knockbackStrengthMod;
movingobjectposition.entityHit.addVelocity(
this.motionX
* (double) this.knockbackStrength
this.motionX * (double) this.knockbackStrength
* 0.6000000238418579D
/ (double) f3,
0.1D,
@@ -249,12 +253,11 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
damagesource = DamageSource.causeArrowDamage(this, this.shootingEntity);
}
if (this.shootingEntity != null
&& movingobjectposition.entityHit != this.shootingEntity
if (this.shootingEntity != null && movingobjectposition.entityHit != this.shootingEntity
&& movingobjectposition.entityHit instanceof EntityPlayer
&& this.shootingEntity instanceof EntityPlayerMP) {
((EntityPlayerMP) this.shootingEntity)
.playerNetServerHandler.sendPacket(new S2BPacketChangeGameState(6, 0));
((EntityPlayerMP) this.shootingEntity).playerNetServerHandler
.sendPacket(new S2BPacketChangeGameState(6, 0));
// TConstruct.packetPipeline.sendTo(new
// S2BPacketChangeGameState(6, 0),
// (EntityPlayerMP) this.shootingEntity);
@@ -287,10 +290,10 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
this.field_145791_d = movingobjectposition.blockX;
this.field_145792_e = movingobjectposition.blockY;
this.field_145789_f = movingobjectposition.blockZ;
this.field_145790_g =
this.worldObj.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
this.inData = this.worldObj.getBlockMetadata(
this.field_145791_d, this.field_145792_e, this.field_145789_f);
this.field_145790_g = this.worldObj
.getBlock(this.field_145791_d, this.field_145792_e, this.field_145789_f);
this.inData = this.worldObj
.getBlockMetadata(this.field_145791_d, this.field_145792_e, this.field_145789_f);
this.motionX = (float) (movingobjectposition.hitVec.xCoord - this.posX);
this.motionY = (float) (movingobjectposition.hitVec.yCoord - this.posY);
this.motionZ = (float) (movingobjectposition.hitVec.zCoord - this.posZ);
@@ -306,7 +309,11 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
if (this.field_145790_g != Blocks.air) {
this.field_145790_g.onEntityCollidedWithBlock(
this.worldObj, this.field_145791_d, this.field_145792_e, this.field_145789_f, this);
this.worldObj,
this.field_145791_d,
this.field_145792_e,
this.field_145789_f,
this);
}
}
}
@@ -470,8 +477,7 @@ public class ArrowEntity extends EntityArrow implements IEntityAdditionalSpawnDa
private int storeItemStack(ItemStack par1ItemStack, EntityLivingBase living) {
for (int slotID = 0; slotID < 5; ++slotID) {
ItemStack stack = living.getEquipmentInSlot(slotID);
if (stack != null
&& stack.isItemEqual(par1ItemStack)
if (stack != null && stack.isItemEqual(par1ItemStack)
&& ItemStack.areItemStackTagsEqual(stack, par1ItemStack)
&& stack.isStackable()
&& stack.stackSize < stack.getMaxStackSize()) {
@@ -4,10 +4,12 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.*;
import net.minecraft.world.World;
import tconstruct.library.entity.ProjectileBase;
import tconstruct.library.tools.*;
public class DaggerEntity extends ProjectileBase {
public int roll;
public DaggerEntity(World world) {
@@ -24,7 +26,11 @@ public class DaggerEntity extends ProjectileBase {
float pitch = Math.max(-90f, player.rotationPitch - 20f);
// same as in the others, but with pitch upped
this.setLocationAndAngles(
player.posX, player.posY + (double) player.getEyeHeight(), player.posZ, player.rotationYaw, pitch);
player.posX,
player.posY + (double) player.getEyeHeight(),
player.posZ,
player.rotationYaw,
pitch);
this.posX -= MathHelper.cos(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
this.posY -= 0.10000000149011612D;
this.posZ -= MathHelper.sin(this.rotationYaw / 180.0F * (float) Math.PI) * 0.16F;
@@ -49,8 +55,10 @@ public class DaggerEntity extends ProjectileBase {
@Override
public void onHitEntity(MovingObjectPosition movingobjectposition) {
AbilityHelper.onLeftClickEntity(
returnStack, (EntityPlayer) shootingEntity, movingobjectposition.entityHit, (ToolCore)
returnStack.getItem());
returnStack,
(EntityPlayer) shootingEntity,
movingobjectposition.entityHit,
(ToolCore) returnStack.getItem());
// super.onHitEntity(movingobjectposition);
}
@@ -7,6 +7,7 @@ import net.minecraft.util.DamageSource;
import net.minecraft.world.World;
public class FancyEntityItem extends EntityItem {
public FancyEntityItem(World par1World, double par2, double par4, double par6) {
super(par1World, par2, par4, par6);
this.isImmuneToFire = true;
@@ -16,8 +17,7 @@ public class FancyEntityItem extends EntityItem {
public FancyEntityItem(World par1World, double par2, double par4, double par6, ItemStack par8ItemStack) {
this(par1World, par2, par4, par6);
this.setEntityItemStack(par8ItemStack);
this.lifespan = (par8ItemStack.getItem() == null
? 6000
this.lifespan = (par8ItemStack.getItem() == null ? 6000
: par8ItemStack.getItem().getEntityLifespan(par8ItemStack, par1World));
}
@@ -1,7 +1,7 @@
package tconstruct.tools.entity;
import cpw.mods.fml.relauncher.*;
import java.util.*;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.projectile.EntityThrowable;
import net.minecraft.init.Items;
@@ -11,7 +11,10 @@ import net.minecraft.potion.*;
import net.minecraft.util.*;
import net.minecraft.world.World;
import cpw.mods.fml.relauncher.*;
public class LaunchedPotion extends EntityThrowable {
/**
* The damage value of the thrown potion that this EntityPotion represents.
*/
@@ -67,8 +70,7 @@ public class LaunchedPotion extends EntityThrowable {
}
/**
* Returns the damage value of the thrown potion that this EntityPotion
* represents.
* Returns the damage value of the thrown potion that this EntityPotion represents.
*/
public int getPotionDamage() {
if (this.potionDamage == null) {
@@ -88,8 +90,8 @@ public class LaunchedPotion extends EntityThrowable {
if (list != null && !list.isEmpty()) {
AxisAlignedBB axisalignedbb = this.boundingBox.expand(4.0D, 2.0D, 4.0D);
List<EntityLivingBase> list1 =
this.worldObj.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
List<EntityLivingBase> list1 = this.worldObj
.getEntitiesWithinAABB(EntityLivingBase.class, axisalignedbb);
if (list1 != null && !list1.isEmpty()) {
@@ -108,13 +110,16 @@ public class LaunchedPotion extends EntityThrowable {
if (Potion.potionTypes[i].isInstant()) {
Potion.potionTypes[i].affectEntity(
this.getThrower(), entityliving, potioneffect.getAmplifier(), d1);
this.getThrower(),
entityliving,
potioneffect.getAmplifier(),
d1);
} else {
int j = (int) (d1 * (double) potioneffect.getDuration() + 0.5D);
if (j > 20) {
entityliving.addPotionEffect(
new PotionEffect(i, j, potioneffect.getAmplifier()));
entityliving
.addPotionEffect(new PotionEffect(i, j, potioneffect.getAmplifier()));
}
}
}
@@ -1,9 +1,7 @@
package tconstruct.tools.entity;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import io.netty.buffer.ByteBuf;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
@@ -12,7 +10,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import net.minecraft.world.World;
import tconstruct.library.tools.AbilityHelper;
import cpw.mods.fml.common.network.ByteBufUtils;
import cpw.mods.fml.common.registry.IEntityAdditionalSpawnData;
import io.netty.buffer.ByteBuf;
@Deprecated
public class RotatingBase extends Entity implements IEntityAdditionalSpawnData {
@@ -56,20 +58,17 @@ public class RotatingBase extends Entity implements IEntityAdditionalSpawnData {
posZ -= MathHelper.sin((rotationYaw / 180F) * 3.141593F) * 0.16F;
setPosition(posX, posY, posZ);
yOffset = 0.0F;
motionX =
-MathHelper.sin((rotationYaw / 180F) * 3.141593F) * MathHelper.cos((rotationPitch / 180F) * 3.141593F);
motionX = -MathHelper.sin((rotationYaw / 180F) * 3.141593F)
* MathHelper.cos((rotationPitch / 180F) * 3.141593F);
motionZ = MathHelper.cos((rotationYaw / 180F) * 3.141593F) * MathHelper.cos((rotationPitch / 180F) * 3.141593F);
motionY = -MathHelper.sin((rotationPitch / 180F) * 3.141593F - 0.2f);
setArrowHeading(motionX, motionY, motionZ, f, f1);
}
/*
* public void setOnGround(boolean flag) { onGround = flag;
* this.dataWatcher.updateObject(6, Byte.valueOf((byte) (flag == true ? 1 :
* 0))); }
*
* public boolean getOnGround() { return
* this.dataWatcher.getWatchableObjectByte(0) == 1 ? true : false; }
* public void setOnGround(boolean flag) { onGround = flag; this.dataWatcher.updateObject(6, Byte.valueOf((byte)
* (flag == true ? 1 : 0))); } public boolean getOnGround() { return this.dataWatcher.getWatchableObjectByte(0) == 1
* ? true : false; }
*/
@Override
@@ -89,11 +88,9 @@ public class RotatingBase extends Entity implements IEntityAdditionalSpawnData {
}
/*
* public void returnToPlayer() { damageDagger(0, true);
* if(returnStack.stackSize < 1) { return; } if(returnStackSlot > 0) {
* mod_Infi2x2.forceAddToInv((EntityPlayer)returnsTo, returnStack,
* returnStackSlot, true); } else {
* mod_Infi2x2.addToInv((EntityPlayer)returnsTo, returnStack, true); } }
* public void returnToPlayer() { damageDagger(0, true); if(returnStack.stackSize < 1) { return; }
* if(returnStackSlot > 0) { mod_Infi2x2.forceAddToInv((EntityPlayer)returnsTo, returnStack, returnStackSlot, true);
* } else { mod_Infi2x2.addToInv((EntityPlayer)returnsTo, returnStack, true); } }
*/
public void determineRotation() {
@@ -161,8 +158,8 @@ public class RotatingBase extends Entity implements IEntityAdditionalSpawnData {
* this.motionX = 0; this.motionY = 0; this.motionZ = 0;
*/
/*
* ticksInGround++; if (ticksInGround == 1200) { setDead(); } if
* (ticksInGround == maxGroundTicks) { setDead(); }
* ticksInGround++; if (ticksInGround == 1200) { setDead(); } if (ticksInGround == maxGroundTicks) {
* setDead(); }
*/
if (!hasHitGround) {
hasHitGround = true;
@@ -187,7 +184,8 @@ public class RotatingBase extends Entity implements IEntityAdditionalSpawnData {
}
Entity entity = null;
List<Entity> list = worldObj.getEntitiesWithinAABBExcludingEntity(
this, boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
this,
boundingBox.addCoord(motionX, motionY, motionZ).expand(1.0D, 1.0D, 1.0D));
double d = 0.0D;
for (Entity entity1 : list) {
if (!entity1.canBeCollidedWith() || entity1 == owner && ticksInAir < 5) {
@@ -265,22 +263,12 @@ public class RotatingBase extends Entity implements IEntityAdditionalSpawnData {
}
/*
* public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) {
* super.readEntityFromNBT(par1NBTTagCompound);
*
* if (par1NBTTagCompound.hasKey("Potion")) { this.potionDamage =
* ItemStack.loadItemStackFromNBT
* public void readEntityFromNBT(NBTTagCompound par1NBTTagCompound) { super.readEntityFromNBT(par1NBTTagCompound);
* if (par1NBTTagCompound.hasKey("Potion")) { this.potionDamage = ItemStack.loadItemStackFromNBT
* (par1NBTTagCompound.getCompoundTag("Potion")); } else {
* this.setPotionDamage(par1NBTTagCompound.getInteger("potionValue")); }
*
* if (this.potionDamage == null) { this.setDead(); } }
*
* public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {
* super.writeEntityToNBT(par1NBTTagCompound);
*
* if (this.potionDamage != null) {
*
* } }
* this.setPotionDamage(par1NBTTagCompound.getInteger("potionValue")); } if (this.potionDamage == null) {
* this.setDead(); } } public void writeEntityToNBT(NBTTagCompound par1NBTTagCompound) {
* super.writeEntityToNBT(par1NBTTagCompound); if (this.potionDamage != null) { } }
*/
@Override
@@ -325,7 +313,10 @@ public class RotatingBase extends Entity implements IEntityAdditionalSpawnData {
}
if (!doNotRetrieve) AbilityHelper.addToInv(entityplayer, returnStack, true);
worldObj.playSoundAtEntity(
this, "random.pop", 0.2F, ((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
this,
"random.pop",
0.2F,
((this.rand.nextFloat() - this.rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
entityplayer.onItemPickup(this, 1);
kill();
}
@@ -5,21 +5,24 @@ import net.minecraft.client.renderer.Tessellator;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.*;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import tconstruct.TConstruct;
import tconstruct.library.TConstructRegistry;
import tconstruct.tools.logic.BattlesignLogic;
import tconstruct.util.network.SignDataPacket;
public class BattlesignGui extends GuiScreen {
private final BattlesignLogic battlesign;
private float bgColR = 1F;
private float bgColG = 1F;
private float bgColB = 1F;
private static final ResourceLocation background = new ResourceLocation("tinker:textures/gui/battlesignText.png");
private final String[] text = {"", "", "", "", ""};
private final String[] text = { "", "", "", "", "" };
int currentLine = 0;
public BattlesignGui(BattlesignLogic logic) {
@@ -72,19 +75,14 @@ public class BattlesignGui extends GuiScreen {
float lum = calcLuminance(bgColR, bgColG, bgColB);
for (int i = 0; i < text.length; i++) {
final EnumChatFormatting chatFormatting = lum >= 35F
? EnumChatFormatting.BLACK
final EnumChatFormatting chatFormatting = lum >= 35F ? EnumChatFormatting.BLACK
: lum >= 31F ? EnumChatFormatting.GRAY : EnumChatFormatting.WHITE;
fontRendererObj.drawString(
chatFormatting
+ (i == currentLine ? "> " : "")
chatFormatting + (i == currentLine ? "> " : "")
+ text[i]
+ (i == currentLine ? " " + EnumChatFormatting.RESET + chatFormatting + "<" : ""),
k
- fontRendererObj.getStringWidth(
(i == currentLine ? "> " : "") + text[i] + (i == currentLine ? " <" : ""))
/ 2
+ 51,
k - fontRendererObj.getStringWidth(
(i == currentLine ? "> " : "") + text[i] + (i == currentLine ? " <" : "")) / 2 + 51,
l + 4 + 10 * i,
0);
}
@@ -97,8 +95,7 @@ public class BattlesignGui extends GuiScreen {
super.keyTyped(c, i);
if (fontRendererObj.getStringWidth(text[currentLine]) < 90 && ChatAllowedCharacters.isAllowedCharacter(c)) {
if (Keyboard.isKeyDown(56)
&& c == 'f'
if (Keyboard.isKeyDown(56) && c == 'f'
&& (text[currentLine].length() == 0
|| text[currentLine].charAt(text[currentLine].length() - 1) != '\u00A7')) {
text[currentLine] += "\u00A7";
@@ -146,12 +143,13 @@ public class BattlesignGui extends GuiScreen {
Keyboard.enableRepeatEvents(false);
TConstruct.packetPipeline.sendToServer(new SignDataPacket(
battlesign.getWorldObj().provider.dimensionId,
battlesign.xCoord,
battlesign.yCoord,
battlesign.zCoord,
text));
TConstruct.packetPipeline.sendToServer(
new SignDataPacket(
battlesign.getWorldObj().provider.dimensionId,
battlesign.xCoord,
battlesign.yCoord,
battlesign.zCoord,
text));
}
private float calcLuminance(float r, float g, float b) {
@@ -1,14 +1,16 @@
package tconstruct.tools.gui;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
public class ChestSlot extends Slot {
/*
* A Slot, used for adjacent Chest Inventories, that can be disabled.
*/
@@ -24,7 +26,7 @@ public class ChestSlot extends Slot {
@SideOnly(Side.CLIENT)
@Override
public boolean func_111238_b /*isEnabled*/() {
public boolean func_111238_b /* isEnabled */() {
return enabled;
}
@@ -1,12 +1,9 @@
package tconstruct.tools.gui;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
import java.awt.Rectangle;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -17,18 +14,25 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.PatternBuilder;
import tconstruct.library.modifier.IModifyable;
import tconstruct.library.tools.ToolMaterial;
import tconstruct.library.util.HarvestLevels;
import tconstruct.tools.logic.CraftingStationLogic;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
@Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems")
public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
/*
* Slider/slots related. Taken & adapted from Tinkers Construct 1.12 under the MIT License
* Slider/slots related. Taken & adapted from Tinkers Construct 1.12 under the MIT License
*/
private static final ResourceLocation gui_inventory = new ResourceLocation("tinker", "textures/gui/generic.png");
@@ -43,8 +47,13 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
private static final GuiElementScalable sliderBackground = new GuiElementScalable(43, 8, 12, 30, 64, 64);
private static final GuiElementScalable textBackground = new GuiElementScalable(7 + 18, 7, 18, 10, 64, 64);
private final GuiSliderWidget slider =
new GuiSliderWidget(sliderNormal, sliderHigh, sliderLow, sliderTop, sliderBottom, sliderBackground);
private final GuiSliderWidget slider = new GuiSliderWidget(
sliderNormal,
sliderHigh,
sliderLow,
sliderTop,
sliderBottom,
sliderBackground);
private final GuiBorderWidget border = new GuiBorderWidget();
private int firstSlotId;
@@ -119,15 +128,14 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
if (logic.chest != null) {
if (logic.chest.get() instanceof TileEntity) {
TileEntity te = (TileEntity) logic.chest.get();
if (te == null
|| te.getWorldObj().getTileEntity(te.xCoord, te.yCoord, te.zCoord) == null
&& te.getWorldObj().isRemote) {
if (te == null || te.getWorldObj().getTileEntity(te.xCoord, te.yCoord, te.zCoord) == null
&& te.getWorldObj().isRemote) {
mc.thePlayer.closeScreen();
return;
}
}
this.fontRendererObj.drawString(
StatCollector.translateToLocal(logic.chest.get().getInventoryName()), 8, 6, 0x202020);
this.fontRendererObj
.drawString(StatCollector.translateToLocal(logic.chest.get().getInventoryName()), 8, 6, 0x202020);
}
this.fontRendererObj.drawString(
@@ -135,22 +143,22 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
craftingTextLeft + 8,
6,
0x202020);
this.fontRendererObj.drawString(
StatCollector.translateToLocal("container.inventory"), craftingTextLeft + 8, 72, 0x202020);
this.fontRendererObj
.drawString(StatCollector.translateToLocal("container.inventory"), craftingTextLeft + 8, 72, 0x202020);
if (logic.tinkerTable) {
if (logic.isStackInSlot(0)) // output slot = modified item
drawToolStats(logic.getStackInSlot(0));
drawToolStats(logic.getStackInSlot(0));
else if (logic.isStackInSlot(5)) { // center slot if no output item
// other slots empty?
if (!logic.isStackInSlot(1)
&& !logic.isStackInSlot(2)
if (!logic.isStackInSlot(1) && !logic.isStackInSlot(2)
&& !logic.isStackInSlot(3)
&& !logic.isStackInSlot(4)
&& !logic.isStackInSlot(6)
&& !logic.isStackInSlot(7)
&& !logic.isStackInSlot(8)
&& !logic.isStackInSlot(9)) drawToolStats(logic.getStackInSlot(5));
&& !logic.isStackInSlot(9))
drawToolStats(logic.getStackInSlot(5));
else drawToolInformation();
} else drawToolInformation();
}
@@ -206,21 +214,18 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
16777215);
int attack = materialEnum.attack();
String heart = attack == 2
? StatCollector.translateToLocal("gui.partcrafter8")
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
: StatCollector.translateToLocal("gui.partcrafter9");
if (attack % 2 == 0)
this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2 + heart,
baseX,
baseY + 60,
0xffffff);
else
this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2f + heart,
baseX,
baseY + 60,
0xffffff);
if (attack % 2 == 0) this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2 + heart,
baseX,
baseY + 60,
0xffffff);
else this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2f + heart,
baseX,
baseY + 60,
0xffffff);
}
@Override
@@ -333,8 +338,7 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
final int xMod = (slider.isEnabled() ? slider.width : 0) + border.w;
final int yMod = (shouldDrawName() ? textBackground.y : 0) + (border.h * 2);
return mouseX >= (this.chestLeft - xMod)
&& mouseX < (chestLeft + chestWidth + xMod)
return mouseX >= (this.chestLeft - xMod) && mouseX < (chestLeft + chestWidth + xMod)
&& mouseY >= (this.chestTop - yMod)
&& mouseY < (chestTop + chestHeight + yMod);
}
@@ -349,14 +353,13 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
}
protected boolean shouldDrawName() {
return this.logic.chest != null
&& this.logic.chest.get().getInventoryName() != null
return this.logic.chest != null && this.logic.chest.get().getInventoryName() != null
&& !this.logic.chest.get().getInventoryName().isEmpty();
}
@Override
public void func_146977_a /*drawSlot*/(Slot slot) {
if (!slot.func_111238_b /*isEnabled*/()) return;
public void func_146977_a /* drawSlot */(Slot slot) {
if (!slot.func_111238_b /* isEnabled */()) return;
super.func_146977_a(slot);
}
@@ -406,8 +409,7 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
slider.disable();
}
chestWidth = logic.invColumns * CraftingStationGui.slotElement.w
+ 2 * border.w
chestWidth = logic.invColumns * CraftingStationGui.slotElement.w + 2 * border.w
+ (slider.isEnabled() ? slider.width : 0);
chestLeft = guiLeft - chestWidth;
@@ -415,8 +417,8 @@ public class CraftingStationGui extends GuiContainer implements INEIGuiHandler {
// Leaving out the xSize increase by chestSize and adjusting where it's used, because otherwise it shifts both
// the bookmarks and item panel
// way too far out. If anything (mouseClick, for example) relies on xSize, you'll need to hack it like below.
// xSize += guiLeft - chestLeft;
// way too far out. If anything (mouseClick, for example) relies on xSize, you'll need to hack it like below.
// xSize += guiLeft - chestLeft;
guiLeft = chestLeft;
border.setPosition(chestLeft, chestTop);
@@ -4,10 +4,13 @@ import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.*;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.tools.logic.FrypanLogic;
public class FrypanGui extends GuiContainer {
public FrypanLogic logic;
public FrypanGui(InventoryPlayer inventoryplayer, FrypanLogic frypan, World world, int x, int y, int z) {
@@ -18,8 +21,8 @@ public class FrypanGui extends GuiContainer {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
fontRendererObj.drawString(StatCollector.translateToLocal("crafters.Frypan"), 60, 6, 0x404040);
fontRendererObj.drawString(
StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
fontRendererObj
.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/frypan.png");
@@ -1,18 +1,21 @@
package tconstruct.tools.gui;
import cpw.mods.fml.relauncher.*;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import tconstruct.tools.inventory.FurnaceContainer;
import tconstruct.tools.logic.FurnaceLogic;
import cpw.mods.fml.relauncher.*;
@SideOnly(Side.CLIENT)
public class FurnaceGui extends GuiContainer {
private static final ResourceLocation furnaceGuiTextures =
new ResourceLocation("textures/gui/container/furnace.png");
private static final ResourceLocation furnaceGuiTextures = new ResourceLocation(
"textures/gui/container/furnace.png");
private final FurnaceLogic logic;
public FurnaceGui(InventoryPlayer inventory, FurnaceLogic furnace) {
@@ -21,8 +24,7 @@ public class FurnaceGui extends GuiContainer {
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of
* the items)
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
@@ -32,8 +34,7 @@ public class FurnaceGui extends GuiContainer {
}
/**
* Draw the background layer for the GuiContainer (everything behind the
* items)
* Draw the background layer for the GuiContainer (everything behind the items)
*/
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
@@ -1,22 +1,21 @@
package tconstruct.tools.gui;
/*
* Taken from Tinker's Construct 1.12 under the MIT License
*
* The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
* Taken from Tinker's Construct 1.12 under the MIT License The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights
* (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions: The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
public class GuiBorderWidget {
// all elements based on generic gui
public GuiElementDuex cornerTopLeft = new GuiElementDuex(0, 0, 7, 7, 64, 64);
public GuiElementDuex cornerTopRight = new GuiElementDuex(64 - 7, 0, 7, 7, 64, 64);
@@ -3,13 +3,15 @@ package tconstruct.tools.gui;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import tconstruct.library.client.StencilGuiElement;
public class GuiButtonStencil extends GuiButton {
/**
* True for pointing right (next page), false for pointing left (previous
* page).
* True for pointing right (next page), false for pointing left (previous page).
*/
int textureX;
@@ -18,8 +20,8 @@ public class GuiButtonStencil extends GuiButton {
public StencilGuiElement element;
private static ResourceLocation background;
public GuiButtonStencil(
int id, int posX, int posY, int texX, int texY, String domain, String tex, StencilGuiElement e) {
public GuiButtonStencil(int id, int posX, int posY, int texX, int texY, String domain, String tex,
StencilGuiElement e) {
super(id, posX, posY, 18, 18, "");
textureX = texX;
textureY = texY;
@@ -34,15 +36,13 @@ public class GuiButtonStencil extends GuiButton {
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
boolean var4 = mouseX >= this.xPosition
&& mouseY >= this.yPosition
boolean var4 = mouseX >= this.xPosition && mouseY >= this.yPosition
&& mouseX < this.xPosition + this.width
&& mouseY < this.yPosition + this.height;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(background);
this.field_146123_n = mouseX >= this.xPosition
&& mouseY >= this.yPosition
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
&& mouseX < this.xPosition + this.width
&& mouseY < this.yPosition + this.height;
int var5 = this.getHoverState(this.field_146123_n);
@@ -1,17 +1,19 @@
package tconstruct.tools.gui;
import cpw.mods.fml.relauncher.*;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.util.ResourceLocation;
import org.lwjgl.opengl.GL11;
import tconstruct.library.client.ToolGuiElement;
import cpw.mods.fml.relauncher.*;
@SideOnly(Side.CLIENT)
public class GuiButtonTool extends GuiButton {
/**
* True for pointing right (next page), false for pointing left (previous
* page).
* True for pointing right (next page), false for pointing left (previous page).
*/
int textureX;
@@ -37,15 +39,13 @@ public class GuiButtonTool extends GuiButton {
@Override
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
if (this.visible) {
boolean var4 = mouseX >= this.xPosition
&& mouseY >= this.yPosition
boolean var4 = mouseX >= this.xPosition && mouseY >= this.yPosition
&& mouseX < this.xPosition + this.width
&& mouseY < this.yPosition + this.height;
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
mc.getTextureManager().bindTexture(background);
this.field_146123_n = mouseX >= this.xPosition
&& mouseY >= this.yPosition
this.field_146123_n = mouseX >= this.xPosition && mouseY >= this.yPosition
&& mouseX < this.xPosition + this.width
&& mouseY < this.yPosition + this.height;
int var5 = this.getHoverState(this.field_146123_n);
@@ -1,24 +1,23 @@
package tconstruct.tools.gui;
import net.minecraft.client.gui.GuiScreen;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
/*
* Taken from Mantle 1.12-1.3.3.49 under the MIT License
*
* The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
* Taken from Mantle 1.12-1.3.3.49 under the MIT License The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights
* (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions: The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
@SideOnly(Side.CLIENT)
public class GuiElementDuex {
@@ -1,24 +1,23 @@
package tconstruct.tools.gui;
import net.minecraft.client.gui.GuiScreen;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
/*
* Taken from Mantle 1.12-1.3.3.49 under the MIT License
*
* The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
* Taken from Mantle 1.12-1.3.3.49 under the MIT License The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights
* (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions: The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
@SideOnly(Side.CLIENT)
public class GuiElementScalable extends GuiElementDuex {
@@ -1,28 +1,28 @@
package tconstruct.tools.gui;
import org.lwjgl.input.Mouse;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import org.lwjgl.input.Mouse;
/*
* Taken from Mantle 1.12-1.3.3.49 under the MIT License
*
* The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt)
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
* WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
* Taken from Mantle 1.12-1.3.3.49 under the MIT License The MIT License (MIT) Copyright (c) 2013-2014 Slime Knights
* (mDiyo, fuj1n, Sunstrike, progwml6, pillbox, alexbegt) Permission is hereby granted, free of charge, to any person
* obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute,
* sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so,
* subject to the following conditions: The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE
* AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
// a vertical slider!
@SideOnly(Side.CLIENT)
public class GuiSliderWidget {
// gui info
public final GuiElementDuex slider;
public final GuiElementDuex sliderHighlighted;
@@ -51,13 +51,8 @@ public class GuiSliderWidget {
private int clickY;
private boolean clickedBar; // if the bar has already been clicked and not released
public GuiSliderWidget(
GuiElementDuex slider,
GuiElementDuex sliderHighlighted,
GuiElementDuex sliderDisabled,
GuiElementDuex slideBarTop,
GuiElementDuex slideBarBottom,
GuiElementScalable slideBar) {
public GuiSliderWidget(GuiElementDuex slider, GuiElementDuex sliderHighlighted, GuiElementDuex sliderDisabled,
GuiElementDuex slideBarTop, GuiElementDuex slideBarBottom, GuiElementScalable slideBar) {
this.slider = slider;
this.sliderHighlighted = sliderHighlighted;
this.sliderDisabled = sliderDisabled;
@@ -1,27 +1,31 @@
package tconstruct.tools.gui;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.PatternBuilder;
import tconstruct.library.tools.ToolMaterial;
import tconstruct.library.util.HarvestLevels;
import tconstruct.tools.inventory.PartCrafterChestContainer;
import tconstruct.tools.logic.PartBuilderLogic;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
@Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems")
public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
PartBuilderLogic logic;
String title, otherTitle = "";
boolean drawChestPart;
@@ -49,8 +53,8 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
private int chestLeft = 0;
private int chestTop = 0;
public PartCrafterGui(
InventoryPlayer inventoryplayer, PartBuilderLogic partlogic, World world, int x, int y, int z) {
public PartCrafterGui(InventoryPlayer inventoryplayer, PartBuilderLogic partlogic, World world, int x, int y,
int z) {
super(partlogic.getGuiContainer(inventoryplayer, world, x, y, z));
logic = partlogic;
drawChestPart = inventorySlots instanceof PartCrafterChestContainer;
@@ -92,8 +96,8 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
this.fontRendererObj.drawString(StatCollector.translateToLocal("inventory.PatternChest"), 14, 17, 4210752);
}
this.fontRendererObj.drawString(
StatCollector.translateToLocal("crafters.PartBuilder"), craftingTextLeft + 6, 6, 4210752);
this.fontRendererObj
.drawString(StatCollector.translateToLocal("crafters.PartBuilder"), craftingTextLeft + 6, 6, 4210752);
this.fontRendererObj.drawString(
StatCollector.translateToLocal("container.inventory"),
craftingTextLeft + 8,
@@ -107,7 +111,11 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
title = "\u00A7n" + StatCollector.translateToLocal("gui.partcrafter2");
this.drawCenteredString(fontRendererObj, title, descTextLeft + DESC_WIDTH / 2, 8, 16777215);
fontRendererObj.drawSplitString(
StatCollector.translateToLocal("gui.partcrafter3"), descTextLeft + 8, 24, 115, 16777215);
StatCollector.translateToLocal("gui.partcrafter3"),
descTextLeft + 8,
24,
115,
16777215);
}
void drawMaterialInformation() {
@@ -165,21 +173,18 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
16777215);
int attack = topEnum.attack();
String heart = attack == 2
? StatCollector.translateToLocal("gui.partcrafter8")
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
: StatCollector.translateToLocal("gui.partcrafter9");
if (attack % 2 == 0)
this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2 + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
else
this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2f + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
if (attack % 2 == 0) this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2 + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
else this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2f + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
}
offset = 90;
@@ -207,29 +212,27 @@ public class PartCrafterGui extends GuiContainer implements INEIGuiHandler {
offset + 49,
16777215);
int attack = bottomEnum.attack();
String heart = attack == 2
? StatCollector.translateToLocal("gui.partcrafter8")
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
: StatCollector.translateToLocal("gui.partcrafter9");
if (attack % 2 == 0)
this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2 + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
else
this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2f + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
if (attack % 2 == 0) this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2 + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
else this.fontRendererObj.drawString(
StatCollector.translateToLocal("gui.partcrafter10") + attack / 2f + heart,
descTextLeft + 8,
offset + 60,
0xffffff);
}
if (!hasTop && !hasBottom) drawDefaultInformation();
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/toolparts.png");
private static final ResourceLocation minichest =
new ResourceLocation("tinker", "textures/gui/patternchestmini.png");
private static final ResourceLocation minichest = new ResourceLocation(
"tinker",
"textures/gui/patternchestmini.png");
private static final ResourceLocation description = new ResourceLocation("tinker", "textures/gui/description.png");
@Override
@@ -4,14 +4,17 @@ import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.*;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.tools.logic.PatternChestLogic;
public class PatternChestGui extends GuiContainer {
public PatternChestLogic logic;
public PatternChestGui(
InventoryPlayer inventoryplayer, PatternChestLogic holder, World world, int x, int y, int z) {
public PatternChestGui(InventoryPlayer inventoryplayer, PatternChestLogic holder, World world, int x, int y,
int z) {
super(holder.getGuiContainer(inventoryplayer, world, x, y, z));
logic = holder;
xSize = 194;
@@ -21,8 +24,8 @@ public class PatternChestGui extends GuiContainer {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
fontRendererObj.drawString(StatCollector.translateToLocal("inventory.PatternChest"), 60, 6, 0x404040);
fontRendererObj.drawString(
StatCollector.translateToLocal("container.inventory"), 17, (ySize - 96) + 2, 0x404040);
fontRendererObj
.drawString(StatCollector.translateToLocal("container.inventory"), 17, (ySize - 96) + 2, 0x404040);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/patternchest.png");
@@ -1,34 +1,38 @@
package tconstruct.tools.gui;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.*;
import net.minecraft.world.World;
import org.lwjgl.opengl.GL11;
import tconstruct.TConstruct;
import tconstruct.library.client.*;
import tconstruct.library.crafting.StencilBuilder;
import tconstruct.tools.inventory.PatternShaperContainer;
import tconstruct.tools.logic.StencilTableLogic;
import tconstruct.util.network.PatternTablePacket;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
@Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems")
public class StencilTableGui extends GuiContainer implements INEIGuiHandler {
int[] buttonsLeftRect = new int[] {Integer.MAX_VALUE, Integer.MIN_VALUE};
int[] buttonsRightRect = new int[] {Integer.MIN_VALUE, Integer.MIN_VALUE};
int[] buttonsLeftRect = new int[] { Integer.MAX_VALUE, Integer.MIN_VALUE };
int[] buttonsRightRect = new int[] { Integer.MIN_VALUE, Integer.MIN_VALUE };
StencilTableLogic logic;
int activeButton;
public StencilTableGui(
InventoryPlayer inventoryplayer, StencilTableLogic shaper, World world, int x, int y, int z) {
public StencilTableGui(InventoryPlayer inventoryplayer, StencilTableLogic shaper, World world, int x, int y,
int z) {
super(new PatternShaperContainer(inventoryplayer, shaper));
logic = shaper;
activeButton = 0;
@@ -42,8 +46,8 @@ public class StencilTableGui extends GuiContainer implements INEIGuiHandler {
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
fontRendererObj.drawString(StatCollector.translateToLocal("crafters.PatternShaper"), 50, 6, 0x404040);
fontRendererObj.drawString(
StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
fontRendererObj
.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 2, 0x404040);
}
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/patternshaper.png");
@@ -69,8 +73,8 @@ public class StencilTableGui extends GuiContainer implements INEIGuiHandler {
int cornerY = this.guiTop + 2;
this.buttonList.clear();
this.buttonsLeftRect = new int[] {Integer.MAX_VALUE, Integer.MIN_VALUE};
this.buttonsRightRect = new int[] {Integer.MIN_VALUE, Integer.MIN_VALUE};
this.buttonsLeftRect = new int[] { Integer.MAX_VALUE, Integer.MIN_VALUE };
this.buttonsRightRect = new int[] { Integer.MIN_VALUE, Integer.MIN_VALUE };
int id = 0;
for (int iter = 0; iter < TConstructClientRegistry.stencilButtons.size(); iter++) {
@@ -115,8 +119,8 @@ public class StencilTableGui extends GuiContainer implements INEIGuiHandler {
if (logic.getStackInSlot(1) != null) {
activeButton = StencilBuilder.getId(logic.getStackInSlot(1));
setActiveButton(activeButton);
stack = StencilBuilder.getStencil(
((GuiButtonStencil) this.buttonList.get(activeButton)).element.stencilIndex);
stack = StencilBuilder
.getStencil(((GuiButtonStencil) this.buttonList.get(activeButton)).element.stencilIndex);
} else stack = null;
logic.setSelectedPattern(stack);
@@ -175,16 +179,14 @@ public class StencilTableGui extends GuiContainer implements INEIGuiHandler {
public boolean hideItemPanelSlot(GuiContainer guiContainer, int x, int y, int w, int h) {
// is it in the horizontal column of the right buttons?
if (x > this.guiLeft + this.xSize
&& x < this.buttonsRightRect[0]
if (x > this.guiLeft + this.xSize && x < this.buttonsRightRect[0]
&& y + h > this.guiTop
&& y < this.buttonsRightRect[1]) {
return true;
}
// is it in the horizontal column of the left buttons?
return x + w > this.buttonsLeftRect[0]
&& x < this.guiLeft
return x + w > this.buttonsLeftRect[0] && x < this.guiLeft
&& y + h > this.guiTop
&& y < this.buttonsLeftRect[1];
}
@@ -1,19 +1,21 @@
package tconstruct.tools.gui;
import cpw.mods.fml.relauncher.*;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import tconstruct.library.client.*;
import tconstruct.tools.logic.ToolForgeLogic;
import cpw.mods.fml.relauncher.*;
@SideOnly(Side.CLIENT)
public class ToolForgeGui extends ToolStationGui {
int selectedButton;
public ToolForgeGui(
InventoryPlayer inventoryplayer, ToolForgeLogic stationlogic, World world, int x, int y, int z) {
public ToolForgeGui(InventoryPlayer inventoryplayer, ToolForgeLogic stationlogic, World world, int x, int y,
int z) {
super(inventoryplayer, stationlogic, world, x, y, z);
}
@@ -92,8 +94,8 @@ public class ToolForgeGui extends ToolStationGui {
this.text.setText("");
selectedButton = 0;
setSlotType(0);
iconX = new int[] {0, 1, 2, 13};
iconY = new int[] {13, 13, 13, 13};
iconX = new int[] { 0, 1, 2, 13 };
iconY = new int[] { 13, 13, 13, 13 };
title = "\u00A7n" + StatCollector.translateToLocal("gui.toolforge1");
body = StatCollector.translateToLocal("gui.toolforge2");
}
@@ -102,44 +104,44 @@ public class ToolForgeGui extends ToolStationGui {
void setSlotType(int type) {
switch (type) {
case 0:
slotX = new int[] {56, 38, 38, 14}; // Repair
slotY = new int[] {37, 28, 46, 37};
slotX = new int[] { 56, 38, 38, 14 }; // Repair
slotY = new int[] { 37, 28, 46, 37 };
break;
case 1:
slotX = new int[] {56, 56, 56, 14}; // Three parts
slotY = new int[] {19, 55, 37, 37};
slotX = new int[] { 56, 56, 56, 14 }; // Three parts
slotY = new int[] { 19, 55, 37, 37 };
break;
case 2:
slotX = new int[] {56, 56, 14, 14}; // Two parts
slotY = new int[] {28, 46, 28, 46};
slotX = new int[] { 56, 56, 14, 14 }; // Two parts
slotY = new int[] { 28, 46, 28, 46 };
break;
case 3:
slotX = new int[] {38, 47, 56, 14}; // Double head
slotY = new int[] {28, 46, 28, 37};
slotX = new int[] { 38, 47, 56, 14 }; // Double head
slotY = new int[] { 28, 46, 28, 37 };
break;
case 4:
slotX = new int[] {47, 38, 56, 47}; // Four parts
slotY = new int[] {19, 37, 37, 55};
slotX = new int[] { 47, 38, 56, 47 }; // Four parts
slotY = new int[] { 19, 37, 37, 55 };
break;
case 5:
slotX = new int[] {38, 47, 56, 47}; // Four parts, double head
slotY = new int[] {19, 55, 19, 37};
slotX = new int[] { 38, 47, 56, 47 }; // Four parts, double head
slotY = new int[] { 19, 55, 19, 37 };
break;
case 6:
slotX = new int[] {38, 38, 20, 56}; // Double head
slotY = new int[] {28, 46, 28, 28};
slotX = new int[] { 38, 38, 20, 56 }; // Double head
slotY = new int[] { 28, 46, 28, 28 };
break;
case 7:
slotX = new int[] {56, 56, 56, 14}; // Three parts reverse
slotY = new int[] {19, 37, 55, 37};
slotX = new int[] { 56, 56, 56, 14 }; // Three parts reverse
slotY = new int[] { 19, 37, 55, 37 };
break;
case 8:
slotX = new int[] {20, 38, 56, 38}; // Double head middle
slotY = new int[] {28, 46, 28, 28};
slotX = new int[] { 20, 38, 56, 38 }; // Double head middle
slotY = new int[] { 28, 46, 28, 28 };
break;
case 9:
slotX = new int[] {38, 56, 47, 47}; // Four parts, crossbow.
slotY = new int[] {37, 37, 55, 19};
slotX = new int[] { 38, 56, 47, 47 }; // Four parts, crossbow.
slotY = new int[] { 37, 37, 55, 19 };
break;
}
toolSlots.resetSlots(slotX, slotY);
@@ -1,13 +1,8 @@
package tconstruct.tools.gui;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import java.util.Collections;
import java.util.List;
import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.gui.inventory.GuiContainer;
@@ -16,18 +11,27 @@ import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import org.lwjgl.input.Keyboard;
import org.lwjgl.opengl.GL11;
import tconstruct.TConstruct;
import tconstruct.library.client.TConstructClientRegistry;
import tconstruct.library.client.ToolGuiElement;
import tconstruct.tools.inventory.ToolStationContainer;
import tconstruct.tools.logic.ToolStationLogic;
import tconstruct.util.network.ToolStationPacket;
import codechicken.nei.VisiblityData;
import codechicken.nei.api.INEIGuiHandler;
import codechicken.nei.api.TaggedInventoryArea;
import cpw.mods.fml.common.Optional;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
@SideOnly(Side.CLIENT)
@Optional.Interface(iface = "codechicken.nei.api.INEIGuiHandler", modid = "NotEnoughItems")
public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
public ToolStationLogic logic;
public ToolStationContainer toolSlots;
public GuiTextField text;
@@ -37,8 +41,8 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
public boolean active;
public String title, body = "";
public ToolStationGui(
InventoryPlayer inventoryplayer, ToolStationLogic stationlogic, World world, int x, int y, int z) {
public ToolStationGui(InventoryPlayer inventoryplayer, ToolStationLogic stationlogic, World world, int x, int y,
int z) {
super(stationlogic.getGuiContainer(inventoryplayer, world, x, y, z));
this.logic = stationlogic;
toolSlots = (ToolStationContainer) inventorySlots;
@@ -70,8 +74,8 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
this.text.setText("");
guiType = 0;
setSlotType(0);
iconX = new int[] {0, 1, 2};
iconY = new int[] {13, 13, 13};
iconX = new int[] { 0, 1, 2 };
iconY = new int[] { 13, 13, 13 };
title = "\u00A7n" + StatCollector.translateToLocal("gui.toolforge1");
body = StatCollector.translateToLocal("gui.toolforge2");
}
@@ -136,24 +140,24 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
void setSlotType(int type) {
switch (type) {
case 0:
slotX = new int[] {56, 38, 38}; // Repair
slotY = new int[] {37, 28, 46};
slotX = new int[] { 56, 38, 38 }; // Repair
slotY = new int[] { 37, 28, 46 };
break;
case 1:
slotX = new int[] {56, 56, 56}; // Three parts
slotY = new int[] {19, 55, 37};
slotX = new int[] { 56, 56, 56 }; // Three parts
slotY = new int[] { 19, 55, 37 };
break;
case 2:
slotX = new int[] {56, 56, 14}; // Two parts
slotY = new int[] {28, 46, 37};
slotX = new int[] { 56, 56, 14 }; // Two parts
slotY = new int[] { 28, 46, 37 };
break;
case 3:
slotX = new int[] {38, 47, 56}; // Double head
slotY = new int[] {28, 46, 28};
slotX = new int[] { 38, 47, 56 }; // Double head
slotY = new int[] { 28, 46, 28 };
break;
case 7:
slotX = new int[] {56, 56, 56}; // Three parts reverse
slotY = new int[] {19, 37, 55};
slotX = new int[] { 56, 56, 56 }; // Three parts reverse
slotY = new int[] { 19, 37, 55 };
break;
}
toolSlots.resetSlots(slotX, slotY);
@@ -166,14 +170,13 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
}
/**
* Draw the foreground layer for the GuiContainer (everything in front of
* the items)
* Draw the foreground layer for the GuiContainer (everything in front of the items)
*/
@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
this.fontRendererObj.drawString(StatCollector.translateToLocal(logic.getInvName()), 116, 8, 0x000000);
this.fontRendererObj.drawString(
StatCollector.translateToLocal("container.inventory"), 118, this.ySize - 96 + 2, 0x000000);
this.fontRendererObj
.drawString(StatCollector.translateToLocal("container.inventory"), 118, this.ySize - 96 + 2, 0x000000);
this.fontRendererObj.drawString(toolName + "_", 180, 8, 0xffffff);
if (logic.isStackInSlot(0)) ToolStationGuiHelper.drawToolStats(logic.getStackInSlot(0), 294, 0);
@@ -190,8 +193,7 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
private static final ResourceLocation description = new ResourceLocation("tinker", "textures/gui/description.png");
/**
* Draw the background layer for the GuiContainer (everything behind the
* items)
* Draw the background layer for the GuiContainer (everything behind the items)
*/
@Override
protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) {
@@ -213,7 +215,12 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
this.drawTexturedModalRect(cornerX + slotX[i], this.guiTop + slotY[i], 144, 216, 18, 18);
if (!logic.isStackInSlot(i + 1)) {
this.drawTexturedModalRect(
cornerX + slotX[i], this.guiTop + slotY[i], 18 * iconX[i], 18 * iconY[i], 18, 18);
cornerX + slotX[i],
this.guiTop + slotY[i],
18 * iconX[i],
18 * iconY[i],
18,
18);
}
}
@@ -240,19 +247,12 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
void updateServer(String name) {
/*
* ByteArrayOutputStream bos = new ByteArrayOutputStream(8);
* DataOutputStream outputStream = new DataOutputStream(bos); try {
* outputStream.writeByte(1);
* outputStream.writeInt(logic.getWorld().provider.dimensionId);
* outputStream.writeInt(logic.xCoord);
* outputStream.writeInt(logic.yCoord);
* outputStream.writeInt(logic.zCoord); outputStream.writeUTF(name); }
* catch (Exception ex) { ex.printStackTrace(); }
*
* Packet250CustomPayload packet = new Packet250CustomPayload();
* packet.channel = "TConstruct"; packet.data = bos.toByteArray();
* packet.length = bos.size();
*
* ByteArrayOutputStream bos = new ByteArrayOutputStream(8); DataOutputStream outputStream = new
* DataOutputStream(bos); try { outputStream.writeByte(1);
* outputStream.writeInt(logic.getWorld().provider.dimensionId); outputStream.writeInt(logic.xCoord);
* outputStream.writeInt(logic.yCoord); outputStream.writeInt(logic.zCoord); outputStream.writeUTF(name); }
* catch (Exception ex) { ex.printStackTrace(); } Packet250CustomPayload packet = new Packet250CustomPayload();
* packet.channel = "TConstruct"; packet.data = bos.toByteArray(); packet.length = bos.size();
* PacketDispatcher.sendPacketToServer(packet);
*/
@@ -260,9 +260,8 @@ public class ToolStationGui extends GuiContainer implements INEIGuiHandler {
}
/*
* protected void mouseClicked(int par1, int par2, int par3) {
* super.mouseClicked(par1, par2, par3); text.mouseClicked(par1, par2,
* par3); }
* protected void mouseClicked(int par1, int par2, int par3) { super.mouseClicked(par1, par2, par3);
* text.mouseClicked(par1, par2, par3); }
*/
@Override
@@ -4,6 +4,7 @@ import java.text.DecimalFormat;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedList;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.item.Item;
@@ -11,6 +12,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.StatCollector;
import tconstruct.library.accessory.AccessoryCore;
import tconstruct.library.armor.ArmorCore;
import tconstruct.library.modifier.IModifyable;
@@ -22,6 +24,7 @@ import tconstruct.library.weaponry.IAmmo;
import tconstruct.library.weaponry.ProjectileWeapon;
public final class ToolStationGuiHelper {
// non-instantiable
private ToolStationGuiHelper() {}
@@ -40,8 +43,7 @@ public final class ToolStationGuiHelper {
}
public static void drawToolStats(ItemStack stack, int x, int y) {
String name = stack.getItem() instanceof ToolCore
? ((ToolCore) stack.getItem()).getLocalizedToolName()
String name = stack.getItem() instanceof ToolCore ? ((ToolCore) stack.getItem()).getLocalizedToolName()
: stack.getDisplayName();
Item item = stack.getItem();
NBTTagCompound tags = stack.getTagCompound();
@@ -147,8 +149,7 @@ public final class ToolStationGuiHelper {
EnumChatFormatting.getTextWithoutFormattingCodes(tipName),
StatCollector.translateToLocal(locString));
// re-add the X/Y
if (bracket > 0)
tipName += " " + tags.getString(tooltip + tipNum).substring(bracket);
if (bracket > 0) tipName += " " + tags.getString(tooltip + tipNum).substring(bracket);
}
write("- " + tipName);
tipNum++;
@@ -162,13 +163,13 @@ public final class ToolStationGuiHelper {
write(StatCollector.translateToLocal("gui.toolstation14") + df.format(mineSpeed));
if (stoneboundSpeed != 0) {
String bloss = stoneboundSpeed > 0
? StatCollector.translateToLocal("gui.toolstation4")
String bloss = stoneboundSpeed > 0 ? StatCollector.translateToLocal("gui.toolstation4")
: StatCollector.translateToLocal("gui.toolstation5");
write(bloss + df.format(stoneboundSpeed));
}
write(StatCollector.translateToLocal("gui.toolstation15")
+ HarvestLevels.getHarvestLevelName(tags.getInteger("HarvestLevel")));
write(
StatCollector.translateToLocal("gui.toolstation15")
+ HarvestLevels.getHarvestLevelName(tags.getInteger("HarvestLevel")));
}
private static void drawDualHarvestStats(ToolCore tool, NBTTagCompound tags) {
@@ -179,15 +180,16 @@ public final class ToolStationGuiHelper {
write(StatCollector.translateToLocal("gui.toolstation12"));
write("- " + df.format(mineSpeed) + ", " + df.format(mineSpeed2));
if (stoneboundSpeed != 0) {
String bloss = stoneboundSpeed > 0
? StatCollector.translateToLocal("gui.toolstation4")
String bloss = stoneboundSpeed > 0 ? StatCollector.translateToLocal("gui.toolstation4")
: StatCollector.translateToLocal("gui.toolstation5");
write(bloss + df.format(stoneboundSpeed));
}
write(StatCollector.translateToLocal("gui.toolstation13"));
write("- " + HarvestLevels.getHarvestLevelName(tags.getInteger("HarvestLevel")) + ", "
+ HarvestLevels.getHarvestLevelName(tags.getInteger("HarvestLevel2")));
write(
"- " + HarvestLevels.getHarvestLevelName(tags.getInteger("HarvestLevel"))
+ ", "
+ HarvestLevels.getHarvestLevelName(tags.getInteger("HarvestLevel2")));
}
private static void drawWeaponStats(ToolCore tool, NBTTagCompound tags) {
@@ -201,18 +203,15 @@ public final class ToolStationGuiHelper {
if (attack < 1) attack = 1;
String heart = attack == 2
? StatCollector.translateToLocal("gui.partcrafter8")
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
: StatCollector.translateToLocal("gui.partcrafter9");
if (attack % 2 == 0) write(StatCollector.translateToLocal("gui.toolstation3") + attack / 2 + heart);
else write(StatCollector.translateToLocal("gui.toolstation3") + df.format(attack / 2f) + heart);
if (stoneboundDamage != 0) {
heart = stoneboundDamage == 2
? StatCollector.translateToLocal("gui.partcrafter8")
heart = stoneboundDamage == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
: StatCollector.translateToLocal("gui.partcrafter9");
String bloss = stoneboundDamage > 0
? StatCollector.translateToLocal("gui.toolstation4")
String bloss = stoneboundDamage > 0 ? StatCollector.translateToLocal("gui.toolstation4")
: StatCollector.translateToLocal("gui.toolstation5");
write(bloss + df.format(stoneboundDamage / 2f) + heart);
}
@@ -227,8 +226,7 @@ public final class ToolStationGuiHelper {
int attack = (int) attackf;
String heart = attack == 2
? StatCollector.translateToLocal("gui.partcrafter8")
String heart = attack == 2 ? StatCollector.translateToLocal("gui.partcrafter8")
: StatCollector.translateToLocal("gui.partcrafter9");
if (attack % 2 == 0) write(StatCollector.translateToLocal("gui.toolstation23") + attack / 2 + heart);
else write(StatCollector.translateToLocal("gui.toolstation23") + df.format(attack / 2f) + heart);
@@ -269,8 +267,10 @@ public final class ToolStationGuiHelper {
double protection = armor.getProtection(stack);
double maxProtection = tags.getDouble("MaxDefense");
write(StatCollector.translateToLocal("gui.toolstation20") + df.format(protection) + "/"
+ df.format(maxProtection));
write(
StatCollector.translateToLocal("gui.toolstation20") + df.format(protection)
+ "/"
+ df.format(maxProtection));
}
private static void drawAccessoryStats(AccessoryCore core, NBTTagCompound tags) {
@@ -282,12 +282,14 @@ public final class ToolStationGuiHelper {
}
/**
* Renders the specified text to the screen, center-aligned.
* Copied out of GUI
* Renders the specified text to the screen, center-aligned. Copied out of GUI
*/
public static void drawCenteredString(
FontRenderer p_73732_1_, String p_73732_2_, int p_73732_3_, int p_73732_4_, int p_73732_5_) {
public static void drawCenteredString(FontRenderer p_73732_1_, String p_73732_2_, int p_73732_3_, int p_73732_4_,
int p_73732_5_) {
p_73732_1_.drawStringWithShadow(
p_73732_2_, p_73732_3_ - p_73732_1_.getStringWidth(p_73732_2_) / 2, p_73732_4_, p_73732_5_);
p_73732_2_,
p_73732_3_ - p_73732_1_.getStringWidth(p_73732_2_) / 2,
p_73732_4_,
p_73732_5_);
}
}
@@ -1,7 +1,9 @@
package tconstruct.tools.inventory;
import java.lang.ref.WeakReference;
import javax.annotation.Nonnull;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
@@ -14,6 +16,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.world.World;
import tconstruct.library.crafting.ModifyBuilder;
import tconstruct.library.modifier.IModifyable;
import tconstruct.tools.TinkerTools;
@@ -21,6 +24,7 @@ import tconstruct.tools.gui.ChestSlot;
import tconstruct.tools.logic.CraftingStationLogic;
public class CraftingStationContainer extends Container {
private final World worldObj;
private final int posX;
private final int posY;
@@ -62,8 +66,14 @@ public class CraftingStationContainer extends Container {
final int inventoryOffsetX = 8 + bothOffset;
// 0 - crafting slot
this.addSlotToContainer(new SlotCraftingStation(
inventoryplayer.player, this.craftMatrix, this.craftResult, 0, craftingOffsetX + 94, 35));
this.addSlotToContainer(
new SlotCraftingStation(
inventoryplayer.player,
this.craftMatrix,
this.craftResult,
0,
craftingOffsetX + 94,
35));
// 1 - 9 - Crafting Matrix
for (row = 0; row < 3; ++row) {
@@ -156,7 +166,11 @@ public class CraftingStationContainer extends Container {
// Crafting Result
if (ret.getItem() instanceof IModifyable) {
nothingDone &= !this.mergeCraftedStack(
itemstack, logic.getSizeInventory(), this.inventorySlots.size(), true, entityPlayer);
itemstack,
logic.getSizeInventory(),
this.inventorySlots.size(),
true,
entityPlayer);
} else {
// First refill the attached chests
nothingDone &= this.refillChest(itemstack);
@@ -229,7 +243,7 @@ public class CraftingStationContainer extends Container {
return !this.mergeItemStack(itemstack, 1, 10, true);
}
public boolean func_94530_a /*canMergeSlot*/(ItemStack par1ItemStack, Slot par2Slot) {
public boolean func_94530_a /* canMergeSlot */(ItemStack par1ItemStack, Slot par2Slot) {
return par2Slot.inventory != this.craftResult && super.func_94530_a(par1ItemStack, par2Slot);
}
@@ -251,9 +265,9 @@ public class CraftingStationContainer extends Container {
public void onCraftMatrixChanged(IInventory par1IInventory) {
ItemStack tool = modifyItem();
if (tool != null) this.craftResult.setInventorySlotContents(0, tool);
else
this.craftResult.setInventorySlotContents(
0, CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
else this.craftResult.setInventorySlotContents(
0,
CraftingManager.getInstance().findMatchingRecipe(this.craftMatrix, this.worldObj));
}
@Override
@@ -268,8 +282,8 @@ public class CraftingStationContainer extends Container {
<= 64.0D;
}
protected boolean mergeCraftedStack(
ItemStack stack, int slotsStart, int slotsTotal, boolean playerInventory, EntityPlayer player) {
protected boolean mergeCraftedStack(ItemStack stack, int slotsStart, int slotsTotal, boolean playerInventory,
EntityPlayer player) {
boolean failedToMerge = false;
int slotIndex = slotsStart;
@@ -314,8 +328,8 @@ public class CraftingStationContainer extends Container {
}
// only refills items that are already present
protected boolean mergeItemStackRefill(
@Nonnull ItemStack stack, int startIndex, int endIndex, boolean useEndIndex) {
protected boolean mergeItemStackRefill(@Nonnull ItemStack stack, int startIndex, int endIndex,
boolean useEndIndex) {
if (stack.stackSize <= 0) {
return false;
}
@@ -331,11 +345,10 @@ public class CraftingStationContainer extends Container {
slot = (Slot) this.inventorySlots.get(k);
itemstack1 = slot.getStack();
if (itemstack1 != null
&& itemstack1.getItem() == stack.getItem()
if (itemstack1 != null && itemstack1.getItem() == stack.getItem()
&& (!stack.getHasSubtypes() || stack.getItemDamage() == itemstack1.getItemDamage())
&& ItemStack.areItemStackTagsEqual(stack, itemstack1)
&& this.func_94530_a /*canMergeSlot*/(stack, slot)) {
&& this.func_94530_a /* canMergeSlot */(stack, slot)) {
int l = itemstack1.stackSize + stack.stackSize;
int limit = Math.min(stack.getMaxStackSize(), slot.getSlotStackLimit());
@@ -353,7 +366,7 @@ public class CraftingStationContainer extends Container {
}
if (useEndIndex) --k;
else ++k;
else++k;
}
}
@@ -373,9 +386,8 @@ public class CraftingStationContainer extends Container {
final Slot slot = (Slot) this.inventorySlots.get(k);
ItemStack itemstack1 = slot.getStack();
if ((itemstack1 == null || itemstack1.stackSize == 0)
&& slot.isItemValid(stack)
&& this.func_94530_a /*canMergeSlot*/(stack, slot)) {
if ((itemstack1 == null || itemstack1.stackSize == 0) && slot.isItemValid(stack)
&& this.func_94530_a /* canMergeSlot */(stack, slot)) {
// Forge: Make sure to respect isItemValid in the slot.
int limit = slot.getSlotStackLimit();
ItemStack stack2 = stack.copy();
@@ -395,7 +407,7 @@ public class CraftingStationContainer extends Container {
}
if (useEndIndex) --k;
else ++k;
else++k;
}
return didSomething;
@@ -4,10 +4,12 @@ import net.minecraft.block.Block;
import net.minecraft.entity.player.*;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import tconstruct.tools.TinkerTools;
import tconstruct.tools.logic.FrypanLogic;
public class FrypanContainer extends Container {
public FrypanLogic logic;
public int progress = 0;
public int fuel = 0;
@@ -17,9 +19,8 @@ public class FrypanContainer extends Container {
InventoryPlayer inventoryplayer = player.inventory;
logic = frypan;
this.addSlotToContainer(new Slot(frypan, 1, 26, 45));
for (int y = 0; y < 2; y++)
for (int x = 0; x < 4; x++)
this.addSlotToContainer(new SlotFrypan(frypan, 2 + x + y * 4, 70 + x * 18, 27 + y * 18, player));
for (int y = 0; y < 2; y++) for (int x = 0; x < 4; x++)
this.addSlotToContainer(new SlotFrypan(frypan, 2 + x + y * 4, 70 + x * 18, 27 + y * 18, player));
/* Player inventory */
for (int column = 0; column < 3; column++) {
@@ -1,14 +1,16 @@
package tconstruct.tools.inventory;
import cpw.mods.fml.relauncher.*;
import net.minecraft.entity.player.*;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.tileentity.TileEntityFurnace;
import tconstruct.tools.logic.FurnaceLogic;
import cpw.mods.fml.relauncher.*;
public class FurnaceContainer extends Container {
private final FurnaceLogic furnace;
private int lastCookTime;
private int lastBurnTime;
@@ -90,8 +92,7 @@ public class FurnaceContainer extends Container {
}
/**
* Called when a player shift-clicks on a slot. You must override this or
* you will crash when someone does that.
* Called when a player shift-clicks on a slot. You must override this or you will crash when someone does that.
*/
@Override
public ItemStack transferStackInSlot(EntityPlayer par1EntityPlayer, int par2) {
@@ -1,17 +1,18 @@
package tconstruct.tools.inventory;
import mantle.blocks.abstracts.InventoryLogic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
public class InventoryCraftingStation extends InventoryCrafting {
/** the width of the crafting inventory */
private final int inventoryWidth;
/**
* Class containing the callbacks for the events on_GUIClosed and
* on_CraftMaxtrixChanged.
* Class containing the callbacks for the events on_GUIClosed and on_CraftMaxtrixChanged.
*/
private final Container eventHandler;
@@ -62,8 +63,8 @@ public class InventoryCraftingStation extends InventoryCrafting {
}
/**
* Removes from an inventory slot (first arg) up to a specified number
* (second arg) of items and returns them in a new stack.
* Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a
* new stack.
*/
@Override
public ItemStack decrStackSize(int slotID, int par2) {
@@ -84,8 +85,7 @@ public class InventoryCraftingStation extends InventoryCrafting {
}
/**
* Sets the given item stack to the specified slot in the inventory (can be
* crafting or armor sections).
* Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
*/
@Override
public void setInventorySlotContents(int slot, ItemStack itemstack) {
@@ -94,8 +94,8 @@ public class InventoryCraftingStation extends InventoryCrafting {
}
/**
* Returns the maximum stack size for a inventory slot. Seems to always be
* 64, possibly will be extended. *Isn't this more of a set than a get?*
* Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't
* this more of a set than a get?*
*/
@Override
public int getInventoryStackLimit() {
@@ -109,8 +109,7 @@ public class InventoryCraftingStation extends InventoryCrafting {
public void markDirty() {}
/**
* Do not make give this method the name canInteractWith because it clashes
* with Container
* Do not make give this method the name canInteractWith because it clashes with Container
*/
@Override
public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) {
@@ -122,8 +121,7 @@ public class InventoryCraftingStation extends InventoryCrafting {
public void closeChest() {}
/**
* Returns true if automation is allowed to insert the given stack (ignoring
* stack size) into the given slot.
* Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
*/
public boolean isStackValidForSlot(int par1, ItemStack par2ItemStack) {
return true;
@@ -3,9 +3,11 @@ package tconstruct.tools.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.InventoryCraftResult;
import net.minecraft.item.ItemStack;
import tconstruct.tools.logic.CraftingStationLogic;
public class InventoryCraftingStationResult extends InventoryCraftResult {
CraftingStationLogic logic;
public InventoryCraftingStationResult(CraftingStationLogic logic) {
@@ -36,17 +38,16 @@ public class InventoryCraftingStationResult extends InventoryCraftResult {
}
/**
* If this returns false, the inventory name will be used as an unlocalized
* name, and translated into the player's language. Otherwise it will be
* used directly.
* If this returns false, the inventory name will be used as an unlocalized name, and translated into the player's
* language. Otherwise it will be used directly.
*/
public boolean isInvNameLocalized() {
return false;
}
/**
* Removes from an inventory slot (first arg) up to a specified number
* (second arg) of items and returns them in a new stack.
* Removes from an inventory slot (first arg) up to a specified number (second arg) of items and returns them in a
* new stack.
*/
@Override
public ItemStack decrStackSize(int par1, int par2) {
@@ -60,9 +61,8 @@ public class InventoryCraftingStationResult extends InventoryCraftResult {
}
/**
* When some containers are closed they call this on each slot, then drop
* whatever it returns as an EntityItem - like when you close a workbench
* GUI.
* When some containers are closed they call this on each slot, then drop whatever it returns as an EntityItem -
* like when you close a workbench GUI.
*/
@Override
public ItemStack getStackInSlotOnClosing(int par1) {
@@ -70,8 +70,7 @@ public class InventoryCraftingStationResult extends InventoryCraftResult {
}
/**
* Sets the given item stack to the specified slot in the inventory (can be
* crafting or armor sections).
* Sets the given item stack to the specified slot in the inventory (can be crafting or armor sections).
*/
@Override
public void setInventorySlotContents(int par1, ItemStack par2ItemStack) {
@@ -79,8 +78,8 @@ public class InventoryCraftingStationResult extends InventoryCraftResult {
}
/**
* Returns the maximum stack size for a inventory slot. Seems to always be
* 64, possibly will be extended. *Isn't this more of a set than a get?*
* Returns the maximum stack size for a inventory slot. Seems to always be 64, possibly will be extended. *Isn't
* this more of a set than a get?*
*/
@Override
public int getInventoryStackLimit() {
@@ -94,8 +93,7 @@ public class InventoryCraftingStationResult extends InventoryCraftResult {
public void markDirty() {}
/**
* Do not make give this method the name canInteractWith because it clashes
* with Container
* Do not make give this method the name canInteractWith because it clashes with Container
*/
@Override
public boolean isUseableByPlayer(EntityPlayer par1EntityPlayer) {
@@ -107,8 +105,7 @@ public class InventoryCraftingStationResult extends InventoryCraftResult {
public void closeChest() {}
/**
* Returns true if automation is allowed to insert the given stack (ignoring
* stack size) into the given slot.
* Returns true if automation is allowed to insert the given stack (ignoring stack size) into the given slot.
*/
public boolean isStackValidForSlot(int par1, ItemStack par2ItemStack) {
return true;
@@ -5,6 +5,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import tconstruct.armor.inventory.SlotOnlyTake;
import tconstruct.library.util.IPattern;
import tconstruct.smeltery.inventory.ActiveContainer;
@@ -13,6 +14,7 @@ import tconstruct.tools.logic.PartBuilderLogic;
import tconstruct.tools.logic.PatternChestLogic;
public class PartCrafterChestContainer extends ActiveContainer {
protected PatternChestLogic patternLogic;
protected InventoryPlayer invPlayer;
protected PartBuilderLogic logic;
@@ -20,22 +22,16 @@ public class PartCrafterChestContainer extends ActiveContainer {
protected Slot[] inventory;
public boolean largeInventory;
public PartCrafterChestContainer(
InventoryPlayer inventoryplayer, PartBuilderLogic partLogic, PatternChestLogic pLogic) {
public PartCrafterChestContainer(InventoryPlayer inventoryplayer, PartBuilderLogic partLogic,
PatternChestLogic pLogic) {
logic = partLogic;
patternLogic = pLogic;
largeInventory = true;
inventory = new Slot[] {
new SlotPattern(partLogic, 0, 156, 27),
new SlotPattern(partLogic, 1, 156, 45),
new Slot(partLogic, 2, 174, 27),
new Slot(partLogic, 3, 174, 45),
new SlotOnlyTake(partLogic, 4, 218, 27),
new SlotOnlyTake(partLogic, 5, 236, 27),
new SlotOnlyTake(partLogic, 6, 218, 45),
new SlotOnlyTake(partLogic, 7, 236, 45)
};
inventory = new Slot[] { new SlotPattern(partLogic, 0, 156, 27), new SlotPattern(partLogic, 1, 156, 45),
new Slot(partLogic, 2, 174, 27), new Slot(partLogic, 3, 174, 45),
new SlotOnlyTake(partLogic, 4, 218, 27), new SlotOnlyTake(partLogic, 5, 236, 27),
new SlotOnlyTake(partLogic, 6, 218, 45), new SlotOnlyTake(partLogic, 7, 236, 45) };
for (Slot slot : inventory) {
this.addSlotToContainer(slot);
}
@@ -4,6 +4,7 @@ import net.minecraft.block.Block;
import net.minecraft.entity.player.*;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import tconstruct.armor.inventory.SlotOnlyTake;
import tconstruct.library.util.IPattern;
import tconstruct.smeltery.inventory.ActiveContainer;
@@ -11,6 +12,7 @@ import tconstruct.tools.TinkerTools;
import tconstruct.tools.logic.PartBuilderLogic;
public class PartCrafterContainer extends ActiveContainer {
protected InventoryPlayer invPlayer;
protected PartBuilderLogic logic;
protected Slot[] input;
@@ -22,16 +24,10 @@ public class PartCrafterContainer extends ActiveContainer {
logic = partLogic;
largeInventory = false;
inventory = new Slot[] {
new SlotPattern(partLogic, 0, 40, 27),
new SlotPattern(partLogic, 1, 40, 45),
new Slot(partLogic, 2, 58, 27),
new Slot(partLogic, 3, 58, 45),
new SlotOnlyTake(partLogic, 4, 102, 27),
new SlotOnlyTake(partLogic, 5, 120, 27),
new SlotOnlyTake(partLogic, 6, 102, 45),
new SlotOnlyTake(partLogic, 7, 120, 45)
};
inventory = new Slot[] { new SlotPattern(partLogic, 0, 40, 27), new SlotPattern(partLogic, 1, 40, 45),
new Slot(partLogic, 2, 58, 27), new Slot(partLogic, 3, 58, 45), new SlotOnlyTake(partLogic, 4, 102, 27),
new SlotOnlyTake(partLogic, 5, 120, 27), new SlotOnlyTake(partLogic, 6, 102, 45),
new SlotOnlyTake(partLogic, 7, 120, 45) };
for (Slot slot : inventory) {
this.addSlotToContainer(slot);
}
@@ -1,16 +1,18 @@
package tconstruct.tools.inventory;
import invtweaks.api.container.ChestContainer;
import net.minecraft.block.Block;
import net.minecraft.entity.player.*;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import tconstruct.library.util.IPattern;
import tconstruct.tools.TinkerTools;
import tconstruct.tools.logic.PatternChestLogic;
import invtweaks.api.container.ChestContainer;
@ChestContainer
public class PatternChestContainer extends Container {
public PatternChestLogic logic;
public int progress = 0;
public int fuel = 0;
@@ -4,24 +4,23 @@ import net.minecraft.block.Block;
import net.minecraft.entity.player.*;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import tconstruct.armor.inventory.SlotOnlyTake;
import tconstruct.tools.TinkerTools;
import tconstruct.tools.logic.StencilTableLogic;
public class PatternShaperContainer extends Container {
public StencilTableLogic logic;
public PatternShaperContainer(InventoryPlayer inventoryplayer, StencilTableLogic shaper) {
logic = shaper;
this.addSlotToContainer(new Slot(shaper, 0, 48, 35));
this.addSlotToContainer(new SlotOnlyTake(shaper, 1, 106, 35));
/*for (int i = 0; i < 3; i++)
{
for (int l = 0; l < 3; l++)
{
this.addSlotToContainer(new Slot(craftMatrix, l + i * 3, 30 + l * 18, 17 + i * 18));
}
}*/
/*
* for (int i = 0; i < 3; i++) { for (int l = 0; l < 3; l++) { this.addSlotToContainer(new Slot(craftMatrix, l +
* i * 3, 30 + l * 18, 17 + i * 18)); } }
*/
/* Player inventory */
for (int column = 0; column < 3; column++) {
@@ -36,25 +35,16 @@ public class PatternShaperContainer extends Container {
}
}
/*public void onCraftMatrixChanged(IInventory iinventory)
{
craftResult.setInventorySloTRepos(0, CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj));
}*/
/*
* public void onCraftMatrixChanged(IInventory iinventory) { craftResult.setInventorySloTRepos(0,
* CraftingManager.getInstance().findMatchingRecipe(craftMatrix, worldObj)); }
*/
/*@Override
public void onContainerClosed(EntityPlayer entityplayer)
{
super.onContainerClosed(entityplayer);
if (logic.worldObj.isRemote)
{
return;
}
ItemStack itemstack = logic.getStackInSlot(0);
if (itemstack != null)
{
entityplayer.dropPlayerItem(itemstack);
}
}*/
/*
* @Override public void onContainerClosed(EntityPlayer entityplayer) { super.onContainerClosed(entityplayer); if
* (logic.worldObj.isRemote) { return; } ItemStack itemstack = logic.getStackInSlot(0); if (itemstack != null) {
* entityplayer.dropPlayerItem(itemstack); } }
*/
@Override
public boolean canInteractWith(EntityPlayer entityplayer) {
@@ -66,36 +56,13 @@ public class PatternShaperContainer extends Container {
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
return null;
/*ItemStack stack = null;
Slot slot = (Slot)this.inventorySlots.get(slotID);
if (slot != null && slot.getHasStack())
{
ItemStack slotStack = slot.getStack();
stack = slotStack.copy();
if (slotID < logic.getSizeInventory())
{
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true))
{
return null;
}
}
else if (!this.mergeItemStack(slotStack, 0, logic.getSizeInventory()-1, false))
{
return null;
}
if (slotStack.stackSize == 0)
{
slot.putStack((ItemStack)null);
}
else
{
slot.onSlotChanged();
}
}
return stack;*/
/*
* ItemStack stack = null; Slot slot = (Slot)this.inventorySlots.get(slotID); if (slot != null &&
* slot.getHasStack()) { ItemStack slotStack = slot.getStack(); stack = slotStack.copy(); if (slotID <
* logic.getSizeInventory()) { if (!this.mergeItemStack(slotStack, logic.getSizeInventory(),
* this.inventorySlots.size(), true)) { return null; } } else if (!this.mergeItemStack(slotStack, 0,
* logic.getSizeInventory()-1, false)) { return null; } if (slotStack.stackSize == 0) {
* slot.putStack((ItemStack)null); } else { slot.onSlotChanged(); } } return stack;
*/
}
}
@@ -3,20 +3,17 @@ package tconstruct.tools.inventory;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import tconstruct.library.modifier.IModifyable;
import tconstruct.library.tools.AbilityHelper;
public class SlotCraftingStation extends SlotCrafting {
private final IInventory matrix;
private final EntityPlayer player;
public SlotCraftingStation(
EntityPlayer par1EntityPlayer,
IInventory par2IInventory,
IInventory par3iInventory,
int par4,
int par5,
int par6) {
public SlotCraftingStation(EntityPlayer par1EntityPlayer, IInventory par2IInventory, IInventory par3iInventory,
int par4, int par5, int par6) {
super(par1EntityPlayer, par2IInventory, par3iInventory, par4, par5, par6);
this.matrix = par2IInventory;
this.player = par1EntityPlayer;
@@ -4,6 +4,7 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.*;
import net.minecraft.item.*;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.achievements.TAchievements;
public class SlotFrypan extends Slot {
@@ -18,8 +19,7 @@ public class SlotFrypan extends Slot {
@Override
public void putStack(ItemStack par1ItemStack) {
super.putStack(par1ItemStack);
if (par1ItemStack != null
&& par1ItemStack.getItem() != null
if (par1ItemStack != null && par1ItemStack.getItem() != null
&& par1ItemStack.getItem() instanceof ItemFood
&& par1ItemStack.hasTagCompound()) {
NBTTagCompound stackTagCompound = par1ItemStack.getTagCompound();
@@ -2,9 +2,11 @@ package tconstruct.tools.inventory;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import tconstruct.library.util.IPattern;
public class SlotPattern extends Slot {
public SlotPattern(IInventory builder, int par3, int par4, int par5) {
super(builder, par3, par4, par5);
}
@@ -1,16 +1,19 @@
package tconstruct.tools.inventory;
import java.util.Random;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.MinecraftForge;
import tconstruct.library.event.ToolCraftedEvent;
import tconstruct.library.modifier.IModifyable;
public class SlotTool extends Slot {
/** The player that is using the GUI where this slot resides. */
public EntityPlayer player;
@@ -49,21 +52,20 @@ public class SlotTool extends Slot {
*/
protected void onCrafting(ItemStack stack) {
if (stack.getItem() instanceof IModifyable) {
NBTTagCompound tags =
stack.getTagCompound().getCompoundTag(((IModifyable) stack.getItem()).getBaseTagName());
NBTTagCompound tags = stack.getTagCompound()
.getCompoundTag(((IModifyable) stack.getItem()).getBaseTagName());
boolean full = (inventory.getStackInSlot(2) != null || inventory.getStackInSlot(3) != null);
for (int i = 2; i <= 3; i++) inventory.decrStackSize(i, 1);
ItemStack compare = inventory.getStackInSlot(1);
int amount = compare.getItem() instanceof IModifyable ? compare.stackSize : 1;
inventory.decrStackSize(1, amount);
if (!player.worldObj.isRemote && full)
player.worldObj.playSoundEffect(
player.posX,
player.posY,
player.posZ,
"tinker:little_saw",
1.0F,
(random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
if (!player.worldObj.isRemote && full) player.worldObj.playSoundEffect(
player.posX,
player.posY,
player.posZ,
"tinker:little_saw",
1.0F,
(random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
MinecraftForge.EVENT_BUS.post(new ToolCraftedEvent(this.inventory, player, stack));
} else
// Simply naming items
@@ -72,8 +74,7 @@ public class SlotTool extends Slot {
inventory.decrStackSize(1, amount);
for (int i = 0; i < inventory.getSizeInventory(); i++) {
if (inventory.getStackInSlot(i) != null
&& inventory.getStackInSlot(i).getItem() == Items.name_tag) {
if (inventory.getStackInSlot(i) != null && inventory.getStackInSlot(i).getItem() == Items.name_tag) {
inventory.decrStackSize(i, 1);
break;
}
@@ -1,16 +1,19 @@
package tconstruct.tools.inventory;
import java.util.Random;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.MinecraftForge;
import tconstruct.library.event.ToolCraftedEvent;
import tconstruct.library.modifier.IModifyable;
public class SlotToolForge extends SlotTool {
/** The player that is using the GUI where this slot resides. */
Random random = new Random();
@@ -20,10 +23,9 @@ public class SlotToolForge extends SlotTool {
protected void onCrafting(ItemStack stack) {
if (stack.getItem() instanceof IModifyable) {
NBTTagCompound tags =
stack.getTagCompound().getCompoundTag(((IModifyable) stack.getItem()).getBaseTagName());
boolean full = (inventory.getStackInSlot(2) != null
|| inventory.getStackInSlot(3) != null
NBTTagCompound tags = stack.getTagCompound()
.getCompoundTag(((IModifyable) stack.getItem()).getBaseTagName());
boolean full = (inventory.getStackInSlot(2) != null || inventory.getStackInSlot(3) != null
|| inventory.getStackInSlot(4) != null);
for (int i = 2; i <= 4; i++) inventory.decrStackSize(i, 1);
ItemStack compare = inventory.getStackInSlot(1);
@@ -39,8 +41,7 @@ public class SlotToolForge extends SlotTool {
inventory.decrStackSize(1, amount);
for (int i = 0; i < inventory.getSizeInventory(); i++) {
if (inventory.getStackInSlot(i) != null
&& inventory.getStackInSlot(i).getItem() == Items.name_tag) {
if (inventory.getStackInSlot(i) != null && inventory.getStackInSlot(i).getItem() == Items.name_tag) {
inventory.decrStackSize(i, 1);
break;
}
@@ -7,6 +7,7 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.MinecraftForge;
import tconstruct.library.event.ToolCraftedEvent;
import tconstruct.library.modifier.IModifyable;
import tconstruct.tools.TinkerTools;
@@ -25,12 +26,8 @@ public class ToolForgeContainer extends ToolStationContainer {
toolSlot = new SlotToolForge(inventoryplayer.player, logic, 0, 225, 38);
this.addSlotToContainer(toolSlot);
slots = new Slot[] {
new Slot(logic, 1, 167, 29),
new Slot(logic, 2, 169, 29),
new Slot(logic, 3, 167, 47),
new Slot(logic, 4, 149, 47)
};
slots = new Slot[] { new Slot(logic, 1, 167, 29), new Slot(logic, 2, 169, 29), new Slot(logic, 3, 167, 47),
new Slot(logic, 4, 149, 47) };
for (int iter = 0; iter < 4; iter++) this.addSlotToContainer(slots[iter]);
@@ -73,10 +70,9 @@ public class ToolForgeContainer extends ToolStationContainer {
@Override
protected void craftTool(ItemStack stack) {
if (stack.getItem() instanceof IModifyable) {
NBTTagCompound tags =
stack.getTagCompound().getCompoundTag(((IModifyable) stack.getItem()).getBaseTagName());
boolean full = (logic.getStackInSlot(2) != null
|| logic.getStackInSlot(3) != null
NBTTagCompound tags = stack.getTagCompound()
.getCompoundTag(((IModifyable) stack.getItem()).getBaseTagName());
boolean full = (logic.getStackInSlot(2) != null || logic.getStackInSlot(3) != null
|| logic.getStackInSlot(4) != null);
for (int i = 2; i <= 4; i++) logic.decrStackSize(i, 1);
ItemStack compare = logic.getStackInSlot(1);
@@ -95,8 +91,7 @@ public class ToolForgeContainer extends ToolStationContainer {
if (!ToolStationLogic.canRename(stack2.getTagCompound(), stack2)) {
for (int i = 0; i < logic.getSizeInventory(); i++) {
if (logic.getStackInSlot(i) != null
&& logic.getStackInSlot(i).getItem() == Items.name_tag) {
if (logic.getStackInSlot(i) != null && logic.getStackInSlot(i).getItem() == Items.name_tag) {
logic.decrStackSize(i, 1);
break;
}
@@ -1,6 +1,7 @@
package tconstruct.tools.inventory;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.entity.player.*;
import net.minecraft.init.Items;
@@ -8,6 +9,7 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.common.MinecraftForge;
import tconstruct.library.event.ToolCraftedEvent;
import tconstruct.library.modifier.IModifyable;
import tconstruct.smeltery.inventory.ActiveContainer;
@@ -15,6 +17,7 @@ import tconstruct.tools.TinkerTools;
import tconstruct.tools.logic.ToolStationLogic;
public class ToolStationContainer extends ActiveContainer {
public InventoryPlayer invPlayer;
public ToolStationLogic logic;
public Slot[] slots;
@@ -31,9 +34,8 @@ public class ToolStationContainer extends ActiveContainer {
toolSlot = new SlotTool(inventoryplayer.player, builderlogic, 0, 225, 38);
this.addSlotToContainer(toolSlot);
slots = new Slot[] {
new Slot(builderlogic, 1, 167, 29), new Slot(builderlogic, 2, 149, 38), new Slot(builderlogic, 3, 167, 47)
};
slots = new Slot[] { new Slot(builderlogic, 1, 167, 29), new Slot(builderlogic, 2, 149, 38),
new Slot(builderlogic, 3, 167, 47) };
for (int iter = 0; iter < 3; iter++) this.addSlotToContainer(slots[iter]);
@@ -92,13 +94,17 @@ public class ToolStationContainer extends ActiveContainer {
if (slotID < logic.getSizeInventory()) {
if (slotID == 0) {
if (!this.mergeCraftedStack(
slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true, player)) {
slotStack,
logic.getSizeInventory(),
this.inventorySlots.size(),
true,
player)) {
return null;
}
} else
if (!this.mergeItemStack(slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true)) {
return null;
}
} else if (!this.mergeItemStack(
slotStack, logic.getSizeInventory(), this.inventorySlots.size(), true)) {
return null;
}
} else if (!this.mergeItemStack(slotStack, 1, logic.getSizeInventory(), false)) {
return null;
}
@@ -115,22 +121,21 @@ public class ToolStationContainer extends ActiveContainer {
protected void craftTool(ItemStack stack) {
if (stack.getItem() instanceof IModifyable) {
NBTTagCompound tags =
stack.getTagCompound().getCompoundTag(((IModifyable) stack.getItem()).getBaseTagName());
NBTTagCompound tags = stack.getTagCompound()
.getCompoundTag(((IModifyable) stack.getItem()).getBaseTagName());
boolean full = (logic.getStackInSlot(2) != null || logic.getStackInSlot(3) != null);
for (int i = 2; i <= 3; i++) logic.decrStackSize(i, 1);
ItemStack compare = logic.getStackInSlot(1);
int amount = compare.getItem() instanceof IModifyable ? compare.stackSize : 1;
logic.decrStackSize(1, amount);
EntityPlayer player = invPlayer.player;
if (!player.worldObj.isRemote && full)
player.worldObj.playSoundEffect(
logic.xCoord,
logic.yCoord,
logic.zCoord,
"tinker:little_saw",
1.0F,
(random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
if (!player.worldObj.isRemote && full) player.worldObj.playSoundEffect(
logic.xCoord,
logic.yCoord,
logic.zCoord,
"tinker:little_saw",
1.0F,
(random.nextFloat() - random.nextFloat()) * 0.2F + 1.0F);
MinecraftForge.EVENT_BUS.post(new ToolCraftedEvent(this.logic, player, stack));
} else
// Simply naming items
@@ -141,8 +146,7 @@ public class ToolStationContainer extends ActiveContainer {
if (!ToolStationLogic.canRename(stack2.getTagCompound(), stack2)) {
for (int i = 0; i < logic.getSizeInventory(); i++) {
if (logic.getStackInSlot(i) != null
&& logic.getStackInSlot(i).getItem() == Items.name_tag) {
if (logic.getStackInSlot(i) != null && logic.getStackInSlot(i).getItem() == Items.name_tag) {
logic.decrStackSize(i, 1);
break;
}
@@ -151,8 +155,8 @@ public class ToolStationContainer extends ActiveContainer {
}
}
protected boolean mergeCraftedStack(
ItemStack stack, int slotsStart, int slotsTotal, boolean playerInventory, EntityPlayer player) {
protected boolean mergeCraftedStack(ItemStack stack, int slotsStart, int slotsTotal, boolean playerInventory,
EntityPlayer player) {
boolean failedToMerge = false;
int slotIndex = slotsStart;
@@ -1,14 +1,15 @@
package tconstruct.tools.itemblocks;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
public class CraftingSlabItemBlock extends MultiItemBlock {
public static final String[] blockTypes = {
"tile.CraftingStation", "Crafter", "Parts", "PatternShaper", "PatternChest", "tile.ToolForge"
};
public static final String[] blockTypes = { "tile.CraftingStation", "Crafter", "Parts", "PatternShaper",
"PatternChest", "tile.ToolForge" };
public CraftingSlabItemBlock(Block b) {
super(b, "ToolStation", blockTypes);
@@ -1,32 +1,20 @@
package tconstruct.tools.itemblocks;
import cpw.mods.fml.relauncher.*;
import java.util.List;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import cpw.mods.fml.relauncher.*;
public class MultiBrickFancyItem extends MultiItemBlock {
static String[] blockTypes = {
"obsidian",
"sandstone",
"netherrack",
"stone.refined",
"iron",
"gold",
"lapis",
"diamond",
"redstone",
"bone",
"slime",
"blueslime",
"endstone",
"obsidian.ingot",
"stone",
"stone.road"
};
static String[] blockTypes = { "obsidian", "sandstone", "netherrack", "stone.refined", "iron", "gold", "lapis",
"diamond", "redstone", "bone", "slime", "blueslime", "endstone", "obsidian.ingot", "stone", "stone.road" };
public MultiBrickFancyItem(Block b) {
super(b, "block.fancybrick", blockTypes);
@@ -1,32 +1,21 @@
package tconstruct.tools.itemblocks;
import cpw.mods.fml.relauncher.*;
import java.util.List;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import cpw.mods.fml.relauncher.*;
public class MultiBrickItem extends MultiItemBlock {
static String[] blockTypes = {
"obsidian",
"sandstone",
"netherrack",
"stone.refined",
"iron",
"gold",
"lapis",
"diamond",
"redstone",
"bone",
"slime",
"blueslime",
"endstone",
"obsidian.ingot",
"stone.road",
"stone.refined.road"
};
static String[] blockTypes = { "obsidian", "sandstone", "netherrack", "stone.refined", "iron", "gold", "lapis",
"diamond", "redstone", "bone", "slime", "blueslime", "endstone", "obsidian.ingot", "stone.road",
"stone.refined.road" };
public MultiBrickItem(Block b) {
super(b, "block.brick", blockTypes);
@@ -1,19 +1,13 @@
package tconstruct.tools.itemblocks;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
public class MultiBrickMetalItem extends MultiItemBlock {
static String[] blockTypes = {
"brick.alumite",
"brick.ardite",
"brick.cobalt",
"brick.manyullyn",
"fancybrick.alumite",
"fancybrick.ardite",
"fancybrick.cobalt",
"fancybrick.manyullyn"
};
static String[] blockTypes = { "brick.alumite", "brick.ardite", "brick.cobalt", "brick.manyullyn",
"fancybrick.alumite", "fancybrick.ardite", "fancybrick.cobalt", "fancybrick.manyullyn" };
public MultiBrickMetalItem(Block b) {
super(b, "block", blockTypes);
@@ -1,26 +1,14 @@
package tconstruct.tools.itemblocks;
import mantle.blocks.abstracts.MultiItemBlock;
import net.minecraft.block.Block;
public class ToolStationItemBlock extends MultiItemBlock {
public static final String[] blockTypes = {
"Crafter",
"Parts",
"Parts",
"Parts",
"Parts",
"PatternChest",
"PatternChest",
"PatternChest",
"PatternChest",
"PatternChest",
"PatternShaper",
"PatternShaper",
"PatternShaper",
"PatternShaper",
"CastingTable"
};
public static final String[] blockTypes = { "Crafter", "Parts", "Parts", "Parts", "Parts", "PatternChest",
"PatternChest", "PatternChest", "PatternChest", "PatternChest", "PatternShaper", "PatternShaper",
"PatternShaper", "PatternShaper", "CastingTable" };
public ToolStationItemBlock(Block b) {
super(b, "ToolStation", blockTypes);
@@ -1,15 +1,19 @@
package tconstruct.tools.items;
import cpw.mods.fml.common.Loader;
import java.util.List;
import mantle.items.abstracts.CraftingItem;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.*;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.util.IToolPart;
import tconstruct.tools.TinkerTools;
import cpw.mods.fml.common.Loader;
public class Bowstring extends CraftingItem implements IToolPart {
public Bowstring() {
super(toolMaterialNames, buildTextureNames("_bowstring"), "parts/", "tinker", TConstructRegistry.materialTab);
this.setHasSubtypes(true);
@@ -25,9 +29,9 @@ public class Bowstring extends CraftingItem implements IToolPart {
return names;
}
public static final String[] toolMaterialNames = new String[] {"string", "enchantedfabric", "flamestring"};
public static final String[] toolMaterialNames = new String[] { "string", "enchantedfabric", "flamestring" };
public static final String[] toolTextureNames = new String[] {"string", "magicfabric", "flamestring"};
public static final String[] toolTextureNames = new String[] { "string", "magicfabric", "flamestring" };
@Override
public int getMaterialID(ItemStack stack) {
@@ -1,16 +1,18 @@
package tconstruct.tools.items;
import cpw.mods.fml.relauncher.*;
import java.util.List;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.*;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.StatCollector;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.*;
import tconstruct.library.tools.ToolCore;
import cpw.mods.fml.relauncher.*;
public class CreativeModifier extends Item {
@@ -1,11 +1,14 @@
package tconstruct.tools.items;
import mantle.items.abstracts.CraftingItem;
import net.minecraft.item.ItemStack;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.util.IToolPart;
public class Fletching extends CraftingItem implements IToolPart {
public Fletching() {
super(toolMaterialNames, buildTextureNames("_fletching"), "parts/", "tinker", TConstructRegistry.materialTab);
this.setHasSubtypes(true);
@@ -21,10 +24,11 @@ public class Fletching extends CraftingItem implements IToolPart {
return names;
}
public static final String[] toolMaterialNames =
new String[] {"feather", "leaf", "slime", "blueslime", "slimeleaf"};
public static final String[] toolMaterialNames = new String[] { "feather", "leaf", "slime", "blueslime",
"slimeleaf" };
public static final String[] toolTextureNames = new String[] {"feather", "leaf", "slime", "blueslime", "slimeleaf"};
public static final String[] toolTextureNames = new String[] { "feather", "leaf", "slime", "blueslime",
"slimeleaf" };
@Override
public int getMaterialID(ItemStack stack) {
@@ -1,25 +1,28 @@
package tconstruct.tools.items;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.*;
import java.util.List;
import mantle.books.BookData;
import mantle.client.gui.GuiManual;
import mantle.items.abstracts.CraftingItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import tconstruct.TConstruct;
import tconstruct.achievements.TAchievements;
import tconstruct.client.TProxyClient;
import tconstruct.library.TConstructRegistry;
import cpw.mods.fml.client.FMLClientHandler;
import cpw.mods.fml.relauncher.*;
public class Manual extends CraftingItem {
static String[] name = new String[] {"beginner", "toolstation", "smeltery", "diary", "weaponry"};
static String[] textureName = new String[] {
"tinkerbook_diary", "tinkerbook_toolstation", "tinkerbook_smeltery", "tinkerbook_blue", "tinkerbook_green"
};
static String[] name = new String[] { "beginner", "toolstation", "smeltery", "diary", "weaponry" };
static String[] textureName = new String[] { "tinkerbook_diary", "tinkerbook_toolstation", "tinkerbook_smeltery",
"tinkerbook_blue", "tinkerbook_green" };
public Manual() {
super(name, textureName, "", "tinker", TConstructRegistry.materialTab);
@@ -1,15 +1,18 @@
package tconstruct.tools.items;
import mantle.books.*;
import net.minecraft.util.*;
import org.w3c.dom.Document;
import tconstruct.client.TProxyClient;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.Side;
import mantle.books.*;
import net.minecraft.util.*;
import org.w3c.dom.Document;
import tconstruct.client.TProxyClient;
public class ManualInfo {
// static String[] name = new String[] { "beginner", "toolstation", "smeltery", "diary" };
// static String[] textureName = new String[] { "tinkerbook_diary", "tinkerbook_toolstation",
// static String[] name = new String[] { "beginner", "toolstation", "smeltery", "diary" };
// static String[] textureName = new String[] { "tinkerbook_diary", "tinkerbook_toolstation",
// "tinkerbook_smeltery", "tinkerbook_blue" };
BookData beginner = new BookData();
@@ -18,10 +21,12 @@ public class ManualInfo {
BookData diary = new BookData();
BookData weaponry = new BookData();
/* diary = readManual("/assets/tinker/manuals/diary.xml", dbFactory);
volume1 = readManual("/assets/tinker/manuals/firstday.xml", dbFactory);
volume2 = readManual("/assets/tinker/manuals/materials.xml", dbFactory);
smelter = readManual("/assets/tinker/manuals/smeltery.xml", dbFactory);*/
/*
* diary = readManual("/assets/tinker/manuals/diary.xml", dbFactory); volume1 =
* readManual("/assets/tinker/manuals/firstday.xml", dbFactory); volume2 =
* readManual("/assets/tinker/manuals/materials.xml", dbFactory); smelter =
* readManual("/assets/tinker/manuals/smeltery.xml", dbFactory);
*/
public ManualInfo() {
Side side = FMLCommonHandler.instance().getEffectiveSide();
@@ -18,95 +18,21 @@ public class MaterialItem extends CraftingItem {
return names;
}
static String[] materialNames = new String[] {
"PaperStack",
"SlimeCrystal",
"SearedBrick",
"CobaltIngot",
"ArditeIngot",
"ManyullynIngot",
"Mossball",
"LavaCrystal",
"NecroticBone",
"CopperIngot",
"TinIngot",
"AluminumIngot",
"RawAluminum",
"BronzeIngot",
"AluBrassIngot",
"AlumiteIngot",
"SteelIngot",
"BlueSlimeCrystal",
"ObsidianIngot",
"IronNugget",
"CopperNugget",
"TinNugget",
"AluminumNugget",
"EssenceCrystal",
"AluBrassNugget",
"SilkyCloth",
"SilkyJewel",
"ObsidianNugget",
"CobaltNugget",
"ArditeNugget",
"ManyullynNugget",
"BronzeNugget",
"AlumiteNugget",
"SteelNugget",
"PigIronIngot",
"PigIronNugget",
"GlueBall",
"SearedBrick",
"ArditeDust",
"CobaltDust",
"AluminumDust",
"ManyullynDust",
"AluBrassDust"
};
static String[] materialNames = new String[] { "PaperStack", "SlimeCrystal", "SearedBrick", "CobaltIngot",
"ArditeIngot", "ManyullynIngot", "Mossball", "LavaCrystal", "NecroticBone", "CopperIngot", "TinIngot",
"AluminumIngot", "RawAluminum", "BronzeIngot", "AluBrassIngot", "AlumiteIngot", "SteelIngot",
"BlueSlimeCrystal", "ObsidianIngot", "IronNugget", "CopperNugget", "TinNugget", "AluminumNugget",
"EssenceCrystal", "AluBrassNugget", "SilkyCloth", "SilkyJewel", "ObsidianNugget", "CobaltNugget",
"ArditeNugget", "ManyullynNugget", "BronzeNugget", "AlumiteNugget", "SteelNugget", "PigIronIngot",
"PigIronNugget", "GlueBall", "SearedBrick", "ArditeDust", "CobaltDust", "AluminumDust", "ManyullynDust",
"AluBrassDust" };
static String[] craftingTextures = new String[] {
"paperstack",
"slimecrystal",
"searedbrick",
"cobaltingot",
"arditeingot",
"manyullyningot",
"mossball",
"lavacrystal",
"necroticbone",
"copperingot",
"tiningot",
"aluminumingot",
"aluminumraw",
"bronzeingot",
"alubrassingot",
"alumiteingot",
"steelingot",
"blueslimecrystal",
"obsidianingot",
"nugget_iron",
"nugget_copper",
"nugget_tin",
"nugget_aluminum",
"",
"nugget_alubrass",
"silkycloth",
"silkyjewel",
"nugget_obsidian",
"nugget_cobalt",
"nugget_ardite",
"nugget_manyullyn",
"nugget_bronze",
"nugget_alumite",
"nugget_steel",
"pigironingot",
"nugget_pigiron",
"glueball",
"searedbrick_nether",
"ardite_dust",
"cobalt_dust",
"aluminum_dust",
"manyullyn_dust",
"alubrass_dust"
};
static String[] craftingTextures = new String[] { "paperstack", "slimecrystal", "searedbrick", "cobaltingot",
"arditeingot", "manyullyningot", "mossball", "lavacrystal", "necroticbone", "copperingot", "tiningot",
"aluminumingot", "aluminumraw", "bronzeingot", "alubrassingot", "alumiteingot", "steelingot",
"blueslimecrystal", "obsidianingot", "nugget_iron", "nugget_copper", "nugget_tin", "nugget_aluminum", "",
"nugget_alubrass", "silkycloth", "silkyjewel", "nugget_obsidian", "nugget_cobalt", "nugget_ardite",
"nugget_manyullyn", "nugget_bronze", "nugget_alumite", "nugget_steel", "pigironingot", "nugget_pigiron",
"glueball", "searedbrick_nether", "ardite_dust", "cobalt_dust", "aluminum_dust", "manyullyn_dust",
"alubrass_dust" };
}
@@ -1,19 +1,23 @@
package tconstruct.tools.items;
import cpw.mods.fml.relauncher.*;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import mantle.items.abstracts.CraftingItem;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.*;
import net.minecraft.util.StatCollector;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.crafting.PatternBuilder.MaterialSet;
import tconstruct.library.util.IPattern;
import cpw.mods.fml.relauncher.*;
public class Pattern extends CraftingItem implements IPattern {
public Pattern(String patternType, String folder) {
this(patternName, getPatternNames(patternType), folder);
}
@@ -32,34 +36,10 @@ public class Pattern extends CraftingItem implements IPattern {
return names;
}
private static final String[] patternName = new String[] {
"ingot",
"rod",
"pickaxe",
"shovel",
"axe",
"swordblade",
"largeguard",
"mediumguard",
"crossbar",
"binding",
"frypan",
"sign",
"knifeblade",
"chisel",
"largerod",
"toughbinding",
"largeplate",
"broadaxe",
"scythe",
"excavator",
"largeblade",
"hammerhead",
"fullguard",
"bowstring",
"fletching",
"arrowhead"
};
private static final String[] patternName = new String[] { "ingot", "rod", "pickaxe", "shovel", "axe", "swordblade",
"largeguard", "mediumguard", "crossbar", "binding", "frypan", "sign", "knifeblade", "chisel", "largerod",
"toughbinding", "largeplate", "broadaxe", "scythe", "excavator", "largeblade", "hammerhead", "fullguard",
"bowstring", "fletching", "arrowhead" };
private static final Map<Integer, Integer> patternCosts = buildPatternCostMap();
@@ -1,8 +1,7 @@
package tconstruct.tools.items;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.*;
import java.util.List;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
@@ -12,19 +11,23 @@ import net.minecraft.init.Items;
import net.minecraft.item.*;
import net.minecraft.util.*;
import net.minecraft.world.World;
import tconstruct.client.TProxyClient;
import tconstruct.library.tools.ToolCore;
import tconstruct.world.entity.BlueSlime;
import tconstruct.world.entity.KingBlueSlime;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.relauncher.*;
// spawn egg.
public class TitleIcon extends Item {
int[] primaryColor = {0x66BBE8, 0x66BBE8};
int[] secondaryColor = {0x1567BF, 0xFFEC6E};
String[] mobNames = {"TConstruct.EdibleSlime", "TConstruct.KingSlime"};
String[] achievementIconNames =
new String[] {"tinkerer", "preparedFight", "proTinkerer", "enemySlayer", "dualConvenience"};
int[] primaryColor = { 0x66BBE8, 0x66BBE8 };
int[] secondaryColor = { 0x1567BF, 0xFFEC6E };
String[] mobNames = { "TConstruct.EdibleSlime", "TConstruct.KingSlime" };
String[] achievementIconNames = new String[] { "tinkerer", "preparedFight", "proTinkerer", "enemySlayer",
"dualConvenience" };
IIcon[] achievementIcons = new IIcon[achievementIconNames.length];
public TitleIcon() {
@@ -100,17 +103,8 @@ public class TitleIcon extends Item {
}
@Override
public boolean onItemUse(
ItemStack stack,
EntityPlayer player,
World world,
int posX,
int posY,
int posZ,
int par7,
float par8,
float par9,
float par10) {
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int posX, int posY, int posZ, int par7,
float par8, float par9, float par10) {
if (!world.isRemote) {
Block b = world.getBlock(posX, posY, posZ);
posX += Facing.offsetsXForSide[par7];
@@ -138,8 +132,8 @@ public class TitleIcon extends Item {
return true;
}
public static EntityLiving activateSpawnEgg(
ItemStack stack, World world, double posX, double posY, double posZ, int par7) {
public static EntityLiving activateSpawnEgg(ItemStack stack, World world, double posX, double posY, double posZ,
int par7) {
Block b = world.getBlock((int) posX, (int) posY, (int) posZ);
posX += Facing.offsetsXForSide[par7];
posY += Facing.offsetsYForSide[par7];
@@ -183,8 +177,8 @@ public class TitleIcon extends Item {
}
}
public static void spawnBossSlime(
double x, double y, double z, KingBlueSlime entity, World world, EntityPlayer player) {
public static void spawnBossSlime(double x, double y, double z, KingBlueSlime entity, World world,
EntityPlayer player) {
if (!world.isRemote) {
entity.setPosition(x, y, z);
entity.setSlimeSize(8);
@@ -1,16 +1,20 @@
package tconstruct.tools.items;
import java.util.List;
import mantle.items.abstracts.CraftingItem;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.*;
import net.minecraft.util.StatCollector;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.util.IToolPart;
import tconstruct.tools.TinkerTools;
@Deprecated
public class ToolPart extends CraftingItem implements IToolPart {
public String partName;
public ToolPart(String textureType, String name) {
@@ -47,75 +51,13 @@ public class ToolPart extends CraftingItem implements IToolPart {
return names;
}
public static final String[] toolMaterialNames = new String[] {
"Wood",
"Stone",
"Iron",
"Flint",
"Cactus",
"Bone",
"Obsidian",
"Netherrack",
"Slime",
"Paper",
"Cobalt",
"Ardite",
"Manyullyn",
"Copper",
"Bronze",
"Alumite",
"Steel",
"Blue Slime",
"Pig Iron",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"Thaumium"
};
public static final String[] toolMaterialNames = new String[] { "Wood", "Stone", "Iron", "Flint", "Cactus", "Bone",
"Obsidian", "Netherrack", "Slime", "Paper", "Cobalt", "Ardite", "Manyullyn", "Copper", "Bronze", "Alumite",
"Steel", "Blue Slime", "Pig Iron", "", "", "", "", "", "", "", "", "", "", "", "", "Thaumium" };
public static final String[] toolTextureNames = new String[] {
"wood",
"stone",
"iron",
"flint",
"cactus",
"bone",
"obsidian",
"netherrack",
"slime",
"paper",
"cobalt",
"ardite",
"manyullyn",
"copper",
"bronze",
"alumite",
"steel",
"blueslime",
"pigiron",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"",
"thaumium"
};
public static final String[] toolTextureNames = new String[] { "wood", "stone", "iron", "flint", "cactus", "bone",
"obsidian", "netherrack", "slime", "paper", "cobalt", "ardite", "manyullyn", "copper", "bronze", "alumite",
"steel", "blueslime", "pigiron", "", "", "", "", "", "", "", "", "", "", "", "", "thaumium" };
@Override
public void getSubItems(Item b, CreativeTabs tab, List list) {
@@ -1,6 +1,7 @@
package tconstruct.tools.items;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
@@ -1,9 +1,11 @@
package tconstruct.tools.items;
import java.util.List;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import tconstruct.library.TConstructRegistry;
import tconstruct.library.tools.DynamicToolPart;
@@ -7,11 +7,12 @@ import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.world.World;
/* Slots
* 0: Battlesign item
/*
* Slots 0: Battlesign item
*/
public class BattlesignLogic extends EquipLogic {
protected String[] text;
public BattlesignLogic() {
@@ -1,7 +1,9 @@
package tconstruct.tools.logic;
import java.lang.ref.WeakReference;
import mantle.blocks.abstracts.InventoryLogic;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
@@ -13,10 +15,12 @@ import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.tools.inventory.CraftingStationContainer;
import tconstruct.util.config.PHConstruct;
public class CraftingStationLogic extends InventoryLogic implements ISidedInventory {
public ForgeDirection chestDirection = ForgeDirection.UNKNOWN;
public int chestSize;
public WeakReference<IInventory> chest;
@@ -65,9 +69,9 @@ public class CraftingStationLogic extends InventoryLogic implements ISidedInvent
for (final ForgeDirection dir : ForgeDirection.VALID_DIRECTIONS) {
final int xPos = x + dir.offsetX, yPos = y + dir.offsetY, zPos = z + dir.offsetZ;
final TileEntity tile = world.getTileEntity(xPos, yPos, zPos);
if (!(tile instanceof IInventory)
|| (tile instanceof CraftingStationLogic)
|| isBlacklisted(tile.getClass())) continue;
if (!(tile instanceof IInventory) || (tile instanceof CraftingStationLogic)
|| isBlacklisted(tile.getClass()))
continue;
final IInventory inv = (IInventory) tile;
@@ -83,20 +87,15 @@ public class CraftingStationLogic extends InventoryLogic implements ISidedInvent
}
if (tile instanceof ISidedInventory
&& ((ISidedInventory) tile)
.getAccessibleSlotsFromSide(
dir.getOpposite().ordinal())
.length
== 0) continue;
&& ((ISidedInventory) tile).getAccessibleSlotsFromSide(dir.getOpposite().ordinal()).length == 0)
continue;
if (chest == null && inv.isUseableByPlayer(inventoryplayer.player)) {
chest = new WeakReference<>(inv);
chestDirection = dir;
invColumns = 6;
chestSize = tile instanceof ISidedInventory
? ((ISidedInventory) tile)
.getAccessibleSlotsFromSide(dir.getOpposite().ordinal())
.length
? ((ISidedInventory) tile).getAccessibleSlotsFromSide(dir.getOpposite().ordinal()).length
: inv.getSizeInventory();
if (tile instanceof TileEntityChest) {
@@ -157,7 +156,7 @@ public class CraftingStationLogic extends InventoryLogic implements ISidedInvent
return true;
}
@SuppressWarnings({"unchecked", "rawtypes"})
@SuppressWarnings({ "unchecked", "rawtypes" })
public static boolean isUseableByPlayer(EntityPlayer player, WeakReference[] inventories) {
for (WeakReference<IInventory> ref : inventories) {
if (ref != null) {
@@ -171,7 +170,7 @@ public class CraftingStationLogic extends InventoryLogic implements ISidedInvent
@SuppressWarnings("rawtypes")
public WeakReference[] getInventories() {
return new WeakReference[] {this.chest, this.doubleChest, this.patternChest, this.furnace};
return new WeakReference[] { this.chest, this.doubleChest, this.patternChest, this.furnace };
}
@Override
@@ -1,15 +1,14 @@
package tconstruct.tools.logic;
import mantle.blocks.abstracts.InventoryLogic;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager;
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
/* Slots
* 0: Frying pan item
* 1: Fuel
* 2-9: Food
/*
* Slots 0: Frying pan item 1: Fuel 2-9: Food
*/
public abstract class EquipLogic extends InventoryLogic {
@@ -1,8 +1,8 @@
package tconstruct.tools.logic;
import cpw.mods.fml.common.registry.GameRegistry;
import mantle.blocks.BlockUtils;
import mantle.blocks.iface.IActiveLogic;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.InventoryPlayer;
@@ -12,15 +12,16 @@ import net.minecraft.item.*;
import net.minecraft.item.crafting.FurnaceRecipes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import tconstruct.tools.inventory.FrypanContainer;
/* Slots
* 0: Frying pan item
* 1: Fuel
* 2-9: Food
import tconstruct.tools.inventory.FrypanContainer;
import cpw.mods.fml.common.registry.GameRegistry;
/*
* Slots 0: Frying pan item 1: Fuel 2-9: Food
*/
public class FrypanLogic extends EquipLogic implements IActiveLogic {
boolean active;
public int fuel;
public int fuelGague;
@@ -116,8 +117,7 @@ public class FrypanLogic extends EquipLogic implements IActiveLogic {
boolean placed = false;
while (ids < 10 && !placed) // Try to merge stacks first
{
if (inventory[ids] != null
&& inventory[ids].isItemEqual(result)
if (inventory[ids] != null && inventory[ids].isItemEqual(result)
&& inventory[ids].stackSize < inventory[ids].getMaxStackSize()) {
if (inventory[ids].stackSize + result.stackSize <= inventory[ids].getMaxStackSize()) {
inventory[ids].stackSize += result.stackSize;
@@ -150,11 +150,11 @@ public class FrypanLogic extends EquipLogic implements IActiveLogic {
public boolean canCook() {
for (int id = 2; id < 10; id++) {
if (inventory[id] == null) // Nothing here!
continue;
continue;
ItemStack result = getResultFor(inventory[id]);
if (result == null) // Doesn't cook into anything
continue;
continue;
for (int slotid = 2; slotid < 10; slotid++) {
if (inventory[slotid] == null) return true;
@@ -174,7 +174,7 @@ public class FrypanLogic extends EquipLogic implements IActiveLogic {
if (stack != null) {
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(stack);
if (result != null && result.getItem() instanceof ItemFood) // Only valid for food
return result.copy();
return result.copy();
}
return null;
}
@@ -200,12 +200,9 @@ public class FrypanLogic extends EquipLogic implements IActiveLogic {
return 300;
}
}
if (item instanceof ItemTool
&& ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200;
if (item instanceof ItemSword
&& ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200;
if (item instanceof ItemHoe
&& ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200;
if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200;
if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200;
if (item instanceof ItemHoe && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200;
if (item == Items.stick) return 100;
if (item == Items.coal) return 800;
if (item == Items.lava_bucket) return 20000;
@@ -1,9 +1,9 @@
package tconstruct.tools.logic;
import cpw.mods.fml.common.registry.GameRegistry;
import mantle.blocks.BlockUtils;
import mantle.blocks.abstracts.InventoryLogic;
import mantle.blocks.iface.*;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.EntityLivingBase;
@@ -18,25 +18,25 @@ import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import tconstruct.tools.inventory.FurnaceContainer;
/* Slots
* 0: Input
* 1: Fuel
* 2: Output
* 3-16: Chest
import tconstruct.tools.inventory.FurnaceContainer;
import cpw.mods.fml.common.registry.GameRegistry;
/*
* Slots 0: Input 1: Fuel 2: Output 3-16: Chest
*/
public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacingLogic, ISidedInventory {
boolean active = false;
public int fuel;
public int fuelGague;
public int progress;
public int fuelScale = 200;
byte direction;
private static final int[] slots_top = new int[] {0};
private static final int[] slots_bottom = new int[] {2, 1};
private static final int[] slots_sides = new int[] {1};
private static final int[] slots_top = new int[] { 0 };
private static final int[] slots_bottom = new int[] { 2, 1 };
private static final int[] slots_sides = new int[] { 1 };
public FurnaceLogic() {
super(3);
@@ -135,7 +135,7 @@ public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacin
public boolean canSmelt() {
if (inventory[0] == null) // Nothing here!
return false;
return false;
else {
ItemStack itemstack = FurnaceRecipes.smelting().getSmeltingResult(this.inventory[0]);
if (itemstack == null) return false;
@@ -153,7 +153,7 @@ public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacin
public ItemStack getResultFor(ItemStack stack) {
ItemStack result = FurnaceRecipes.smelting().getSmeltingResult(stack);
if (result != null) // Only valid for food
return result.copy();
return result.copy();
return null;
}
@@ -184,12 +184,9 @@ public class FurnaceLogic extends InventoryLogic implements IActiveLogic, IFacin
}
}
if (item instanceof ItemTool
&& ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200;
if (item instanceof ItemSword
&& ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200;
if (item instanceof ItemHoe
&& ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200;
if (item instanceof ItemTool && ((ItemTool) item).getToolMaterialName().equals("WOOD")) return 200;
if (item instanceof ItemSword && ((ItemSword) item).getToolMaterialName().equals("WOOD")) return 200;
if (item instanceof ItemHoe && ((ItemHoe) item).getToolMaterialName().equals("WOOD")) return 200;
if (item == Items.stick) return 100;
if (item == Items.coal) return 1600;
if (item == Items.lava_bucket) return 20000;
@@ -1,17 +1,20 @@
package tconstruct.tools.logic;
import mantle.blocks.abstracts.InventoryLogic;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import tconstruct.library.crafting.PatternBuilder;
import tconstruct.library.util.IPattern;
import tconstruct.tools.inventory.*;
public class PartBuilderLogic extends InventoryLogic implements ISidedInventory {
boolean craftedTop;
boolean craftedBottom;
@@ -1,14 +1,17 @@
package tconstruct.tools.logic;
import mantle.blocks.abstracts.InventoryLogic;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import tconstruct.library.util.IPattern;
import tconstruct.tools.inventory.PatternChestContainer;
public class PatternChestLogic extends InventoryLogic {
public PatternChestLogic() {
super(30);
}
@@ -1,16 +1,19 @@
package tconstruct.tools.logic;
import mantle.blocks.abstracts.InventoryLogic;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import tconstruct.library.crafting.StencilBuilder;
import tconstruct.tools.inventory.PatternShaperContainer;
public class StencilTableLogic extends InventoryLogic implements ISidedInventory {
private ItemStack selectedStack;
public StencilTableLogic() {
@@ -32,13 +35,10 @@ public class StencilTableLogic extends InventoryLogic implements ISidedInventory
return new PatternShaperContainer(inventoryplayer, this);
}
/*@Override
public void onInventoryChanged()
{
if (inventory[0] == null)
inventory[1] = null;
super.onInventoryChanged();
}*/
/*
* @Override public void onInventoryChanged() { if (inventory[0] == null) inventory[1] = null;
* super.onInventoryChanged(); }
*/
public void setSelectedPattern(ItemStack stack) {
selectedStack = stack;
@@ -4,14 +4,17 @@ import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.*;
import net.minecraft.item.ItemStack;
import net.minecraft.world.World;
import tconstruct.library.crafting.*;
import tconstruct.library.modifier.IModifyable;
import tconstruct.tools.inventory.ToolForgeContainer;
/* Simple class for storing items in the block
/*
* Simple class for storing items in the block
*/
public class ToolForgeLogic extends ToolStationLogic implements ISidedInventory {
ItemStack previousTool;
String toolName;
@@ -38,15 +41,15 @@ public class ToolForgeLogic extends ToolStationLogic implements ISidedInventory
{
if (inventory[2] == null && inventory[3] == null && inventory[4] == null) output = inventory[1].copy();
else {
output = ModifyBuilder.instance.modifyItem(
inventory[1], new ItemStack[] {inventory[2], inventory[3], inventory[4]});
output = ModifyBuilder.instance
.modifyItem(inventory[1], new ItemStack[] { inventory[2], inventory[3], inventory[4] });
}
} else
// Build new item
{
toolName = name;
ItemStack tool =
ToolBuilder.instance.buildTool(inventory[1], inventory[2], inventory[3], inventory[4], name);
ItemStack tool = ToolBuilder.instance
.buildTool(inventory[1], inventory[2], inventory[3], inventory[4], name);
if (inventory[0] == null) output = tool;
else if (tool != null) {
// NBTTagCompound tags = tool.getTagCompound();
@@ -57,23 +60,14 @@ public class ToolForgeLogic extends ToolStationLogic implements ISidedInventory
}
}
if (!name.equals("")) // Name item
output = tryRenameTool(output, name);
output = tryRenameTool(output, name);
}
inventory[0] = output;
}
/*public void buildTool (String name)
{
toolName = name;
ItemStack tool = ToolBuilder.instance.buildTool(inventory[1], inventory[2], inventory[3], inventory[4], name);
if (inventory[0] == null)
inventory[0] = tool;
else
{
NBTTagCompound tags = inventory[0].getTagCompound();
if (!tags.getCompoundTag("InfiTool").hasKey("Built"))
{
inventory[0] = tool;
}
}
}*/
/*
* public void buildTool (String name) { toolName = name; ItemStack tool =
* ToolBuilder.instance.buildTool(inventory[1], inventory[2], inventory[3], inventory[4], name); if (inventory[0] ==
* null) inventory[0] = tool; else { NBTTagCompound tags = inventory[0].getTagCompound(); if
* (!tags.getCompoundTag("InfiTool").hasKey("Built")) { inventory[0] = tool; } } }
*/
}
@@ -1,6 +1,7 @@
package tconstruct.tools.logic;
import mantle.blocks.abstracts.InventoryLogic;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.init.Items;
import net.minecraft.inventory.Container;
@@ -8,15 +9,18 @@ import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import tconstruct.library.crafting.ModifyBuilder;
import tconstruct.library.crafting.ToolBuilder;
import tconstruct.library.modifier.IModifyable;
import tconstruct.tools.inventory.ToolStationContainer;
/* Simple class for storing items in the block
/*
* Simple class for storing items in the block
*/
public class ToolStationLogic extends InventoryLogic implements ISidedInventory {
public ItemStack previousTool;
public String toolName;
@@ -66,8 +70,8 @@ public class ToolStationLogic extends InventoryLogic implements ISidedInventory
{
if (inventory[2] == null && inventory[3] == null) output = inventory[1].copy();
else {
output = ModifyBuilder.instance.modifyItem(
inventory[1], new ItemStack[] {inventory[2], inventory[3]});
output = ModifyBuilder.instance
.modifyItem(inventory[1], new ItemStack[] { inventory[2], inventory[3] });
}
} else
// Build new item
@@ -77,14 +81,13 @@ public class ToolStationLogic extends InventoryLogic implements ISidedInventory
if (inventory[0] == null) output = tool;
else if (tool != null) {
NBTTagCompound tags = tool.getTagCompound();
if (!tags.getCompoundTag(((IModifyable) tool.getItem()).getBaseTagName())
.hasKey("Built")) {
if (!tags.getCompoundTag(((IModifyable) tool.getItem()).getBaseTagName()).hasKey("Built")) {
output = tool;
}
}
}
if (!name.equals("")) // Name item
output = tryRenameTool(output, name);
output = tryRenameTool(output, name);
}
inventory[0] = output;
}
@@ -1,11 +1,13 @@
package tconstruct.tools.model;
import cpw.mods.fml.client.registry.*;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.*;
public class BattlesignRender implements ISimpleBlockRenderingHandler {
public static int battlesignModelID = RenderingRegistry.getNextAvailableRenderId();
@Override
@@ -14,8 +16,8 @@ public class BattlesignRender implements ISimpleBlockRenderingHandler {
}
@Override
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) {
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID,
RenderBlocks renderer) {
renderer.setRenderBounds(0.45F, 0.0F, 0.45F, 0.55F, 1.125F, 0.55F);
renderer.renderStandardBlock(block, x, y, z);
renderFace(world, x, y, z, block, renderer);
@@ -5,7 +5,9 @@ import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.EnumChatFormatting;
import org.lwjgl.opengl.GL11;
import tconstruct.tools.logic.BattlesignLogic;
public class BattlesignTesr extends TileEntitySpecialRenderer {
@@ -42,16 +44,14 @@ public class BattlesignTesr extends TileEntitySpecialRenderer {
String[] strings = te.getText();
if (strings != null && strings.length > 0) {
float lum = calcLuminance(te.getWorldObj()
.getBlock(te.xCoord, te.yCoord, te.zCoord)
.colorMultiplier(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord));
float lum = calcLuminance(
te.getWorldObj().getBlock(te.xCoord, te.yCoord, te.zCoord)
.colorMultiplier(te.getWorldObj(), te.xCoord, te.yCoord, te.zCoord));
for (int i = 0; i < strings.length; i++) {
fr.drawString(
(lum >= 35F
? EnumChatFormatting.BLACK
: lum >= 31F ? EnumChatFormatting.GRAY : EnumChatFormatting.WHITE)
+ strings[i],
(lum >= 35F ? EnumChatFormatting.BLACK
: lum >= 31F ? EnumChatFormatting.GRAY : EnumChatFormatting.WHITE) + strings[i],
-fr.getStringWidth(strings[i]) / 2 + 40,
10 * i,
0);
@@ -1,7 +1,7 @@
package tconstruct.tools.model;
import cpw.mods.fml.relauncher.*;
import java.util.Random;
import net.minecraft.block.Block;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.FontRenderer;
@@ -13,12 +13,16 @@ import net.minecraft.entity.item.EntityItem;
import net.minecraft.item.*;
import net.minecraft.util.*;
import net.minecraftforge.client.ForgeHooksClient;
import org.lwjgl.opengl.*;
import cpw.mods.fml.relauncher.*;
@SideOnly(Side.CLIENT)
public class FancyItemRender extends Render {
private static final ResourceLocation field_110798_h =
new ResourceLocation("textures/misc/enchanted_item_glint.png");
private static final ResourceLocation field_110798_h = new ResourceLocation(
"textures/misc/enchanted_item_glint.png");
private final RenderBlocks itemRenderBlocks = new RenderBlocks();
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
@@ -64,91 +68,106 @@ public class FancyItemRender extends Render {
Block block = Block.getBlockFromItem(itemstack.getItem());
if (ForgeHooksClient.renderEntityItem(
par1EntityItem, itemstack, f2, f3, random, renderManager.renderEngine, field_147909_c, 1)) {
} else if (itemstack.getItemSpriteNumber() == 0
&& block != null
&& RenderBlocks.renderItemIn3d(
Block.getBlockFromItem(itemstack.getItem()).getRenderType())) {
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
par1EntityItem,
itemstack,
f2,
f3,
random,
renderManager.renderEngine,
field_147909_c,
1)) {} else
if (itemstack.getItemSpriteNumber() == 0 && block != null
&& RenderBlocks.renderItemIn3d(Block.getBlockFromItem(itemstack.getItem()).getRenderType())) {
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
if (renderInFrame) {
GL11.glScalef(1.25F, 1.25F, 1.25F);
GL11.glTranslatef(0.0F, 0.05F, 0.0F);
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
}
if (renderInFrame) {
GL11.glScalef(1.25F, 1.25F, 1.25F);
GL11.glTranslatef(0.0F, 0.05F, 0.0F);
GL11.glRotatef(-90.0F, 0.0F, 1.0F, 0.0F);
}
float f7 = 0.25F;
int j = block.getRenderType();
float f7 = 0.25F;
int j = block.getRenderType();
if (j == 1 || j == 19 || j == 12 || j == 2) {
f7 = 0.5F;
}
if (j == 1 || j == 19 || j == 12 || j == 2) {
f7 = 0.5F;
}
GL11.glScalef(f7, f7, f7);
GL11.glScalef(f7, f7, f7);
for (i = 0; i < b0; ++i) {
GL11.glPushMatrix();
for (i = 0; i < b0; ++i) {
GL11.glPushMatrix();
if (i > 0) {
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
GL11.glTranslatef(f5, f4, f6);
}
if (i > 0) {
f5 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
f4 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
f6 = (this.random.nextFloat() * 2.0F - 1.0F) * 0.2F / f7;
GL11.glTranslatef(f5, f4, f6);
}
f5 = 1.0F;
this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5);
GL11.glPopMatrix();
}
} else {
float f8;
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses()) {
if (renderInFrame) {
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
} else {
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k) {
this.random.setSeed(187L);
IIcon icon = itemstack.getItem().getIcon(itemstack, k);
f8 = 1.0F;
if (this.renderWithColor) {
i = itemstack.getItem().getColorFromItemStack(itemstack, k);
f5 = (float) (i >> 16 & 255) / 255.0F;
f4 = (float) (i >> 8 & 255) / 255.0F;
f6 = (float) (i & 255) / 255.0F;
GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
this.renderDroppedItem(par1EntityItem, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k);
f5 = 1.0F;
this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5);
GL11.glPopMatrix();
}
} else {
this.renderDroppedItem(par1EntityItem, icon, b0, par9, 1.0F, 1.0F, 1.0F, k);
float f8;
if (itemstack.getItemSpriteNumber() == 1
&& itemstack.getItem().requiresMultipleRenderPasses()) {
if (renderInFrame) {
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
} else {
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
for (int k = 0; k
< itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k) {
this.random.setSeed(187L);
IIcon icon = itemstack.getItem().getIcon(itemstack, k);
f8 = 1.0F;
if (this.renderWithColor) {
i = itemstack.getItem().getColorFromItemStack(itemstack, k);
f5 = (float) (i >> 16 & 255) / 255.0F;
f4 = (float) (i >> 8 & 255) / 255.0F;
f6 = (float) (i & 255) / 255.0F;
GL11.glColor4f(f5 * f8, f4 * f8, f6 * f8, 1.0F);
this.renderDroppedItem(
par1EntityItem,
icon,
b0,
par9,
f5 * f8,
f4 * f8,
f6 * f8,
k);
} else {
this.renderDroppedItem(par1EntityItem, icon, b0, par9, 1.0F, 1.0F, 1.0F, k);
}
}
} else {
if (renderInFrame) {
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
} else {
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
IIcon icon1 = itemstack.getIconIndex();
if (this.renderWithColor) {
int l = itemstack.getItem().getColorFromItemStack(itemstack, 0);
f8 = (float) (l >> 16 & 255) / 255.0F;
float f9 = (float) (l >> 8 & 255) / 255.0F;
f5 = (float) (l & 255) / 255.0F;
f4 = 1.0F;
this.renderDroppedItem(par1EntityItem, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
} else {
this.renderDroppedItem(par1EntityItem, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
}
}
}
}
} else {
if (renderInFrame) {
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
} else {
GL11.glScalef(0.5F, 0.5F, 0.5F);
}
IIcon icon1 = itemstack.getIconIndex();
if (this.renderWithColor) {
int l = itemstack.getItem().getColorFromItemStack(itemstack, 0);
f8 = (float) (l >> 16 & 255) / 255.0F;
float f9 = (float) (l >> 8 & 255) / 255.0F;
f5 = (float) (l & 255) / 255.0F;
f4 = 1.0F;
this.renderDroppedItem(par1EntityItem, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
} else {
this.renderDroppedItem(par1EntityItem, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
}
}
}
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
GL11.glPopMatrix();
@@ -156,33 +175,26 @@ public class FancyItemRender extends Render {
}
protected ResourceLocation func_110796_a(EntityItem par1EntityItem) {
return this.renderManager.renderEngine.getResourceLocation(
par1EntityItem.getEntityItem().getItemSpriteNumber());
return this.renderManager.renderEngine
.getResourceLocation(par1EntityItem.getEntityItem().getItemSpriteNumber());
}
/**
* Renders a dropped item
*/
private void renderDroppedItem(
EntityItem par1EntityItem, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7) {
private void renderDroppedItem(EntityItem par1EntityItem, IIcon par2Icon, int par3, float par4, float par5,
float par6, float par7) {
renderDroppedItem(par1EntityItem, par2Icon, par3, par4, par5, par6, par7, 0);
}
private void renderDroppedItem(
EntityItem par1EntityItem,
IIcon par2Icon,
int par3,
float par4,
float par5,
float par6,
float par7,
int pass) {
private void renderDroppedItem(EntityItem par1EntityItem, IIcon par2Icon, int par3, float par4, float par5,
float par6, float par7, int pass) {
Tessellator tessellator = Tessellator.instance;
if (par2Icon == null) {
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
ResourceLocation resourcelocation = texturemanager.getResourceLocation(
par1EntityItem.getEntityItem().getItemSpriteNumber());
ResourceLocation resourcelocation = texturemanager
.getResourceLocation(par1EntityItem.getEntityItem().getItemSpriteNumber());
par2Icon = ((TextureMap) texturemanager.getTexture(resourcelocation)).getAtlasSprite("missingno");
}
@@ -235,7 +247,14 @@ public class FancyItemRender extends Render {
GL11.glColor4f(par5, par6, par7, 1.0F);
ItemRenderer.renderItemIn2D(
tessellator, f5, f6, f4, f7, par2Icon.getIconWidth(), par2Icon.getIconHeight(), f12);
tessellator,
f5,
f6,
f4,
f7,
par2Icon.getIconWidth(),
par2Icon.getIconHeight(),
f12);
if (itemstack.hasEffect(pass)) {
GL11.glDepthFunc(GL11.GL_EQUAL);
@@ -274,22 +293,13 @@ public class FancyItemRender extends Render {
/**
* Renders the item's icon or block into the UI at the specified position.
*/
public void renderItemIntoGUI(
FontRenderer par1FontRenderer,
TextureManager par2TextureManager,
ItemStack par3ItemStack,
int par4,
int par5) {
public void renderItemIntoGUI(FontRenderer par1FontRenderer, TextureManager par2TextureManager,
ItemStack par3ItemStack, int par4, int par5) {
renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, false);
}
public void renderItemIntoGUI(
FontRenderer par1FontRenderer,
TextureManager par2TextureManager,
ItemStack par3ItemStack,
int par4,
int par5,
boolean renderEffect) {
public void renderItemIntoGUI(FontRenderer par1FontRenderer, TextureManager par2TextureManager,
ItemStack par3ItemStack, int par4, int par5, boolean renderEffect) {
Item k = par3ItemStack.getItem();
int l = par3ItemStack.getItemDamage();
IIcon object = par3ItemStack.getIconIndex();
@@ -299,8 +309,7 @@ public class FancyItemRender extends Render {
float f2;
Block block = Block.getBlockFromItem(k); // (k < Block.blocksList.length ? Block.blocksList[k] : null);
if (par3ItemStack.getItemSpriteNumber() == 0
&& block != null
if (par3ItemStack.getItemSpriteNumber() == 0 && block != null
&& RenderBlocks.renderItemIn3d(block.getRenderType())) {
par2TextureManager.bindTexture(TextureMap.locationBlocksTexture);
GL11.glPushMatrix();
@@ -329,8 +338,7 @@ public class FancyItemRender extends Render {
for (int j1 = 0; j1 < k.getRenderPasses(l); ++j1) {
par2TextureManager.bindTexture(
par3ItemStack.getItemSpriteNumber() == 0
? TextureMap.locationBlocksTexture
par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture
: TextureMap.locationItemsTexture);
IIcon icon = k.getIcon(par3ItemStack, j1);
int k1 = k.getColorFromItemStack(par3ItemStack, j1);
@@ -352,13 +360,12 @@ public class FancyItemRender extends Render {
GL11.glEnable(GL11.GL_LIGHTING);
} else {
GL11.glDisable(GL11.GL_LIGHTING);
ResourceLocation resourcelocation =
par2TextureManager.getResourceLocation(par3ItemStack.getItemSpriteNumber());
ResourceLocation resourcelocation = par2TextureManager
.getResourceLocation(par3ItemStack.getItemSpriteNumber());
par2TextureManager.bindTexture(resourcelocation);
if (object == null) {
object = ((TextureMap)
Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation))
object = ((TextureMap) Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation))
.getAtlasSprite("missingno");
}
@@ -402,38 +409,29 @@ public class FancyItemRender extends Render {
/**
* Render the item's icon or block into the GUI, including the glint effect.
*/
public void renderItemAndEffectIntoGUI(
FontRenderer par1FontRenderer,
TextureManager par2TextureManager,
ItemStack par3ItemStack,
int par4,
int par5) {
public void renderItemAndEffectIntoGUI(FontRenderer par1FontRenderer, TextureManager par2TextureManager,
ItemStack par3ItemStack, int par4, int par5) {
if (par3ItemStack != null) {
if (!ForgeHooksClient.renderInventoryItem(
field_147909_c, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float) par4, (float)
par5)) {
field_147909_c,
par2TextureManager,
par3ItemStack,
renderWithColor,
zLevel,
(float) par4,
(float) par5)) {
this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true);
}
/* Modders must handle this themselves if they use custom renderers!
if (par3ItemStack.hasEffect())
{
GL11.glDepthFunc(GL11.GL_GREATER);
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDepthMask(false);
par2TextureManager.bindTexture(field_110798_h);
this.zLevel -= 50.0F;
GL11.glEnable(GL11.GL_BLEND);
GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR);
GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20);
GL11.glDisable(GL11.GL_BLEND);
GL11.glDepthMask(true);
this.zLevel += 50.0F;
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glDepthFunc(GL11.GL_LEQUAL);
}
*/
/*
* Modders must handle this themselves if they use custom renderers! if (par3ItemStack.hasEffect()) {
* GL11.glDepthFunc(GL11.GL_GREATER); GL11.glDisable(GL11.GL_LIGHTING); GL11.glDepthMask(false);
* par2TextureManager.bindTexture(field_110798_h); this.zLevel -= 50.0F; GL11.glEnable(GL11.GL_BLEND);
* GL11.glBlendFunc(GL11.GL_DST_COLOR, GL11.GL_DST_COLOR); GL11.glColor4f(0.5F, 0.25F, 0.8F, 1.0F);
* this.renderGlint(par4 * 431278612 + par5 * 32178161, par4 - 2, par5 - 2, 20, 20);
* GL11.glDisable(GL11.GL_BLEND); GL11.glDepthMask(true); this.zLevel += 50.0F;
* GL11.glEnable(GL11.GL_LIGHTING); GL11.glDepthFunc(GL11.GL_LEQUAL); }
*/
}
}
@@ -449,8 +447,7 @@ public class FancyItemRender extends Render {
float f = 0.00390625F;
float f1 = 0.00390625F;
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873))
/ (3000.0F + (float) (j1 * 1873))
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873)) / (3000.0F + (float) (j1 * 1873))
* 256.0F;
float f3 = 0.0F;
Tessellator tessellator = Tessellator.instance;
@@ -462,7 +459,11 @@ public class FancyItemRender extends Render {
tessellator.startDrawingQuads();
tessellator.addVertexWithUV(
par2 + 0, par3 + par5, this.zLevel, (f2 + (float) par5 * f4) * f, (f3 + (float) par5) * f1);
par2 + 0,
par3 + par5,
this.zLevel,
(f2 + (float) par5 * f4) * f,
(f3 + (float) par5) * f1);
tessellator.addVertexWithUV(
par2 + par4,
par3 + par5,
@@ -479,41 +480,33 @@ public class FancyItemRender extends Render {
* Renders the item's overlay information. Examples being stack count or damage on top of the item's image at the
* specified position.
*/
public void renderItemOverlayIntoGUI(
FontRenderer par1FontRenderer,
TextureManager par2TextureManager,
ItemStack par3ItemStack,
int par4,
int par5) {
public void renderItemOverlayIntoGUI(FontRenderer par1FontRenderer, TextureManager par2TextureManager,
ItemStack par3ItemStack, int par4, int par5) {
this.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, null);
}
public void renderItemOverlayIntoGUI(
FontRenderer par1FontRenderer,
TextureManager par2TextureManager,
ItemStack par3ItemStack,
int par4,
int par5,
String par6Str) {
public void renderItemOverlayIntoGUI(FontRenderer par1FontRenderer, TextureManager par2TextureManager,
ItemStack par3ItemStack, int par4, int par5, String par6Str) {
if (par3ItemStack != null) {
if (par3ItemStack.stackSize > 1 || par6Str != null) {
String s1 = par6Str == null ? String.valueOf(par3ItemStack.stackSize) : par6Str;
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
par1FontRenderer.drawStringWithShadow(
s1, par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1), par5 + 6 + 3, 16777215);
s1,
par4 + 19 - 2 - par1FontRenderer.getStringWidth(s1),
par5 + 6 + 3,
16777215);
GL11.glEnable(GL11.GL_LIGHTING);
GL11.glEnable(GL11.GL_DEPTH_TEST);
}
if (par3ItemStack.isItemDamaged()) {
int k = (int) Math.round(13.0D
- (double) par3ItemStack.getItemDamageForDisplay()
* 13.0D
int k = (int) Math.round(
13.0D - (double) par3ItemStack.getItemDamageForDisplay() * 13.0D
/ (double) par3ItemStack.getMaxDamage());
int l = (int) Math.round(255.0D
- (double) par3ItemStack.getItemDamageForDisplay()
* 255.0D
int l = (int) Math.round(
255.0D - (double) par3ItemStack.getItemDamageForDisplay() * 255.0D
/ (double) par3ItemStack.getMaxDamage());
GL11.glDisable(GL11.GL_LIGHTING);
GL11.glDisable(GL11.GL_DEPTH_TEST);
@@ -533,7 +526,7 @@ public class FancyItemRender extends Render {
}
/**
* Adds a quad to the tesselator at the specified position with the set width and height and color. Args:
* Adds a quad to the tesselator at the specified position with the set width and height and color. Args:
* tessellator, x, y, width, height, color
*/
private void renderQuad(Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6) {
@@ -574,6 +567,7 @@ public class FancyItemRender extends Render {
/**
* Items should spread out when rendered in 3d?
*
* @return
*/
public boolean shouldSpreadItems() {
@@ -582,6 +576,7 @@ public class FancyItemRender extends Render {
/**
* Items should have a bob effect
*
* @return
*/
public boolean shouldBob() {
@@ -598,8 +593,8 @@ public class FancyItemRender extends Render {
}
/**
* Allows for a subclass to override how many rendered items appear in a
* "mini item 3d stack"
* Allows for a subclass to override how many rendered items appear in a "mini item 3d stack"
*
* @param stack
* @return
*/
@@ -1,11 +1,13 @@
package tconstruct.tools.model;
import cpw.mods.fml.client.registry.*;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderBlocks;
import net.minecraft.world.IBlockAccess;
import cpw.mods.fml.client.registry.*;
public class FrypanRender implements ISimpleBlockRenderingHandler {
public static int frypanModelID = RenderingRegistry.getNextAvailableRenderId();
@Override
@@ -14,8 +16,8 @@ public class FrypanRender implements ISimpleBlockRenderingHandler {
}
@Override
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) {
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID,
RenderBlocks renderer) {
renderer.setRenderBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.125F, 1.0F);
renderer.renderStandardBlock(block, x, y, z);
renderer.setRenderBounds(0.0F, 0.125F, 0.0F, 0.125F, 0.25F, 1.0F);
@@ -1,13 +1,16 @@
package tconstruct.tools.model;
import cpw.mods.fml.client.registry.*;
import net.minecraft.block.Block;
import net.minecraft.client.renderer.*;
import net.minecraft.world.IBlockAccess;
import org.lwjgl.opengl.GL11;
import tconstruct.tools.TinkerTools;
import cpw.mods.fml.client.registry.*;
public class TableRender implements ISimpleBlockRenderingHandler {
public static int model = RenderingRegistry.getNextAvailableRenderId();
@Override
@@ -35,8 +38,8 @@ public class TableRender implements ISimpleBlockRenderingHandler {
}
@Override
public boolean renderWorldBlock(
IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer) {
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelID,
RenderBlocks renderer) {
if (modelID == model) {
int metadata = world.getBlockMetadata(x, y, z);
// until we get the new model.. finally...