mirror of
https://github.com/GTNewHorizons/TinkersConstruct.git
synced 2026-11-19 03:49:29 +00:00
Fix JABBA-related issues with crafting station slots (#54)
* Fix shift-merging tools voiding items fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/11392> * Change 0-sized ItemStacks into null stacks in crafting station attached slots Fixes <https://github.com/GTNewHorizons/GT-New-Horizons-Modpack/issues/10425> * Update buildscript * spotlessApply
This commit is contained in:
1 parent
18bfeaff32
commit
39be06c23b
571 files changed
+25959
-28223
No files matched your search
@@ -12,14 +12,14 @@ import cpw.mods.fml.common.network.NetworkRegistry;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import cpw.mods.fml.common.registry.VillagerRegistry;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
import mantle.pulsar.config.ForgeCFG;
|
||||
import mantle.pulsar.control.PulseManager;
|
||||
import net.minecraft.world.gen.structure.MapGenStructureIO;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import tconstruct.achievements.AchievementEvents;
|
||||
import tconstruct.achievements.TAchievements;
|
||||
import tconstruct.api.TConstructAPI;
|
||||
@@ -36,13 +36,13 @@ import tconstruct.library.crafting.LiquidCasting;
|
||||
import tconstruct.mechworks.TinkerMechworks;
|
||||
import tconstruct.mechworks.landmine.behavior.Behavior;
|
||||
import tconstruct.mechworks.landmine.behavior.stackCombo.SpecialStackHandler;
|
||||
import tconstruct.plugins.gears.TinkerGears;
|
||||
import tconstruct.plugins.TinkerThaumcraft;
|
||||
import tconstruct.plugins.fmp.TinkerFMP;
|
||||
import tconstruct.plugins.gears.TinkerGears;
|
||||
import tconstruct.plugins.ic2.TinkerIC2;
|
||||
import tconstruct.plugins.imc.TinkerAE2;
|
||||
import tconstruct.plugins.imc.TinkerBuildCraft;
|
||||
import tconstruct.plugins.imc.TinkerMystcraft;
|
||||
import tconstruct.plugins.TinkerThaumcraft;
|
||||
import tconstruct.plugins.imc.TinkerRfTools;
|
||||
import tconstruct.plugins.mfr.TinkerMFR;
|
||||
import tconstruct.plugins.te4.TinkerTE4;
|
||||
@@ -61,51 +61,48 @@ import tconstruct.world.TinkerWorld;
|
||||
import tconstruct.world.gen.SlimeIslandGen;
|
||||
import tconstruct.world.village.*;
|
||||
|
||||
import java.util.Map;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* TConstruct, the tool mod. Craft your tools with style, then modify until the
|
||||
* original is gone!
|
||||
*
|
||||
*
|
||||
* @author mDiyo
|
||||
*/
|
||||
|
||||
@Mod(modid = TConstruct.modID, name = "TConstruct", version = TConstruct.modVersion,
|
||||
dependencies = "required-after:Forge@[10.13.3.1384,11.14);" +
|
||||
"required-after:Mantle@[0.3.2,1.7.10),[1.7.10-0.3.2,);" + //make sure we still have the 0.3.2 requirement, even without the 1.7.10 prefix
|
||||
"after:MineFactoryReloaded@[1.7.10R2.8.0RC7,);" +
|
||||
"after:ThermalExpansion@[1.7.10R4.0.0RC2,);" +
|
||||
"after:ThermalFoundation@[1.7.10R1.0.0RC3,);" +
|
||||
"after:armourersWorkshop@[1.7.10-0.28.0,);" +
|
||||
"after:CoFHAPI|energy;" +
|
||||
"after:CoFHCore;" +
|
||||
"after:battlegear2;" +
|
||||
"after:ZeldaItemAPI;" +
|
||||
"after:DynamicSkillsAPI;" +
|
||||
"after:NotEnoughItems;" +
|
||||
"after:Waila;" +
|
||||
"before:GalacticraftCore;" +
|
||||
"before:UndergroundBiomes"
|
||||
)
|
||||
public class TConstruct
|
||||
{
|
||||
@Mod(
|
||||
modid = TConstruct.modID,
|
||||
name = "TConstruct",
|
||||
version = TConstruct.modVersion,
|
||||
dependencies =
|
||||
"required-after:Forge@[10.13.3.1384,11.14);" + "required-after:Mantle@[0.3.2,1.7.10),[1.7.10-0.3.2,);"
|
||||
+ // make sure we still have the 0.3.2 requirement, even without the 1.7.10 prefix
|
||||
"after:MineFactoryReloaded@[1.7.10R2.8.0RC7,);"
|
||||
+ "after:ThermalExpansion@[1.7.10R4.0.0RC2,);"
|
||||
+ "after:ThermalFoundation@[1.7.10R1.0.0RC3,);"
|
||||
+ "after:armourersWorkshop@[1.7.10-0.28.0,);"
|
||||
+ "after:CoFHAPI|energy;"
|
||||
+ "after:CoFHCore;"
|
||||
+ "after:battlegear2;"
|
||||
+ "after:ZeldaItemAPI;"
|
||||
+ "after:DynamicSkillsAPI;"
|
||||
+ "after:NotEnoughItems;"
|
||||
+ "after:Waila;"
|
||||
+ "before:GalacticraftCore;"
|
||||
+ "before:UndergroundBiomes")
|
||||
public class TConstruct {
|
||||
public static final String modVersion = "GRADLETOKEN_VERSION";
|
||||
/** The value of one ingot in millibuckets */
|
||||
public static final int ingotLiquidValue = 144;
|
||||
|
||||
public static final int oreLiquidValue = ingotLiquidValue * 2;
|
||||
public static final int blockLiquidValue = ingotLiquidValue * 9;
|
||||
public static final int chunkLiquidValue = ingotLiquidValue / 2;
|
||||
public static final int nuggetLiquidValue = ingotLiquidValue / 9;
|
||||
public static final int stoneLiquidValue = ingotLiquidValue/8;
|
||||
public static final int stoneLiquidValue = ingotLiquidValue / 8;
|
||||
|
||||
public static final int liquidUpdateAmount = 6;
|
||||
public static final String modID = "TConstruct";
|
||||
public static final Logger logger = LogManager.getLogger(modID);
|
||||
public static final PacketPipeline packetPipeline = new PacketPipeline();
|
||||
public static Random random = new Random();
|
||||
|
||||
|
||||
|
||||
/* Instance of this mod, used for grabbing prototype fields */
|
||||
@Instance(modID)
|
||||
@@ -115,33 +112,28 @@ public class TConstruct
|
||||
public static TProxyCommon proxy;
|
||||
|
||||
/* Loads modules in a way that doesn't clutter the @Mod list */
|
||||
public static PulseManager pulsar = new PulseManager(modID, new ForgeCFG("TinkersModules", "Modules: Disabling these will disable a chunk of the mod"));
|
||||
public static PulseManager pulsar = new PulseManager(
|
||||
modID, new ForgeCFG("TinkersModules", "Modules: Disabling these will disable a chunk of the mod"));
|
||||
|
||||
public TConstruct()
|
||||
{
|
||||
if (Loader.isModLoaded("Natura"))
|
||||
{
|
||||
public TConstruct() {
|
||||
if (Loader.isModLoaded("Natura")) {
|
||||
logger.info("Natura, what are we going to do tomorrow night?");
|
||||
LogManager.getLogger("Natura").info("TConstruct, we're going to take over the world!");
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
logger.info("Preparing to take over the world");
|
||||
}
|
||||
|
||||
EnvironmentChecks.verifyEnvironmentSanity();
|
||||
}
|
||||
|
||||
//Force the client and server to have or not have this mod
|
||||
// Force the client and server to have or not have this mod
|
||||
@NetworkCheckHandler()
|
||||
public boolean matchModVersions (Map<String, String> remoteVersions, Side side)
|
||||
{
|
||||
public boolean matchModVersions(Map<String, String> remoteVersions, Side side) {
|
||||
return remoteVersions.containsKey("TConstruct") && modVersion.equals(remoteVersions.get("TConstruct"));
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preInit (FMLPreInitializationEvent event)
|
||||
{
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
PHConstruct.initProps(event.getModConfigurationDirectory());
|
||||
|
||||
pulsar.registerPulse(new TinkerWorld());
|
||||
@@ -179,7 +171,7 @@ public class TConstruct
|
||||
basinCasting = new LiquidCasting();
|
||||
chiselDetailing = new Detailing();
|
||||
|
||||
//GameRegistry.registerFuelHandler(content);
|
||||
// GameRegistry.registerFuelHandler(content);
|
||||
|
||||
playerTracker = new TPlayerHandler();
|
||||
// GameRegistry.registerPlayerTracker(playerTracker);
|
||||
@@ -189,22 +181,20 @@ public class TConstruct
|
||||
|
||||
pulsar.preInit(event);
|
||||
|
||||
if (PHConstruct.achievementsEnabled)
|
||||
{
|
||||
if (PHConstruct.achievementsEnabled) {
|
||||
TAchievements.addDefaultAchievements();
|
||||
}
|
||||
|
||||
if (PHConstruct.addToVillages)
|
||||
{
|
||||
if (PHConstruct.addToVillages) {
|
||||
// adds to the villager spawner egg
|
||||
VillagerRegistry.instance().registerVillagerId(78943);
|
||||
// moved down, not needed if 'addToVillages' is false
|
||||
if(PHConstruct.allowVillagerTrading)
|
||||
if (PHConstruct.allowVillagerTrading)
|
||||
VillagerRegistry.instance().registerVillageTradeHandler(78943, new TVillageTrades());
|
||||
|
||||
VillagerRegistry.instance().registerVillageCreationHandler(new VillageToolStationHandler());
|
||||
MapGenStructureIO.func_143031_a(ComponentToolWorkshop.class, "TConstruct:ToolWorkshopStructure");
|
||||
if(pulsar.isPulseLoaded("Tinkers' Smeltery")) {
|
||||
if (pulsar.isPulseLoaded("Tinkers' Smeltery")) {
|
||||
VillagerRegistry.instance().registerVillageCreationHandler(new VillageSmelteryHandler());
|
||||
MapGenStructureIO.func_143031_a(ComponentSmeltery.class, "TConstruct:SmelteryStructure");
|
||||
}
|
||||
@@ -214,12 +204,10 @@ public class TConstruct
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void init (FMLInitializationEvent event)
|
||||
{
|
||||
public void init(FMLInitializationEvent event) {
|
||||
packetPipeline.initalise();
|
||||
if (event.getSide() == Side.CLIENT)
|
||||
{
|
||||
//MinecraftForge.EVENT_BUS.register(new EventCloakRender());
|
||||
if (event.getSide() == Side.CLIENT) {
|
||||
// MinecraftForge.EVENT_BUS.register(new EventCloakRender());
|
||||
}
|
||||
|
||||
DimensionBlacklist.getBadBimensions();
|
||||
@@ -229,8 +217,7 @@ public class TConstruct
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void postInit (FMLPostInitializationEvent event)
|
||||
{
|
||||
public void postInit(FMLPostInitializationEvent event) {
|
||||
packetPipeline.postInitialise();
|
||||
Behavior.registerBuiltInBehaviors();
|
||||
SpecialStackHandler.registerBuiltInStackHandlers();
|
||||
@@ -238,45 +225,39 @@ public class TConstruct
|
||||
proxy.initialize();
|
||||
pulsar.postInit(event);
|
||||
|
||||
if (PHConstruct.achievementsEnabled)
|
||||
{
|
||||
if (PHConstruct.achievementsEnabled) {
|
||||
TAchievements.registerAchievementPane();
|
||||
MinecraftForge.EVENT_BUS.register(new AchievementEvents());
|
||||
}
|
||||
}
|
||||
|
||||
/** Called on server shutdown to prevent memory leaks */
|
||||
@EventHandler
|
||||
public void serverStopping(FMLServerStoppingEvent event) {
|
||||
TinkerGadgets.log.info("Cleaning up SlimeBounceHandler data.");
|
||||
SlimeBounceHandler.BOUNCING_ENTITIES.clear();
|
||||
}
|
||||
|
||||
/** Called on server shutdown to prevent memory leaks */
|
||||
@EventHandler
|
||||
public void serverStopping(FMLServerStoppingEvent event) {
|
||||
TinkerGadgets.log.info("Cleaning up SlimeBounceHandler data.");
|
||||
SlimeBounceHandler.BOUNCING_ENTITIES.clear();
|
||||
}
|
||||
|
||||
/* IMC Mod Support */
|
||||
@EventHandler
|
||||
public void handleIMC(FMLInterModComms.IMCEvent e)
|
||||
{
|
||||
public void handleIMC(FMLInterModComms.IMCEvent e) {
|
||||
IMCHandler.processIMC(e.getMessages());
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void loadComplete(FMLLoadCompleteEvent evt)
|
||||
{
|
||||
public void loadComplete(FMLLoadCompleteEvent evt) {
|
||||
IMCHandler.processIMC(FMLInterModComms.fetchRuntimeMessages(this));
|
||||
}
|
||||
|
||||
public static LiquidCasting getTableCasting ()
|
||||
{
|
||||
public static LiquidCasting getTableCasting() {
|
||||
return tableCasting;
|
||||
}
|
||||
|
||||
public static LiquidCasting getBasinCasting ()
|
||||
{
|
||||
public static LiquidCasting getBasinCasting() {
|
||||
return basinCasting;
|
||||
}
|
||||
|
||||
public static Detailing getChiselDetailing ()
|
||||
{
|
||||
public static Detailing getChiselDetailing() {
|
||||
return chiselDetailing;
|
||||
}
|
||||
|
||||
@@ -288,9 +269,8 @@ public class TConstruct
|
||||
@Mod.EventHandler
|
||||
public void missingMapping(FMLMissingMappingsEvent event) {
|
||||
// this will be called because the air-block got removed
|
||||
for(FMLMissingMappingsEvent.MissingMapping mapping : event.get()) {
|
||||
if(mapping.name.equals("TConstruct:TankAir"))
|
||||
mapping.ignore();
|
||||
for (FMLMissingMappingsEvent.MissingMapping mapping : event.get()) {
|
||||
if (mapping.name.equals("TConstruct:TankAir")) mapping.ignore();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,58 +14,48 @@ import tconstruct.library.event.ToolCraftedEvent;
|
||||
import tconstruct.library.tools.*;
|
||||
import tconstruct.tools.logic.ToolForgeLogic;
|
||||
|
||||
public class AchievementEvents
|
||||
{
|
||||
public class AchievementEvents {
|
||||
@SubscribeEvent
|
||||
public void toolCreate (ToolCraftedEvent event)
|
||||
{
|
||||
if (event.player != null)
|
||||
{
|
||||
public void toolCreate(ToolCraftedEvent event) {
|
||||
if (event.player != null) {
|
||||
TAchievements.triggerAchievement(event.player, "tconstruct.tinkerer");
|
||||
|
||||
if (event.tool != null && event.tool.getItem() instanceof Weapon)
|
||||
{
|
||||
if (event.tool != null && event.tool.getItem() instanceof Weapon) {
|
||||
TAchievements.triggerAchievement(event.player, "tconstruct.preparedFight");
|
||||
}
|
||||
|
||||
if (event.inventory != null && event.inventory instanceof ToolForgeLogic && event.tool.getItem() instanceof ToolCore && ((ToolCore) event.tool.getItem()).durabilityTypeExtra() != 0)
|
||||
{
|
||||
if (event.inventory != null
|
||||
&& event.inventory instanceof ToolForgeLogic
|
||||
&& event.tool.getItem() instanceof ToolCore
|
||||
&& ((ToolCore) event.tool.getItem()).durabilityTypeExtra() != 0) {
|
||||
TAchievements.triggerAchievement(event.player, "tconstruct.proTinkerer");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void entitySlain (LivingDeathEvent event)
|
||||
{
|
||||
if (event.source != null && event.source.getEntity() instanceof EntityPlayer)
|
||||
{
|
||||
public void entitySlain(LivingDeathEvent event) {
|
||||
if (event.source != null && event.source.getEntity() instanceof EntityPlayer) {
|
||||
EntityPlayer murderer = (EntityPlayer) event.source.getEntity();
|
||||
|
||||
if (murderer.getHeldItem() != null && murderer.getHeldItem().getItem() instanceof Weapon)
|
||||
{
|
||||
if (murderer.getHeldItem() != null && murderer.getHeldItem().getItem() instanceof Weapon) {
|
||||
TAchievements.triggerAchievement(murderer, "tconstruct.enemySlayer");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void entityDrops (LivingDropsEvent event)
|
||||
{
|
||||
if (event.source.getEntity() instanceof EntityPlayer)
|
||||
{
|
||||
public void entityDrops(LivingDropsEvent event) {
|
||||
if (event.source.getEntity() instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) event.source.getEntity();
|
||||
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof FryingPan)
|
||||
{
|
||||
for (int i = 0; i < event.drops.size(); i++)
|
||||
{
|
||||
if (player.getHeldItem() != null && player.getHeldItem().getItem() instanceof FryingPan) {
|
||||
for (int i = 0; i < event.drops.size(); i++) {
|
||||
ItemStack is = event.drops.get(i).getEntityItem();
|
||||
if (FurnaceRecipes.smelting().getSmeltingResult(is) != null && FurnaceRecipes.smelting().getSmeltingResult(is).getItem() instanceof ItemFood)
|
||||
{
|
||||
if (FurnaceRecipes.smelting().getSmeltingResult(is) != null
|
||||
&& FurnaceRecipes.smelting().getSmeltingResult(is).getItem() instanceof ItemFood) {
|
||||
NBTTagCompound stackCompound = is.getTagCompound();
|
||||
if (stackCompound == null)
|
||||
{
|
||||
if (stackCompound == null) {
|
||||
stackCompound = new NBTTagCompound();
|
||||
}
|
||||
|
||||
@@ -79,9 +69,12 @@ public class AchievementEvents
|
||||
|
||||
@SubscribeEvent
|
||||
public void tooltip(ItemTooltipEvent event) {
|
||||
if(event.itemStack == null || event.itemStack.getItem() == null || !event.itemStack.hasTagCompound() || !event.itemStack.getTagCompound().hasKey("frypanKill"))
|
||||
return;
|
||||
if (event.itemStack == null
|
||||
|| event.itemStack.getItem() == null
|
||||
|| !event.itemStack.hasTagCompound()
|
||||
|| !event.itemStack.getTagCompound().hasKey("frypanKill")) return;
|
||||
|
||||
event.toolTip.add("" + ChatFormatting.DARK_PURPLE + ChatFormatting.ITALIC + StatCollector.translateToLocal("frypankill.tooltip"));
|
||||
event.toolTip.add("" + ChatFormatting.DARK_PURPLE + ChatFormatting.ITALIC
|
||||
+ StatCollector.translateToLocal("frypankill.tooltip"));
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,7 @@ import tconstruct.smeltery.TinkerSmeltery;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
public class TAchievements
|
||||
{
|
||||
public class TAchievements {
|
||||
|
||||
private static AchievementPage achievementsPage;
|
||||
private static HashMap<String, Achievement> achievementsList = new HashMap<String, Achievement>();
|
||||
@@ -21,10 +20,8 @@ public class TAchievements
|
||||
* @param name The name of the achievement
|
||||
* @param achievement The achievement
|
||||
*/
|
||||
public static void addAchievement (String name, Achievement achievement)
|
||||
{
|
||||
if (!PHConstruct.achievementsEnabled)
|
||||
{
|
||||
public static void addAchievement(String name, Achievement achievement) {
|
||||
if (!PHConstruct.achievementsEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -36,8 +33,7 @@ public class TAchievements
|
||||
* @param name The name of the achievement
|
||||
* @return The achievement
|
||||
*/
|
||||
public static Achievement getAchievement (String name)
|
||||
{
|
||||
public static Achievement getAchievement(String name) {
|
||||
return achievementsList.get(name);
|
||||
}
|
||||
|
||||
@@ -46,17 +42,14 @@ public class TAchievements
|
||||
* @param player The player that earned the achievement
|
||||
* @param name The name of the achievement
|
||||
*/
|
||||
public static void triggerAchievement (EntityPlayer player, String name)
|
||||
{
|
||||
if (!PHConstruct.achievementsEnabled)
|
||||
{
|
||||
public static void triggerAchievement(EntityPlayer player, String name) {
|
||||
if (!PHConstruct.achievementsEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
Achievement ach = getAchievement(name);
|
||||
|
||||
if (ach != null)
|
||||
{
|
||||
if (ach != null) {
|
||||
player.triggerAchievement(ach);
|
||||
}
|
||||
}
|
||||
@@ -64,38 +57,94 @@ public class TAchievements
|
||||
/**
|
||||
* Adds all the achievements included in TConstruct, call before registerAchievementPane is called
|
||||
*/
|
||||
public static void addDefaultAchievements ()
|
||||
{
|
||||
if (!PHConstruct.achievementsEnabled)
|
||||
{
|
||||
public static void addDefaultAchievements() {
|
||||
if (!PHConstruct.achievementsEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
addAchievement("tconstruct.beginner", new Achievement("tconstruct.beginner", "tconstruct.beginner", 0, 0, TinkerTools.manualBook, null).initIndependentStat());
|
||||
addAchievement("tconstruct.pattern", new Achievement("tconstruct.pattern", "tconstruct.pattern", 2, 1, TinkerTools.blankPattern, getAchievement("tconstruct.beginner")));
|
||||
addAchievement("tconstruct.tinkerer", new Achievement("tconstruct.tinkerer", "tconstruct.tinkerer", 2, 2, new ItemStack(TinkerTools.titleIcon, 1, 4096), getAchievement("tconstruct.pattern")));
|
||||
addAchievement("tconstruct.preparedFight", new Achievement("tconstruct.preparedFight", "tconstruct.preparedFight", 1, 3, new ItemStack(TinkerTools.titleIcon, 1, 4097), getAchievement("tconstruct.tinkerer")));
|
||||
addAchievement("tconstruct.proTinkerer", new Achievement("tconstruct.proTinkerer", "tconstruct.proTinkerer", 4, 3, new ItemStack(TinkerTools.titleIcon, 1, 4098), getAchievement("tconstruct.tinkerer")));
|
||||
addAchievement("tconstruct.smelteryMaker", new Achievement("tconstruct.smelteryMaker", "tconstruct.smelteryMaker", -2, -1, TinkerSmeltery.smeltery, getAchievement("tconstruct.beginner")));
|
||||
addAchievement("tconstruct.enemySlayer", new Achievement("tconstruct.enemySlayer", "tconstruct.enemySlayer", 0, 5, new ItemStack(TinkerTools.titleIcon, 1, 4099), getAchievement("tconstruct.preparedFight")));
|
||||
addAchievement("tconstruct.dualConvenience", new Achievement("tconstruct.dualConvenience", "tconstruct.dualConvenience", 0, 7, new ItemStack(TinkerTools.titleIcon, 1, 4100), getAchievement("tconstruct.enemySlayer")).setSpecial());
|
||||
addAchievement(
|
||||
"tconstruct.beginner",
|
||||
new Achievement("tconstruct.beginner", "tconstruct.beginner", 0, 0, TinkerTools.manualBook, null)
|
||||
.initIndependentStat());
|
||||
addAchievement(
|
||||
"tconstruct.pattern",
|
||||
new Achievement(
|
||||
"tconstruct.pattern",
|
||||
"tconstruct.pattern",
|
||||
2,
|
||||
1,
|
||||
TinkerTools.blankPattern,
|
||||
getAchievement("tconstruct.beginner")));
|
||||
addAchievement(
|
||||
"tconstruct.tinkerer",
|
||||
new Achievement(
|
||||
"tconstruct.tinkerer",
|
||||
"tconstruct.tinkerer",
|
||||
2,
|
||||
2,
|
||||
new ItemStack(TinkerTools.titleIcon, 1, 4096),
|
||||
getAchievement("tconstruct.pattern")));
|
||||
addAchievement(
|
||||
"tconstruct.preparedFight",
|
||||
new Achievement(
|
||||
"tconstruct.preparedFight",
|
||||
"tconstruct.preparedFight",
|
||||
1,
|
||||
3,
|
||||
new ItemStack(TinkerTools.titleIcon, 1, 4097),
|
||||
getAchievement("tconstruct.tinkerer")));
|
||||
addAchievement(
|
||||
"tconstruct.proTinkerer",
|
||||
new Achievement(
|
||||
"tconstruct.proTinkerer",
|
||||
"tconstruct.proTinkerer",
|
||||
4,
|
||||
3,
|
||||
new ItemStack(TinkerTools.titleIcon, 1, 4098),
|
||||
getAchievement("tconstruct.tinkerer")));
|
||||
addAchievement(
|
||||
"tconstruct.smelteryMaker",
|
||||
new Achievement(
|
||||
"tconstruct.smelteryMaker",
|
||||
"tconstruct.smelteryMaker",
|
||||
-2,
|
||||
-1,
|
||||
TinkerSmeltery.smeltery,
|
||||
getAchievement("tconstruct.beginner")));
|
||||
addAchievement(
|
||||
"tconstruct.enemySlayer",
|
||||
new Achievement(
|
||||
"tconstruct.enemySlayer",
|
||||
"tconstruct.enemySlayer",
|
||||
0,
|
||||
5,
|
||||
new ItemStack(TinkerTools.titleIcon, 1, 4099),
|
||||
getAchievement("tconstruct.preparedFight")));
|
||||
addAchievement(
|
||||
"tconstruct.dualConvenience",
|
||||
new Achievement(
|
||||
"tconstruct.dualConvenience",
|
||||
"tconstruct.dualConvenience",
|
||||
0,
|
||||
7,
|
||||
new ItemStack(TinkerTools.titleIcon, 1, 4100),
|
||||
getAchievement("tconstruct.enemySlayer"))
|
||||
.setSpecial());
|
||||
}
|
||||
|
||||
/**
|
||||
* Should be called after all the achievements are loaded (PostInit would be good)
|
||||
*/
|
||||
public static void registerAchievementPane ()
|
||||
{
|
||||
if (!PHConstruct.achievementsEnabled)
|
||||
{
|
||||
public static void registerAchievementPane() {
|
||||
if (!PHConstruct.achievementsEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
Achievement[] achievements = new Achievement[achievementsList.size()];
|
||||
|
||||
achievements = achievementsList.values().toArray(achievements);
|
||||
achievementsPage = new AchievementPage(StatCollector.translateToLocal("tconstruct.achievementPage.name"), achievements);
|
||||
achievementsPage =
|
||||
new AchievementPage(StatCollector.translateToLocal("tconstruct.achievementPage.name"), achievements);
|
||||
AchievementPage.registerAchievementPage(achievementsPage);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,22 +7,24 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.achievements.TAchievements;
|
||||
|
||||
public class CraftAchievementItem extends CraftingItem
|
||||
{
|
||||
public class CraftAchievementItem extends CraftingItem {
|
||||
public String grantedAchievement = "";
|
||||
|
||||
public CraftAchievementItem(String[] names, String[] tex, String folder, String modTexturePrefix, CreativeTabs tab, String tachievement)
|
||||
{
|
||||
public CraftAchievementItem(
|
||||
String[] names,
|
||||
String[] tex,
|
||||
String folder,
|
||||
String modTexturePrefix,
|
||||
CreativeTabs tab,
|
||||
String tachievement) {
|
||||
super(names, tex, folder, modTexturePrefix, tab);
|
||||
|
||||
grantedAchievement = tachievement;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreated (ItemStack item, World world, EntityPlayer player)
|
||||
{
|
||||
if (grantedAchievement != null && !grantedAchievement.equals(""))
|
||||
{
|
||||
public void onCreated(ItemStack item, World world, EntityPlayer player) {
|
||||
if (grantedAchievement != null && !grantedAchievement.equals("")) {
|
||||
TAchievements.triggerAchievement(player, grantedAchievement);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,9 +3,8 @@ package tconstruct.api;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
|
||||
public interface IPlayerExtendedInventoryWrapper
|
||||
{
|
||||
public IInventory getKnapsackInventory (EntityPlayer player);
|
||||
public interface IPlayerExtendedInventoryWrapper {
|
||||
public IInventory getKnapsackInventory(EntityPlayer player);
|
||||
|
||||
public IInventory getAccessoryInventory (EntityPlayer player);
|
||||
public IInventory getAccessoryInventory(EntityPlayer player);
|
||||
}
|
||||
@@ -2,12 +2,10 @@ package tconstruct.api;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
|
||||
public class TConstructAPI
|
||||
{
|
||||
public class TConstructAPI {
|
||||
public static String PROP_NAME;
|
||||
|
||||
public static IPlayerExtendedInventoryWrapper getInventoryWrapper (EntityPlayer player)
|
||||
{
|
||||
public static IPlayerExtendedInventoryWrapper getInventoryWrapper(EntityPlayer player) {
|
||||
return (IPlayerExtendedInventoryWrapper) player.getExtendedProperties(PROP_NAME);
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
package tconstruct.armor;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -12,51 +14,42 @@ import tconstruct.armor.items.TravelGear;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.util.network.HealthUpdatePacket;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent;
|
||||
|
||||
public class ArmorAbilities
|
||||
{
|
||||
public class ArmorAbilities {
|
||||
public static List<String> stepBoostedPlayers = new ArrayList();
|
||||
//ItemStack prevFeet;
|
||||
// ItemStack prevFeet;
|
||||
double prevMotionY;
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerTick (TickEvent.PlayerTickEvent event)
|
||||
{
|
||||
public void playerTick(TickEvent.PlayerTickEvent event) {
|
||||
EntityPlayer player = event.player;
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
|
||||
// Wall climb
|
||||
if (stats.climbWalls)
|
||||
{
|
||||
if (stats.climbWalls) {
|
||||
double motionX = player.posX - player.lastTickPosX;
|
||||
double motionZ = player.posZ - player.lastTickPosZ;
|
||||
double motionY = player.posY - player.lastTickPosY - 0.762;
|
||||
if (motionY > 0.0D && (motionX == 0D || motionZ == 0D))
|
||||
{
|
||||
if (motionY > 0.0D && (motionX == 0D || motionZ == 0D)) {
|
||||
player.fallDistance = 0.0F;
|
||||
}
|
||||
}
|
||||
|
||||
//Feet changes
|
||||
// Feet changes
|
||||
ItemStack feet = player.getCurrentArmor(0);
|
||||
if (feet != null && feet.hasTagCompound())
|
||||
{
|
||||
if (feet.getItem() instanceof IModifyable && !player.isSneaking())
|
||||
{
|
||||
NBTTagCompound tag = feet.getTagCompound().getCompoundTag(((IModifyable) feet.getItem()).getBaseTagName());
|
||||
if (feet != null && feet.hasTagCompound()) {
|
||||
if (feet.getItem() instanceof IModifyable && !player.isSneaking()) {
|
||||
NBTTagCompound tag =
|
||||
feet.getTagCompound().getCompoundTag(((IModifyable) feet.getItem()).getBaseTagName());
|
||||
int sole = tag.getInteger("Slimy Soles");
|
||||
if (sole > 0)
|
||||
{
|
||||
if (sole > 0) {
|
||||
if (!player.isSneaking() && player.onGround && prevMotionY < -0.4)
|
||||
player.motionY = -prevMotionY * (Math.min(0.99, sole * 0.2));
|
||||
}
|
||||
}
|
||||
prevMotionY = player.motionY;
|
||||
}
|
||||
/* Former step height boost handling
|
||||
/* Former step height boost handling
|
||||
if (feet != prevFeet)
|
||||
{
|
||||
if (prevFeet != null && prevFeet.getItem() instanceof TravelGear)
|
||||
@@ -65,19 +58,16 @@ public class ArmorAbilities
|
||||
player.stepHeight += 0.6f;
|
||||
prevFeet = feet;
|
||||
}*/
|
||||
boolean stepBoosted = stepBoostedPlayers.contains(player.getGameProfile().getName());
|
||||
if (stepBoosted)
|
||||
player.stepHeight = 1.1f;
|
||||
if (!stepBoosted && feet != null && feet.getItem() instanceof TravelGear)
|
||||
{
|
||||
boolean stepBoosted =
|
||||
stepBoostedPlayers.contains(player.getGameProfile().getName());
|
||||
if (stepBoosted) player.stepHeight = 1.1f;
|
||||
if (!stepBoosted && feet != null && feet.getItem() instanceof TravelGear) {
|
||||
stepBoostedPlayers.add(player.getGameProfile().getName());
|
||||
}
|
||||
else if (stepBoosted && (feet == null || !(feet.getItem() instanceof TravelGear)))
|
||||
{
|
||||
} else if (stepBoosted && (feet == null || !(feet.getItem() instanceof TravelGear))) {
|
||||
stepBoostedPlayers.remove(player.getGameProfile().getName());
|
||||
player.stepHeight -= 0.6f;
|
||||
}
|
||||
//TODO: Proper minimap support
|
||||
// TODO: Proper minimap support
|
||||
/*ItemStack stack = player.inventory.getStackInSlot(8);
|
||||
if (stack != null && stack.getItem() instanceof ItemMap)
|
||||
{
|
||||
@@ -85,16 +75,14 @@ public class ArmorAbilities
|
||||
}*/
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void dimensionChanged(PlayerEvent.PlayerChangedDimensionEvent event)
|
||||
{
|
||||
if(event.player == null || !(event.player instanceof EntityPlayerMP))
|
||||
return;
|
||||
public void dimensionChanged(PlayerEvent.PlayerChangedDimensionEvent event) {
|
||||
if (event.player == null || !(event.player instanceof EntityPlayerMP)) return;
|
||||
|
||||
// this callback is only called serverside
|
||||
float oldHealth = event.player.getHealth();
|
||||
// tell the client to update its hp
|
||||
TConstruct.packetPipeline.sendTo(new HealthUpdatePacket(oldHealth), (net.minecraft.entity.player.EntityPlayerMP) event.player);
|
||||
TConstruct.packetPipeline.sendTo(
|
||||
new HealthUpdatePacket(oldHealth), (net.minecraft.entity.player.EntityPlayerMP) event.player);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -9,41 +9,34 @@ import tconstruct.armor.inventory.*;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.common.TProxyCommon;
|
||||
|
||||
public class ArmorProxyCommon implements IGuiHandler
|
||||
{
|
||||
public class ArmorProxyCommon implements IGuiHandler {
|
||||
public static final int inventoryGui = 100;
|
||||
public static final int armorGuiID = 101;
|
||||
public static final int knapsackGuiID = 102;
|
||||
|
||||
public void preInit() {}
|
||||
|
||||
public void initialize ()
|
||||
{
|
||||
public void initialize() {
|
||||
registerGuiHandler();
|
||||
}
|
||||
|
||||
protected void registerGuiHandler ()
|
||||
{
|
||||
protected void registerGuiHandler() {
|
||||
TProxyCommon.registerServerGuiHandler(inventoryGui, this);
|
||||
TProxyCommon.registerServerGuiHandler(armorGuiID, this);
|
||||
TProxyCommon.registerServerGuiHandler(knapsackGuiID, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
if (ID == ArmorProxyCommon.inventoryGui)
|
||||
{
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
if (ID == ArmorProxyCommon.inventoryGui) {
|
||||
// GuiInventory inv = new GuiInventory(player);
|
||||
return player.inventoryContainer;
|
||||
}
|
||||
if (ID == ArmorProxyCommon.armorGuiID)
|
||||
{
|
||||
if (ID == ArmorProxyCommon.armorGuiID) {
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
return new ArmorExtendedContainer(player.inventory, stats.armor);
|
||||
}
|
||||
if (ID == ArmorProxyCommon.knapsackGuiID)
|
||||
{
|
||||
if (ID == ArmorProxyCommon.knapsackGuiID) {
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
return new KnapsackContainer(player.inventory, stats.knapsack);
|
||||
}
|
||||
@@ -52,29 +45,18 @@ public class ArmorProxyCommon implements IGuiHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
public void registerTickHandler ()
|
||||
{
|
||||
public void registerTickHandler() {}
|
||||
|
||||
}
|
||||
public void registerKeys() {}
|
||||
|
||||
public void registerKeys ()
|
||||
{
|
||||
public void updatePlayerStats(TPlayerStats stats) {}
|
||||
|
||||
}
|
||||
|
||||
public void updatePlayerStats(TPlayerStats stats)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public void dumpTPlayerStats(TPlayerStats stats)
|
||||
{
|
||||
public void dumpTPlayerStats(TPlayerStats stats) {
|
||||
TConstruct.logger.debug("~~~~~~~~~~~~~~~~~ STATS ~~~~~~~~~~~~~~~~~");
|
||||
TConstruct.logger.debug("Player: " + stats.player.get().getCommandSenderName());
|
||||
TConstruct.logger.debug("Level: " + stats.level);
|
||||
@@ -91,19 +73,15 @@ public class ArmorProxyCommon implements IGuiHandler
|
||||
TConstruct.logger.debug("BattleSign Bonus: " + stats.battlesignBonus);
|
||||
TConstruct.logger.debug("Derp Level: " + stats.derpLevel);
|
||||
int i = 0;
|
||||
for (ItemStack stack : stats.armor.inventory)
|
||||
{
|
||||
if (stack != null)
|
||||
{
|
||||
TConstruct.logger.debug("Armor Slot: " + i + " Contains: " + stack.getDisplayName());
|
||||
for (ItemStack stack : stats.armor.inventory) {
|
||||
if (stack != null) {
|
||||
TConstruct.logger.debug("Armor Slot: " + i + " Contains: " + stack.getDisplayName());
|
||||
}
|
||||
i++;
|
||||
}
|
||||
i = 0;
|
||||
for (ItemStack stack : stats.knapsack.inventory)
|
||||
{
|
||||
if (stack != null)
|
||||
{
|
||||
for (ItemStack stack : stats.knapsack.inventory) {
|
||||
if (stack != null) {
|
||||
TConstruct.logger.debug("Knapsack Slot: " + i + " Contains: " + stack.getDisplayName());
|
||||
}
|
||||
i++;
|
||||
|
||||
@@ -6,21 +6,18 @@ import cpw.mods.fml.relauncher.*;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import tconstruct.client.ArmorControls;
|
||||
|
||||
public class ArmorTickHandler
|
||||
{
|
||||
public class ArmorTickHandler {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
|
||||
ArmorControls controlInstance = ((ArmorProxyClient) TinkerArmor.proxy).controlInstance;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void tickEnd (ClientTickEvent event)
|
||||
{
|
||||
public void tickEnd(ClientTickEvent event) {
|
||||
/*TinkerWorld.oreBerry.setGraphicsLevel(Blocks.leaves.field_150121_P);
|
||||
TinkerWorld.oreBerrySecond.setGraphicsLevel(Blocks.leaves.field_150121_P);
|
||||
TinkerWorld.slimeLeaves.setGraphicsLevel(Blocks.leaves.field_150121_P);*/
|
||||
if (mc.thePlayer != null && mc.thePlayer.onGround)
|
||||
controlInstance.landOnGround();
|
||||
if (mc.thePlayer != null && mc.thePlayer.onGround) controlInstance.landOnGround();
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -8,48 +8,37 @@ import net.minecraft.potion.*;
|
||||
import tconstruct.armor.player.*;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
public class PlayerAbilityHelper
|
||||
{
|
||||
public class PlayerAbilityHelper {
|
||||
|
||||
public static void toggleGoggles (EntityPlayer player, boolean active)
|
||||
{
|
||||
public static void toggleGoggles(EntityPlayer player, boolean active) {
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
stats.activeGoggles = active;
|
||||
if (!stats.activeGoggles)
|
||||
{
|
||||
if (!stats.activeGoggles) {
|
||||
player.removePotionEffect(Potion.nightVision.id);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
player.addPotionEffect(new PotionEffect(Potion.nightVision.id, 15 * 20, 0, true));
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean isDimensionAllowed (EntityPlayer player) {
|
||||
public static boolean isDimensionAllowed(EntityPlayer player) {
|
||||
int currentDimID = player.worldObj.provider.dimensionId;
|
||||
for (int id : PHConstruct.cfgForbiddenDim)
|
||||
{
|
||||
if (id == currentDimID)
|
||||
return false;
|
||||
for (int id : PHConstruct.cfgForbiddenDim) {
|
||||
if (id == currentDimID) return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void swapBelt (EntityPlayer player, ArmorExtended armor)
|
||||
{
|
||||
public static void swapBelt(EntityPlayer player, ArmorExtended armor) {
|
||||
if (!isDimensionAllowed(player)) return;
|
||||
NBTTagList slots = new NBTTagList();
|
||||
InventoryPlayer hotbar = player.inventory;
|
||||
ItemStack belt = armor.inventory[3];
|
||||
if(belt == null)
|
||||
return;
|
||||
if (belt == null) return;
|
||||
|
||||
NBTTagCompound itemTag;
|
||||
|
||||
for (int i = 0; i < 9; ++i)
|
||||
{
|
||||
if (hotbar.mainInventory[i] != null)
|
||||
{
|
||||
for (int i = 0; i < 9; ++i) {
|
||||
if (hotbar.mainInventory[i] != null) {
|
||||
itemTag = new NBTTagCompound();
|
||||
itemTag.setByte("Slot", (byte) i);
|
||||
hotbar.mainInventory[i].writeToNBT(itemTag);
|
||||
@@ -59,16 +48,13 @@ public class PlayerAbilityHelper
|
||||
}
|
||||
|
||||
NBTTagList replaceSlots = belt.getTagCompound().getTagList("Inventory", 10);
|
||||
for (int i = 0; i < replaceSlots.tagCount(); ++i)
|
||||
{
|
||||
for (int i = 0; i < replaceSlots.tagCount(); ++i) {
|
||||
NBTTagCompound nbttagcompound = replaceSlots.getCompoundTagAt(i);
|
||||
int j = nbttagcompound.getByte("Slot") & 255;
|
||||
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (j >= 0 && j < hotbar.mainInventory.length)
|
||||
{
|
||||
if (itemstack != null) {
|
||||
if (j >= 0 && j < hotbar.mainInventory.length) {
|
||||
hotbar.mainInventory[j] = itemstack;
|
||||
}
|
||||
}
|
||||
@@ -76,12 +62,10 @@ public class PlayerAbilityHelper
|
||||
belt.getTagCompound().setTag("Inventory", slots);
|
||||
}
|
||||
|
||||
public static void setEntitySize (Entity entity, float width, float height)
|
||||
{
|
||||
public static void setEntitySize(Entity entity, float width, float height) {
|
||||
float f2;
|
||||
|
||||
if (width != entity.width || height != entity.height)
|
||||
{
|
||||
if (width != entity.width || height != entity.height) {
|
||||
f2 = entity.width;
|
||||
entity.width = width;
|
||||
entity.height = height;
|
||||
@@ -89,36 +73,24 @@ public class PlayerAbilityHelper
|
||||
entity.boundingBox.maxZ = entity.boundingBox.minZ + (double) entity.width;
|
||||
entity.boundingBox.maxY = entity.boundingBox.minY + (double) entity.height;
|
||||
|
||||
if (entity.width > f2 && !entity.worldObj.isRemote)
|
||||
{
|
||||
if (entity.width > f2 && !entity.worldObj.isRemote) {
|
||||
entity.moveEntity((double) (f2 - entity.width), 0.0D, (double) (f2 - entity.width));
|
||||
}
|
||||
}
|
||||
|
||||
f2 = width % 2.0F;
|
||||
|
||||
if ((double) f2 < 0.375D)
|
||||
{
|
||||
if ((double) f2 < 0.375D) {
|
||||
entity.myEntitySize = Entity.EnumEntitySize.SIZE_1;
|
||||
}
|
||||
else if ((double) f2 < 0.75D)
|
||||
{
|
||||
} else if ((double) f2 < 0.75D) {
|
||||
entity.myEntitySize = Entity.EnumEntitySize.SIZE_2;
|
||||
}
|
||||
else if ((double) f2 < 1.0D)
|
||||
{
|
||||
} else if ((double) f2 < 1.0D) {
|
||||
entity.myEntitySize = Entity.EnumEntitySize.SIZE_3;
|
||||
}
|
||||
else if ((double) f2 < 1.375D)
|
||||
{
|
||||
} else if ((double) f2 < 1.375D) {
|
||||
entity.myEntitySize = Entity.EnumEntitySize.SIZE_4;
|
||||
}
|
||||
else if ((double) f2 < 1.75D)
|
||||
{
|
||||
} else if ((double) f2 < 1.75D) {
|
||||
entity.myEntitySize = Entity.EnumEntitySize.SIZE_5;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
entity.myEntitySize = Entity.EnumEntitySize.SIZE_6;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,10 +4,7 @@ import cpw.mods.fml.common.*;
|
||||
import cpw.mods.fml.common.event.*;
|
||||
import cpw.mods.fml.common.registry.*;
|
||||
import cpw.mods.fml.common.registry.GameRegistry.ObjectHolder;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
|
||||
import java.util.EnumSet;
|
||||
|
||||
import mantle.pulsar.pulse.*;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.init.*;
|
||||
@@ -21,8 +18,6 @@ import tconstruct.TConstruct;
|
||||
import tconstruct.armor.blocks.DryingRack;
|
||||
import tconstruct.armor.items.*;
|
||||
import tconstruct.blocks.logic.DryingRackLogic;
|
||||
import tconstruct.client.ArmorControls;
|
||||
import tconstruct.client.tabs.TabRegistry;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.accessory.AccessoryCore;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
@@ -30,14 +25,12 @@ import tconstruct.library.crafting.*;
|
||||
import tconstruct.modifiers.accessory.GloveSpeed;
|
||||
import tconstruct.modifiers.armor.*;
|
||||
import tconstruct.modifiers.tools.ModAttack;
|
||||
import tconstruct.modifiers.tools.ModInteger;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
|
||||
@ObjectHolder(TConstruct.modID)
|
||||
@Pulse(id = "Tinkers' Armory", description = "Modifyable armors, such as the traveller's gear.")
|
||||
public class TinkerArmor
|
||||
{
|
||||
public class TinkerArmor {
|
||||
@SidedProxy(clientSide = "tconstruct.armor.ArmorProxyClient", serverSide = "tconstruct.armor.ArmorProxyCommon")
|
||||
public static ArmorProxyCommon proxy;
|
||||
|
||||
@@ -63,7 +56,7 @@ public class TinkerArmor
|
||||
public static Item bootsWood;
|
||||
public static ArmorMaterial materialWood;
|
||||
|
||||
//Clothing - Travel Gear
|
||||
// Clothing - Travel Gear
|
||||
public static TravelGear travelGoggles;
|
||||
public static TravelGear travelWings;
|
||||
public static TravelGear travelVest;
|
||||
@@ -74,8 +67,7 @@ public class TinkerArmor
|
||||
public static ModAttack modAttackGlove;
|
||||
|
||||
@Handler
|
||||
public void preInit (FMLPreInitializationEvent event)
|
||||
{
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
proxy.preInit();
|
||||
|
||||
MinecraftForge.EVENT_BUS.register(new TinkerArmorEvents());
|
||||
@@ -87,8 +79,7 @@ public class TinkerArmor
|
||||
TinkerArmor.diamondApple = new DiamondApple().setUnlocalizedName("tconstruct.apple.diamond");
|
||||
GameRegistry.registerItem(TinkerArmor.diamondApple, "diamondApple");
|
||||
boolean foodOverhaul = false;
|
||||
if (Loader.isModLoaded("HungerOverhaul") || Loader.isModLoaded("fc_food"))
|
||||
{
|
||||
if (Loader.isModLoaded("HungerOverhaul") || Loader.isModLoaded("fc_food")) {
|
||||
foodOverhaul = true;
|
||||
}
|
||||
|
||||
@@ -111,11 +102,15 @@ public class TinkerArmor
|
||||
GameRegistry.registerItem(TinkerArmor.knapsack, "knapsack");
|
||||
|
||||
LiquidCasting basinCasting = TConstruct.getBasinCasting();
|
||||
TinkerArmor.materialWood = EnumHelper.addArmorMaterial("WOOD", 2, new int[] { 1, 2, 2, 1 }, 3);
|
||||
TinkerArmor.helmetWood = new ArmorBasic(TinkerArmor.materialWood, 0, "wood").setUnlocalizedName("tconstruct.helmetWood");
|
||||
TinkerArmor.chestplateWood = new ArmorBasic(TinkerArmor.materialWood, 1, "wood").setUnlocalizedName("tconstruct.chestplateWood");
|
||||
TinkerArmor.leggingsWood = new ArmorBasic(TinkerArmor.materialWood, 2, "wood").setUnlocalizedName("tconstruct.leggingsWood");
|
||||
TinkerArmor.bootsWood = new ArmorBasic(TinkerArmor.materialWood, 3, "wood").setUnlocalizedName("tconstruct.bootsWood");
|
||||
TinkerArmor.materialWood = EnumHelper.addArmorMaterial("WOOD", 2, new int[] {1, 2, 2, 1}, 3);
|
||||
TinkerArmor.helmetWood =
|
||||
new ArmorBasic(TinkerArmor.materialWood, 0, "wood").setUnlocalizedName("tconstruct.helmetWood");
|
||||
TinkerArmor.chestplateWood =
|
||||
new ArmorBasic(TinkerArmor.materialWood, 1, "wood").setUnlocalizedName("tconstruct.chestplateWood");
|
||||
TinkerArmor.leggingsWood =
|
||||
new ArmorBasic(TinkerArmor.materialWood, 2, "wood").setUnlocalizedName("tconstruct.leggingsWood");
|
||||
TinkerArmor.bootsWood =
|
||||
new ArmorBasic(TinkerArmor.materialWood, 3, "wood").setUnlocalizedName("tconstruct.bootsWood");
|
||||
GameRegistry.registerItem(TinkerArmor.helmetWood, "helmetWood");
|
||||
GameRegistry.registerItem(TinkerArmor.chestplateWood, "chestplateWood");
|
||||
GameRegistry.registerItem(TinkerArmor.leggingsWood, "leggingsWood");
|
||||
@@ -141,8 +136,7 @@ public class TinkerArmor
|
||||
}
|
||||
|
||||
@Handler
|
||||
public void init (FMLInitializationEvent event)
|
||||
{
|
||||
public void init(FMLInitializationEvent event) {
|
||||
craftingTableRecipes();
|
||||
registerModifiers();
|
||||
addRecipesForDryingRack();
|
||||
@@ -151,58 +145,139 @@ public class TinkerArmor
|
||||
}
|
||||
|
||||
@Handler
|
||||
public void postInit (FMLPostInitializationEvent evt)
|
||||
{
|
||||
public void postInit(FMLPostInitializationEvent evt) {
|
||||
proxy.registerTickHandler();
|
||||
}
|
||||
|
||||
private void craftingTableRecipes ()
|
||||
{
|
||||
private void craftingTableRecipes() {
|
||||
|
||||
// Armor Recipes
|
||||
Object[] helm = new String[] { "www", "w w" };
|
||||
Object[] chest = new String[] { "w w", "www", "www" };
|
||||
Object[] pants = new String[] { "www", "w w", "w w" };
|
||||
Object[] shoes = new String[] { "w w", "w w" };
|
||||
Object[] helm = new String[] {"www", "w w"};
|
||||
Object[] chest = new String[] {"w w", "www", "www"};
|
||||
Object[] pants = new String[] {"www", "w w", "w w"};
|
||||
Object[] shoes = new String[] {"w w", "w w"};
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.helmetWood, helm, 'w', "logWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.chestplateWood, chest, 'w', "logWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.leggingsWood, pants, 'w', "logWood"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(TinkerArmor.bootsWood, shoes, 'w', "logWood"));
|
||||
|
||||
// Accessories
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminum"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminium"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminum"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), "##", "##", '#', "ingotAluminium"));
|
||||
// GameRegistry.addRecipe(new ShapedOreRecipe(new
|
||||
// ItemStack(TRepo.heartCanister, 1, 0), "##", "##", '#',
|
||||
// "ingotNaturalAluminum"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 0), " # ", "#B#", " # ", '#', "ingotTin", 'B', Items.bone));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 0), " # ", "#B#", " # ", '#', "ingotTin", 'B', Items.bone));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.diamondApple), " d ", "d#d", " d ", 'd', "gemDiamond", '#', new ItemStack(Items.apple)));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 2), new ItemStack(TinkerArmor.diamondApple), new ItemStack(TinkerTools.materials, 1, 8), new ItemStack(TinkerArmor.heartCanister, 1, 0), new ItemStack(TinkerArmor.heartCanister, 1, 1));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 1), new ItemStack(TinkerArmor.heartCanister, 1, 3));
|
||||
GameRegistry.addShapelessRecipe(new ItemStack(TinkerArmor.heartCanister, 1, 4), new ItemStack(TinkerArmor.heartCanister, 1, 2), new ItemStack(TinkerArmor.heartCanister, 1, 3), new ItemStack(Items.golden_apple, 1, 1));
|
||||
//GameRegistry.addShapelessRecipe(new ItemStack(heartCanister, 1, 6), new ItemStack(heartCanister, 1, 0), new ItemStack(heartCanister, 1, 4), new ItemStack(heartCanister, 1, 5));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
new ItemStack(TinkerArmor.diamondApple),
|
||||
" d ",
|
||||
"d#d",
|
||||
" d ",
|
||||
'd',
|
||||
"gemDiamond",
|
||||
'#',
|
||||
new ItemStack(Items.apple)));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 2),
|
||||
new ItemStack(TinkerArmor.diamondApple),
|
||||
new ItemStack(TinkerTools.materials, 1, 8),
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 0),
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 1));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 1), new ItemStack(TinkerArmor.heartCanister, 1, 3));
|
||||
GameRegistry.addShapelessRecipe(
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 4),
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 2),
|
||||
new ItemStack(TinkerArmor.heartCanister, 1, 3),
|
||||
new ItemStack(Items.golden_apple, 1, 1));
|
||||
// GameRegistry.addShapelessRecipe(new ItemStack(heartCanister, 1, 6), new ItemStack(heartCanister, 1, 0), new
|
||||
// ItemStack(heartCanister, 1, 4), new ItemStack(heartCanister, 1, 5));
|
||||
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.knapsack, 1, 0), "###", "rmr", "###", '#', new ItemStack(Items.leather), 'r', new ItemStack(TinkerTools.toughRod, 1, 2), 'm', "ingotGold"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
new ItemStack(TinkerArmor.knapsack, 1, 0),
|
||||
"###",
|
||||
"rmr",
|
||||
"###",
|
||||
'#',
|
||||
new ItemStack(Items.leather),
|
||||
'r',
|
||||
new ItemStack(TinkerTools.toughRod, 1, 2),
|
||||
'm',
|
||||
"ingotGold"));
|
||||
ItemStack aluBrass = new ItemStack(TinkerTools.materials, 1, 14);
|
||||
GameRegistry.addRecipe(new ItemStack(TinkerArmor.knapsack, 1, 0), "###", "rmr", "###", '#', new ItemStack(Items.leather), 'r', new ItemStack(TinkerTools.toughRod, 1, 2), 'm', aluBrass);
|
||||
GameRegistry.addRecipe(
|
||||
new ItemStack(TinkerArmor.knapsack, 1, 0),
|
||||
"###",
|
||||
"rmr",
|
||||
"###",
|
||||
'#',
|
||||
new ItemStack(Items.leather),
|
||||
'r',
|
||||
new ItemStack(TinkerTools.toughRod, 1, 2),
|
||||
'm',
|
||||
aluBrass);
|
||||
// Drying Rack Recipes
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(TinkerArmor.dryingRack, 1, 0), "bbb", 'b', "slabWood"));
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(new ItemStack(TinkerArmor.dryingRack, 1, 0), "bbb", 'b', "slabWood"));
|
||||
|
||||
//Temporary recipes
|
||||
// Temporary recipes
|
||||
ItemStack leather = new ItemStack(Items.leather);
|
||||
ItemStack glass = new ItemStack(Blocks.glass);
|
||||
ItemStack string = new ItemStack(Items.string);
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(travelGoggles.getDefaultItem(), "# #", "q#q", "g g", '#', leather, 'q', "blockGlass", 'g', "ingotGold"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(travelWings.getDefaultItem(), "g g", "i#i", "i i", '#', Items.ender_pearl, 'g', "ingotGold", 'i', "ingotBronze"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(travelVest.getDefaultItem(), "#w#", "#i#", "#w#", '#', leather, 'i', "ingotAluminum", 'w', new ItemStack(Blocks.wool, 1, Short.MAX_VALUE)));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(travelBoots.getDefaultItem(), "#s#", "#i#", "#s#", '#', leather, 's', string, 'i', "ingotAluminum"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
travelGoggles.getDefaultItem(),
|
||||
"# #",
|
||||
"q#q",
|
||||
"g g",
|
||||
'#',
|
||||
leather,
|
||||
'q',
|
||||
"blockGlass",
|
||||
'g',
|
||||
"ingotGold"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
travelWings.getDefaultItem(),
|
||||
"g g",
|
||||
"i#i",
|
||||
"i i",
|
||||
'#',
|
||||
Items.ender_pearl,
|
||||
'g',
|
||||
"ingotGold",
|
||||
'i',
|
||||
"ingotBronze"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
travelVest.getDefaultItem(),
|
||||
"#w#",
|
||||
"#i#",
|
||||
"#w#",
|
||||
'#',
|
||||
leather,
|
||||
'i',
|
||||
"ingotAluminum",
|
||||
'w',
|
||||
new ItemStack(Blocks.wool, 1, Short.MAX_VALUE)));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
travelBoots.getDefaultItem(), "#s#", "#i#", "#s#", '#', leather, 's', string, 'i', "ingotAluminum"));
|
||||
GameRegistry.addShapedRecipe(travelGlove.getDefaultItem(), " #", "###", " ##", '#', leather);
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(travelBelt.getDefaultItem(), "###", "ici", "###", '#', leather, 'c', "chestWood", 'i', "ingotAluminum"));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
travelBelt.getDefaultItem(),
|
||||
"###",
|
||||
"ici",
|
||||
"###",
|
||||
'#',
|
||||
leather,
|
||||
'c',
|
||||
"chestWood",
|
||||
'i',
|
||||
"ingotAluminum"));
|
||||
}
|
||||
|
||||
protected static void addRecipesForDryingRack ()
|
||||
{
|
||||
protected static void addRecipesForDryingRack() {
|
||||
// Drying rack
|
||||
DryingRackRecipes.addDryingRecipe(Items.beef, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 0));
|
||||
DryingRackRecipes.addDryingRecipe(Items.chicken, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 1));
|
||||
@@ -211,46 +286,148 @@ public class TinkerArmor
|
||||
// ItemStack(TRepo.jerky, 1, 3));
|
||||
DryingRackRecipes.addDryingRecipe(Items.fish, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 4));
|
||||
DryingRackRecipes.addDryingRecipe(Items.rotten_flesh, 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 5));
|
||||
DryingRackRecipes.addDryingRecipe(new ItemStack(TinkerWorld.strangeFood, 1, 0), 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 6));
|
||||
DryingRackRecipes.addDryingRecipe(new ItemStack(TinkerWorld.strangeFood, 1, 1), 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 7));
|
||||
DryingRackRecipes.addDryingRecipe(
|
||||
new ItemStack(TinkerWorld.strangeFood, 1, 0), 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 6));
|
||||
DryingRackRecipes.addDryingRecipe(
|
||||
new ItemStack(TinkerWorld.strangeFood, 1, 1), 20 * 60 * 5, new ItemStack(TinkerArmor.jerky, 1, 7));
|
||||
|
||||
// DryingRackRecipes.addDryingRecipe(new ItemStack(TRepo.jerky, 1, 5),
|
||||
// 20 * 60 * 10, Item.leather);
|
||||
}
|
||||
|
||||
private void registerModifiers ()
|
||||
{
|
||||
private void registerModifiers() {
|
||||
ItemStack redstoneItem = new ItemStack(Items.redstone);
|
||||
ItemStack redstoneBlock = new ItemStack(Blocks.redstone_block);
|
||||
//Travel gear modifiers
|
||||
//MultiType
|
||||
ModifyBuilder.registerModifier(new TravelModDoubleJump(EnumSet.of(ArmorPart.Legs, ArmorPart.Feet), new ItemStack[] { new ItemStack(Items.ghast_tear), new ItemStack(TinkerWorld.slimeGel, 1, 0), new ItemStack(Blocks.piston) }));
|
||||
ModifyBuilder.registerModifier(new TravelModDoubleJump(EnumSet.of(ArmorPart.Legs, ArmorPart.Feet), new ItemStack[] { new ItemStack(Items.ghast_tear), new ItemStack(TinkerWorld.slimeGel, 1, 1), new ItemStack(Blocks.piston) }));
|
||||
ModifyBuilder.registerModifier(new AModInteger(4, "Moss", EnumSet.of(ArmorPart.Legs, ArmorPart.Feet, ArmorPart.Chest, ArmorPart.Head), new ItemStack[] { new ItemStack(TinkerTools.materials, 1, 6) }, 3, "\u00a72", StatCollector.translateToLocal("modifier.tool.moss")));
|
||||
// Travel gear modifiers
|
||||
// MultiType
|
||||
ModifyBuilder.registerModifier(
|
||||
new TravelModDoubleJump(EnumSet.of(ArmorPart.Legs, ArmorPart.Feet), new ItemStack[] {
|
||||
new ItemStack(Items.ghast_tear),
|
||||
new ItemStack(TinkerWorld.slimeGel, 1, 0),
|
||||
new ItemStack(Blocks.piston)
|
||||
}));
|
||||
ModifyBuilder.registerModifier(
|
||||
new TravelModDoubleJump(EnumSet.of(ArmorPart.Legs, ArmorPart.Feet), new ItemStack[] {
|
||||
new ItemStack(Items.ghast_tear),
|
||||
new ItemStack(TinkerWorld.slimeGel, 1, 1),
|
||||
new ItemStack(Blocks.piston)
|
||||
}));
|
||||
ModifyBuilder.registerModifier(new AModInteger(
|
||||
4,
|
||||
"Moss",
|
||||
EnumSet.of(ArmorPart.Legs, ArmorPart.Feet, ArmorPart.Chest, ArmorPart.Head),
|
||||
new ItemStack[] {new ItemStack(TinkerTools.materials, 1, 6)},
|
||||
3,
|
||||
"\u00a72",
|
||||
StatCollector.translateToLocal("modifier.tool.moss")));
|
||||
ModifyBuilder.registerModifier(new TravelModRepair());
|
||||
TConstructRegistry.registerActiveArmorMod(new ActiveTinkerArmor());
|
||||
|
||||
//Head
|
||||
ModifyBuilder.registerModifier(new AModBoolean(0, "Night Vision", EnumSet.of(ArmorPart.Head), new ItemStack[] { new ItemStack(Items.flint_and_steel), new ItemStack(Items.potionitem, 1, 8198), new ItemStack(Items.golden_carrot) }, "\u00a78", "Night Vision"));
|
||||
// Head
|
||||
ModifyBuilder.registerModifier(new AModBoolean(
|
||||
0,
|
||||
"Night Vision",
|
||||
EnumSet.of(ArmorPart.Head),
|
||||
new ItemStack[] {
|
||||
new ItemStack(Items.flint_and_steel),
|
||||
new ItemStack(Items.potionitem, 1, 8198),
|
||||
new ItemStack(Items.golden_carrot)
|
||||
},
|
||||
"\u00a78",
|
||||
"Night Vision"));
|
||||
|
||||
//Chest
|
||||
ModifyBuilder.registerModifier(new AModInteger(0, "Perfect Dodge", EnumSet.of(ArmorPart.Chest), new ItemStack[] { new ItemStack(Items.ender_eye), new ItemStack(Items.ender_pearl), new ItemStack(Items.sugar) }, 1, "\u00a7d", "Perfect Dodge"));
|
||||
ModifyBuilder.registerModifier(new AModBoolean(1, "Stealth", EnumSet.of(ArmorPart.Chest), new ItemStack[] { new ItemStack(Items.fermented_spider_eye), new ItemStack(Items.ender_eye), new ItemStack(Items.potionitem, 1, 8206), new ItemStack(Items.golden_carrot) }, "\u00a78", "Stealth"));
|
||||
// Chest
|
||||
ModifyBuilder.registerModifier(new AModInteger(
|
||||
0,
|
||||
"Perfect Dodge",
|
||||
EnumSet.of(ArmorPart.Chest),
|
||||
new ItemStack[] {
|
||||
new ItemStack(Items.ender_eye), new ItemStack(Items.ender_pearl), new ItemStack(Items.sugar)
|
||||
},
|
||||
1,
|
||||
"\u00a7d",
|
||||
"Perfect Dodge"));
|
||||
ModifyBuilder.registerModifier(new AModBoolean(
|
||||
1,
|
||||
"Stealth",
|
||||
EnumSet.of(ArmorPart.Chest),
|
||||
new ItemStack[] {
|
||||
new ItemStack(Items.fermented_spider_eye),
|
||||
new ItemStack(Items.ender_eye),
|
||||
new ItemStack(Items.potionitem, 1, 8206),
|
||||
new ItemStack(Items.golden_carrot)
|
||||
},
|
||||
"\u00a78",
|
||||
"Stealth"));
|
||||
|
||||
//Wings
|
||||
// Wings
|
||||
ItemStack feather = new ItemStack(Items.feather);
|
||||
ModifyBuilder.registerModifier(new AModInteger(1, "Feather Fall", EnumSet.of(ArmorPart.Legs), new ItemStack[] { new ItemStack(TinkerWorld.slimeGel, 1, 0), new ItemStack(Items.ender_pearl), feather, feather, feather, feather, feather, feather }, 1, "\u00a7f", "Feather Fall"));
|
||||
ModifyBuilder.registerModifier(new AModInteger(1, "Feather Fall", EnumSet.of(ArmorPart.Legs), new ItemStack[] { new ItemStack(TinkerWorld.slimeGel, 1, 1), new ItemStack(Items.ender_pearl), feather, feather, feather, feather, feather, feather }, 1, "\u00a7f", "Feather Fall"));
|
||||
ModifyBuilder.registerModifier(new AModInteger(
|
||||
1,
|
||||
"Feather Fall",
|
||||
EnumSet.of(ArmorPart.Legs),
|
||||
new ItemStack[] {
|
||||
new ItemStack(TinkerWorld.slimeGel, 1, 0),
|
||||
new ItemStack(Items.ender_pearl),
|
||||
feather,
|
||||
feather,
|
||||
feather,
|
||||
feather,
|
||||
feather,
|
||||
feather
|
||||
},
|
||||
1,
|
||||
"\u00a7f",
|
||||
"Feather Fall"));
|
||||
ModifyBuilder.registerModifier(new AModInteger(
|
||||
1,
|
||||
"Feather Fall",
|
||||
EnumSet.of(ArmorPart.Legs),
|
||||
new ItemStack[] {
|
||||
new ItemStack(TinkerWorld.slimeGel, 1, 1),
|
||||
new ItemStack(Items.ender_pearl),
|
||||
feather,
|
||||
feather,
|
||||
feather,
|
||||
feather,
|
||||
feather,
|
||||
feather
|
||||
},
|
||||
1,
|
||||
"\u00a7f",
|
||||
"Feather Fall"));
|
||||
|
||||
//Feet
|
||||
ModifyBuilder.registerModifier(new AModBoolean(1, "WaterWalk", EnumSet.of(ArmorPart.Feet), new ItemStack[] { new ItemStack(Blocks.waterlily), new ItemStack(Blocks.waterlily) }, "\u00a79", "Water-Walking"));
|
||||
ModifyBuilder.registerModifier(new AModLeadBoots(new ItemStack[] { new ItemStack(Blocks.iron_block) }));
|
||||
ModifyBuilder.registerModifier(new AModInteger(3, "Slimy Soles", EnumSet.of(ArmorPart.Feet), new ItemStack[] { new ItemStack(TinkerWorld.slimePad, 1, 0), new ItemStack(TinkerWorld.slimePad, 1, 0) }, 1, "\u00a7a", "Slimy Soles"));
|
||||
// Feet
|
||||
ModifyBuilder.registerModifier(new AModBoolean(
|
||||
1,
|
||||
"WaterWalk",
|
||||
EnumSet.of(ArmorPart.Feet),
|
||||
new ItemStack[] {new ItemStack(Blocks.waterlily), new ItemStack(Blocks.waterlily)},
|
||||
"\u00a79",
|
||||
"Water-Walking"));
|
||||
ModifyBuilder.registerModifier(new AModLeadBoots(new ItemStack[] {new ItemStack(Blocks.iron_block)}));
|
||||
ModifyBuilder.registerModifier(new AModInteger(
|
||||
3,
|
||||
"Slimy Soles",
|
||||
EnumSet.of(ArmorPart.Feet),
|
||||
new ItemStack[] {new ItemStack(TinkerWorld.slimePad, 1, 0), new ItemStack(TinkerWorld.slimePad, 1, 0)},
|
||||
1,
|
||||
"\u00a7a",
|
||||
"Slimy Soles"));
|
||||
|
||||
//Glove
|
||||
ModifyBuilder.registerModifier(new GloveSpeed(1, new ItemStack[] { redstoneItem, redstoneBlock }, new int[] { 1, 9 }));
|
||||
//ModifyBuilder.registerModifier(new GloveClimb(new ItemStack[] { new ItemStack(Items.slime_ball), new ItemStack(Blocks.web), new ItemStack(TinkerTools.materials, 1, 25) }));
|
||||
modAttackGlove = new ModAttack("Quartz", 2, new ItemStack[] { new ItemStack(Items.quartz), new ItemStack(Blocks.quartz_block, 1, Short.MAX_VALUE) }, new int[] { 1, 4 }, 50, 50, "Accessory");
|
||||
//ModifyBuilder.registerModifier(modAttackGlove);
|
||||
// Glove
|
||||
ModifyBuilder.registerModifier(
|
||||
new GloveSpeed(1, new ItemStack[] {redstoneItem, redstoneBlock}, new int[] {1, 9}));
|
||||
// ModifyBuilder.registerModifier(new GloveClimb(new ItemStack[] { new ItemStack(Items.slime_ball), new
|
||||
// ItemStack(Blocks.web), new ItemStack(TinkerTools.materials, 1, 25) }));
|
||||
modAttackGlove = new ModAttack(
|
||||
"Quartz",
|
||||
2,
|
||||
new ItemStack[] {new ItemStack(Items.quartz), new ItemStack(Blocks.quartz_block, 1, Short.MAX_VALUE)},
|
||||
new int[] {1, 4},
|
||||
50,
|
||||
50,
|
||||
"Accessory");
|
||||
// ModifyBuilder.registerModifier(modAttackGlove);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
package tconstruct.armor;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.PlayerEvent;
|
||||
import java.util.Locale;
|
||||
import net.minecraft.entity.boss.*;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.monster.IMob;
|
||||
@@ -14,47 +14,47 @@ import net.minecraftforge.event.entity.living.*;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent.LivingJumpEvent;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.armor.items.TravelWings;
|
||||
import tconstruct.armor.player.ArmorExtended;
|
||||
import tconstruct.armor.player.TPlayerStats;
|
||||
import tconstruct.library.modifier.IModifyable;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
import tconstruct.util.network.ArmourGuiSyncPacket;
|
||||
import tconstruct.world.entity.BlueSlime;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class TinkerArmorEvents
|
||||
{
|
||||
public class TinkerArmorEvents {
|
||||
|
||||
@SubscribeEvent
|
||||
public void onLivingDrop (LivingDropsEvent event)
|
||||
{
|
||||
if (event.entityLiving == null)
|
||||
return;
|
||||
public void onLivingDrop(LivingDropsEvent event) {
|
||||
if (event.entityLiving == null) return;
|
||||
|
||||
if(!event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot"))
|
||||
return;
|
||||
if (!event.entityLiving.worldObj.getGameRules().getGameRuleBooleanValue("doMobLoot")) return;
|
||||
|
||||
if (TConstruct.random.nextInt(200) == 0 && event.entityLiving instanceof IMob && event.source.damageType.equals("player"))
|
||||
{
|
||||
if (TConstruct.random.nextInt(200) == 0
|
||||
&& event.entityLiving instanceof IMob
|
||||
&& event.source.damageType.equals("player")) {
|
||||
ItemStack dropStack = new ItemStack(TinkerArmor.heartCanister, 1, 1);
|
||||
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack);
|
||||
EntityItem entityitem = new EntityItem(
|
||||
event.entityLiving.worldObj,
|
||||
event.entityLiving.posX,
|
||||
event.entityLiving.posY,
|
||||
event.entityLiving.posZ,
|
||||
dropStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
|
||||
if (event.entityLiving instanceof IBossDisplayData)
|
||||
{
|
||||
if (event.entityLiving instanceof IBossDisplayData) {
|
||||
String entityName = event.entityLiving.getClass().getSimpleName().toLowerCase();
|
||||
for(String name : PHConstruct.heartDropBlacklist)
|
||||
if (name.toLowerCase(Locale.US).equals(entityName))
|
||||
return;
|
||||
for (String name : PHConstruct.heartDropBlacklist)
|
||||
if (name.toLowerCase(Locale.US).equals(entityName)) return;
|
||||
|
||||
int count = event.entityLiving instanceof EntityDragon ? 5 : 1;
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
for (int i = 0; i < count; i++) {
|
||||
ItemStack dropStack = new ItemStack(TinkerArmor.heartCanister, 1, 3);
|
||||
EntityItem entityitem = new EntityItem(event.entityLiving.worldObj, event.entityLiving.posX, event.entityLiving.posY, event.entityLiving.posZ, dropStack);
|
||||
EntityItem entityitem = new EntityItem(
|
||||
event.entityLiving.worldObj,
|
||||
event.entityLiving.posX,
|
||||
event.entityLiving.posY,
|
||||
event.entityLiving.posZ,
|
||||
dropStack);
|
||||
entityitem.delayBeforeCanPickup = 10;
|
||||
event.drops.add(entityitem);
|
||||
}
|
||||
@@ -63,20 +63,18 @@ public class TinkerArmorEvents
|
||||
|
||||
/* Abilities */
|
||||
@SubscribeEvent
|
||||
public void armorMineSpeed (net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed event)
|
||||
{
|
||||
if(event.entityPlayer == null)
|
||||
return;
|
||||
public void armorMineSpeed(net.minecraftforge.event.entity.player.PlayerEvent.BreakSpeed event) {
|
||||
if (event.entityPlayer == null) return;
|
||||
|
||||
ItemStack glove = TPlayerStats.get(event.entityPlayer).armor.getStackInSlot(1);
|
||||
if(event.entityPlayer.worldObj.isRemote) { // todo: sync extended inventory with clients so this stuff and rendering is done properly...
|
||||
if(ArmorProxyClient.armorExtended != null)
|
||||
glove = ArmorProxyClient.armorExtended.getStackInSlot(1);
|
||||
else
|
||||
glove = null;
|
||||
if (event.entityPlayer
|
||||
.worldObj
|
||||
.isRemote) { // todo: sync extended inventory with clients so this stuff and rendering is done
|
||||
// properly...
|
||||
if (ArmorProxyClient.armorExtended != null) glove = ArmorProxyClient.armorExtended.getStackInSlot(1);
|
||||
else glove = null;
|
||||
}
|
||||
if(glove == null || !glove.hasTagCompound())
|
||||
return;
|
||||
if (glove == null || !glove.hasTagCompound()) return;
|
||||
|
||||
// ok, we got a glove. bonus mining speeeeed
|
||||
NBTTagCompound tags = glove.getTagCompound().getCompoundTag(TinkerArmor.travelGlove.getBaseTagName());
|
||||
@@ -88,25 +86,21 @@ public class TinkerArmorEvents
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void jumpHeight (LivingJumpEvent event)
|
||||
{
|
||||
public void jumpHeight(LivingJumpEvent event) {
|
||||
ItemStack stack = event.entityLiving.getEquipmentInSlot(2);
|
||||
if (stack != null && stack.getItem() instanceof TravelWings)
|
||||
{
|
||||
if (stack != null && stack.getItem() instanceof TravelWings) {
|
||||
event.entityLiving.motionY += 0.2;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void slimefall (LivingFallEvent event)
|
||||
{
|
||||
public void slimefall(LivingFallEvent event) {
|
||||
ItemStack boots = event.entityLiving.getEquipmentInSlot(1);
|
||||
if (boots != null && boots.getItem() instanceof IModifyable)
|
||||
{
|
||||
NBTTagCompound tag = boots.getTagCompound().getCompoundTag(((IModifyable) boots.getItem()).getBaseTagName());
|
||||
if (boots != null && boots.getItem() instanceof IModifyable) {
|
||||
NBTTagCompound tag =
|
||||
boots.getTagCompound().getCompoundTag(((IModifyable) boots.getItem()).getBaseTagName());
|
||||
int sole = tag.getInteger("Slimy Soles");
|
||||
if (sole > 0)
|
||||
{
|
||||
if (sole > 0) {
|
||||
event.distance /= (1 + sole);
|
||||
event.entityLiving.fallDistance /= (1 + sole);
|
||||
}
|
||||
@@ -114,38 +108,30 @@ public class TinkerArmorEvents
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void perfectDodge(LivingAttackEvent event)
|
||||
{
|
||||
if(!event.source.isProjectile())
|
||||
return;
|
||||
public void perfectDodge(LivingAttackEvent event) {
|
||||
if (!event.source.isProjectile()) return;
|
||||
|
||||
// perfect dodge?
|
||||
if(!(event.entityLiving instanceof EntityPlayer))
|
||||
return;
|
||||
if (!(event.entityLiving instanceof EntityPlayer)) return;
|
||||
|
||||
EntityPlayer player = (EntityPlayer) event.entityLiving;
|
||||
ItemStack chest = player.getCurrentArmor(2);
|
||||
if(chest == null || !(chest.getItem() instanceof IModifyable) || !chest.hasTagCompound())
|
||||
return;
|
||||
if (chest == null || !(chest.getItem() instanceof IModifyable) || !chest.hasTagCompound()) return;
|
||||
|
||||
NBTTagCompound tags = chest.getTagCompound().getCompoundTag(((IModifyable) chest.getItem()).getBaseTagName());
|
||||
int dodge = tags.getInteger("Perfect Dodge");
|
||||
if(dodge > TConstruct.random.nextInt(10))
|
||||
event.setCanceled(true);
|
||||
if (dodge > TConstruct.random.nextInt(10)) event.setCanceled(true);
|
||||
}
|
||||
|
||||
|
||||
@SubscribeEvent
|
||||
public void joinWorld(EntityJoinWorldEvent event)
|
||||
{
|
||||
if (event.entity instanceof EntityPlayerMP)
|
||||
{
|
||||
EntityPlayerMP player = (EntityPlayerMP)event.entity;
|
||||
public void joinWorld(EntityJoinWorldEvent event) {
|
||||
if (event.entity instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP player = (EntityPlayerMP) event.entity;
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
stats.saveNBTData(tag);
|
||||
ArmourGuiSyncPacket syncPacket = new ArmourGuiSyncPacket(tag);
|
||||
TConstruct.packetPipeline.sendTo(syncPacket, player);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -17,11 +17,9 @@ import tconstruct.blocks.logic.DryingRackLogic;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
|
||||
public class DryingRack extends InventoryBlock
|
||||
{
|
||||
public class DryingRack extends InventoryBlock {
|
||||
|
||||
public DryingRack()
|
||||
{
|
||||
public DryingRack() {
|
||||
super(Material.wood);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
setHardness(2.0f);
|
||||
@@ -29,76 +27,60 @@ public class DryingRack extends InventoryBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity (World world, int metadata)
|
||||
{
|
||||
public TileEntity createNewTileEntity(World world, int metadata) {
|
||||
return new DryingRackLogic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderBlockPass ()
|
||||
{
|
||||
public int getRenderBlockPass() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer getGui (World world, int x, int y, int z, EntityPlayer entityplayer)
|
||||
{
|
||||
public Integer getGui(World world, int x, int y, int z, EntityPlayer entityplayer) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getModInstance ()
|
||||
{
|
||||
public Object getModInstance() {
|
||||
return TConstruct.instance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int onBlockPlaced (World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta)
|
||||
{
|
||||
if (side > 1)
|
||||
return side;
|
||||
public int onBlockPlaced(World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ, int meta) {
|
||||
if (side > 1) return side;
|
||||
return meta;
|
||||
}
|
||||
|
||||
public void onBlockPlacedBy (World world, int x, int y, int z, EntityLiving living, ItemStack stack)
|
||||
{
|
||||
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLiving living, ItemStack stack) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta == 0)
|
||||
{
|
||||
if (meta == 0) {
|
||||
int l = MathHelper.floor_double((double) (living.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
|
||||
int direction = l % 2;
|
||||
if (direction == 1)
|
||||
world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
if (direction == 1) world.setBlockMetadataWithNotify(x, y, z, 1, 2);
|
||||
}
|
||||
}
|
||||
|
||||
/* Activation */
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int side, float clickX, float clickY, float clickZ) {
|
||||
return activateDryingRack(world, x, y, z, player);
|
||||
}
|
||||
|
||||
boolean activateDryingRack (World world, int x, int y, int z, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
boolean activateDryingRack(World world, int x, int y, int z, EntityPlayer player) {
|
||||
if (!world.isRemote) {
|
||||
DryingRackLogic logic = (DryingRackLogic) world.getTileEntity(x, y, z);
|
||||
|
||||
if (!logic.isStackInSlot(0))
|
||||
{
|
||||
if (!logic.isStackInSlot(0)) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null)
|
||||
{
|
||||
if (stack != null) {
|
||||
stack = player.inventory.decrStackSize(player.inventory.currentItem, 1);
|
||||
logic.setInventorySlotContents(0, stack);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
ItemStack decrStack = logic.decrStackSize(0, 1);
|
||||
if (decrStack != null)
|
||||
AbilityHelper.spawnItemAtPlayer(player, decrStack);
|
||||
if (decrStack != null) AbilityHelper.spawnItemAtPlayer(player, decrStack);
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
@@ -107,8 +89,7 @@ public class DryingRack extends InventoryBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
public AxisAlignedBB getSelectedBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
float xMin = 0F;
|
||||
float yMin = 0F;
|
||||
@@ -116,41 +97,45 @@ public class DryingRack extends InventoryBlock
|
||||
float xMax = 1F;
|
||||
float yMax = 1F;
|
||||
float zMax = 1F;
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
zMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
zMax = 0.625F;
|
||||
break;
|
||||
case 1:
|
||||
xMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
xMax = 0.625F;
|
||||
break;
|
||||
case 2:
|
||||
zMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 3:
|
||||
zMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 5:
|
||||
xMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
switch (metadata) {
|
||||
case 0:
|
||||
zMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
zMax = 0.625F;
|
||||
break;
|
||||
case 1:
|
||||
xMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
xMax = 0.625F;
|
||||
break;
|
||||
case 2:
|
||||
zMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 3:
|
||||
zMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 5:
|
||||
xMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
}
|
||||
return AxisAlignedBB.getBoundingBox((double) x + xMin, (double) y + yMin, (double) z + zMin, (double) x + xMax, (double) y + yMax, (double) z + zMax);
|
||||
return AxisAlignedBB.getBoundingBox(
|
||||
(double) x + xMin,
|
||||
(double) y + yMin,
|
||||
(double) z + zMin,
|
||||
(double) x + xMax,
|
||||
(double) y + yMax,
|
||||
(double) z + zMax);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
int metadata = world.getBlockMetadata(x, y, z);
|
||||
float xMin = 0F;
|
||||
float yMin = 0F;
|
||||
@@ -158,98 +143,95 @@ public class DryingRack extends InventoryBlock
|
||||
float xMax = 1F;
|
||||
float yMax = 1F;
|
||||
float zMax = 1F;
|
||||
switch (metadata)
|
||||
{
|
||||
case 0:
|
||||
zMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
zMax = 0.625F;
|
||||
break;
|
||||
case 1:
|
||||
xMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
xMax = 0.625F;
|
||||
break;
|
||||
case 2:
|
||||
zMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 3:
|
||||
zMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 5:
|
||||
xMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
switch (metadata) {
|
||||
case 0:
|
||||
zMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
zMax = 0.625F;
|
||||
break;
|
||||
case 1:
|
||||
xMin = 0.375F;
|
||||
yMax = 0.25F;
|
||||
xMax = 0.625F;
|
||||
break;
|
||||
case 2:
|
||||
zMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 3:
|
||||
zMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 4:
|
||||
xMin = 0.75F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
case 5:
|
||||
xMax = 0.25F;
|
||||
yMin = 0.75F;
|
||||
break;
|
||||
}
|
||||
this.setBlockBounds(xMin, yMin, zMin, xMax, yMax, zMax);
|
||||
}
|
||||
|
||||
@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) {
|
||||
this.setBlockBoundsBasedOnState(world, x, y, z);
|
||||
super.addCollisionBoxesToList(world, x, y, z, aabb, list, entity);
|
||||
}
|
||||
|
||||
/* Rendering */
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return DryingRackRender.model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTextureNames ()
|
||||
{
|
||||
String[] textureNames = { "castingtable_top", "castingtable_side", "castingtable_bottom", "faucet", "blockcast_top", "blockcast_side", "blockcast_bottom" };
|
||||
public String[] getTextureNames() {
|
||||
String[] textureNames = {
|
||||
"castingtable_top",
|
||||
"castingtable_side",
|
||||
"castingtable_bottom",
|
||||
"faucet",
|
||||
"blockcast_top",
|
||||
"blockcast_side",
|
||||
"blockcast_bottom"
|
||||
};
|
||||
|
||||
return textureNames;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTextureDomain (int textureNameIndex)
|
||||
{
|
||||
public String getTextureDomain(int textureNameIndex) {
|
||||
return "tinker";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return Blocks.planks.getIcon(side, 0);
|
||||
}
|
||||
|
||||
public int getTextureIndex (int side)
|
||||
{
|
||||
if (side == 0)
|
||||
return 2;
|
||||
if (side == 1)
|
||||
return 0;
|
||||
public int getTextureIndex(int side) {
|
||||
if (side == 0) return 2;
|
||||
if (side == 1) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createTileEntity (World world, int metadata)
|
||||
{
|
||||
public TileEntity createTileEntity(World world, int metadata) {
|
||||
return new DryingRackLogic();
|
||||
}
|
||||
|
||||
@@ -271,11 +253,11 @@ public class DryingRack extends InventoryBlock
|
||||
* != 1) { this.setBlockBounds(0, 0, 0, 1, 1, 1); } else { FaucetLogic logic
|
||||
* = (FaucetLogic) world.getBlockTileEntity(x, y, z); float xMin = 0.25F;
|
||||
* float xMax = 0.75F; float zMin = 0.25F; float zMax = 0.75F;
|
||||
*
|
||||
*
|
||||
* switch (logic.getRenderDirection()) { case 2: zMin = 0.625F; zMax = 1.0F;
|
||||
* break; case 3: zMax = 0.375F; zMin = 0F; break; case 4: xMin = 0.625F;
|
||||
* xMax = 1.0F; break; case 5: xMax = 0.375F; xMin = 0F; break; }
|
||||
*
|
||||
*
|
||||
* this.setBlockBounds(xMin, 0.25F, zMin, xMax, 0.625F, zMax); } }
|
||||
*/
|
||||
|
||||
@@ -286,15 +268,15 @@ public class DryingRack extends InventoryBlock
|
||||
* 1, y + 1, z + 1); } else { FaucetLogic logic = (FaucetLogic)
|
||||
* world.getBlockTileEntity(x, y, z); if (logic != null) { float xMin =
|
||||
* 0.25F; float xMax = 0.75F; float zMin = 0.25F; float zMax = 0.75F;
|
||||
*
|
||||
*
|
||||
* switch (logic.getRenderDirection()) { case 2: zMin = 0.625F; zMax = 1.0F;
|
||||
* break; case 3: zMax = 0.375F; zMin = 0F; break; case 4: xMin = 0.625F;
|
||||
* xMax = 1.0F; break; case 5: xMax = 0.375F; xMin = 0F; break; }
|
||||
*
|
||||
*
|
||||
* return AxisAlignedBB.getBoundingBox((double) ((float) x + xMin),
|
||||
* (double) y + 0.25, (double) ((float) z + zMin), (double) ((float) x +
|
||||
* xMax), (double) y + 0.625, (double) ((float) z + zMax)); } }
|
||||
*
|
||||
*
|
||||
* return super.getCollisionBoundingBoxFromPool(world, x, y, z); }
|
||||
*/
|
||||
|
||||
|
||||
@@ -10,24 +10,21 @@ import tconstruct.armor.inventory.ArmorExtendedContainer;
|
||||
import tconstruct.armor.player.ArmorExtended;
|
||||
import tconstruct.client.tabs.*;
|
||||
|
||||
public class ArmorExtendedGui extends InventoryEffectRenderer
|
||||
{
|
||||
public class ArmorExtendedGui extends InventoryEffectRenderer {
|
||||
public InventoryPlayer inv;
|
||||
public ArmorExtended stats;
|
||||
|
||||
private float xSize_lo;
|
||||
private float ySize_lo;
|
||||
|
||||
public ArmorExtendedGui(InventoryPlayer inventoryplayer, ArmorExtended holder)
|
||||
{
|
||||
public ArmorExtendedGui(InventoryPlayer inventoryplayer, ArmorExtended holder) {
|
||||
super(new ArmorExtendedContainer(inventoryplayer, holder));
|
||||
inv = inventoryplayer;
|
||||
stats = holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui ()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
int cornerX = guiLeft;
|
||||
@@ -47,8 +44,7 @@ public class ArmorExtendedGui extends InventoryEffectRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
// fontRenderer.drawString(StatCollector.translateToLocal("inventory.armorextended"),
|
||||
// 60, 6, 0x404040);
|
||||
// fontRenderer.drawString(StatCollector.translateToLocal("container.inventory"),
|
||||
@@ -56,8 +52,7 @@ public class ArmorExtendedGui extends InventoryEffectRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawScreen (int par1, int par2, float par3)
|
||||
{
|
||||
public void drawScreen(int par1, int par2, float par3) {
|
||||
super.drawScreen(par1, par2, par3);
|
||||
this.xSize_lo = (float) par1;
|
||||
this.ySize_lo = (float) par2;
|
||||
@@ -85,8 +80,7 @@ public class ArmorExtendedGui extends InventoryEffectRenderer
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/armorextended.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
|
||||
{
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
// mc.renderEngine.bindTexture("/mods/tinker/textures/gui/armorextended.png");
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
@@ -94,28 +88,26 @@ public class ArmorExtendedGui extends InventoryEffectRenderer
|
||||
int cornerY = guiTop;
|
||||
drawTexturedModalRect(cornerX, guiTop, 0, 0, xSize, ySize);
|
||||
|
||||
if (!stats.isStackInSlot(0))
|
||||
drawTexturedModalRect(cornerX + 79, cornerY + 16, 176, 9, 18, 18);
|
||||
if (!stats.isStackInSlot(1))
|
||||
drawTexturedModalRect(cornerX + 79, cornerY + 34, 176, 27, 18, 18);
|
||||
if (!stats.isStackInSlot(2))
|
||||
drawTexturedModalRect(cornerX + 115, cornerY + 16, 212, 9, 18, 18);
|
||||
if (!stats.isStackInSlot(3))
|
||||
drawTexturedModalRect(cornerX + 115, cornerY + 34, 212, 27, 18, 18);
|
||||
if (!stats.isStackInSlot(4))
|
||||
drawTexturedModalRect(cornerX + 151, cornerY + 52, 230, 0, 18, 18);
|
||||
if (!stats.isStackInSlot(5))
|
||||
drawTexturedModalRect(cornerX + 151, cornerY + 34, 230, 18, 18, 18);
|
||||
if (!stats.isStackInSlot(6))
|
||||
drawTexturedModalRect(cornerX + 151, cornerY + 16, 230, 36, 18, 18);
|
||||
if (!stats.isStackInSlot(0)) drawTexturedModalRect(cornerX + 79, cornerY + 16, 176, 9, 18, 18);
|
||||
if (!stats.isStackInSlot(1)) drawTexturedModalRect(cornerX + 79, cornerY + 34, 176, 27, 18, 18);
|
||||
if (!stats.isStackInSlot(2)) drawTexturedModalRect(cornerX + 115, cornerY + 16, 212, 9, 18, 18);
|
||||
if (!stats.isStackInSlot(3)) drawTexturedModalRect(cornerX + 115, cornerY + 34, 212, 27, 18, 18);
|
||||
if (!stats.isStackInSlot(4)) drawTexturedModalRect(cornerX + 151, cornerY + 52, 230, 0, 18, 18);
|
||||
if (!stats.isStackInSlot(5)) drawTexturedModalRect(cornerX + 151, cornerY + 34, 230, 18, 18, 18);
|
||||
if (!stats.isStackInSlot(6)) drawTexturedModalRect(cornerX + 151, cornerY + 16, 230, 36, 18, 18);
|
||||
|
||||
cornerX = this.guiLeft;
|
||||
cornerY = this.guiTop;
|
||||
drawPlayerOnGui(this.mc, cornerX + 33, cornerY + 75, 30, (float) (cornerX + 51) - this.xSize_lo, (float) (cornerY + 75 - 50) - this.ySize_lo);
|
||||
drawPlayerOnGui(
|
||||
this.mc,
|
||||
cornerX + 33,
|
||||
cornerY + 75,
|
||||
30,
|
||||
(float) (cornerX + 51) - this.xSize_lo,
|
||||
(float) (cornerY + 75 - 50) - this.ySize_lo);
|
||||
}
|
||||
|
||||
public static void drawPlayerOnGui (Minecraft par0Minecraft, int par1, int par2, int par3, float par4, float par5)
|
||||
{
|
||||
public static void drawPlayerOnGui(Minecraft par0Minecraft, int par1, int par2, int par3, float par4, float par5) {
|
||||
GL11.glEnable(GL11.GL_COLOR_MATERIAL);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par1, (float) par2, 50.0F);
|
||||
@@ -150,7 +142,7 @@ public class ArmorExtendedGui extends InventoryEffectRenderer
|
||||
/*
|
||||
* protected void keyTyped(char par1, int par2) { if (par2 ==
|
||||
* TControls.armorKey.keyCode) { this.mc.thePlayer.closeScreen(); }
|
||||
*
|
||||
*
|
||||
* super.keyTyped(par1, par2); }
|
||||
*/
|
||||
}
|
||||
@@ -8,21 +8,18 @@ import tconstruct.armor.inventory.KnapsackContainer;
|
||||
import tconstruct.armor.player.KnapsackInventory;
|
||||
import tconstruct.client.tabs.*;
|
||||
|
||||
public class KnapsackGui extends InventoryEffectRenderer
|
||||
{
|
||||
public class KnapsackGui extends InventoryEffectRenderer {
|
||||
public InventoryPlayer inv;
|
||||
public KnapsackInventory stats;
|
||||
|
||||
public KnapsackGui(InventoryPlayer inventoryplayer, KnapsackInventory holder)
|
||||
{
|
||||
public KnapsackGui(InventoryPlayer inventoryplayer, KnapsackInventory holder) {
|
||||
super(new KnapsackContainer(inventoryplayer, holder));
|
||||
inv = inventoryplayer;
|
||||
stats = holder;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initGui ()
|
||||
{
|
||||
public void initGui() {
|
||||
super.initGui();
|
||||
|
||||
int cornerX = guiLeft;
|
||||
@@ -45,17 +42,16 @@ public class KnapsackGui extends InventoryEffectRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerForegroundLayer (int par1, int par2)
|
||||
{
|
||||
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("inventory.knapsack"), 8, 6, 0x404040);
|
||||
fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
|
||||
fontRendererObj.drawString(
|
||||
StatCollector.translateToLocal("container.inventory"), 8, (ySize - 96) + 4, 0x404040);
|
||||
}
|
||||
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/knapsack.png");
|
||||
|
||||
@Override
|
||||
protected void drawGuiContainerBackgroundLayer (float f, int i, int j)
|
||||
{
|
||||
protected void drawGuiContainerBackgroundLayer(float f, int i, int j) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
this.mc.getTextureManager().bindTexture(background);
|
||||
int cornerX = guiLeft;
|
||||
@@ -66,7 +62,7 @@ public class KnapsackGui extends InventoryEffectRenderer
|
||||
/*
|
||||
* protected void keyTyped(char par1, int par2) { if (par2 ==
|
||||
* TControls.armorKey.keyCode) { this.mc.thePlayer.closeScreen(); }
|
||||
*
|
||||
*
|
||||
* super.keyTyped(par1, par2); }
|
||||
*/
|
||||
}
|
||||
@@ -6,13 +6,11 @@ import net.minecraft.item.ItemStack;
|
||||
import tconstruct.armor.player.ArmorExtended;
|
||||
import tconstruct.smeltery.inventory.ActiveContainer;
|
||||
|
||||
public class ArmorExtendedContainer extends ActiveContainer
|
||||
{
|
||||
public class ArmorExtendedContainer extends ActiveContainer {
|
||||
public InventoryPlayer invPlayer;
|
||||
public ArmorExtended armor;
|
||||
|
||||
public ArmorExtendedContainer(InventoryPlayer inventoryplayer, ArmorExtended armor)
|
||||
{
|
||||
public ArmorExtendedContainer(InventoryPlayer inventoryplayer, ArmorExtended armor) {
|
||||
invPlayer = inventoryplayer;
|
||||
this.armor = armor;
|
||||
|
||||
@@ -20,40 +18,40 @@ public class ArmorExtendedContainer extends ActiveContainer
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 1, 80, 35, 1));
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 2, 116, 17, 1));
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 3, 116, 35, 1));
|
||||
|
||||
|
||||
// HeartCanister
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 4, 152, 53, 10));
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 5, 152, 35, 10));
|
||||
this.addSlotToContainer(new SlotAccessory(armor, 6, 152, 17, 10));
|
||||
for (int playerArmor = 0; playerArmor < 4; ++playerArmor)
|
||||
{
|
||||
this.addSlotToContainer(new SlotArmorCopy(this, inventoryplayer, inventoryplayer.getSizeInventory() - 1 - playerArmor, 98, 8 + playerArmor * 18, playerArmor));
|
||||
for (int playerArmor = 0; playerArmor < 4; ++playerArmor) {
|
||||
this.addSlotToContainer(new SlotArmorCopy(
|
||||
this,
|
||||
inventoryplayer,
|
||||
inventoryplayer.getSizeInventory() - 1 - playerArmor,
|
||||
98,
|
||||
8 + playerArmor * 18,
|
||||
playerArmor));
|
||||
}
|
||||
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
|
||||
for (int column = 0; column < 3; column++) {
|
||||
for (int row = 0; row < 9; row++) {
|
||||
this.addSlotToContainer(
|
||||
new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int column = 0; column < 9; column++)
|
||||
{
|
||||
for (int column = 0; column < 9; column++) {
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, column, 8 + column * 18, 142));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer var1)
|
||||
{
|
||||
public boolean canInteractWith(EntityPlayer var1) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -5,74 +5,58 @@ import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.armor.player.KnapsackInventory;
|
||||
|
||||
public class KnapsackContainer extends Container
|
||||
{
|
||||
public class KnapsackContainer extends Container {
|
||||
public KnapsackInventory backpack;
|
||||
public int progress = 0;
|
||||
public int fuel = 0;
|
||||
public int fuelGague = 0;
|
||||
|
||||
public KnapsackContainer(InventoryPlayer inventoryplayer, KnapsackInventory knapsack)
|
||||
{
|
||||
public KnapsackContainer(InventoryPlayer inventoryplayer, KnapsackInventory knapsack) {
|
||||
backpack = knapsack;
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
for (int column = 0; column < 3; column++) {
|
||||
for (int row = 0; row < 9; row++) {
|
||||
this.addSlotToContainer(new Slot(knapsack, row + column * 9, 8 + row * 18, 17 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
/* Player inventory */
|
||||
for (int column = 0; column < 3; column++)
|
||||
{
|
||||
for (int row = 0; row < 9; row++)
|
||||
{
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
|
||||
for (int column = 0; column < 3; column++) {
|
||||
for (int row = 0; row < 9; row++) {
|
||||
this.addSlotToContainer(
|
||||
new Slot(inventoryplayer, row + column * 9 + 9, 8 + row * 18, 84 + column * 18));
|
||||
}
|
||||
}
|
||||
|
||||
for (int column = 0; column < 9; column++)
|
||||
{
|
||||
for (int column = 0; column < 9; column++) {
|
||||
this.addSlotToContainer(new Slot(inventoryplayer, column, 8 + column * 18, 142));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canInteractWith (EntityPlayer entityplayer)
|
||||
{
|
||||
public boolean canInteractWith(EntityPlayer entityplayer) {
|
||||
return backpack.isUseableByPlayer(entityplayer);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack transferStackInSlot (EntityPlayer player, int slotID)
|
||||
{
|
||||
public ItemStack transferStackInSlot(EntityPlayer player, int slotID) {
|
||||
ItemStack stack = null;
|
||||
Slot slot = (Slot) this.inventorySlots.get(slotID);
|
||||
|
||||
if (slot != null && slot.getHasStack())
|
||||
{
|
||||
if (slot != null && slot.getHasStack()) {
|
||||
ItemStack slotStack = slot.getStack();
|
||||
stack = slotStack.copy();
|
||||
|
||||
if (slotID < backpack.getSizeInventory())
|
||||
{
|
||||
if (!this.mergeItemStack(slotStack, backpack.getSizeInventory(), this.inventorySlots.size(), true))
|
||||
{
|
||||
if (slotID < backpack.getSizeInventory()) {
|
||||
if (!this.mergeItemStack(slotStack, backpack.getSizeInventory(), this.inventorySlots.size(), true)) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else if (!this.mergeItemStack(slotStack, 0, backpack.getSizeInventory(), false))
|
||||
{
|
||||
} else if (!this.mergeItemStack(slotStack, 0, backpack.getSizeInventory(), false)) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (slotStack.stackSize == 0)
|
||||
{
|
||||
if (slotStack.stackSize == 0) {
|
||||
slot.putStack((ItemStack) null);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
slot.onSlotChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,13 +4,11 @@ import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.*;
|
||||
import tconstruct.library.accessory.IAccessory;
|
||||
|
||||
public class SlotAccessory extends Slot
|
||||
{
|
||||
public class SlotAccessory extends Slot {
|
||||
private final int slotID;
|
||||
private final int slotStackLimit;
|
||||
|
||||
public SlotAccessory(IInventory par2IInventory, int par3, int par4, int par5, int slotStackLimit)
|
||||
{
|
||||
public SlotAccessory(IInventory par2IInventory, int par3, int par4, int par5, int slotStackLimit) {
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
this.slotID = par3;
|
||||
this.slotStackLimit = slotStackLimit;
|
||||
@@ -20,17 +18,17 @@ public class SlotAccessory extends Slot
|
||||
* Returns the maximum stack size for a given slot (usually the same as getInventoryStackLimit(), but 1 in the case
|
||||
* of armor slots)
|
||||
*/
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
public int getSlotStackLimit() {
|
||||
return slotStackLimit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the stack is a valid item for this slot. Always true beside for the armor slots.
|
||||
*/
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
|
||||
return item != null && (item instanceof IAccessory) && ((IAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
|
||||
return item != null
|
||||
&& (item instanceof IAccessory)
|
||||
&& ((IAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,7 @@ import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.*;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class SlotArmorCopy extends Slot
|
||||
{
|
||||
public class SlotArmorCopy extends Slot {
|
||||
/**
|
||||
* The armor type that can be placed on that slot, it uses the same values
|
||||
* of armorType field on ItemArmor.
|
||||
@@ -19,8 +18,7 @@ public class SlotArmorCopy extends Slot
|
||||
*/
|
||||
final Container parent;
|
||||
|
||||
public SlotArmorCopy(Container container, IInventory par2IInventory, int par3, int par4, int par5, int par6)
|
||||
{
|
||||
public SlotArmorCopy(Container container, IInventory par2IInventory, int par3, int par4, int par5, int par6) {
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
this.parent = container;
|
||||
this.armorType = par6;
|
||||
@@ -31,8 +29,7 @@ public class SlotArmorCopy extends Slot
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -41,12 +38,10 @@ public class SlotArmorCopy extends Slot
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
|
||||
boolean isValidArmor = false;
|
||||
if (item instanceof ItemArmor)
|
||||
{
|
||||
if (item instanceof ItemArmor) {
|
||||
isValidArmor = (((ItemArmor) item).armorType == armorType);
|
||||
}
|
||||
return item != null && (isValidArmor || (item instanceof ItemBlock && armorType == 0));
|
||||
@@ -57,8 +52,7 @@ public class SlotArmorCopy extends Slot
|
||||
/**
|
||||
* Returns the icon index on items.png that is used as background image of the slot.
|
||||
*/
|
||||
public IIcon getBackgroundIconIndex ()
|
||||
{
|
||||
public IIcon getBackgroundIconIndex() {
|
||||
return ItemArmor.func_94602_b(this.armorType);
|
||||
}
|
||||
}
|
||||
@@ -4,36 +4,30 @@ import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.mechworks.landmine.behavior.Behavior;
|
||||
|
||||
public class SlotBehavedOnly extends Slot
|
||||
{
|
||||
public class SlotBehavedOnly extends Slot {
|
||||
|
||||
public SlotBehavedOnly(IInventory par1iInventory, int par2, int par3, int par4)
|
||||
{
|
||||
public SlotBehavedOnly(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
Behavior b = Behavior.getBehaviorFromStack(par1ItemStack);
|
||||
|
||||
if (b == null)
|
||||
{
|
||||
if (b == null) {
|
||||
return false;
|
||||
}
|
||||
|
||||
int stackL = b.getStackLimit(par1ItemStack);
|
||||
|
||||
if (b != null && this.inventory.getStackInSlot(this.slotNumber) != null && !this.inventory.getStackInSlot(this.slotNumber).isItemEqual(par1ItemStack))
|
||||
{
|
||||
if (b != null
|
||||
&& this.inventory.getStackInSlot(this.slotNumber) != null
|
||||
&& !this.inventory.getStackInSlot(this.slotNumber).isItemEqual(par1ItemStack)) {
|
||||
ItemStack is = this.inventory.getStackInSlot(this.slotNumber);
|
||||
if (is.stackSize + par1ItemStack.stackSize <= stackL)
|
||||
{
|
||||
if (is.stackSize + par1ItemStack.stackSize <= stackL) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return par1ItemStack.stackSize <= stackL;
|
||||
}
|
||||
|
||||
@@ -41,8 +35,9 @@ public class SlotBehavedOnly extends Slot
|
||||
// return b != null;
|
||||
}
|
||||
|
||||
public int getSlotStackLimit (ItemStack par1ItemStack)
|
||||
{
|
||||
return Behavior.getBehaviorFromStack(par1ItemStack) != null ? Behavior.getBehaviorFromStack(par1ItemStack).getStackLimit(par1ItemStack) : 1;
|
||||
public int getSlotStackLimit(ItemStack par1ItemStack) {
|
||||
return Behavior.getBehaviorFromStack(par1ItemStack) != null
|
||||
? Behavior.getBehaviorFromStack(par1ItemStack).getStackLimit(par1ItemStack)
|
||||
: 1;
|
||||
}
|
||||
}
|
||||
@@ -4,28 +4,23 @@ import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.*;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SlotBlocksOnly extends Slot
|
||||
{
|
||||
public class SlotBlocksOnly extends Slot {
|
||||
|
||||
public SlotBlocksOnly(IInventory par1iInventory, int par2, int par3, int par4)
|
||||
{
|
||||
public SlotBlocksOnly(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return par1ItemStack.getItem() instanceof ItemBlock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,12 +4,10 @@ import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.*;
|
||||
import tconstruct.library.accessory.IHealthAccessory;
|
||||
|
||||
public class SlotCanister extends Slot
|
||||
{
|
||||
public class SlotCanister extends Slot {
|
||||
private final int slotID;
|
||||
|
||||
public SlotCanister(IInventory par2IInventory, int par3, int par4, int par5)
|
||||
{
|
||||
public SlotCanister(IInventory par2IInventory, int par3, int par4, int par5) {
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
this.slotID = par3;
|
||||
}
|
||||
@@ -19,8 +17,7 @@ public class SlotCanister extends Slot
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
public int getSlotStackLimit() {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@@ -29,10 +26,10 @@ public class SlotCanister extends Slot
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
|
||||
return item != null && (item instanceof IHealthAccessory) && ((IHealthAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
|
||||
|
||||
return item != null
|
||||
&& (item instanceof IHealthAccessory)
|
||||
&& ((IHealthAccessory) item).canEquipAccessory(par1ItemStack, this.slotID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,10 +4,8 @@ import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.*;
|
||||
import tconstruct.armor.items.Knapsack;
|
||||
|
||||
public class SlotKnapsack extends Slot
|
||||
{
|
||||
public SlotKnapsack(IInventory par2IInventory, int par3, int par4, int par5)
|
||||
{
|
||||
public class SlotKnapsack extends Slot {
|
||||
public SlotKnapsack(IInventory par2IInventory, int par3, int par4, int par5) {
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
}
|
||||
|
||||
@@ -16,8 +14,7 @@ public class SlotKnapsack extends Slot
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@@ -26,9 +23,8 @@ public class SlotKnapsack extends Slot
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
Item item = (par1ItemStack == null ? null : par1ItemStack.getItem());
|
||||
return item != null && (item instanceof Knapsack);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,11 +3,9 @@ package tconstruct.armor.inventory;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotOnlyTake extends Slot
|
||||
{
|
||||
public class SlotOnlyTake extends Slot {
|
||||
|
||||
public SlotOnlyTake(IInventory builder, int par3, int par4, int par5)
|
||||
{
|
||||
public SlotOnlyTake(IInventory builder, int par3, int par4, int par5) {
|
||||
super(builder, par3, par4, par5);
|
||||
}
|
||||
|
||||
@@ -16,8 +14,7 @@ public class SlotOnlyTake extends Slot
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack stack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack stack) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -6,23 +6,19 @@ import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author fuj1n
|
||||
*
|
||||
*
|
||||
*/
|
||||
public class SlotOpaqueBlocksOnly extends SlotBlocksOnly
|
||||
{
|
||||
public class SlotOpaqueBlocksOnly extends SlotBlocksOnly {
|
||||
|
||||
public SlotOpaqueBlocksOnly(IInventory par1iInventory, int par2, int par3, int par4)
|
||||
{
|
||||
public SlotOpaqueBlocksOnly(IInventory par1iInventory, int par2, int par3, int par4) {
|
||||
super(par1iInventory, par2, par3, par4);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
if (super.isItemValid(par1ItemStack))
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
if (super.isItemValid(par1ItemStack)) {
|
||||
Block b = BlockUtils.getBlockFromItemStack(par1ItemStack);
|
||||
return b.isOpaqueCube() && b.renderAsNormalBlock();
|
||||
}
|
||||
@@ -31,9 +27,7 @@ public class SlotOpaqueBlocksOnly extends SlotBlocksOnly
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
public int getSlotStackLimit() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,10 +3,8 @@ package tconstruct.armor.inventory;
|
||||
import net.minecraft.inventory.*;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class SlotUnused extends Slot
|
||||
{
|
||||
public SlotUnused(IInventory par2IInventory, int par3, int par4, int par5)
|
||||
{
|
||||
public class SlotUnused extends Slot {
|
||||
public SlotUnused(IInventory par2IInventory, int par3, int par4, int par5) {
|
||||
super(par2IInventory, par3, par4, par5);
|
||||
}
|
||||
|
||||
@@ -15,8 +13,7 @@ public class SlotUnused extends Slot
|
||||
* getInventoryStackLimit(), but 1 in the case of armor slots)
|
||||
*/
|
||||
@Override
|
||||
public int getSlotStackLimit ()
|
||||
{
|
||||
public int getSlotStackLimit() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -25,8 +22,7 @@ public class SlotUnused extends Slot
|
||||
* the armor slots.
|
||||
*/
|
||||
@Override
|
||||
public boolean isItemValid (ItemStack par1ItemStack)
|
||||
{
|
||||
public boolean isItemValid(ItemStack par1ItemStack) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,28 +4,28 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.item.*;
|
||||
|
||||
public class ArmorBasic extends ItemArmor
|
||||
{
|
||||
public class ArmorBasic extends ItemArmor {
|
||||
|
||||
public String textureName;
|
||||
|
||||
public ArmorBasic(ArmorMaterial par2EnumArmorMaterial, int par3, String textureName)
|
||||
{
|
||||
public ArmorBasic(ArmorMaterial par2EnumArmorMaterial, int par3, String textureName) {
|
||||
super(par2EnumArmorMaterial, 0, par3);
|
||||
this.textureName = textureName;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
this.itemIcon = par1IconRegister.registerIcon("tinker:armor/" + textureName + "_" + (this.armorType == 0 ? "helmet" : this.armorType == 1 ? "chestplate" : this.armorType == 2 ? "leggings" : this.armorType == 3 ? "boots" : "helmet"));
|
||||
public void registerIcons(IIconRegister par1IconRegister) {
|
||||
this.itemIcon = par1IconRegister.registerIcon("tinker:armor/" + textureName + "_"
|
||||
+ (this.armorType == 0
|
||||
? "helmet"
|
||||
: this.armorType == 1
|
||||
? "chestplate"
|
||||
: this.armorType == 2 ? "leggings" : this.armorType == 3 ? "boots" : "helmet"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String type)
|
||||
{
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
||||
int suffix = this.armorType == 2 ? 2 : 1;
|
||||
return "tinker:textures/armor/" + textureName + "_" + suffix + ".png";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,13 +9,11 @@ import net.minecraft.item.*;
|
||||
import net.minecraft.util.IIcon;
|
||||
import tconstruct.library.*;
|
||||
|
||||
public class ArmorPattern extends CraftingItem implements ItemBlocklike
|
||||
{
|
||||
public class ArmorPattern extends CraftingItem implements ItemBlocklike {
|
||||
|
||||
private IIcon baseIcon;
|
||||
|
||||
public ArmorPattern(int id, String patternType, String folder)
|
||||
{
|
||||
public ArmorPattern(int id, String patternType, String folder) {
|
||||
super(patternName, getPatternNames(patternType), folder, "tinker", TConstructRegistry.materialTab);
|
||||
this.setHasSubtypes(true);
|
||||
this.setMaxDamage(0);
|
||||
@@ -23,36 +21,29 @@ public class ArmorPattern extends CraftingItem implements ItemBlocklike
|
||||
this.setMaxStackSize(1);
|
||||
}
|
||||
|
||||
protected static String[] getPatternNames (String partType)
|
||||
{
|
||||
protected static String[] getPatternNames(String partType) {
|
||||
String[] names = new String[patternName.length];
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
names[i] = partType + patternName[i];
|
||||
for (int i = 0; i < patternName.length; i++) names[i] = partType + patternName[i];
|
||||
return names;
|
||||
}
|
||||
|
||||
public IIcon getBaseIcon ()
|
||||
{
|
||||
public IIcon getBaseIcon() {
|
||||
return baseIcon;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
super.registerIcons(iconRegister);
|
||||
baseIcon = iconRegister.registerIcon("tinker:" + folder + "armor_cast");
|
||||
}
|
||||
|
||||
private static final String[] patternName = new String[] { "helmet", "chestplate", "leggings", "boots" };
|
||||
private static final String[] patternName = new String[] {"helmet", "chestplate", "leggings", "boots"};
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item block, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int i = 0; i < patternName.length; i++)
|
||||
{
|
||||
public void getSubItems(Item block, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < patternName.length; i++) {
|
||||
list.add(new ItemStack(block, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -8,14 +8,12 @@ import net.minecraft.potion.*;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class DiamondApple extends ItemFood
|
||||
{
|
||||
public class DiamondApple extends ItemFood {
|
||||
public IIcon[] icons;
|
||||
public String[] textureNames = new String[] { "food/apple_diamond" };
|
||||
public String[] itemNames = new String[] { "apple.diamond" };
|
||||
public String[] textureNames = new String[] {"food/apple_diamond"};
|
||||
public String[] itemNames = new String[] {"apple.diamond"};
|
||||
|
||||
public DiamondApple()
|
||||
{
|
||||
public DiamondApple() {
|
||||
super(4, 2.0F, false);
|
||||
setHasSubtypes(true);
|
||||
setMaxDamage(0);
|
||||
@@ -23,58 +21,54 @@ public class DiamondApple extends ItemFood
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (!world.isRemote) {
|
||||
int duration = 0;
|
||||
PotionEffect potion;
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.resistance);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
if (potion != null) duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.field_76444_x.id, duration + 60 * 40, 4));
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.resistance);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
if (potion != null) duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.resistance.id, duration + 60 * 20, 0));
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.digSpeed);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
if (potion != null) duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.digSpeed.id, duration + 60 * 20, 0));
|
||||
|
||||
potion = player.getActivePotionEffect(Potion.damageBoost);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
if (potion != null) duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, duration + 60 * 20, 0));
|
||||
}
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage (int meta)
|
||||
{
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return icons[meta];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
/* Name override */
|
||||
@Override
|
||||
public String getUnlocalizedName (ItemStack itemstack)
|
||||
{
|
||||
return (new StringBuilder()).append("item.food.").append(itemNames[(itemstack.getItemDamage()>=itemNames.length||itemstack.getItemDamage()<0)?(0):(itemstack.getItemDamage())]).toString();
|
||||
public String getUnlocalizedName(ItemStack itemstack) {
|
||||
return (new StringBuilder())
|
||||
.append("item.food.")
|
||||
.append(itemNames[
|
||||
(itemstack.getItemDamage() >= itemNames.length || itemstack.getItemDamage() < 0)
|
||||
? (0)
|
||||
: (itemstack.getItemDamage())])
|
||||
.toString();
|
||||
}
|
||||
}
|
||||
@@ -4,17 +4,14 @@ import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.item.Item;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class Glove extends Item
|
||||
{
|
||||
public Glove()
|
||||
{
|
||||
public class Glove extends Item {
|
||||
public Glove() {
|
||||
super();
|
||||
this.setCreativeTab(TConstructRegistry.materialTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
itemIcon = iconRegister.registerIcon("tinker:armor/dirthand");
|
||||
}
|
||||
}
|
||||
@@ -11,37 +11,43 @@ import tconstruct.armor.player.*;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.accessory.IHealthAccessory;
|
||||
|
||||
public class HeartCanister extends CraftingItem implements IHealthAccessory
|
||||
{
|
||||
public class HeartCanister extends CraftingItem implements IHealthAccessory {
|
||||
|
||||
public HeartCanister()
|
||||
{
|
||||
super(new String[] { "empty", "miniheart.red", "red", "miniheart.yellow", "yellow", "miniheart.green", "green" }, new String[] { "canister_empty", "miniheart_red", "canister_red", "miniheart_yellow", "canister_yellow", "miniheart_green", "canister_green" }, "", "tinker", TConstructRegistry.materialTab);
|
||||
public HeartCanister() {
|
||||
super(
|
||||
new String[] {"empty", "miniheart.red", "red", "miniheart.yellow", "yellow", "miniheart.green", "green"
|
||||
},
|
||||
new String[] {
|
||||
"canister_empty",
|
||||
"miniheart_red",
|
||||
"canister_red",
|
||||
"miniheart_yellow",
|
||||
"canister_yellow",
|
||||
"miniheart_green",
|
||||
"canister_green"
|
||||
},
|
||||
"",
|
||||
"tinker",
|
||||
TConstructRegistry.materialTab);
|
||||
this.setMaxStackSize(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta == 1 || meta == 3 || meta == 5)
|
||||
{
|
||||
if (meta == 1 || meta == 3 || meta == 5) {
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
}
|
||||
if (!world.isRemote && meta == 2)
|
||||
{
|
||||
if (!world.isRemote && meta == 2) {
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
if (stats != null && stats.armor != null)
|
||||
{
|
||||
if (stats != null && stats.armor != null) {
|
||||
ArmorExtended armor = stats.armor;
|
||||
ItemStack slotStack = armor.getStackInSlot(6);
|
||||
if (slotStack == null)// || slotStack.getItem() == this)
|
||||
if (slotStack == null) // || slotStack.getItem() == this)
|
||||
{
|
||||
armor.setInventorySlotContents(6, new ItemStack(this, 1, 2));
|
||||
stack.stackSize--;
|
||||
}
|
||||
else if (slotStack.getItem() == this && slotStack.stackSize < this.maxStackSize)
|
||||
{
|
||||
} else if (slotStack.getItem() == this && slotStack.stackSize < this.maxStackSize) {
|
||||
slotStack.stackSize++;
|
||||
stack.stackSize--;
|
||||
}
|
||||
@@ -52,8 +58,7 @@ public class HeartCanister extends CraftingItem implements IHealthAccessory
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public ItemStack onEaten(ItemStack stack, World world, EntityPlayer player) {
|
||||
int meta = stack.getItemDamage();
|
||||
--stack.stackSize;
|
||||
player.heal((meta + 1) * 10);
|
||||
@@ -62,53 +67,44 @@ public class HeartCanister extends CraftingItem implements IHealthAccessory
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack par1ItemStack)
|
||||
{
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
return EnumAction.eat;
|
||||
}
|
||||
|
||||
public int getMaxItemUseDuration (ItemStack par1ItemStack)
|
||||
{
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
|
||||
return 32;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
int meta = stack.getItemDamage();
|
||||
if (meta == 0 || meta % 2 == 1)
|
||||
list.add(StatCollector.translateToLocal("item.crafting.tooltip"));
|
||||
else
|
||||
{
|
||||
if (meta == 0 || meta % 2 == 1) list.add(StatCollector.translateToLocal("item.crafting.tooltip"));
|
||||
else {
|
||||
list.add(StatCollector.translateToLocal("item.accessory.tooltip"));
|
||||
list.add(StatCollector.translateToLocal("canister.tooltip"));
|
||||
}
|
||||
|
||||
switch (meta)
|
||||
{
|
||||
case 1:
|
||||
list.add(StatCollector.translateToLocal("canister.red.tooltip1"));
|
||||
list.add(StatCollector.translateToLocal("canister.red.tooltip2"));
|
||||
break;
|
||||
case 2:
|
||||
list.add(StatCollector.translateToLocal("canister.green.tooltip1"));
|
||||
list.add(StatCollector.translateToLocal("canister.green.tooltip2"));
|
||||
break;
|
||||
switch (meta) {
|
||||
case 1:
|
||||
list.add(StatCollector.translateToLocal("canister.red.tooltip1"));
|
||||
list.add(StatCollector.translateToLocal("canister.red.tooltip2"));
|
||||
break;
|
||||
case 2:
|
||||
list.add(StatCollector.translateToLocal("canister.green.tooltip1"));
|
||||
list.add(StatCollector.translateToLocal("canister.green.tooltip2"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquipAccessory (ItemStack item, int slot)
|
||||
{
|
||||
public boolean canEquipAccessory(ItemStack item, int slot) {
|
||||
int type = item.getItemDamage();
|
||||
return ((type == 2 && slot == 6) || (type == 4 && slot == 5) || (type == 6 && slot == 4));
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getHealthBoost (ItemStack item)
|
||||
{
|
||||
public int getHealthBoost(ItemStack item) {
|
||||
return item.stackSize * 2;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,65 +10,65 @@ import net.minecraft.util.*;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.world.items.SpecialFood;
|
||||
|
||||
public class Jerky extends SpecialFood
|
||||
{
|
||||
public static String[] textureNames = new String[] { "beef", "chicken", "pork", "mutton", "fish", "monster", "blueslime", "blood" };
|
||||
public static String[] itemNames = new String[] { "jerky.beef", "jerky.chicken", "jerky.pig", "jerky.sheep", "jerky.fish", "jerky.zombie", "jerky.blueslime", "jerky.blood" };
|
||||
public static int[] hunger = new int[] { 8, 6, 8, 6, 5, 4, 6, 4 };
|
||||
public static float[] saturation = new float[] { 1.0f, 0.8f, 1.0f, 0.8f, 0.8f, 0.4f, 1.0f, 0.4f };
|
||||
public static int[] overhaulHunger = new int[] { 1, 1, 1, 1, 1, 1, 1, 1 };
|
||||
public class Jerky extends SpecialFood {
|
||||
public static String[] textureNames =
|
||||
new String[] {"beef", "chicken", "pork", "mutton", "fish", "monster", "blueslime", "blood"};
|
||||
public static String[] itemNames = new String[] {
|
||||
"jerky.beef",
|
||||
"jerky.chicken",
|
||||
"jerky.pig",
|
||||
"jerky.sheep",
|
||||
"jerky.fish",
|
||||
"jerky.zombie",
|
||||
"jerky.blueslime",
|
||||
"jerky.blood"
|
||||
};
|
||||
public static int[] hunger = new int[] {8, 6, 8, 6, 5, 4, 6, 4};
|
||||
public static float[] saturation = new float[] {1.0f, 0.8f, 1.0f, 0.8f, 0.8f, 0.4f, 1.0f, 0.4f};
|
||||
public static int[] overhaulHunger = new int[] {1, 1, 1, 1, 1, 1, 1, 1};
|
||||
|
||||
public Jerky(boolean hungerOverhaul)
|
||||
{
|
||||
public Jerky(boolean hungerOverhaul) {
|
||||
super(hungerOverhaul ? overhaulHunger : hunger, saturation, itemNames, textureNames);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[iconNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:food/jerky_" + iconNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName (ItemStack stack)
|
||||
{
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
int arr = MathHelper.clamp_int(stack.getItemDamage(), 0, unlocalizedNames.length);
|
||||
return "item.tconstruct." + unlocalizedNames[arr];
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onFoodEaten (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
if (stack.getItemDamage() == 7)
|
||||
{
|
||||
protected void onFoodEaten(ItemStack stack, World world, EntityPlayer player) {
|
||||
if (stack.getItemDamage() == 7) {
|
||||
int duration = 0;
|
||||
PotionEffect potion = player.getActivePotionEffect(Potion.field_76434_w);
|
||||
if (potion != null)
|
||||
duration = potion.getDuration();
|
||||
if (potion != null) duration = potion.getDuration();
|
||||
player.addPotionEffect(new PotionEffect(Potion.field_76434_w.id, duration + 60 * 60, 1));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
int type = stack.getItemDamage();
|
||||
switch (type)
|
||||
{
|
||||
case 6:
|
||||
list.add("\u00a7b" + StatCollector.translateToLocal("strangefood5.tooltip"));
|
||||
break;
|
||||
case 7:
|
||||
list.add("\u00a74" + StatCollector.translateToLocal("strangefood6.tooltip"));
|
||||
break;
|
||||
switch (type) {
|
||||
case 6:
|
||||
list.add("\u00a7b" + StatCollector.translateToLocal("strangefood5.tooltip"));
|
||||
break;
|
||||
case 7:
|
||||
list.add("\u00a74" + StatCollector.translateToLocal("strangefood6.tooltip"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,30 +9,25 @@ import net.minecraft.util.StatCollector;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.library.accessory.IAccessory;
|
||||
|
||||
public class Knapsack extends CraftingItem implements IAccessory
|
||||
{
|
||||
public class Knapsack extends CraftingItem implements IAccessory {
|
||||
|
||||
public Knapsack()
|
||||
{
|
||||
super(new String[] { "knapsack" }, new String[] { "knapsack" }, "armor/", "tinker", TConstructRegistry.materialTab);
|
||||
public Knapsack() {
|
||||
super(new String[] {"knapsack"}, new String[] {"knapsack"}, "armor/", "tinker", TConstructRegistry.materialTab);
|
||||
this.setMaxStackSize(10);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
switch (stack.getItemDamage())
|
||||
{
|
||||
case 0:
|
||||
list.add(StatCollector.translateToLocal("knapsack.tooltip"));
|
||||
break;
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
switch (stack.getItemDamage()) {
|
||||
case 0:
|
||||
list.add(StatCollector.translateToLocal("knapsack.tooltip"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquipAccessory (ItemStack item, int slot)
|
||||
{
|
||||
public boolean canEquipAccessory(ItemStack item, int slot) {
|
||||
return slot == 2;
|
||||
}
|
||||
|
||||
@@ -42,7 +37,7 @@ public class Knapsack extends CraftingItem implements IAccessory
|
||||
* player, ItemStack itemStack) { TPlayerStats stats =
|
||||
* TConstruct.playerTracker.getPlayerStats(player.getDisplayName());
|
||||
* KnapsackInventory inv = stats.knapsack;
|
||||
*
|
||||
*
|
||||
* if (stats != null && inv != null) { for (int i = 0; i <
|
||||
* inv.getSizeInventory(); i++) { if (inv.getStackInSlot(i) != null) {
|
||||
* inv.getStackInSlot(i).getItem().onUpdate(inv.getStackInSlot(i),
|
||||
|
||||
@@ -14,13 +14,12 @@ public class TArmorBase extends ItemArmor
|
||||
// implements ISpecialArmor
|
||||
{
|
||||
IIcon[] icons;
|
||||
String[] iconNames = { "wood_boots" };
|
||||
String[] iconNames = {"wood_boots"};
|
||||
|
||||
// static Minecraft mc = Minecraft.getMinecraft();
|
||||
// private ModelBiped modelArmor;
|
||||
|
||||
public TArmorBase(int armorSlot)
|
||||
{
|
||||
public TArmorBase(int armorSlot) {
|
||||
super(ArmorMaterial.CLOTH, 0, armorSlot);
|
||||
this.maxStackSize = 1;
|
||||
this.setMaxDamage(100);
|
||||
@@ -31,18 +30,15 @@ public class TArmorBase extends ItemArmor
|
||||
// this.setCreativeTab(TConstructRegistry.toolTab);
|
||||
}
|
||||
|
||||
public void onArmorTickUpdate (World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
|
||||
}
|
||||
public void onArmorTickUpdate(World world, EntityPlayer player, ItemStack itemStack) {}
|
||||
|
||||
/**
|
||||
* Called by RenderBiped and RenderPlayer to determine the armor texture
|
||||
* that should be use for the currently equiped item. This will only be
|
||||
* called on instances of ItemArmor.
|
||||
*
|
||||
*
|
||||
* Returning null from this function will use the default value.
|
||||
*
|
||||
*
|
||||
* @param stack
|
||||
* ItemStack for the equpt armor
|
||||
* @param entity
|
||||
@@ -56,52 +52,46 @@ public class TArmorBase extends ItemArmor
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String layer)
|
||||
{
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer) {
|
||||
return "/mods/tinker/textures/armor/wood_1.png";
|
||||
}
|
||||
|
||||
/**
|
||||
* Override this method to have an item handle its own armor rendering.
|
||||
*
|
||||
*
|
||||
* @param entityLiving
|
||||
* The entity wearing the armor
|
||||
* @param itemStack
|
||||
* The itemStack to render the model of
|
||||
* @param armorSlot
|
||||
* 0=head, 1=torso, 2=legs, 3=feet
|
||||
*
|
||||
*
|
||||
* @return A ModelBiped to render instead of the default
|
||||
*/
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase par1EntityLiving, ItemStack itemStack, int armorSlot)
|
||||
{
|
||||
public ModelBiped getArmorModel(EntityLivingBase par1EntityLiving, ItemStack itemStack, int armorSlot) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses ()
|
||||
{
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public IIcon getIconFromDamage (int meta)
|
||||
{
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return icons[0];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[iconNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:armor/" + iconNames[i]);
|
||||
}
|
||||
}
|
||||
@@ -110,14 +100,14 @@ public class TArmorBase extends ItemArmor
|
||||
* @Override public ArmorProperties getProperties (EntityLiving player,
|
||||
* ItemStack armor, DamageSource source, double damage, int slot) { // TODO
|
||||
* Auto-generated method stub return null; }
|
||||
*
|
||||
*
|
||||
* @Override public int getArmorDisplay (EntityPlayer player, ItemStack
|
||||
* armor, int slot) { // TODO Auto-generated method stub return 0; }
|
||||
*
|
||||
*
|
||||
* @Override public void damageArmor (EntityLiving entity, ItemStack stack,
|
||||
* DamageSource source, int damage, int slot) { // TODO Auto-generated
|
||||
* method stub
|
||||
*
|
||||
*
|
||||
* }
|
||||
*/
|
||||
}
|
||||
@@ -14,29 +14,23 @@ import tconstruct.armor.ArmorProxyClient;
|
||||
import tconstruct.client.ArmorControls;
|
||||
import tconstruct.library.accessory.*;
|
||||
|
||||
public class TravelBelt extends AccessoryCore implements IAccessoryModel
|
||||
{
|
||||
public TravelBelt()
|
||||
{
|
||||
public class TravelBelt extends AccessoryCore implements IAccessoryModel {
|
||||
public TravelBelt() {
|
||||
super("travelgear/travel_belt");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquipAccessory (ItemStack item, int slot)
|
||||
{
|
||||
public boolean canEquipAccessory(ItemStack item, int slot) {
|
||||
return slot == 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void registerModifiers (IIconRegister iconRegister)
|
||||
{
|
||||
}
|
||||
protected void registerModifiers(IIconRegister iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
|
||||
{
|
||||
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
|
||||
return ArmorProxyClient.belt;
|
||||
}
|
||||
|
||||
@@ -44,19 +38,17 @@ public class TravelBelt extends AccessoryCore implements IAccessoryModel
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getWearbleTexture (Entity entity, ItemStack stack, int slot)
|
||||
{
|
||||
public ResourceLocation getWearbleTexture(Entity entity, ItemStack stack, int slot) {
|
||||
return texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (!stack.hasTagCompound()) return;
|
||||
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelbelt.ability"));
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelbelt.control") + GameSettings.getKeyDisplayString(ArmorControls.beltSwap.getKeyCode()));
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelbelt.control")
|
||||
+ GameSettings.getKeyDisplayString(ArmorControls.beltSwap.getKeyCode()));
|
||||
}
|
||||
}
|
||||
@@ -23,48 +23,35 @@ import thaumcraft.api.nodes.IRevealer;
|
||||
@Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.nodes.IRevealer"),
|
||||
@Optional.Interface(modid = "Thaumcraft", iface = "thaumcraft.api.IGoggles")
|
||||
})
|
||||
public class TravelGear extends ArmorCore implements IRevealer, IGoggles
|
||||
{
|
||||
public class TravelGear extends ArmorCore implements IRevealer, IGoggles {
|
||||
|
||||
public TravelGear(ArmorPart part)
|
||||
{
|
||||
public TravelGear(ArmorPart part) {
|
||||
super(0, part, "Clothing", "travelgear", "travel");
|
||||
this.setMaxDamage(1035);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTick (World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
super.onArmorTick(world, player, itemStack);
|
||||
if (armorPart == ArmorPart.Chest)
|
||||
{
|
||||
if (player.isInWater())
|
||||
{
|
||||
if (armorPart == ArmorPart.Chest) {
|
||||
if (player.isInWater()) {
|
||||
player.motionX *= 1.2D;
|
||||
if (player.motionY > 0.0D)
|
||||
{
|
||||
if (player.motionY > 0.0D) {
|
||||
player.motionY *= 1.2D;
|
||||
}
|
||||
player.motionZ *= 1.2D;
|
||||
double maxSpeed = 0.2D;
|
||||
if (player.motionX > maxSpeed)
|
||||
{
|
||||
if (player.motionX > maxSpeed) {
|
||||
player.motionX = maxSpeed;
|
||||
}
|
||||
else if (player.motionX < -maxSpeed)
|
||||
{
|
||||
} else if (player.motionX < -maxSpeed) {
|
||||
player.motionX = -maxSpeed;
|
||||
}
|
||||
if (player.motionY > maxSpeed)
|
||||
{
|
||||
if (player.motionY > maxSpeed) {
|
||||
player.motionY = maxSpeed;
|
||||
}
|
||||
if (player.motionZ > maxSpeed)
|
||||
{
|
||||
if (player.motionZ > maxSpeed) {
|
||||
player.motionZ = maxSpeed;
|
||||
}
|
||||
else if (player.motionZ < -maxSpeed)
|
||||
{
|
||||
} else if (player.motionZ < -maxSpeed) {
|
||||
player.motionZ = -maxSpeed;
|
||||
}
|
||||
}
|
||||
@@ -72,129 +59,129 @@ public class TravelGear extends ArmorCore implements IRevealer, IGoggles
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getBaseDefense ()
|
||||
{
|
||||
switch (armorPart)
|
||||
{
|
||||
case Head:
|
||||
return 0;
|
||||
case Chest:
|
||||
return 4;
|
||||
case Legs:
|
||||
return 2;
|
||||
case Feet:
|
||||
return 2;
|
||||
protected double getBaseDefense() {
|
||||
switch (armorPart) {
|
||||
case Head:
|
||||
return 0;
|
||||
case Chest:
|
||||
return 4;
|
||||
case Legs:
|
||||
return 2;
|
||||
case Feet:
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected double getMaxDefense ()
|
||||
{
|
||||
switch (armorPart)
|
||||
{
|
||||
case Head:
|
||||
return 4;
|
||||
case Chest:
|
||||
return 10;
|
||||
case Legs:
|
||||
return 8;
|
||||
case Feet:
|
||||
return 6;
|
||||
protected double getMaxDefense() {
|
||||
switch (armorPart) {
|
||||
case Head:
|
||||
return 4;
|
||||
case Chest:
|
||||
return 10;
|
||||
case Legs:
|
||||
return 8;
|
||||
case Feet:
|
||||
return 6;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDurability ()
|
||||
{
|
||||
protected int getDurability() {
|
||||
return 1035;
|
||||
}
|
||||
|
||||
//Temporary?
|
||||
public ItemStack getRepairMaterial (ItemStack input)
|
||||
{
|
||||
// Temporary?
|
||||
public ItemStack getRepairMaterial(ItemStack input) {
|
||||
return new ItemStack(Items.leather);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
this.itemIcon = iconRegister.registerIcon("tinker:" + textureFolder + "/" + textureName + "_" + (this.armorType == 0 ? "goggles" : this.armorType == 1 ? "vest" : this.armorType == 2 ? "wings" : this.armorType == 3 ? "boots" : "helmet"));
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon("tinker:" + textureFolder + "/" + textureName + "_"
|
||||
+ (this.armorType == 0
|
||||
? "goggles"
|
||||
: this.armorType == 1
|
||||
? "vest"
|
||||
: this.armorType == 2 ? "wings" : this.armorType == 3 ? "boots" : "helmet"));
|
||||
registerModifiers(iconRegister);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
|
||||
{
|
||||
if (armorSlot == 1)
|
||||
return ArmorProxyClient.vest;
|
||||
if (armorSlot == 2)
|
||||
return ArmorProxyClient.wings;
|
||||
if (armorSlot == 3)
|
||||
return ArmorProxyClient.bootbump;
|
||||
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
|
||||
if (armorSlot == 1) return ArmorProxyClient.vest;
|
||||
if (armorSlot == 2) return ArmorProxyClient.wings;
|
||||
if (armorSlot == 3) return ArmorProxyClient.bootbump;
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void registerModifiers (IIconRegister iconRegister) //temporary
|
||||
{
|
||||
switch (armorType)
|
||||
{
|
||||
case 0:
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_" + "nightvision");
|
||||
modifiers[1] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_" + "thaumic1");
|
||||
modifiers[2] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_" + "thaumic2");
|
||||
modifiers[4] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_" + "moss");
|
||||
break;
|
||||
case 1:
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "vest" + "_" + "dodge");
|
||||
modifiers[1] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "vest" + "_" + "stealth");
|
||||
modifiers[4] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "vest" + "_" + "moss");
|
||||
break;
|
||||
case 2:
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "wings" + "_" + "doublejump");
|
||||
modifiers[1] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "wings" + "_" + "featherfall");
|
||||
modifiers[4] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "wings" + "_" + "moss");
|
||||
break;
|
||||
case 3:
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_" + "doublejump");
|
||||
modifiers[1] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_" + "waterwalk");
|
||||
modifiers[2] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_" + "leadweight");
|
||||
modifiers[3] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_" + "slimysole");
|
||||
modifiers[4] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_" + "moss");
|
||||
break;
|
||||
protected void registerModifiers(IIconRegister iconRegister) // temporary
|
||||
{
|
||||
switch (armorType) {
|
||||
case 0:
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] =
|
||||
iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_" + "nightvision");
|
||||
modifiers[1] =
|
||||
iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_" + "thaumic1");
|
||||
modifiers[2] =
|
||||
iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_" + "thaumic2");
|
||||
modifiers[4] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "goggles" + "_" + "moss");
|
||||
break;
|
||||
case 1:
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "vest" + "_" + "dodge");
|
||||
modifiers[1] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "vest" + "_" + "stealth");
|
||||
modifiers[4] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "vest" + "_" + "moss");
|
||||
break;
|
||||
case 2:
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] =
|
||||
iconRegister.registerIcon("tinker:" + textureFolder + "/" + "wings" + "_" + "doublejump");
|
||||
modifiers[1] =
|
||||
iconRegister.registerIcon("tinker:" + textureFolder + "/" + "wings" + "_" + "featherfall");
|
||||
modifiers[4] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "wings" + "_" + "moss");
|
||||
break;
|
||||
case 3:
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] =
|
||||
iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_" + "doublejump");
|
||||
modifiers[1] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_" + "waterwalk");
|
||||
modifiers[2] =
|
||||
iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_" + "leadweight");
|
||||
modifiers[3] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_" + "slimysole");
|
||||
modifiers[4] = iconRegister.registerIcon("tinker:" + textureFolder + "/" + "boots" + "_" + "moss");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
|
||||
switch (armorPart)
|
||||
{
|
||||
case Head:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelgoggles.ability") + GameSettings.getKeyDisplayString(tconstruct.client.ArmorControls.zoomKey.getKeyCode()));
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelgoggles.toggleabilities") + GameSettings.getKeyDisplayString(tconstruct.client.ArmorControls.toggleGoggles.getKeyCode()));
|
||||
break;
|
||||
case Chest:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelvest.ability"));
|
||||
break;
|
||||
case Legs:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelwings.ability"));
|
||||
break;
|
||||
case Feet:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelboots.ability"));
|
||||
break;
|
||||
default:
|
||||
switch (armorPart) {
|
||||
case Head:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelgoggles.ability")
|
||||
+ GameSettings.getKeyDisplayString(tconstruct.client.ArmorControls.zoomKey.getKeyCode()));
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelgoggles.toggleabilities")
|
||||
+ GameSettings.getKeyDisplayString(tconstruct.client.ArmorControls.toggleGoggles.getKeyCode()));
|
||||
break;
|
||||
case Chest:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelvest.ability"));
|
||||
break;
|
||||
case Legs:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelwings.ability"));
|
||||
break;
|
||||
case Feet:
|
||||
list.add("\u00a76" + StatCollector.translateToLocal("armor.travelboots.ability"));
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
super.addInformation(stack, player, list, par4);
|
||||
@@ -203,7 +190,7 @@ public class TravelGear extends ArmorCore implements IRevealer, IGoggles
|
||||
@Optional.Method(modid = "Thaumcraft")
|
||||
@Override
|
||||
public boolean showNodes(ItemStack itemstack, EntityLivingBase player) {
|
||||
if(itemstack == null || !itemstack.hasTagCompound() || itemstack.getItem() != TinkerArmor.travelGoggles)
|
||||
if (itemstack == null || !itemstack.hasTagCompound() || itemstack.getItem() != TinkerArmor.travelGoggles)
|
||||
return false;
|
||||
|
||||
return itemstack.getTagCompound().getCompoundTag(this.getBaseTagName()).getBoolean("Thaumic Senses");
|
||||
@@ -212,7 +199,7 @@ public class TravelGear extends ArmorCore implements IRevealer, IGoggles
|
||||
@Optional.Method(modid = "Thaumcraft")
|
||||
@Override
|
||||
public boolean showIngamePopups(ItemStack itemstack, EntityLivingBase player) {
|
||||
if(itemstack == null || !itemstack.hasTagCompound() || itemstack.getItem() != TinkerArmor.travelGoggles)
|
||||
if (itemstack == null || !itemstack.hasTagCompound() || itemstack.getItem() != TinkerArmor.travelGoggles)
|
||||
return false;
|
||||
|
||||
return itemstack.getTagCompound().getCompoundTag(this.getBaseTagName()).getBoolean("Thaumic Vision");
|
||||
|
||||
@@ -9,23 +9,19 @@ import net.minecraft.util.*;
|
||||
import tconstruct.armor.ArmorProxyClient;
|
||||
import tconstruct.library.accessory.*;
|
||||
|
||||
public class TravelGlove extends AccessoryCore implements IAccessoryModel
|
||||
{
|
||||
public TravelGlove()
|
||||
{
|
||||
public class TravelGlove extends AccessoryCore implements IAccessoryModel {
|
||||
public TravelGlove() {
|
||||
super("travelgear/travel_glove");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canEquipAccessory (ItemStack item, int slot)
|
||||
{
|
||||
public boolean canEquipAccessory(ItemStack item, int slot) {
|
||||
return slot == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void registerModifiers (IIconRegister iconRegister)
|
||||
{
|
||||
protected void registerModifiers(IIconRegister iconRegister) {
|
||||
this.modifiers = new IIcon[4];
|
||||
this.modifiers[0] = iconRegister.registerIcon("tinker:travelgear/glove_guard");
|
||||
this.modifiers[1] = iconRegister.registerIcon("tinker:travelgear/glove_speedaura");
|
||||
@@ -34,8 +30,7 @@ public class TravelGlove extends AccessoryCore implements IAccessoryModel
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ModelBiped getArmorModel (EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot)
|
||||
{
|
||||
public ModelBiped getArmorModel(EntityLivingBase entityLiving, ItemStack itemStack, int armorSlot) {
|
||||
return ArmorProxyClient.glove;
|
||||
}
|
||||
|
||||
@@ -43,13 +38,12 @@ public class TravelGlove extends AccessoryCore implements IAccessoryModel
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public ResourceLocation getWearbleTexture (Entity entity, ItemStack stack, int slot)
|
||||
{
|
||||
public ResourceLocation getWearbleTexture(Entity entity, ItemStack stack, int slot) {
|
||||
return texture;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTraits() {
|
||||
return new String[] { "accessory", "glove" };
|
||||
return new String[] {"accessory", "glove"};
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package tconstruct.armor.items;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -9,21 +11,16 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.armor.ArmorPart;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
public class TravelWings extends TravelGear
|
||||
{
|
||||
public class TravelWings extends TravelGear {
|
||||
|
||||
public TravelWings()
|
||||
{
|
||||
public TravelWings() {
|
||||
super(ArmorPart.Legs);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected void registerModifiers (IIconRegister IIconRegister)
|
||||
{
|
||||
protected void registerModifiers(IIconRegister IIconRegister) {
|
||||
String base = "tinker:armor/travel_wings_";
|
||||
modifiers = new IIcon[5];
|
||||
modifiers[0] = IIconRegister.registerIcon("tinker:" + textureFolder + "/" + "wings" + "_" + "doublejump");
|
||||
@@ -36,26 +33,19 @@ public class TravelWings extends TravelGear
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onArmorTick (World world, EntityPlayer player, ItemStack itemStack)
|
||||
{
|
||||
public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) {
|
||||
super.onArmorTick(world, player, itemStack);
|
||||
if (itemStack.hasTagCompound())
|
||||
{
|
||||
if (itemStack.hasTagCompound()) {
|
||||
NBTTagCompound tag = itemStack.getTagCompound().getCompoundTag(getBaseTagName());
|
||||
int feather = tag.getInteger("Feather Fall");
|
||||
if (feather > 0)
|
||||
{
|
||||
if (player.fallDistance > 2.5)
|
||||
player.fallDistance = 2.5f;
|
||||
if (feather > 0) {
|
||||
if (player.fallDistance > 2.5) player.fallDistance = 2.5f;
|
||||
float terminalVelocity = -0.4f + (feather * 0.08f);
|
||||
if (terminalVelocity > -0.05f)
|
||||
terminalVelocity = -0.05f;
|
||||
if (player.isSneaking() && terminalVelocity > -0.8f)
|
||||
terminalVelocity = -0.8F;
|
||||
if (terminalVelocity > -0.05f) terminalVelocity = -0.05f;
|
||||
if (player.isSneaking() && terminalVelocity > -0.8f) terminalVelocity = -0.8F;
|
||||
boolean flying = false;
|
||||
flying = player.capabilities.isFlying;
|
||||
if (!flying && player.motionY < terminalVelocity)
|
||||
{
|
||||
if (!flying && player.motionY < terminalVelocity) {
|
||||
player.motionY = terminalVelocity;
|
||||
}
|
||||
}
|
||||
@@ -64,14 +54,12 @@ public class TravelWings extends TravelGear
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture (ItemStack stack, Entity entity, int slot, String layer)
|
||||
{
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String layer) {
|
||||
return "tinker:textures/armor/travel_wings.png";
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getRepairMaterial (ItemStack input)
|
||||
{
|
||||
public ItemStack getRepairMaterial(ItemStack input) {
|
||||
return new ItemStack(TinkerTools.materials, 1, 13);
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,7 @@ package tconstruct.armor.model;
|
||||
import net.minecraft.client.model.*;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public class BeltModel extends ModelBiped
|
||||
{
|
||||
public class BeltModel extends ModelBiped {
|
||||
ModelRenderer Buckle;
|
||||
ModelRenderer FrontRight;
|
||||
ModelRenderer FrontLeft;
|
||||
@@ -12,8 +11,7 @@ public class BeltModel extends ModelBiped
|
||||
ModelRenderer SideLeft;
|
||||
ModelRenderer Back;
|
||||
|
||||
public BeltModel()
|
||||
{
|
||||
public BeltModel() {
|
||||
textureWidth = 64;
|
||||
textureHeight = 32;
|
||||
|
||||
@@ -54,12 +52,11 @@ public class BeltModel extends ModelBiped
|
||||
bipedBody.addChild(Back);
|
||||
}
|
||||
|
||||
public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
//super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
// super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
bipedBody.render(f5);
|
||||
//Buckle.render(f5);
|
||||
// Buckle.render(f5);
|
||||
/*FrontRight.render(f5);
|
||||
FrontLeft.render(f5);
|
||||
SideRight.render(f5);
|
||||
@@ -67,17 +64,14 @@ public class BeltModel extends ModelBiped
|
||||
Back.render(f5);*/
|
||||
}
|
||||
|
||||
private void setRotation (ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRotationAngles (float f, float f1, float partialTick, float f3, float f4, float f5, Entity player)
|
||||
{
|
||||
public void setRotationAngles(float f, float f1, float partialTick, float f3, float f4, float f5, Entity player) {
|
||||
super.setRotationAngles(f, f1, partialTick, f3, f4, f5, player);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -2,13 +2,11 @@ package tconstruct.armor.model;
|
||||
|
||||
import net.minecraft.client.model.*;
|
||||
|
||||
public class BootBump extends ModelBiped
|
||||
{
|
||||
public class BootBump extends ModelBiped {
|
||||
ModelRenderer rightBump;
|
||||
ModelRenderer leftBump;
|
||||
|
||||
public BootBump()
|
||||
{
|
||||
public BootBump() {
|
||||
super(0.5f, 0, 64, 32);
|
||||
|
||||
rightBump = new ModelRenderer(this, 24, 0);
|
||||
|
||||
@@ -2,36 +2,34 @@ package tconstruct.armor.model;
|
||||
|
||||
import net.minecraft.client.model.ModelBiped;
|
||||
|
||||
public class HiddenPlayerModel extends ModelBiped
|
||||
{
|
||||
public HiddenPlayerModel(float size, int slot)
|
||||
{
|
||||
public class HiddenPlayerModel extends ModelBiped {
|
||||
public HiddenPlayerModel(float size, int slot) {
|
||||
super(size, 0, 64, 32);
|
||||
|
||||
if (slot != 0) //Head
|
||||
if (slot != 0) // Head
|
||||
{
|
||||
this.bipedHead.isHidden = true;
|
||||
this.bipedHeadwear.isHidden = true;
|
||||
}
|
||||
if (slot != 1 && slot != 5) //Chest, belt
|
||||
if (slot != 1 && slot != 5) // Chest, belt
|
||||
{
|
||||
this.bipedBody.isHidden = true;
|
||||
}
|
||||
if (slot != 2 && slot != 3) //Legs, shoes
|
||||
if (slot != 2 && slot != 3) // Legs, shoes
|
||||
{
|
||||
this.bipedRightLeg.isHidden = true;
|
||||
this.bipedLeftLeg.isHidden = true;
|
||||
}
|
||||
if (slot != 4) //Gloves
|
||||
if (slot != 4) // Gloves
|
||||
{
|
||||
this.bipedRightArm.isHidden = true;
|
||||
this.bipedLeftArm.isHidden = true;
|
||||
}
|
||||
if (slot != 6) //Ears
|
||||
if (slot != 6) // Ears
|
||||
{
|
||||
this.bipedEars.isHidden = true;
|
||||
}
|
||||
if (slot != 7) //Cloak
|
||||
if (slot != 7) // Cloak
|
||||
{
|
||||
this.bipedCloak.isHidden = true;
|
||||
}
|
||||
|
||||
@@ -12,60 +12,56 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.armor.items.ArmorPattern;
|
||||
|
||||
public class RenderArmorCast implements IItemRenderer
|
||||
{
|
||||
public class RenderArmorCast implements IItemRenderer {
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType (ItemStack item, ItemRenderType type)
|
||||
{
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type != ItemRenderType.FIRST_PERSON_MAP;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
switch (helper)
|
||||
{
|
||||
case BLOCK_3D:
|
||||
return true;
|
||||
case ENTITY_BOBBING:
|
||||
return true;
|
||||
case ENTITY_ROTATION:
|
||||
return true;
|
||||
case EQUIPPED_BLOCK:
|
||||
return true;
|
||||
case INVENTORY_BLOCK:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
switch (helper) {
|
||||
case BLOCK_3D:
|
||||
return true;
|
||||
case ENTITY_BOBBING:
|
||||
return true;
|
||||
case ENTITY_ROTATION:
|
||||
return true;
|
||||
case EQUIPPED_BLOCK:
|
||||
return true;
|
||||
case INVENTORY_BLOCK:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem (ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
RenderBlocks renderer = Minecraft.getMinecraft().renderGlobal.renderBlocksRg;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
IIcon baseIcon = item.getItem() instanceof ArmorPattern ? ((ArmorPattern) item.getItem()).getBaseIcon() : item.getIconIndex();
|
||||
IIcon baseIcon = item.getItem() instanceof ArmorPattern
|
||||
? ((ArmorPattern) item.getItem()).getBaseIcon()
|
||||
: item.getIconIndex();
|
||||
GL11.glPushMatrix();
|
||||
switch (type)
|
||||
{
|
||||
case ENTITY:
|
||||
GL11.glScalef(0.8F, 0.33F, 0.8F);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
GL11.glTranslatef(0F, -0.1F, 0F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
GL11.glScalef(0.8F, 0.33F, 0.8F);
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
break;
|
||||
case INVENTORY:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
GL11.glTranslatef(0F, -0.1F, 0F);
|
||||
break;
|
||||
case EQUIPPED:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
break;
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
GL11.glScalef(1F, 0.6F, 1F);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
renderer.setRenderBounds(0.1F, 0.1F, 0.1F, 0.9F, 0.83F, 0.9F);
|
||||
renderCube(tessellator, renderer, baseIcon);
|
||||
@@ -81,8 +77,7 @@ public class RenderArmorCast implements IItemRenderer
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderCube (Tessellator tessellator, RenderBlocks renderer, IIcon icon)
|
||||
{
|
||||
public void renderCube(Tessellator tessellator, RenderBlocks renderer, IIcon icon) {
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0F, 0F);
|
||||
renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
@@ -99,37 +94,29 @@ public class RenderArmorCast implements IItemRenderer
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderSelectedCube (Tessellator tessellator, RenderBlocks renderer, IIcon icon, List<ForgeDirection> sidesToRender)
|
||||
{
|
||||
public void renderSelectedCube(
|
||||
Tessellator tessellator, RenderBlocks renderer, IIcon icon, List<ForgeDirection> sidesToRender) {
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.WEST))
|
||||
renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
if (sidesToRender.contains(ForgeDirection.WEST)) renderer.renderFaceXNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(1F, 0F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.EAST))
|
||||
renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon);
|
||||
if (sidesToRender.contains(ForgeDirection.EAST)) renderer.renderFaceXPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, -1F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.DOWN))
|
||||
renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
if (sidesToRender.contains(ForgeDirection.DOWN)) renderer.renderFaceYNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 1F, 0F);
|
||||
if (sidesToRender.contains(ForgeDirection.UP))
|
||||
renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon);
|
||||
if (sidesToRender.contains(ForgeDirection.UP)) renderer.renderFaceYPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 0F, -1F);
|
||||
if (sidesToRender.contains(ForgeDirection.SOUTH))
|
||||
renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
if (sidesToRender.contains(ForgeDirection.SOUTH)) renderer.renderFaceZNeg((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.setNormal(0F, 0F, 1F);
|
||||
if (sidesToRender.contains(ForgeDirection.NORTH))
|
||||
renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon);
|
||||
if (sidesToRender.contains(ForgeDirection.NORTH)) renderer.renderFaceZPos((Block) null, 0F, 0F, 0F, icon);
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderCastTop (ItemStack par1ItemStack, ItemRenderType type)
|
||||
{
|
||||
public void renderCastTop(ItemStack par1ItemStack, ItemRenderType type) {
|
||||
GL11.glPushMatrix();
|
||||
IIcon icon = par1ItemStack.getIconIndex();
|
||||
|
||||
if (icon == null)
|
||||
{
|
||||
if (icon == null) {
|
||||
GL11.glPopMatrix();
|
||||
return;
|
||||
}
|
||||
@@ -158,8 +145,15 @@ public class RenderArmorCast implements IItemRenderer
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public static void renderItemIn2D (Tessellator par0Tessellator, float par1, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
public static void renderItemIn2D(
|
||||
Tessellator par0Tessellator,
|
||||
float par1,
|
||||
float par2,
|
||||
float par3,
|
||||
float par4,
|
||||
float par5,
|
||||
float par6,
|
||||
float par7) {
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
par0Tessellator.addVertexWithUV(0.0D, 0.0D, 0.0D, (double) par1, (double) par4);
|
||||
@@ -182,8 +176,7 @@ public class RenderArmorCast implements IItemRenderer
|
||||
float f7;
|
||||
float f8;
|
||||
|
||||
for (k = 0; k < par5; ++k)
|
||||
{
|
||||
for (k = 0; k < par5; ++k) {
|
||||
f7 = (float) k / (float) par5;
|
||||
f8 = par1 + (par3 - par1) * f7 - f5;
|
||||
par0Tessellator.addVertexWithUV((double) f7, 0.0D, (double) (0.0F - par7), (double) f8, (double) par4);
|
||||
@@ -197,8 +190,7 @@ public class RenderArmorCast implements IItemRenderer
|
||||
par0Tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
float f9;
|
||||
|
||||
for (k = 0; k < par5; ++k)
|
||||
{
|
||||
for (k = 0; k < par5; ++k) {
|
||||
f7 = (float) k / (float) par5;
|
||||
f8 = par1 + (par3 - par1) * f7 - f5;
|
||||
f9 = f7 + 1.0F / (float) par5;
|
||||
@@ -212,8 +204,7 @@ public class RenderArmorCast implements IItemRenderer
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
|
||||
for (k = 0; k < par6; ++k)
|
||||
{
|
||||
for (k = 0; k < par6; ++k) {
|
||||
f7 = (float) k / (float) par6;
|
||||
f8 = par4 + (par2 - par4) * f7 - f6;
|
||||
f9 = f7 + 1.0F / (float) par6;
|
||||
@@ -227,8 +218,7 @@ public class RenderArmorCast implements IItemRenderer
|
||||
par0Tessellator.startDrawingQuads();
|
||||
par0Tessellator.setNormal(0.0F, -1.0F, 0.0F);
|
||||
|
||||
for (k = 0; k < par6; ++k)
|
||||
{
|
||||
for (k = 0; k < par6; ++k) {
|
||||
f7 = (float) k / (float) par6;
|
||||
f8 = par4 + (par2 - par4) * f7 - f6;
|
||||
par0Tessellator.addVertexWithUV(1.0D, (double) f7, 0.0D, (double) par3, (double) f8);
|
||||
@@ -239,5 +229,4 @@ public class RenderArmorCast implements IItemRenderer
|
||||
|
||||
par0Tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,7 @@ import net.minecraft.client.model.*;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.util.MathHelper;
|
||||
|
||||
public class WingModel extends ModelBiped
|
||||
{
|
||||
public class WingModel extends ModelBiped {
|
||||
ModelRenderer WingBaseRight;
|
||||
ModelRenderer WingEdgeRight;
|
||||
ModelRenderer WingInsetRight;
|
||||
@@ -19,22 +18,21 @@ public class WingModel extends ModelBiped
|
||||
ModelRenderer WingFlangeLeft;
|
||||
ModelRenderer WingAuxLeft;
|
||||
|
||||
public WingModel()
|
||||
{
|
||||
public WingModel() {
|
||||
super(0.25f, 0, 64, 64);
|
||||
textureWidth = 64;
|
||||
textureHeight = 32;
|
||||
|
||||
//Right Wing
|
||||
// Right Wing
|
||||
WingBaseRight = new ModelRenderer(this, 0, 9);
|
||||
WingBaseRight.addBox(-0.5F, -1F, 0F, 1, 2, 10);
|
||||
WingBaseRight.setRotationPoint(-1F, 1F, 0F);
|
||||
setRotation(WingBaseRight, 0.5235988F, -0.5235988F, 0F);
|
||||
|
||||
WingEdgeRight = new ModelRenderer(this, 0, 21); //Texture position
|
||||
WingEdgeRight.addBox(0F, 0F, -2F, 1, 9, 2); //Offset, Size
|
||||
WingEdgeRight.setRotationPoint(-0.502F, -1F, 10F); //Negative x, y - 1, Position
|
||||
setRotation(WingEdgeRight, 0.5235988F, 0F, 0F); //Angle in radians
|
||||
WingEdgeRight = new ModelRenderer(this, 0, 21); // Texture position
|
||||
WingEdgeRight.addBox(0F, 0F, -2F, 1, 9, 2); // Offset, Size
|
||||
WingEdgeRight.setRotationPoint(-0.502F, -1F, 10F); // Negative x, y - 1, Position
|
||||
setRotation(WingEdgeRight, 0.5235988F, 0F, 0F); // Angle in radians
|
||||
|
||||
WingInsetRight = new ModelRenderer(this, 6, 21);
|
||||
WingInsetRight.addBox(0F, 0F, -1F, 1, 9, 2);
|
||||
@@ -62,7 +60,7 @@ public class WingModel extends ModelBiped
|
||||
WingBaseRight.addChild(WingFlangeRight);
|
||||
WingBaseRight.addChild(WingAuxRight);
|
||||
|
||||
//Left Wing
|
||||
// Left Wing
|
||||
WingBaseLeft = new ModelRenderer(this, 42, 9);
|
||||
WingBaseLeft.addBox(-0.5F, -1F, 0F, 1, 2, 10);
|
||||
WingBaseLeft.setRotationPoint(1F, 1F, 0F);
|
||||
@@ -109,26 +107,22 @@ public class WingModel extends ModelBiped
|
||||
this.bipedLeftLeg.isHidden = true;
|
||||
}
|
||||
|
||||
public void render (Entity entity, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
public void render(Entity entity, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
super.render(entity, f, f1, f2, f3, f4, f5);
|
||||
setRotationAngles(f, f1, f2, f3, f4, f5, entity);
|
||||
WingBaseRight.render(f5);
|
||||
WingBaseLeft.render(f5);
|
||||
}
|
||||
|
||||
private void setRotation (ModelRenderer model, float x, float y, float z)
|
||||
{
|
||||
private void setRotation(ModelRenderer model, float x, float y, float z) {
|
||||
model.rotateAngleX = x;
|
||||
model.rotateAngleY = y;
|
||||
model.rotateAngleZ = z;
|
||||
}
|
||||
|
||||
public void setRotationAngles (float f, float f1, float partialTick, float f3, float f4, float f5, Entity player)
|
||||
{
|
||||
public void setRotationAngles(float f, float f1, float partialTick, float f3, float f4, float f5, Entity player) {
|
||||
super.setRotationAngles(f, f1, partialTick, f3, f4, f5, player);
|
||||
if (this.isRiding)
|
||||
{
|
||||
if (this.isRiding) {
|
||||
float slow = 17f;
|
||||
this.WingBaseRight.rotateAngleX = MathHelper.sin(partialTick / slow) / 10f + 0.9F;
|
||||
this.WingBaseRight.rotateAngleY = MathHelper.sin(partialTick / slow) / 5.0f - 0.7f;
|
||||
@@ -137,9 +131,7 @@ public class WingModel extends ModelBiped
|
||||
this.WingBaseLeft.rotateAngleX = MathHelper.sin(partialTick / slow) / 10 + 0.9F;
|
||||
this.WingBaseLeft.rotateAngleY = -MathHelper.sin(partialTick / slow) / 5.0f + 0.7f;
|
||||
this.WingBaseLeft.rotateAngleZ = -MathHelper.sin(partialTick / slow) / 2.5f + 0.3f;
|
||||
}
|
||||
else if (player.isInWater())
|
||||
{
|
||||
} else if (player.isInWater()) {
|
||||
float slow = 17f;
|
||||
this.WingBaseRight.rotateAngleX = MathHelper.sin(partialTick / slow) / 15f + 0.5235988F;
|
||||
this.WingBaseRight.rotateAngleY = MathHelper.sin(partialTick / slow) / 15f - 0.8f;
|
||||
@@ -148,9 +140,7 @@ public class WingModel extends ModelBiped
|
||||
this.WingBaseLeft.rotateAngleX = MathHelper.sin(partialTick / slow) / 15f + 0.5235988F;
|
||||
this.WingBaseLeft.rotateAngleY = -MathHelper.sin(partialTick / slow) / 15f + 0.8f;
|
||||
this.WingBaseLeft.rotateAngleZ = -MathHelper.sin(partialTick / slow) / 15f + 0.8f;
|
||||
}
|
||||
else if (player.posY - player.prevPosY < 0f && player.fallDistance > 2.3)
|
||||
{
|
||||
} else if (player.posY - player.prevPosY < 0f && player.fallDistance > 2.3) {
|
||||
float slow = 20f;
|
||||
this.WingBaseRight.rotateAngleX = MathHelper.sin(partialTick / slow) / 15f + 0.7F;
|
||||
this.WingBaseRight.rotateAngleY = MathHelper.sin(partialTick / slow) / 15f - 0.8f;
|
||||
@@ -159,9 +149,7 @@ public class WingModel extends ModelBiped
|
||||
this.WingBaseLeft.rotateAngleX = MathHelper.sin(partialTick / slow) / 15f + 0.7F;
|
||||
this.WingBaseLeft.rotateAngleY = -MathHelper.sin(partialTick / slow) / 15f + 0.8f;
|
||||
this.WingBaseLeft.rotateAngleZ = -MathHelper.sin(partialTick / slow) / 15f + 0.3f;
|
||||
}
|
||||
else if (player.isSprinting() || this.onGround > 0)
|
||||
{
|
||||
} else if (player.isSprinting() || this.onGround > 0) {
|
||||
float slow = 1.73f;
|
||||
this.WingBaseRight.rotateAngleX = MathHelper.sin(partialTick / slow) / 15f + 0.5235988F;
|
||||
this.WingBaseRight.rotateAngleY = MathHelper.sin(partialTick / slow) / 15f - 0.6f;
|
||||
@@ -170,12 +158,9 @@ public class WingModel extends ModelBiped
|
||||
this.WingBaseLeft.rotateAngleX = MathHelper.sin(partialTick / slow) / 15f + 0.5235988F;
|
||||
this.WingBaseLeft.rotateAngleY = -MathHelper.sin(partialTick / slow) / 15f + 0.6f;
|
||||
this.WingBaseLeft.rotateAngleZ = -MathHelper.sin(partialTick / slow) / 15f + 0.3f;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
float slow = 17f;
|
||||
if (player.motionX != 0 || player.motionZ != 0)
|
||||
slow = 6f;
|
||||
if (player.motionX != 0 || player.motionZ != 0) slow = 6f;
|
||||
this.WingBaseRight.rotateAngleX = MathHelper.sin(partialTick / slow) / 5f + 0.5235988F;
|
||||
this.WingBaseRight.rotateAngleY = MathHelper.sin(partialTick / slow) / 3.0f - 0.6f;
|
||||
this.WingBaseRight.rotateAngleZ = MathHelper.sin(partialTick / slow) / 1.5f - 0.3f;
|
||||
@@ -185,11 +170,9 @@ public class WingModel extends ModelBiped
|
||||
this.WingBaseLeft.rotateAngleZ = -MathHelper.sin(partialTick / slow) / 1.5f + 0.3f;
|
||||
}
|
||||
|
||||
if (this.isSneak)
|
||||
{
|
||||
if (this.isSneak) {
|
||||
this.WingBaseRight.rotateAngleX += 0.4f;
|
||||
this.WingBaseLeft.rotateAngleX += 0.4f;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -7,49 +7,39 @@ import net.minecraft.world.IBlockAccess;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.util.ItemHelper;
|
||||
|
||||
public class DryingRackRender implements ISimpleBlockRenderingHandler
|
||||
{
|
||||
public class DryingRackRender implements ISimpleBlockRenderingHandler {
|
||||
public static int model = RenderingRegistry.getNextAvailableRenderId();
|
||||
|
||||
@Override
|
||||
public void renderInventoryBlock (Block block, int metadata, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == model)
|
||||
{
|
||||
public void renderInventoryBlock(Block block, int metadata, int modelID, RenderBlocks renderer) {
|
||||
if (modelID == model) {
|
||||
renderer.setRenderBounds(0.375F, 0.375F, 0.0F, 0.625F, 0.625F, 1.0F);
|
||||
ItemHelper.renderStandardInvBlock(renderer, block, metadata);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean renderWorldBlock (IBlockAccess world, int x, int y, int z, Block block, int modelID, RenderBlocks renderer)
|
||||
{
|
||||
if (modelID == model)
|
||||
{
|
||||
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);
|
||||
if (metadata == 0)
|
||||
{
|
||||
if (metadata == 0) {
|
||||
renderer.setRenderBounds(0.0F, 0.0, 0.375F, 1.0F, 0.25F, 0.625F);
|
||||
}
|
||||
if (metadata == 1)
|
||||
{
|
||||
if (metadata == 1) {
|
||||
renderer.setRenderBounds(0.375F, 0.0, 0.0f, 0.625F, 0.25F, 1F);
|
||||
}
|
||||
|
||||
if (metadata == 2)
|
||||
{
|
||||
if (metadata == 2) {
|
||||
renderer.setRenderBounds(0.0F, 0.75F, 0.75F, 1F, 1.0F, 1F);
|
||||
}
|
||||
if (metadata == 3)
|
||||
{
|
||||
if (metadata == 3) {
|
||||
renderer.setRenderBounds(0.0F, 0.75F, 0F, 1F, 1.0F, 0.25F);
|
||||
}
|
||||
if (metadata == 4)
|
||||
{
|
||||
if (metadata == 4) {
|
||||
renderer.setRenderBounds(0.75F, 0.75F, 0.0f, 1F, 1.0F, 1F);
|
||||
}
|
||||
if (metadata == 5)
|
||||
{
|
||||
if (metadata == 5) {
|
||||
renderer.setRenderBounds(0F, 0.75F, 0.0f, 0.25F, 1.0F, 1F);
|
||||
}
|
||||
renderer.renderStandardBlock(block, x, y, z);
|
||||
@@ -59,19 +49,16 @@ public class DryingRackRender implements ISimpleBlockRenderingHandler
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldRender3DInInventory (int modelID)
|
||||
{
|
||||
public boolean shouldRender3DInInventory(int modelID) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderId ()
|
||||
{
|
||||
public int getRenderId() {
|
||||
return model;
|
||||
}
|
||||
|
||||
public static void renderStandardInvBlock (RenderBlocks renderblocks, Block block, int meta)
|
||||
{
|
||||
public static void renderStandardInvBlock(RenderBlocks renderblocks, Block block, int meta) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
GL11.glTranslatef(-0.5F, -0.5F, -0.5F);
|
||||
tessellator.startDrawingQuads();
|
||||
|
||||
@@ -12,11 +12,9 @@ import tconstruct.tools.entity.FancyEntityItem;
|
||||
/* Special renderer, only used for drawing tools */
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class DryingRackSpecialRender extends TileEntitySpecialRenderer
|
||||
{
|
||||
public class DryingRackSpecialRender extends TileEntitySpecialRenderer {
|
||||
|
||||
public void render (DryingRackLogic logic, double posX, double posY, double posZ, float var8)
|
||||
{
|
||||
public void render(DryingRackLogic logic, double posX, double posY, double posZ, float var8) {
|
||||
GL11.glPushMatrix();
|
||||
float var10 = (float) (posX - 0.5F);
|
||||
float var11 = (float) (posY - 0.5F);
|
||||
@@ -26,56 +24,45 @@ public class DryingRackSpecialRender extends TileEntitySpecialRenderer
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
private void func_82402_b (DryingRackLogic logic)
|
||||
{
|
||||
private void func_82402_b(DryingRackLogic logic) {
|
||||
ItemStack stack = logic.getStackInSlot(0);
|
||||
|
||||
if (stack != null)
|
||||
renderItem(logic, stack);
|
||||
if (stack != null) renderItem(logic, stack);
|
||||
}
|
||||
|
||||
void renderItem (DryingRackLogic logic, ItemStack stack)
|
||||
{
|
||||
void renderItem(DryingRackLogic logic, ItemStack stack) {
|
||||
FancyEntityItem entityitem = new FancyEntityItem(logic.getWorldObj(), 0.0D, 0.0D, 0.0D, stack);
|
||||
entityitem.getEntityItem().stackSize = 1;
|
||||
entityitem.hoverStart = 0.0F;
|
||||
GL11.glPushMatrix();
|
||||
int meta = logic.getWorldObj().getBlockMetadata(logic.xCoord, logic.yCoord, logic.zCoord);
|
||||
if (meta <= 1)
|
||||
GL11.glTranslatef(1F, -0.375F, 0.905F);
|
||||
else
|
||||
{
|
||||
if (meta <= 1) GL11.glTranslatef(1F, -0.375F, 0.905F);
|
||||
else {
|
||||
GL11.glTranslatef(1F, 0.375F, 0.905F);
|
||||
|
||||
if (meta / 2 == 2)
|
||||
{
|
||||
if (meta / 2 == 2) {
|
||||
GL11.glRotatef(90F, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(-0.0625F, 0F, 0F);
|
||||
}
|
||||
if (meta == 2)
|
||||
GL11.glTranslatef(0F, 0F, 0.375F);
|
||||
if (meta == 3)
|
||||
{
|
||||
// Rotate, Flip.
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, 0.2F);
|
||||
//GL11.glTranslatef(0F, 0F, -0.375F);
|
||||
if (meta == 2) GL11.glTranslatef(0F, 0F, 0.375F);
|
||||
if (meta == 3) {
|
||||
// Rotate, Flip.
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, 0.2F);
|
||||
// GL11.glTranslatef(0F, 0F, -0.375F);
|
||||
}
|
||||
if (meta == 4)
|
||||
{
|
||||
if (meta == 4) {
|
||||
GL11.glTranslatef(0F, 0F, 0.2875F);
|
||||
}
|
||||
if (meta == 5)
|
||||
{
|
||||
//Rotate, Flip.
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, 0.3F);
|
||||
//GL11.glTranslatef(0F, 0F, -0.5F);
|
||||
if (meta == 5) {
|
||||
// Rotate, Flip.
|
||||
GL11.glRotatef(180F, 0F, 1F, 0F);
|
||||
GL11.glTranslatef(0F, 0F, 0.3F);
|
||||
// GL11.glTranslatef(0F, 0F, -0.5F);
|
||||
}
|
||||
}
|
||||
GL11.glScalef(2F, 2F, 2F);
|
||||
if (stack.getItem() instanceof ItemBlock)
|
||||
{
|
||||
if (stack.getItem() instanceof ItemBlock) {
|
||||
// GL11.glRotatef(90F, -1, 0F, 0F);
|
||||
GL11.glTranslatef(0F, 0.2125F, 0.0375F);
|
||||
}
|
||||
@@ -88,8 +75,7 @@ public class DryingRackSpecialRender extends TileEntitySpecialRenderer
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderTileEntityAt (TileEntity logic, double var2, double var4, double var6, float var8)
|
||||
{
|
||||
public void renderTileEntityAt(TileEntity logic, double var2, double var4, double var6, float var8) {
|
||||
this.render((DryingRackLogic) logic, var2, var4, var6, var8);
|
||||
}
|
||||
}
|
||||
@@ -1,13 +1,12 @@
|
||||
package tconstruct.armor.player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.UUID;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import java.util.UUID;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
@@ -19,76 +18,62 @@ import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
import tconstruct.library.accessory.IHealthAccessory;
|
||||
|
||||
public class ArmorExtended implements IInventory
|
||||
{
|
||||
public class ArmorExtended implements IInventory {
|
||||
public ItemStack[] inventory = new ItemStack[7];
|
||||
public WeakReference<EntityPlayer> parent;
|
||||
public UUID globalID = UUID.fromString("B243BE32-DC1B-4C53-8D13-8752D5C69D5B");
|
||||
|
||||
public void init (EntityPlayer player)
|
||||
{
|
||||
public void init(EntityPlayer player) {
|
||||
parent = new WeakReference<EntityPlayer>(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory ()
|
||||
{
|
||||
public int getSizeInventory() {
|
||||
return inventory.length;
|
||||
}
|
||||
|
||||
public boolean isStackInSlot (int slot)
|
||||
{
|
||||
public boolean isStackInSlot(int slot) {
|
||||
return inventory[slot] != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot (int slot)
|
||||
{
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory[slot];
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slot, int quantity)
|
||||
{
|
||||
if (inventory[slot] != null)
|
||||
{
|
||||
public ItemStack decrStackSize(int slot, int quantity) {
|
||||
if (inventory[slot] != null) {
|
||||
// TConstruct.logger.info("Took something from slot " + slot);
|
||||
if (inventory[slot].stackSize <= quantity)
|
||||
{
|
||||
if (inventory[slot].stackSize <= quantity) {
|
||||
ItemStack stack = inventory[slot];
|
||||
inventory[slot] = null;
|
||||
return stack;
|
||||
}
|
||||
ItemStack split = inventory[slot].splitStack(quantity);
|
||||
if (inventory[slot].stackSize == 0)
|
||||
{
|
||||
if (inventory[slot].stackSize == 0) {
|
||||
inventory[slot] = null;
|
||||
}
|
||||
EntityPlayer player = parent.get();
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
recalculateHealth(player, stats);
|
||||
return split;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing (int slot)
|
||||
{
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
public void setInventorySlotContents(int slot, ItemStack itemstack) {
|
||||
inventory[slot] = itemstack;
|
||||
// TConstruct.logger.info("Changed slot " + slot + " on side " +
|
||||
// FMLCommonHandler.instance().getEffectiveSide());
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
|
||||
@@ -98,26 +83,22 @@ public class ArmorExtended implements IInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName ()
|
||||
{
|
||||
public String getInventoryName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName ()
|
||||
{
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit ()
|
||||
{
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty ()
|
||||
{
|
||||
public void markDirty() {
|
||||
EntityPlayer player = parent.get();
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
// recalculateSkills(player, stats);
|
||||
@@ -129,18 +110,14 @@ public class ArmorExtended implements IInventory
|
||||
*/
|
||||
}
|
||||
|
||||
public void recalculateHealth (EntityPlayer player, TPlayerStats stats)
|
||||
{
|
||||
public void recalculateHealth(EntityPlayer player, TPlayerStats stats) {
|
||||
Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
|
||||
if (inventory[4] != null || inventory[5] != null || inventory[6] != null)
|
||||
{
|
||||
if (inventory[4] != null || inventory[5] != null || inventory[6] != null) {
|
||||
int bonusHP = 0;
|
||||
for (int i = 4; i < 7; i++)
|
||||
{
|
||||
for (int i = 4; i < 7; i++) {
|
||||
ItemStack stack = inventory[i];
|
||||
if (stack != null && stack.getItem() instanceof IHealthAccessory)
|
||||
{
|
||||
if (stack != null && stack.getItem() instanceof IHealthAccessory) {
|
||||
bonusHP += ((IHealthAccessory) stack.getItem()).getHealthBoost(stack);
|
||||
}
|
||||
}
|
||||
@@ -148,70 +125,53 @@ public class ArmorExtended implements IInventory
|
||||
stats.bonusHealth = bonusHP;
|
||||
|
||||
int healthChange = bonusHP - prevHealth;
|
||||
if (healthChange != 0)
|
||||
{
|
||||
IAttributeInstance attributeinstance = player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth);
|
||||
try
|
||||
{
|
||||
if (healthChange != 0) {
|
||||
IAttributeInstance attributeinstance =
|
||||
player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth);
|
||||
try {
|
||||
attributeinstance.removeModifier(attributeinstance.getModifier(globalID));
|
||||
} catch (Exception e) {
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
attributeinstance.applyModifier(new AttributeModifier(globalID, "tconstruct.heartCanister", bonusHP, 0));
|
||||
|
||||
attributeinstance.applyModifier(
|
||||
new AttributeModifier(globalID, "tconstruct.heartCanister", bonusHP, 0));
|
||||
}
|
||||
}
|
||||
else if (parent != null && parent.get() != null)
|
||||
{
|
||||
} else if (parent != null && parent.get() != null) {
|
||||
int prevHealth = stats.bonusHealth;
|
||||
int bonusHP = 0;
|
||||
stats.bonusHealth = bonusHP;
|
||||
int healthChange = bonusHP - prevHealth;
|
||||
if (healthChange != 0)
|
||||
{
|
||||
IAttributeInstance attributeinstance = player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth);
|
||||
try
|
||||
{
|
||||
if (healthChange != 0) {
|
||||
IAttributeInstance attributeinstance =
|
||||
player.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.maxHealth);
|
||||
try {
|
||||
attributeinstance.removeModifier(attributeinstance.getModifier(globalID));
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer (EntityPlayer entityplayer)
|
||||
{
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public void openChest ()
|
||||
{
|
||||
}
|
||||
public void openChest() {}
|
||||
|
||||
public void closeChest ()
|
||||
{
|
||||
}
|
||||
public void closeChest() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot (int slot, ItemStack itemstack)
|
||||
{
|
||||
public boolean isItemValidForSlot(int slot, ItemStack itemstack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/* Save/Load */
|
||||
public void saveToNBT (NBTTagCompound tagCompound)
|
||||
{
|
||||
public void saveToNBT(NBTTagCompound tagCompound) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
NBTTagCompound invSlot;
|
||||
|
||||
for (int i = 0; i < this.inventory.length; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
for (int i = 0; i < this.inventory.length; ++i) {
|
||||
if (this.inventory[i] != null) {
|
||||
invSlot = new NBTTagCompound();
|
||||
invSlot.setByte("Slot", (byte) i);
|
||||
this.inventory[i].writeToNBT(invSlot);
|
||||
@@ -222,27 +182,22 @@ public class ArmorExtended implements IInventory
|
||||
tagCompound.setTag("Inventory", tagList);
|
||||
}
|
||||
|
||||
public void readFromNBT (NBTTagCompound tagCompound)
|
||||
{
|
||||
if (tagCompound != null)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
if (tagCompound != null) {
|
||||
NBTTagList tagList = tagCompound.getTagList("Inventory", 10);
|
||||
for (int i = 0; i < tagList.tagCount(); ++i)
|
||||
{
|
||||
for (int i = 0; i < tagList.tagCount(); ++i) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) tagList.getCompoundTagAt(i);
|
||||
int j = nbttagcompound.getByte("Slot") & 255;
|
||||
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack != null) {
|
||||
this.inventory[j] = itemstack;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// --- EnderIO SoulBound enchant support
|
||||
// --- EnderIO SoulBound enchant support
|
||||
|
||||
private static int soulBoundID = -6;
|
||||
|
||||
@@ -273,18 +228,13 @@ public class ArmorExtended implements IInventory
|
||||
return false;
|
||||
}
|
||||
|
||||
// ---
|
||||
// ---
|
||||
|
||||
|
||||
public void dropItems ()
|
||||
{
|
||||
public void dropItems() {
|
||||
EntityPlayer player = parent.get();
|
||||
if (player != null)
|
||||
{
|
||||
for (int i = 0; i < 4; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null && !isSoulBounded(this.inventory[i]))
|
||||
{
|
||||
if (player != null) {
|
||||
for (int i = 0; i < 4; ++i) {
|
||||
if (this.inventory[i] != null && !isSoulBounded(this.inventory[i])) {
|
||||
player.func_146097_a(this.inventory[i], true, false);
|
||||
this.inventory[i] = null;
|
||||
}
|
||||
@@ -293,24 +243,16 @@ public class ArmorExtended implements IInventory
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory ()
|
||||
{
|
||||
}
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory ()
|
||||
{
|
||||
public void closeInventory() {}
|
||||
|
||||
public void writeInventoryToStream(ByteBuf os) throws IOException {
|
||||
for (int i = 0; i < inventory.length; i++) ByteBufUtils.writeItemStack(os, inventory[i]);
|
||||
}
|
||||
|
||||
public void writeInventoryToStream (ByteBuf os) throws IOException
|
||||
{
|
||||
for (int i = 0; i < inventory.length; i++)
|
||||
ByteBufUtils.writeItemStack(os, inventory[i]);
|
||||
}
|
||||
|
||||
public void readInventoryFromStream (ByteBuf is) throws IOException
|
||||
{
|
||||
for (int i = 0; i < inventory.length; i++)
|
||||
inventory[i] = ByteBufUtils.readItemStack(is);
|
||||
public void readInventoryFromStream(ByteBuf is) throws IOException {
|
||||
for (int i = 0; i < inventory.length; i++) inventory[i] = ByteBufUtils.readItemStack(is);
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package tconstruct.armor.player;
|
||||
|
||||
public class ArmorExtendedClient extends ArmorExtended
|
||||
{
|
||||
public class ArmorExtendedClient extends ArmorExtended {
|
||||
/*
|
||||
* public void recalculateSkills(EntityPlayer player, TPlayerStats stats) {
|
||||
* TConstruct.logger.info("Client skills"); if (inventory[1] != null &&
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
package tconstruct.armor.player;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import cpw.mods.fml.common.network.ByteBufUtils;
|
||||
import io.netty.buffer.ByteBuf;
|
||||
import java.io.IOException;
|
||||
import java.lang.ref.WeakReference;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@@ -13,126 +12,99 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.nbt.NBTTagList;
|
||||
|
||||
public class KnapsackInventory implements IInventory
|
||||
{
|
||||
public class KnapsackInventory implements IInventory {
|
||||
public ItemStack[] inventory = new ItemStack[27];
|
||||
public WeakReference<EntityPlayer> parent;
|
||||
|
||||
public void init (EntityPlayer player)
|
||||
{
|
||||
public void init(EntityPlayer player) {
|
||||
parent = new WeakReference<EntityPlayer>(player);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlot (int slot)
|
||||
{
|
||||
public ItemStack getStackInSlot(int slot) {
|
||||
return inventory[slot];
|
||||
}
|
||||
|
||||
public boolean isStackInSlot (int slot)
|
||||
{
|
||||
public boolean isStackInSlot(int slot) {
|
||||
return inventory[slot] != null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSizeInventory ()
|
||||
{
|
||||
public int getSizeInventory() {
|
||||
return inventory.length;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getInventoryStackLimit ()
|
||||
{
|
||||
public int getInventoryStackLimit() {
|
||||
return 64;
|
||||
}
|
||||
|
||||
public boolean canDropInventorySlot (int slot)
|
||||
{
|
||||
public boolean canDropInventorySlot(int slot) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
public void setInventorySlotContents(int slot, ItemStack itemstack) {
|
||||
inventory[slot] = itemstack;
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit())
|
||||
{
|
||||
if (itemstack != null && itemstack.stackSize > getInventoryStackLimit()) {
|
||||
itemstack.stackSize = getInventoryStackLimit();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slot, int quantity)
|
||||
{
|
||||
if (inventory[slot] != null)
|
||||
{
|
||||
if (inventory[slot].stackSize <= quantity)
|
||||
{
|
||||
public ItemStack decrStackSize(int slot, int quantity) {
|
||||
if (inventory[slot] != null) {
|
||||
if (inventory[slot].stackSize <= quantity) {
|
||||
ItemStack stack = inventory[slot];
|
||||
inventory[slot] = null;
|
||||
return stack;
|
||||
}
|
||||
ItemStack split = inventory[slot].splitStack(quantity);
|
||||
if (inventory[slot].stackSize == 0)
|
||||
{
|
||||
if (inventory[slot].stackSize == 0) {
|
||||
inventory[slot] = null;
|
||||
}
|
||||
return split;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName ()
|
||||
{
|
||||
public String getInventoryName() {
|
||||
return "tconstruct.knapsack";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName ()
|
||||
{
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getStackInSlotOnClosing (int slot)
|
||||
{
|
||||
public ItemStack getStackInSlotOnClosing(int slot) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public void openChest ()
|
||||
{
|
||||
}
|
||||
public void openChest() {}
|
||||
|
||||
public void closeChest ()
|
||||
{
|
||||
}
|
||||
public void closeChest() {}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot (int i, ItemStack itemstack)
|
||||
{
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemstack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUseableByPlayer (EntityPlayer entityplayer)
|
||||
{
|
||||
public boolean isUseableByPlayer(EntityPlayer entityplayer) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/* Save/Load */
|
||||
public void saveToNBT (NBTTagCompound tagCompound)
|
||||
{
|
||||
public void saveToNBT(NBTTagCompound tagCompound) {
|
||||
NBTTagList tagList = new NBTTagList();
|
||||
NBTTagCompound invSlot;
|
||||
|
||||
for (int i = 0; i < this.inventory.length; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
for (int i = 0; i < this.inventory.length; ++i) {
|
||||
if (this.inventory[i] != null) {
|
||||
invSlot = new NBTTagCompound();
|
||||
invSlot.setByte("Slot", (byte) i);
|
||||
this.inventory[i].writeToNBT(invSlot);
|
||||
@@ -143,36 +115,28 @@ public class KnapsackInventory implements IInventory
|
||||
tagCompound.setTag("Knapsack", tagList);
|
||||
}
|
||||
|
||||
public void readFromNBT (NBTTagCompound tagCompound)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tagCompound) {
|
||||
// player doesn't have a knapsack saved, tcon probably wasn't present before. don't error out.
|
||||
if(tagCompound == null || !tagCompound.hasKey("Knapsack"))
|
||||
return;
|
||||
if (tagCompound == null || !tagCompound.hasKey("Knapsack")) return;
|
||||
|
||||
NBTTagList tagList = tagCompound.getTagList("Knapsack", 10);
|
||||
for (int i = 0; i < tagList.tagCount(); ++i)
|
||||
{
|
||||
for (int i = 0; i < tagList.tagCount(); ++i) {
|
||||
NBTTagCompound nbttagcompound = (NBTTagCompound) tagList.getCompoundTagAt(i);
|
||||
int j = nbttagcompound.getByte("Slot") & 255;
|
||||
ItemStack itemstack = ItemStack.loadItemStackFromNBT(nbttagcompound);
|
||||
|
||||
if (itemstack != null)
|
||||
{
|
||||
if (itemstack != null) {
|
||||
this.inventory[j] = itemstack;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void dropItems ()
|
||||
{
|
||||
public void dropItems() {
|
||||
EntityPlayer player = parent.get();
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
for (int i = 0; i < inventory.length; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
if (player != null) {
|
||||
for (int i = 0; i < inventory.length; ++i) {
|
||||
if (this.inventory[i] != null) {
|
||||
player.func_146097_a(this.inventory[i], true, false);
|
||||
this.inventory[i] = null;
|
||||
}
|
||||
@@ -180,16 +144,12 @@ public class KnapsackInventory implements IInventory
|
||||
}
|
||||
}
|
||||
|
||||
public void unequipItems ()
|
||||
{
|
||||
public void unequipItems() {
|
||||
EntityPlayer player = parent.get();
|
||||
|
||||
if (player != null)
|
||||
{
|
||||
for (int i = 0; i < inventory.length; ++i)
|
||||
{
|
||||
if (this.inventory[i] != null)
|
||||
{
|
||||
if (player != null) {
|
||||
for (int i = 0; i < inventory.length; ++i) {
|
||||
if (this.inventory[i] != null) {
|
||||
dropItemEntity(player, inventory[i]);
|
||||
this.inventory[i] = null;
|
||||
}
|
||||
@@ -197,37 +157,25 @@ public class KnapsackInventory implements IInventory
|
||||
}
|
||||
}
|
||||
|
||||
void dropItemEntity (Entity dropper, ItemStack dropStack)
|
||||
{
|
||||
void dropItemEntity(Entity dropper, ItemStack dropStack) {
|
||||
EntityItem entityitem = new EntityItem(dropper.worldObj, dropper.posX, dropper.posY, dropper.posZ, dropStack);
|
||||
dropper.worldObj.spawnEntityInWorld(entityitem);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void markDirty ()
|
||||
{
|
||||
}
|
||||
public void markDirty() {}
|
||||
|
||||
@Override
|
||||
public void openInventory ()
|
||||
{
|
||||
}
|
||||
public void openInventory() {}
|
||||
|
||||
@Override
|
||||
public void closeInventory ()
|
||||
{
|
||||
public void closeInventory() {}
|
||||
|
||||
public void writeInventoryToStream(ByteBuf os) throws IOException {
|
||||
for (int i = 0; i < 27; i++) ByteBufUtils.writeItemStack(os, inventory[i]);
|
||||
}
|
||||
|
||||
public void writeInventoryToStream (ByteBuf os) throws IOException
|
||||
{
|
||||
for (int i = 0; i < 27; i++)
|
||||
ByteBufUtils.writeItemStack(os, inventory[i]);
|
||||
public void readInventoryFromStream(ByteBuf is) throws IOException {
|
||||
for (int i = 0; i < 27; i++) inventory[i] = ByteBufUtils.readItemStack(is);
|
||||
}
|
||||
|
||||
public void readInventoryFromStream (ByteBuf is) throws IOException
|
||||
{
|
||||
for (int i = 0; i < 27; i++)
|
||||
inventory[i] = ByteBufUtils.readItemStack(is);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -10,7 +10,6 @@ import java.net.*;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import mantle.player.PlayerUtils;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.enchantment.Enchantment;
|
||||
import net.minecraft.entity.*;
|
||||
import net.minecraft.entity.Entity.EnumEntitySize;
|
||||
@@ -21,69 +20,58 @@ import net.minecraft.nbt.*;
|
||||
import net.minecraftforge.event.entity.EntityEvent;
|
||||
import net.minecraftforge.event.entity.living.*;
|
||||
import net.minecraftforge.event.entity.player.PlayerDropsEvent;
|
||||
import net.minecraftforge.event.entity.player.PlayerEvent;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
//TODO: Redesign this class
|
||||
public class TPlayerHandler
|
||||
{
|
||||
// TODO: Redesign this class
|
||||
public class TPlayerHandler {
|
||||
/* Player */
|
||||
// public int hunger;
|
||||
|
||||
private ConcurrentHashMap<UUID, TPlayerStats> playerStats = new ConcurrentHashMap<UUID, TPlayerStats>();
|
||||
|
||||
@SubscribeEvent
|
||||
public void PlayerLoggedInEvent (PlayerLoggedInEvent event)
|
||||
{
|
||||
public void PlayerLoggedInEvent(PlayerLoggedInEvent event) {
|
||||
onPlayerLogin(event.player);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlayerRespawn (PlayerRespawnEvent event)
|
||||
{
|
||||
public void onPlayerRespawn(PlayerRespawnEvent event) {
|
||||
onPlayerRespawn(event.player);
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onEntityConstructing (EntityEvent.EntityConstructing event)
|
||||
{
|
||||
if (event.entity instanceof EntityPlayer && TPlayerStats.get((EntityPlayer) event.entity) == null)
|
||||
{
|
||||
public void onEntityConstructing(EntityEvent.EntityConstructing event) {
|
||||
if (event.entity instanceof EntityPlayer && TPlayerStats.get((EntityPlayer) event.entity) == null) {
|
||||
TPlayerStats.register((EntityPlayer) event.entity);
|
||||
}
|
||||
}
|
||||
|
||||
public void onPlayerLogin (EntityPlayer player)
|
||||
{
|
||||
public void onPlayerLogin(EntityPlayer player) {
|
||||
// Lookup player
|
||||
TPlayerStats stats = TPlayerStats.get(player);
|
||||
|
||||
stats.level = player.experienceLevel;
|
||||
stats.hunger = player.getFoodStats().getFoodLevel();
|
||||
|
||||
//stats.battlesignBonus = tags.getCompoundTag("TConstruct").getBoolean("battlesignBonus");
|
||||
// stats.battlesignBonus = tags.getCompoundTag("TConstruct").getBoolean("battlesignBonus");
|
||||
|
||||
// gamerule naturalRegeneration false
|
||||
if (!PHConstruct.enableHealthRegen)
|
||||
player.worldObj.getGameRules().setOrCreateGameRule("naturalRegeneration", "false");
|
||||
if (!stats.beginnerManual)
|
||||
{
|
||||
if (!stats.beginnerManual) {
|
||||
stats.beginnerManual = true;
|
||||
stats.battlesignBonus = true;
|
||||
if (PHConstruct.beginnerBook)
|
||||
{
|
||||
if (PHConstruct.beginnerBook) {
|
||||
ItemStack diary = new ItemStack(TinkerTools.manualBook);
|
||||
if (!player.inventory.addItemStackToInventory(diary))
|
||||
{
|
||||
if (!player.inventory.addItemStackToInventory(diary)) {
|
||||
AbilityHelper.spawnItemAtPlayer(player, diary);
|
||||
}
|
||||
}
|
||||
|
||||
if (player.getDisplayName().toLowerCase().equals("fractuality"))
|
||||
{
|
||||
if (player.getDisplayName().toLowerCase().equals("fractuality")) {
|
||||
ItemStack pattern = new ItemStack(TinkerTools.woodPattern, 1, 22);
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
@@ -98,8 +86,7 @@ public class TPlayerHandler
|
||||
AbilityHelper.spawnItemAtPlayer(player, pattern);
|
||||
}
|
||||
|
||||
if (player.getDisplayName().toLowerCase().equals("zerokyuuni"))
|
||||
{
|
||||
if (player.getDisplayName().toLowerCase().equals("zerokyuuni")) {
|
||||
ItemStack pattern = new ItemStack(Items.stick);
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
@@ -112,15 +99,13 @@ public class TPlayerHandler
|
||||
|
||||
AbilityHelper.spawnItemAtPlayer(player, pattern);
|
||||
}
|
||||
if (player.getDisplayName().toLowerCase().equals("zisteau"))
|
||||
{
|
||||
if (player.getDisplayName().toLowerCase().equals("zisteau")) {
|
||||
spawnPigmanModifier(player);
|
||||
}
|
||||
|
||||
NBTTagCompound tags = player.getEntityData();
|
||||
NBTTagCompound persistTag = tags.getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG);
|
||||
if (stickUsers.contains(player.getDisplayName()) && !persistTag.hasKey("TCon-Stick"))
|
||||
{
|
||||
if (stickUsers.contains(player.getDisplayName()) && !persistTag.hasKey("TCon-Stick")) {
|
||||
ItemStack stick = new ItemStack(Items.stick);
|
||||
persistTag.setBoolean("TCon-Stick", true);
|
||||
|
||||
@@ -139,11 +124,8 @@ public class TPlayerHandler
|
||||
AbilityHelper.spawnItemAtPlayer(player, stick);
|
||||
tags.setTag(EntityPlayer.PERSISTED_NBT_TAG, persistTag);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!stats.battlesignBonus)
|
||||
{
|
||||
} else {
|
||||
if (!stats.battlesignBonus) {
|
||||
stats.battlesignBonus = true;
|
||||
ItemStack modifier = new ItemStack(TinkerTools.creativeModifier);
|
||||
|
||||
@@ -158,27 +140,24 @@ public class TPlayerHandler
|
||||
|
||||
AbilityHelper.spawnItemAtPlayer(player, modifier);
|
||||
|
||||
if (player.getDisplayName().toLowerCase().equals("zisteau"))
|
||||
{
|
||||
if (player.getDisplayName().toLowerCase().equals("zisteau")) {
|
||||
spawnPigmanModifier(player);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (PHConstruct.gregtech && Loader.isModLoaded("GregTech-Addon"))
|
||||
{
|
||||
if (PHConstruct.gregtech && Loader.isModLoaded("GregTech-Addon")) {
|
||||
PHConstruct.gregtech = false;
|
||||
if (PHConstruct.lavaFortuneInteraction)
|
||||
{
|
||||
if (PHConstruct.lavaFortuneInteraction) {
|
||||
PlayerUtils.sendChatMessage(player, "Warning: Cross-mod Exploit Present!");
|
||||
PlayerUtils.sendChatMessage(player, "Solution 1: Disable Reverse Smelting recipes from GregTech.");
|
||||
PlayerUtils.sendChatMessage(player, "Solution 2: Disable Auto-Smelt/Fortune interaction from TConstruct.");
|
||||
PlayerUtils.sendChatMessage(
|
||||
player, "Solution 2: Disable Auto-Smelt/Fortune interaction from TConstruct.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void spawnPigmanModifier (EntityPlayer entityplayer)
|
||||
{
|
||||
void spawnPigmanModifier(EntityPlayer entityplayer) {
|
||||
ItemStack modifier = new ItemStack(TinkerTools.creativeModifier);
|
||||
|
||||
NBTTagCompound compound = new NBTTagCompound();
|
||||
@@ -194,13 +173,11 @@ public class TPlayerHandler
|
||||
AbilityHelper.spawnItemAtPlayer(entityplayer, modifier);
|
||||
}
|
||||
|
||||
public void onPlayerRespawn (EntityPlayer entityplayer)
|
||||
{
|
||||
public void onPlayerRespawn(EntityPlayer entityplayer) {
|
||||
// Boom!
|
||||
TPlayerStats playerData = playerStats.remove(entityplayer.getPersistentID());
|
||||
TPlayerStats stats = TPlayerStats.get(entityplayer);
|
||||
if (playerData != null)
|
||||
{
|
||||
if (playerData != null) {
|
||||
stats.copyFrom(playerData, false);
|
||||
stats.level = playerData.level;
|
||||
stats.hunger = playerData.hunger;
|
||||
@@ -213,37 +190,29 @@ public class TPlayerHandler
|
||||
* TFoodStats food = new TFoodStats(); entityplayer.foodStats = food;
|
||||
*/
|
||||
|
||||
if (PHConstruct.keepLevels)
|
||||
entityplayer.experienceLevel = stats.level;
|
||||
if (PHConstruct.keepHunger)
|
||||
entityplayer.getFoodStats().addStats(-1 * (20 - stats.hunger), 0);
|
||||
if (PHConstruct.keepLevels) entityplayer.experienceLevel = stats.level;
|
||||
if (PHConstruct.keepHunger) entityplayer.getFoodStats().addStats(-1 * (20 - stats.hunger), 0);
|
||||
|
||||
Side side = FMLCommonHandler.instance().getEffectiveSide();
|
||||
if (side == Side.CLIENT)
|
||||
{
|
||||
if (side == Side.CLIENT) {
|
||||
// TProxyClient.controlInstance.resetControls();
|
||||
if (PHConstruct.keepHunger)
|
||||
entityplayer.getFoodStats().setFoodLevel(stats.hunger);
|
||||
if (PHConstruct.keepHunger) entityplayer.getFoodStats().setFoodLevel(stats.hunger);
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void livingFall (LivingFallEvent evt) // Only for negating fall damage
|
||||
{
|
||||
if (evt.entityLiving instanceof EntityPlayer)
|
||||
{
|
||||
public void livingFall(LivingFallEvent evt) // Only for negating fall damage
|
||||
{
|
||||
if (evt.entityLiving instanceof EntityPlayer) {
|
||||
evt.distance -= 1;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerDeath (LivingDeathEvent event)
|
||||
{
|
||||
if(!(event.entity instanceof EntityPlayer))
|
||||
return;
|
||||
public void playerDeath(LivingDeathEvent event) {
|
||||
if (!(event.entity instanceof EntityPlayer)) return;
|
||||
|
||||
if (!event.entity.worldObj.isRemote)
|
||||
{
|
||||
if (!event.entity.worldObj.isRemote) {
|
||||
TPlayerStats properties = (TPlayerStats) event.entity.getExtendedProperties(TPlayerStats.PROP_NAME);
|
||||
properties.hunger = ((EntityPlayer) event.entity).getFoodStats().getFoodLevel();
|
||||
playerStats.put(((EntityPlayer) event.entity).getPersistentID(), properties);
|
||||
@@ -251,21 +220,17 @@ public class TPlayerHandler
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void playerDrops (PlayerDropsEvent evt)
|
||||
{
|
||||
public void playerDrops(PlayerDropsEvent evt) {
|
||||
// After playerDeath event. Modifying saved data.
|
||||
TPlayerStats stats = playerStats.get(evt.entityPlayer.getPersistentID());
|
||||
|
||||
stats.level = evt.entityPlayer.experienceLevel / 2;
|
||||
// stats.health = 20;
|
||||
int hunger = evt.entityPlayer.getFoodStats().getFoodLevel();
|
||||
if (hunger < 6)
|
||||
stats.hunger = 6;
|
||||
else
|
||||
stats.hunger = evt.entityPlayer.getFoodStats().getFoodLevel();
|
||||
if (hunger < 6) stats.hunger = 6;
|
||||
else stats.hunger = evt.entityPlayer.getFoodStats().getFoodLevel();
|
||||
|
||||
if (evt.entityPlayer.capturedDrops != evt.drops)
|
||||
{
|
||||
if (evt.entityPlayer.capturedDrops != evt.drops) {
|
||||
evt.entityPlayer.capturedDrops.clear();
|
||||
}
|
||||
|
||||
@@ -274,8 +239,7 @@ public class TPlayerHandler
|
||||
stats.knapsack.dropItems();
|
||||
evt.entityPlayer.captureDrops = false;
|
||||
|
||||
if (evt.entityPlayer.capturedDrops != evt.drops)
|
||||
{
|
||||
if (evt.entityPlayer.capturedDrops != evt.drops) {
|
||||
evt.drops.addAll(evt.entityPlayer.capturedDrops);
|
||||
}
|
||||
|
||||
@@ -283,19 +247,16 @@ public class TPlayerHandler
|
||||
}
|
||||
|
||||
/* Modify Player */
|
||||
public void updateSize (String user, float offset)
|
||||
{
|
||||
public void updateSize(String user, float offset) {
|
||||
/*
|
||||
* EntityPlayer player = getEntityPlayer(user); setEntitySize(0.6F,
|
||||
* offset, player); player.yOffset = offset - 0.18f;
|
||||
*/
|
||||
}
|
||||
|
||||
public static void setEntitySize (float width, float height, Entity entity)
|
||||
{
|
||||
public static void setEntitySize(float width, float height, Entity entity) {
|
||||
// TConstruct.logger.info("Size: " + height);
|
||||
if (width != entity.width || height != entity.height)
|
||||
{
|
||||
if (width != entity.width || height != entity.height) {
|
||||
entity.width = width;
|
||||
entity.height = height;
|
||||
entity.boundingBox.maxX = entity.boundingBox.minX + (double) entity.width;
|
||||
@@ -305,28 +266,17 @@ public class TPlayerHandler
|
||||
|
||||
float que = width % 2.0F;
|
||||
|
||||
if ((double) que < 0.375D)
|
||||
{
|
||||
if ((double) que < 0.375D) {
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_1;
|
||||
}
|
||||
else if ((double) que < 0.75D)
|
||||
{
|
||||
} else if ((double) que < 0.75D) {
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_2;
|
||||
}
|
||||
else if ((double) que < 1.0D)
|
||||
{
|
||||
} else if ((double) que < 1.0D) {
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_3;
|
||||
}
|
||||
else if ((double) que < 1.375D)
|
||||
{
|
||||
} else if ((double) que < 1.375D) {
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_4;
|
||||
}
|
||||
else if ((double) que < 1.75D)
|
||||
{
|
||||
} else if ((double) que < 1.75D) {
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_5;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
entity.myEntitySize = EnumEntitySize.SIZE_6;
|
||||
}
|
||||
// entity.yOffset = height;
|
||||
@@ -336,11 +286,9 @@ public class TPlayerHandler
|
||||
private final int timeout = 1000;
|
||||
private HashSet<String> stickUsers = new HashSet<String>();
|
||||
|
||||
public void buildStickURLDatabase (String location)
|
||||
{
|
||||
public void buildStickURLDatabase(String location) {
|
||||
URL url;
|
||||
try
|
||||
{
|
||||
try {
|
||||
url = new URL(location);
|
||||
URLConnection con = url.openConnection();
|
||||
con.setConnectTimeout(timeout);
|
||||
@@ -350,19 +298,15 @@ public class TPlayerHandler
|
||||
|
||||
String nick;
|
||||
int linetracker = 1;
|
||||
while ((nick = br.readLine()) != null)
|
||||
{
|
||||
if (!nick.startsWith("--"))
|
||||
{
|
||||
while ((nick = br.readLine()) != null) {
|
||||
if (!nick.startsWith("--")) {
|
||||
stickUsers.add(nick);
|
||||
}
|
||||
linetracker++;
|
||||
}
|
||||
|
||||
br.close();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
TConstruct.logger.error(e.getMessage() != null ? e.getMessage() : "UNKOWN DL ERROR", e);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package tconstruct.armor.player;
|
||||
|
||||
import java.lang.ref.WeakReference;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
@@ -10,7 +9,9 @@ import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.IExtendedEntityProperties;
|
||||
import tconstruct.api.IPlayerExtendedInventoryWrapper;
|
||||
|
||||
public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedInventoryWrapper //TODO: IExtendedEntityProperties is not appropriate!
|
||||
public class TPlayerStats
|
||||
implements IExtendedEntityProperties,
|
||||
IPlayerExtendedInventoryWrapper // TODO: IExtendedEntityProperties is not appropriate!
|
||||
{
|
||||
public static final String PROP_NAME = "TConstruct";
|
||||
|
||||
@@ -37,14 +38,12 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
|
||||
public ArmorExtended armor;
|
||||
public KnapsackInventory knapsack;
|
||||
|
||||
public TPlayerStats()
|
||||
{
|
||||
public TPlayerStats() {
|
||||
this.armor = new ArmorExtended();
|
||||
this.knapsack = new KnapsackInventory();
|
||||
}
|
||||
|
||||
public TPlayerStats(EntityPlayer entityplayer)
|
||||
{
|
||||
public TPlayerStats(EntityPlayer entityplayer) {
|
||||
this.player = new WeakReference<EntityPlayer>(entityplayer);
|
||||
this.armor = new ArmorExtended();
|
||||
this.armor.init(entityplayer);
|
||||
@@ -56,8 +55,7 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
|
||||
}
|
||||
|
||||
@Override
|
||||
public void saveNBTData (NBTTagCompound compound)
|
||||
{
|
||||
public void saveNBTData(NBTTagCompound compound) {
|
||||
NBTTagCompound tTag = new NBTTagCompound();
|
||||
armor.saveToNBT(tTag);
|
||||
knapsack.saveToNBT(tTag);
|
||||
@@ -71,11 +69,9 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadNBTData (NBTTagCompound compound)
|
||||
{
|
||||
public void loadNBTData(NBTTagCompound compound) {
|
||||
NBTTagCompound properties = (NBTTagCompound) compound.getTag(PROP_NAME);
|
||||
if (properties != null)
|
||||
{
|
||||
if (properties != null) {
|
||||
this.armor.readFromNBT(properties);
|
||||
this.knapsack.readFromNBT(properties);
|
||||
this.beginnerManual = properties.getBoolean("beginnerManual");
|
||||
@@ -88,15 +84,13 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init (Entity entity, World world)
|
||||
{
|
||||
public void init(Entity entity, World world) {
|
||||
this.player = new WeakReference<EntityPlayer>((EntityPlayer) entity);
|
||||
this.armor.init((EntityPlayer) entity);
|
||||
this.knapsack.init((EntityPlayer) entity);
|
||||
}
|
||||
|
||||
public void copyFrom (TPlayerStats stats, boolean copyCalc)
|
||||
{
|
||||
public void copyFrom(TPlayerStats stats, boolean copyCalc) {
|
||||
this.armor = stats.armor;
|
||||
this.knapsack = stats.knapsack;
|
||||
this.beginnerManual = stats.beginnerManual;
|
||||
@@ -107,34 +101,28 @@ public class TPlayerStats implements IExtendedEntityProperties, IPlayerExtendedI
|
||||
|
||||
this.derpLevel = stats.derpLevel;
|
||||
|
||||
if (copyCalc)
|
||||
{
|
||||
if (copyCalc) {
|
||||
this.bonusHealth = stats.bonusHealth;
|
||||
this.hunger = stats.hunger;
|
||||
this.level = stats.level;
|
||||
}
|
||||
}
|
||||
|
||||
public static final void register (EntityPlayer player)
|
||||
{
|
||||
public static final void register(EntityPlayer player) {
|
||||
player.registerExtendedProperties(TPlayerStats.PROP_NAME, new TPlayerStats(player));
|
||||
}
|
||||
|
||||
public static final TPlayerStats get (EntityPlayer player)
|
||||
{
|
||||
public static final TPlayerStats get(EntityPlayer player) {
|
||||
return (TPlayerStats) player.getExtendedProperties(PROP_NAME);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getKnapsackInventory (EntityPlayer player)
|
||||
{
|
||||
public IInventory getKnapsackInventory(EntityPlayer player) {
|
||||
return this.knapsack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IInventory getAccessoryInventory (EntityPlayer player)
|
||||
{
|
||||
public IInventory getAccessoryInventory(EntityPlayer player) {
|
||||
return this.armor;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,52 +8,49 @@ import net.minecraft.entity.item.EntityFallingBlock;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockFalling extends Block
|
||||
{
|
||||
public class BlockFalling extends Block {
|
||||
public static boolean fallInstantly;
|
||||
|
||||
public BlockFalling()
|
||||
{
|
||||
public BlockFalling() {
|
||||
super(Material.craftedSnow);
|
||||
this.setCreativeTab(CreativeTabs.tabBlock);
|
||||
}
|
||||
|
||||
public BlockFalling(Material p_i45405_1_)
|
||||
{
|
||||
public BlockFalling(Material p_i45405_1_) {
|
||||
super(p_i45405_1_);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded (World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_)
|
||||
{
|
||||
public void onBlockAdded(World p_149726_1_, int p_149726_2_, int p_149726_3_, int p_149726_4_) {
|
||||
p_149726_1_.scheduleBlockUpdate(p_149726_2_, p_149726_3_, p_149726_4_, this, this.tickRate(p_149726_1_));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNeighborBlockChange (World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_)
|
||||
{
|
||||
public void onNeighborBlockChange(
|
||||
World p_149695_1_, int p_149695_2_, int p_149695_3_, int p_149695_4_, Block p_149695_5_) {
|
||||
p_149695_1_.scheduleBlockUpdate(p_149695_2_, p_149695_3_, p_149695_4_, this, this.tickRate(p_149695_1_));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick (World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_)
|
||||
{
|
||||
if (!p_149674_1_.isRemote)
|
||||
{
|
||||
public void updateTick(World p_149674_1_, int p_149674_2_, int p_149674_3_, int p_149674_4_, Random p_149674_5_) {
|
||||
if (!p_149674_1_.isRemote) {
|
||||
this.func_149830_m(p_149674_1_, p_149674_2_, p_149674_3_, p_149674_4_);
|
||||
}
|
||||
}
|
||||
|
||||
private void func_149830_m (World p_149830_1_, int p_149830_2_, int p_149830_3_, int p_149830_4_)
|
||||
{
|
||||
if (func_149831_e(p_149830_1_, p_149830_2_, p_149830_3_ - 1, p_149830_4_) && p_149830_3_ >= 0)
|
||||
{
|
||||
private void func_149830_m(World p_149830_1_, int p_149830_2_, int p_149830_3_, int p_149830_4_) {
|
||||
if (func_149831_e(p_149830_1_, p_149830_2_, p_149830_3_ - 1, p_149830_4_) && p_149830_3_ >= 0) {
|
||||
byte b0 = 32;
|
||||
|
||||
if (!fallInstantly && p_149830_1_.checkChunksExist(p_149830_2_ - b0, p_149830_3_ - b0, p_149830_4_ - b0, p_149830_2_ + b0, p_149830_3_ + b0, p_149830_4_ + b0))
|
||||
{
|
||||
if (!p_149830_1_.isRemote)
|
||||
{
|
||||
if (!fallInstantly
|
||||
&& p_149830_1_.checkChunksExist(
|
||||
p_149830_2_ - b0,
|
||||
p_149830_3_ - b0,
|
||||
p_149830_4_ - b0,
|
||||
p_149830_2_ + b0,
|
||||
p_149830_3_ + b0,
|
||||
p_149830_4_ + b0)) {
|
||||
if (!p_149830_1_.isRemote) {
|
||||
// EntityFallingBlock entityfallingblock = new
|
||||
// EntityFallingBlock(p_149830_1_,
|
||||
// (double)((float)p_149830_2_ + 0.5F),
|
||||
@@ -64,48 +61,35 @@ public class BlockFalling extends Block
|
||||
// this.func_149829_a(entityfallingblock);
|
||||
// p_149830_1_.spawnEntityInWorld(entityfallingblock);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
p_149830_1_.setBlockToAir(p_149830_2_, p_149830_3_, p_149830_4_);
|
||||
|
||||
while (func_149831_e(p_149830_1_, p_149830_2_, p_149830_3_ - 1, p_149830_4_) && p_149830_3_ > 0)
|
||||
{
|
||||
while (func_149831_e(p_149830_1_, p_149830_2_, p_149830_3_ - 1, p_149830_4_) && p_149830_3_ > 0) {
|
||||
--p_149830_3_;
|
||||
}
|
||||
|
||||
if (p_149830_3_ > 0)
|
||||
{
|
||||
if (p_149830_3_ > 0) {
|
||||
p_149830_1_.setBlock(p_149830_2_, p_149830_3_, p_149830_4_, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected void func_149829_a (EntityFallingBlock p_149829_1_)
|
||||
{
|
||||
}
|
||||
protected void func_149829_a(EntityFallingBlock p_149829_1_) {}
|
||||
|
||||
@Override
|
||||
public int tickRate (World p_149738_1_)
|
||||
{
|
||||
public int tickRate(World p_149738_1_) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public static boolean func_149831_e (World p_149831_0_, int p_149831_1_, int p_149831_2_, int p_149831_3_)
|
||||
{
|
||||
public static boolean func_149831_e(World p_149831_0_, int p_149831_1_, int p_149831_2_, int p_149831_3_) {
|
||||
Block block = p_149831_0_.getBlock(p_149831_1_, p_149831_2_, p_149831_3_);
|
||||
|
||||
if (block.isAir(p_149831_0_, p_149831_1_, p_149831_2_, p_149831_3_))
|
||||
{
|
||||
if (block.isAir(p_149831_0_, p_149831_1_, p_149831_2_, p_149831_3_)) {
|
||||
return true;
|
||||
}
|
||||
else if (block == Blocks.fire)
|
||||
{
|
||||
} else if (block == Blocks.fire) {
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// TODO: King, take a look here when doing liquids!
|
||||
// Material material = block.blockMaterial;
|
||||
// return material == Material.water ? true : material ==
|
||||
@@ -114,7 +98,5 @@ public class BlockFalling extends Block
|
||||
}
|
||||
}
|
||||
|
||||
public void func_149828_a (World p_149828_1_, int p_149828_2_, int p_149828_3_, int p_149828_4_, int p_149828_5_)
|
||||
{
|
||||
}
|
||||
}
|
||||
public void func_149828_a(World p_149828_1_, int p_149828_2_, int p_149828_3_, int p_149828_4_, int p_149828_5_) {}
|
||||
}
|
||||
@@ -13,20 +13,17 @@ import net.minecraft.util.*;
|
||||
import net.minecraft.world.*;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class SlabBase extends MantleBlock
|
||||
{
|
||||
public class SlabBase extends MantleBlock {
|
||||
Block modelBlock;
|
||||
int startingMeta;
|
||||
int totalSize;
|
||||
|
||||
public SlabBase(Material material)
|
||||
{
|
||||
public SlabBase(Material material) {
|
||||
super(material);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
}
|
||||
|
||||
public SlabBase(Material material, Block model, int meta, int totalSize)
|
||||
{
|
||||
public SlabBase(Material material, Block model, int meta, int totalSize) {
|
||||
super(material);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
this.modelBlock = model;
|
||||
@@ -35,70 +32,66 @@ public class SlabBase extends MantleBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addCollisionBoxesToList (World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List arraylist, Entity entity)
|
||||
{
|
||||
public void addCollisionBoxesToList(
|
||||
World world, int x, int y, int z, AxisAlignedBB axisalignedbb, List arraylist, Entity entity) {
|
||||
setBlockBoundsBasedOnState(world, x, y, z);
|
||||
super.addCollisionBoxesToList(world, x, y, z, axisalignedbb, arraylist, entity);
|
||||
}
|
||||
|
||||
public void setBlockBoundsForItemRender ()
|
||||
{
|
||||
public void setBlockBoundsForItemRender() {
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 0.5F, 1.0F);
|
||||
}
|
||||
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
|
||||
int meta = world.getBlockMetadata(x, y, z) / 8;
|
||||
float minY = meta == 1 ? 0.5F : 0.0F;
|
||||
float maxY = meta == 1 ? 1.0F : 0.5F;
|
||||
setBlockBounds(0.0F, minY, 0F, 1.0F, maxY, 1.0F);
|
||||
}
|
||||
|
||||
public int onBlockPlaced (World par1World, int blockX, int blockY, int blockZ, int side, float clickX, float clickY, float clickZ, int metadata)
|
||||
{
|
||||
if (side == 1)
|
||||
return metadata;
|
||||
if (side == 0 || clickY >= 0.5F)
|
||||
return metadata | 8;
|
||||
public int onBlockPlaced(
|
||||
World par1World,
|
||||
int blockX,
|
||||
int blockY,
|
||||
int blockZ,
|
||||
int side,
|
||||
float clickX,
|
||||
float clickY,
|
||||
float clickZ,
|
||||
int metadata) {
|
||||
if (side == 1) return metadata;
|
||||
if (side == 0 || clickY >= 0.5F) return metadata | 8;
|
||||
|
||||
return metadata;
|
||||
}
|
||||
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
}
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
meta = meta % 8 + startingMeta;
|
||||
return modelBlock.getIcon(side, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < totalSize; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < totalSize; iter++) {
|
||||
list.add(new ItemStack(id, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
public int damageDropped (int meta)
|
||||
{
|
||||
public int damageDropped(int meta) {
|
||||
return meta % 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -10,13 +10,11 @@ import net.minecraft.item.*;
|
||||
import net.minecraft.util.IIcon;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class TConstructBlock extends MantleBlock
|
||||
{
|
||||
public class TConstructBlock extends MantleBlock {
|
||||
public String[] textureNames;
|
||||
public IIcon[] icons;
|
||||
|
||||
public TConstructBlock(Material material, float hardness, String[] tex)
|
||||
{
|
||||
public TConstructBlock(Material material, float hardness, String[] tex) {
|
||||
super(material);
|
||||
setHardness(hardness);
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
@@ -24,47 +22,38 @@ public class TConstructBlock extends MantleBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped (int meta)
|
||||
{
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return meta < icons.length ? icons[meta] : icons[0];
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getSideTextureIndex (int side)
|
||||
{
|
||||
if (side == 0)
|
||||
return 2;
|
||||
if (side == 1)
|
||||
return 0;
|
||||
public int getSideTextureIndex(int side) {
|
||||
if (side == 0) return 2;
|
||||
if (side == 1) return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
// TODO getSubBlocks
|
||||
@Override
|
||||
public void getSubBlocks (Item block, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < icons.length; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item block, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < icons.length; iter++) {
|
||||
list.add(new ItemStack(block, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,36 +12,29 @@ import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.world.World;
|
||||
import tconstruct.library.crafting.DryingRackRecipes;
|
||||
|
||||
public class DryingRackLogic extends InventoryLogic
|
||||
{
|
||||
public class DryingRackLogic extends InventoryLogic {
|
||||
int currentTime;
|
||||
int maxTime;
|
||||
|
||||
public DryingRackLogic()
|
||||
{
|
||||
public DryingRackLogic() {
|
||||
super(1, 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Container getGuiContainer (InventoryPlayer inventoryplayer, World world, int x, int y, int z)
|
||||
{
|
||||
public Container getGuiContainer(InventoryPlayer inventoryplayer, World world, int x, int y, int z) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultName ()
|
||||
{
|
||||
public String getDefaultName() {
|
||||
return "";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity ()
|
||||
{
|
||||
if (!worldObj.isRemote && maxTime > 0 && currentTime < maxTime)
|
||||
{
|
||||
public void updateEntity() {
|
||||
if (!worldObj.isRemote && maxTime > 0 && currentTime < maxTime) {
|
||||
currentTime++;
|
||||
if (currentTime >= maxTime)
|
||||
{
|
||||
if (currentTime >= maxTime) {
|
||||
inventory[0] = DryingRackRecipes.getDryingResult(inventory[0]);
|
||||
updateDryingTime();
|
||||
}
|
||||
@@ -49,103 +42,88 @@ public class DryingRackLogic extends InventoryLogic
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setInventorySlotContents (int slot, ItemStack itemstack)
|
||||
{
|
||||
public void setInventorySlotContents(int slot, ItemStack itemstack) {
|
||||
super.setInventorySlotContents(slot, itemstack);
|
||||
updateDryingTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack decrStackSize (int slot, int quantity)
|
||||
{
|
||||
public ItemStack decrStackSize(int slot, int quantity) {
|
||||
ItemStack stack = super.decrStackSize(slot, quantity);
|
||||
maxTime = 0;
|
||||
currentTime = 0;
|
||||
return stack;
|
||||
}
|
||||
|
||||
public void updateDryingTime ()
|
||||
{
|
||||
public void updateDryingTime() {
|
||||
currentTime = 0;
|
||||
if (inventory[0] != null)
|
||||
maxTime = DryingRackRecipes.getDryingTime(inventory[0]);
|
||||
else
|
||||
maxTime = 0;
|
||||
if (inventory[0] != null) maxTime = DryingRackRecipes.getDryingTime(inventory[0]);
|
||||
else maxTime = 0;
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void readFromNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readFromNBT(NBTTagCompound tags) {
|
||||
currentTime = tags.getInteger("Time");
|
||||
maxTime = tags.getInteger("MaxTime");
|
||||
readCustomNBT(tags);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeToNBT(NBTTagCompound tags) {
|
||||
tags.setInteger("Time", currentTime);
|
||||
tags.setInteger("MaxTime", maxTime);
|
||||
writeCustomNBT(tags);
|
||||
}
|
||||
|
||||
public void readCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void readCustomNBT(NBTTagCompound tags) {
|
||||
super.readFromNBT(tags);
|
||||
}
|
||||
|
||||
public void writeCustomNBT (NBTTagCompound tags)
|
||||
{
|
||||
public void writeCustomNBT(NBTTagCompound tags) {
|
||||
super.writeToNBT(tags);
|
||||
}
|
||||
|
||||
/* Packets */
|
||||
@Override
|
||||
public Packet getDescriptionPacket ()
|
||||
{
|
||||
public Packet getDescriptionPacket() {
|
||||
NBTTagCompound tag = new NBTTagCompound();
|
||||
writeCustomNBT(tag);
|
||||
return new S35PacketUpdateTileEntity(xCoord, yCoord, zCoord, 1, tag);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDataPacket (NetworkManager net, S35PacketUpdateTileEntity packet)
|
||||
{
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity packet) {
|
||||
readCustomNBT(packet.func_148857_g());
|
||||
worldObj.func_147479_m(xCoord, yCoord, zCoord);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public AxisAlignedBB getRenderBoundingBox ()
|
||||
{
|
||||
AxisAlignedBB cbb = AxisAlignedBB.getBoundingBox(xCoord, yCoord - 1, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
|
||||
public AxisAlignedBB getRenderBoundingBox() {
|
||||
AxisAlignedBB cbb =
|
||||
AxisAlignedBB.getBoundingBox(xCoord, yCoord - 1, zCoord, xCoord + 1, yCoord + 1, zCoord + 1);
|
||||
return cbb;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getInventoryName ()
|
||||
{
|
||||
public String getInventoryName() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hasCustomInventoryName ()
|
||||
{
|
||||
public boolean hasCustomInventoryName() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void closeInventory ()
|
||||
{
|
||||
public void closeInventory() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void openInventory ()
|
||||
{
|
||||
public void openInventory() {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@@ -13,20 +13,17 @@ import tconstruct.world.entity.BlueSlime;
|
||||
import tconstruct.world.entity.KingBlueSlime;
|
||||
import tconstruct.world.entity.SlimeBase;
|
||||
|
||||
public class SlimeFluid extends BlockFluidClassic
|
||||
{
|
||||
public class SlimeFluid extends BlockFluidClassic {
|
||||
IIcon stillIcon;
|
||||
IIcon flowIcon;
|
||||
|
||||
public SlimeFluid(Fluid fluid, Material material)
|
||||
{
|
||||
public SlimeFluid(Fluid fluid, Material material) {
|
||||
super(fluid, material);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
stillIcon = iconRegister.registerIcon("tinker:slime_blue");
|
||||
flowIcon = iconRegister.registerIcon("tinker:slime_blue_flow");
|
||||
TinkerWorld.blueSlimeFluid.setStillIcon(stillIcon);
|
||||
@@ -35,31 +32,25 @@ public class SlimeFluid extends BlockFluidClassic
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
if (side == 0 || side == 1)
|
||||
return stillIcon;
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (side == 0 || side == 1) return stillIcon;
|
||||
return flowIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick (World world, int x, int y, int z, Random rand)
|
||||
{
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
super.updateTick(world, x, y, z, rand);
|
||||
if (rand.nextInt(100) == 0 && world.getBlockMetadata(x, y, z) == 0 && world.checkNoEntityCollision(AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 2, y + 2, z + 2)))
|
||||
{
|
||||
if (rand.nextInt(100) == 0
|
||||
&& world.getBlockMetadata(x, y, z) == 0
|
||||
&& world.checkNoEntityCollision(
|
||||
AxisAlignedBB.getBoundingBox(x - 1, y - 1, z - 1, x + 2, y + 2, z + 2))) {
|
||||
SlimeBase slime;
|
||||
if(rand.nextInt(300) == 0)
|
||||
slime = new KingBlueSlime(world);
|
||||
else
|
||||
slime = new BlueSlime(world);
|
||||
if (rand.nextInt(300) == 0) slime = new KingBlueSlime(world);
|
||||
else slime = new BlueSlime(world);
|
||||
slime.setPosition((double) x + 0.5D, (double) y + 1.5D, (double) z + 0.5D);
|
||||
world.spawnEntityInWorld(slime);
|
||||
}
|
||||
}
|
||||
|
||||
public void getSubBlocks (int par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
|
||||
}
|
||||
public void getSubBlocks(int par1, CreativeTabs par2CreativeTabs, List par3List) {}
|
||||
}
|
||||
@@ -13,45 +13,42 @@ import net.minecraft.world.World;
|
||||
import tconstruct.blocks.TConstructBlock;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class SlimeGel extends TConstructBlock
|
||||
{
|
||||
public SlimeGel()
|
||||
{
|
||||
super(Material.sponge, 0.5f, new String[] { "slimeblock_blue", "slimeblock_green", "slimeblock_purple" });
|
||||
public class SlimeGel extends TConstructBlock {
|
||||
public SlimeGel() {
|
||||
super(Material.sponge, 0.5f, new String[] {"slimeblock_blue", "slimeblock_green", "slimeblock_purple"});
|
||||
setCreativeTab(TConstructRegistry.blockTab);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getEnableStats ()
|
||||
{
|
||||
public boolean getEnableStats() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMobilityFlag ()
|
||||
{
|
||||
public int getMobilityFlag() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped (int meta)
|
||||
{
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
if (entity.motionY < 0)
|
||||
{
|
||||
if (entity.motionY < -0.08F)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
if (entity.motionY < 0) {
|
||||
if (entity.motionY < -0.08F) {
|
||||
Block var9 = (Block) this;
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, var9.stepSound.soundName, (var9.stepSound.getVolume()) / 2.0F, var9.stepSound.getPitch() * 0.65F);
|
||||
world.playSoundEffect(
|
||||
x + 0.5F,
|
||||
y + 0.5F,
|
||||
z + 0.5F,
|
||||
var9.stepSound.soundName,
|
||||
(var9.stepSound.getVolume()) / 2.0F,
|
||||
var9.stepSound.getPitch() * 0.65F);
|
||||
}
|
||||
entity.motionY *= -1.2F;
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.jump.id, 1, 2));
|
||||
}
|
||||
}
|
||||
@@ -59,8 +56,7 @@ public class SlimeGel extends TConstructBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World world, int x, int y, int z)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World world, int x, int y, int z) {
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, (double) x + 1.0D, (double) y + 0.625D, (double) z + 1.0D);
|
||||
}
|
||||
|
||||
@@ -68,15 +64,13 @@ public class SlimeGel extends TConstructBlock
|
||||
/**
|
||||
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
|
||||
*/
|
||||
public void getSubBlocks (Block b, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
public void getSubBlocks(Block b, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
par3List.add(new ItemStack(b, 1, 0));
|
||||
par3List.add(new ItemStack(b, 1, 1));
|
||||
// par3List.add(new ItemStack(par1, 1, 2));
|
||||
}
|
||||
|
||||
public boolean canSustainLeaves (World world, int x, int y, int z)
|
||||
{
|
||||
public boolean canSustainLeaves(World world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -16,14 +16,14 @@ import net.minecraftforge.common.util.ForgeDirection;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
|
||||
public class SlimeGrass extends MantleBlock
|
||||
{
|
||||
public String[] textureNames = { "slimegrass_green_top", "slimedirt_blue", "slimegrass_green_blue_side", "slimegrass_green_dirt_side" };// green,
|
||||
// purple
|
||||
public class SlimeGrass extends MantleBlock {
|
||||
public String[] textureNames = {
|
||||
"slimegrass_green_top", "slimedirt_blue", "slimegrass_green_blue_side", "slimegrass_green_dirt_side"
|
||||
}; // green,
|
||||
// purple
|
||||
public IIcon[] icons;
|
||||
|
||||
public SlimeGrass()
|
||||
{
|
||||
public SlimeGrass() {
|
||||
super(Material.grass);
|
||||
setHardness(0.6f);
|
||||
this.setTickRandomly(true);
|
||||
@@ -31,11 +31,9 @@ public class SlimeGrass extends MantleBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public int damageDropped (int meta)
|
||||
{
|
||||
public int damageDropped(int meta) {
|
||||
if (meta == 1) // dirt
|
||||
return 0;
|
||||
|
||||
return 0;
|
||||
else
|
||||
// slime dirt
|
||||
return 5;
|
||||
@@ -43,90 +41,71 @@ public class SlimeGrass extends MantleBlock
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
if (meta >= 2)
|
||||
meta = 0;
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
if (meta >= 2) meta = 0;
|
||||
|
||||
if (side == 0)
|
||||
{
|
||||
if (side == 0) {
|
||||
return meta % 2 == 1 ? Blocks.dirt.getIcon(0, 0) : icons[1];
|
||||
}
|
||||
else if (side == 1)
|
||||
{
|
||||
} else if (side == 1) {
|
||||
return icons[0];
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
return icons[meta + 2];
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item b, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < 1; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item b, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < 1; iter++) {
|
||||
list.add(new ItemStack(b, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canSustainPlant (IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plant)
|
||||
{
|
||||
public boolean canSustainPlant(
|
||||
IBlockAccess world, int x, int y, int z, ForgeDirection direction, IPlantable plant) {
|
||||
EnumPlantType plantType = plant.getPlantType(world, x, y + 1, z);
|
||||
return plantType == EnumPlantType.Plains && plant.getPlant(world, x, y + 1, z) != Blocks.tallgrass;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlantGrow (World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ)
|
||||
{
|
||||
public void onPlantGrow(World world, int x, int y, int z, int sourceX, int sourceY, int sourceZ) {
|
||||
world.setBlock(x, y, z, TinkerTools.craftedSoil, 5, 3);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (world.getBlockLightValue(x, y + 1, z) < 4 && world.getBlockLightOpacity(x, y + 1, z) > 2)
|
||||
{
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
if (!world.isRemote) {
|
||||
if (world.getBlockLightValue(x, y + 1, z) < 4 && world.getBlockLightOpacity(x, y + 1, z) > 2) {
|
||||
world.setBlock(x, y, z, TinkerTools.craftedSoil, 5, 3);
|
||||
}
|
||||
else if (world.getBlockLightValue(x, y + 1, z) >= 9)
|
||||
{
|
||||
for (int l = 0; l < 4; ++l)
|
||||
{
|
||||
} else if (world.getBlockLightValue(x, y + 1, z) >= 9) {
|
||||
for (int l = 0; l < 4; ++l) {
|
||||
int posX = x + random.nextInt(3) - 1;
|
||||
int posY = y + random.nextInt(5) - 3;
|
||||
int posZ = z + random.nextInt(3) - 1;
|
||||
Block blockAbove = world.getBlock(posX, posY + 1, posZ);
|
||||
|
||||
if (world.getBlockLightValue(posX, posY + 1, posZ) >= 4 && world.getBlockLightOpacity(posX, posY + 1, posZ) <= 2 && blockAbove != TinkerTools.craftedSoil && blockAbove != this)
|
||||
{
|
||||
if (world.getBlockLightValue(posX, posY + 1, posZ) >= 4
|
||||
&& world.getBlockLightOpacity(posX, posY + 1, posZ) <= 2
|
||||
&& blockAbove != TinkerTools.craftedSoil
|
||||
&& blockAbove != this) {
|
||||
Block block = world.getBlock(posX, posY, posZ);
|
||||
if (block == Blocks.dirt)
|
||||
{
|
||||
if (block == Blocks.dirt) {
|
||||
world.setBlock(posX, posY, posZ, (Block) this, 1, 3);
|
||||
return;
|
||||
}
|
||||
int blockMeta = world.getBlockMetadata(posX, posY, posZ);
|
||||
if (block == TinkerTools.craftedSoil)
|
||||
{
|
||||
if (blockMeta == 5)
|
||||
world.setBlock(posX, posY, posZ, (Block) this, 0, 3);
|
||||
if (block == TinkerTools.craftedSoil) {
|
||||
if (blockMeta == 5) world.setBlock(posX, posY, posZ, (Block) this, 0, 3);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -134,19 +113,14 @@ public class SlimeGrass extends MantleBlock
|
||||
}
|
||||
}
|
||||
|
||||
public Block blockDropped (int metadata, Random random, int fortune)
|
||||
{
|
||||
if (metadata == 1)
|
||||
return Blocks.dirt;
|
||||
else
|
||||
return TinkerTools.craftedSoil;
|
||||
public Block blockDropped(int metadata, Random random, int fortune) {
|
||||
if (metadata == 1) return Blocks.dirt;
|
||||
else return TinkerTools.craftedSoil;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int metadata, Random random, int p_149650_3_) {
|
||||
if (metadata == 1)
|
||||
return Blocks.dirt.getItemDropped(metadata, random, p_149650_3_);
|
||||
else
|
||||
return ItemSaddle.getItemFromBlock(TinkerTools.craftedSoil);
|
||||
if (metadata == 1) return Blocks.dirt.getItemDropped(metadata, random, p_149650_3_);
|
||||
else return ItemSaddle.getItemFromBlock(TinkerTools.craftedSoil);
|
||||
}
|
||||
}
|
||||
@@ -12,17 +12,17 @@ import net.minecraft.world.*;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
|
||||
public class SlimeLeaves extends BlockLeaves
|
||||
{
|
||||
private static final String[] fastLeaves = new String[] { "slimeleaves_blue_fast" };
|
||||
private static final String[] fancyLeaves = new String[] { "slimeleaves_blue_fancy" };
|
||||
public class SlimeLeaves extends BlockLeaves {
|
||||
private static final String[] fastLeaves = new String[] {"slimeleaves_blue_fast"};
|
||||
private static final String[] fancyLeaves = new String[] {"slimeleaves_blue_fancy"};
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] fastIcons;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] fancyIcons;
|
||||
|
||||
public SlimeLeaves()
|
||||
{
|
||||
public SlimeLeaves() {
|
||||
super();
|
||||
setCreativeTab(TConstructRegistry.blockTab);
|
||||
setLightOpacity(1);
|
||||
@@ -31,34 +31,29 @@ public class SlimeLeaves extends BlockLeaves
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getBlockColor ()
|
||||
{
|
||||
public int getBlockColor() {
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int getRenderColor (int par1)
|
||||
{
|
||||
public int getRenderColor(int par1) {
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public int colorMultiplier (IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
||||
{
|
||||
public int colorMultiplier(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
|
||||
return 0xffffff;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.fastIcons = new IIcon[fastLeaves.length];
|
||||
this.fancyIcons = new IIcon[fancyLeaves.length];
|
||||
|
||||
for (int i = 0; i < this.fastIcons.length; i++)
|
||||
{
|
||||
for (int i = 0; i < this.fastIcons.length; i++) {
|
||||
this.fastIcons[i] = iconRegister.registerIcon("tinker:" + fastLeaves[i]);
|
||||
this.fancyIcons[i] = iconRegister.registerIcon("tinker:" + fancyLeaves[i]);
|
||||
}
|
||||
@@ -66,28 +61,22 @@ public class SlimeLeaves extends BlockLeaves
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
int tex = meta % 1;
|
||||
this.setGraphicsLevel(Minecraft.getMinecraft().gameSettings.fancyGraphics);
|
||||
if (this.field_150121_P)
|
||||
return fancyIcons[tex];
|
||||
else
|
||||
return fastIcons[tex];
|
||||
if (this.field_150121_P) return fancyIcons[tex];
|
||||
else return fastIcons[tex];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubBlocks (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
for (int iter = 0; iter < fastIcons.length; iter++)
|
||||
{
|
||||
public void getSubBlocks(Item id, CreativeTabs tab, List list) {
|
||||
for (int iter = 0; iter < fastIcons.length; iter++) {
|
||||
list.add(new ItemStack(id, 1, iter));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isLeaves (IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public boolean isLeaves(IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -97,8 +86,7 @@ public class SlimeLeaves extends BlockLeaves
|
||||
* Returns the ID of the items to drop on destruction.
|
||||
*/
|
||||
@Override
|
||||
public Item getItemDropped (int p_149650_1_, Random p_149650_2_, int p_149650_3_)
|
||||
{
|
||||
public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) {
|
||||
return Item.getItemFromBlock(TinkerWorld.slimeSapling);
|
||||
}
|
||||
|
||||
@@ -106,10 +94,8 @@ public class SlimeLeaves extends BlockLeaves
|
||||
* Drops the block items with a specified chance of dropping the specified items
|
||||
*/
|
||||
@Override
|
||||
public void dropBlockAsItemWithChance (World world, int x, int y, int z, int meta, float chance, int fortune)
|
||||
{
|
||||
if (!world.isRemote)
|
||||
{
|
||||
public void dropBlockAsItemWithChance(World world, int x, int y, int z, int meta, float chance, int fortune) {
|
||||
if (!world.isRemote) {
|
||||
int dropChance = 35;
|
||||
|
||||
/*if ((meta & 3) == 3)
|
||||
@@ -117,44 +103,37 @@ public class SlimeLeaves extends BlockLeaves
|
||||
j1 = 40;
|
||||
}*/
|
||||
|
||||
if (fortune > 0)
|
||||
{
|
||||
if (fortune > 0) {
|
||||
dropChance -= 2 << fortune;
|
||||
|
||||
if (dropChance < 15)
|
||||
{
|
||||
if (dropChance < 15) {
|
||||
dropChance = 15;
|
||||
}
|
||||
}
|
||||
|
||||
if (world.rand.nextInt(dropChance) == 0)
|
||||
{
|
||||
if (world.rand.nextInt(dropChance) == 0) {
|
||||
Item k1 = this.getItemDropped(meta, world.rand, fortune);
|
||||
this.dropBlockAsItem(world, x, y, z, new ItemStack(k1, 1, this.damageDropped(meta)));
|
||||
}
|
||||
|
||||
dropChance = 80;
|
||||
|
||||
if (fortune > 0)
|
||||
{
|
||||
if (fortune > 0) {
|
||||
dropChance -= 10 << fortune;
|
||||
|
||||
if (dropChance < 20)
|
||||
{
|
||||
if (dropChance < 20) {
|
||||
dropChance = 20;
|
||||
}
|
||||
}
|
||||
|
||||
if ((meta & 3) == 0 && world.rand.nextInt(dropChance) == 0)
|
||||
{
|
||||
if ((meta & 3) == 0 && world.rand.nextInt(dropChance) == 0) {
|
||||
this.dropBlockAsItem(world, x, y, z, new ItemStack(TinkerWorld.strangeFood, 1, 0));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] func_150125_e ()
|
||||
{
|
||||
return new String[] { "slime" };
|
||||
public String[] func_150125_e() {
|
||||
return new String[] {"slime"};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -16,13 +16,11 @@ import tconstruct.tools.TinkerTools;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
import tconstruct.world.gen.SlimeTreeGen;
|
||||
|
||||
public class SlimeSapling extends BlockSapling
|
||||
{
|
||||
public class SlimeSapling extends BlockSapling {
|
||||
public IIcon[] icons;
|
||||
public String[] textureNames = new String[] { "blue" };
|
||||
public String[] textureNames = new String[] {"blue"};
|
||||
|
||||
public SlimeSapling()
|
||||
{
|
||||
public SlimeSapling() {
|
||||
super();
|
||||
float f = 0.4F;
|
||||
setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, f * 2.0F, 0.5F + f);
|
||||
@@ -33,95 +31,74 @@ public class SlimeSapling extends BlockSapling
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.icons = new IIcon[textureNames.length];
|
||||
|
||||
for (int i = 0; i < this.icons.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.icons.length; ++i) {
|
||||
this.icons[i] = iconRegister.registerIcon("tinker:slimesapling_" + textureNames[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canPlaceBlockOn (Block id)
|
||||
{
|
||||
public boolean canPlaceBlockOn(Block id) {
|
||||
return id == Blocks.grass || id == Blocks.dirt || id == TinkerWorld.slimeGrass || id == TinkerTools.craftedSoil;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
if (world.isRemote)
|
||||
{
|
||||
public void updateTick(World world, int x, int y, int z, Random random) {
|
||||
if (world.isRemote) {
|
||||
return;
|
||||
}
|
||||
super.updateTick(world, x, y, z, random);
|
||||
int md = world.getBlockMetadata(x, y, z);
|
||||
if (random.nextInt(10) == 0 && world.getBlockLightValue(x, y + 1, z) >= 9)
|
||||
{
|
||||
if ((md & 8) == 0)
|
||||
world.setBlockMetadataWithNotify(x, y, z, md | 8, 4);
|
||||
|
||||
else
|
||||
growTree(world, x, y, z, random);
|
||||
if (random.nextInt(10) == 0 && world.getBlockLightValue(x, y + 1, z) >= 9) {
|
||||
if ((md & 8) == 0) world.setBlockMetadataWithNotify(x, y, z, md | 8, 4);
|
||||
else growTree(world, x, y, z, random);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return icons[meta % icons.length];
|
||||
}
|
||||
|
||||
@Override
|
||||
public void func_149879_c (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
public void func_149879_c(World world, int x, int y, int z, Random random) {
|
||||
boneFertilize(world, x, y, z, random, null);
|
||||
}
|
||||
|
||||
public boolean boneFertilize (World world, int x, int y, int z, Random random, EntityPlayer player)
|
||||
{
|
||||
public boolean boneFertilize(World world, int x, int y, int z, Random random, EntityPlayer player) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
|
||||
if (meta % 8 == 0 && (player == null || !player.capabilities.isCreativeMode))
|
||||
return false;
|
||||
if (meta % 8 == 0 && (player == null || !player.capabilities.isCreativeMode)) return false;
|
||||
|
||||
if ((meta & 8) == 0)
|
||||
{
|
||||
if ((meta & 8) == 0) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta | 8, 4);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.growTree(world, x, y, z, random);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public void growTree (World world, int x, int y, int z, Random random)
|
||||
{
|
||||
public void growTree(World world, int x, int y, int z, Random random) {
|
||||
int md = world.getBlockMetadata(x, y, z) % 8;
|
||||
world.setBlock(x, y, z, Blocks.air);
|
||||
WorldGenerator obj = null;
|
||||
|
||||
obj = new SlimeTreeGen(true, 5, 4, 1, 0);
|
||||
|
||||
if (!(obj.generate(world, random, x, y, z)))
|
||||
world.setBlock(x, y, z, this, md + 8, 3);
|
||||
if (!(obj.generate(world, random, x, y, z))) world.setBlock(x, y, z, this, md + 8, 3);
|
||||
}
|
||||
|
||||
public int damageDropped (int i)
|
||||
{
|
||||
public int damageDropped(int i) {
|
||||
return i % 8;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public void getSubBlocks (Item par1, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (int i = 0; i < 1; i++)
|
||||
par3List.add(new ItemStack(par1, 1, i));
|
||||
public void getSubBlocks(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for (int i = 0; i < 1; i++) par3List.add(new ItemStack(par1, 1, i));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,14 +13,13 @@ import net.minecraft.world.*;
|
||||
import net.minecraftforge.common.*;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class SlimeTallGrass extends BlockBush implements IShearable
|
||||
{
|
||||
private static final String[] grassTypes = new String[] { "slimegrass_blue_tall" };
|
||||
public class SlimeTallGrass extends BlockBush implements IShearable {
|
||||
private static final String[] grassTypes = new String[] {"slimegrass_blue_tall"};
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private IIcon[] iconArray;
|
||||
|
||||
public SlimeTallGrass()
|
||||
{
|
||||
public SlimeTallGrass() {
|
||||
super(Material.vine);
|
||||
float f = 0.4F;
|
||||
this.setBlockBounds(0.5F - f, 0.0F, 0.5F - f, 0.5F + f, 0.8F, 0.5F + f);
|
||||
@@ -32,17 +31,15 @@ public class SlimeTallGrass extends BlockBush implements IShearable
|
||||
/**
|
||||
* From the specified side and block metadata retrieves the blocks texture. Args: side, metadata
|
||||
*/
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
meta = MathHelper.clamp_int(meta, 0, iconArray.length-1);
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
meta = MathHelper.clamp_int(meta, 0, iconArray.length - 1);
|
||||
return this.iconArray[meta];
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the ID of the items to drop on destruction.
|
||||
*/
|
||||
public int idDropped (int par1, Random par2Random, int par3)
|
||||
{
|
||||
public int idDropped(int par1, Random par2Random, int par3) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -51,8 +48,7 @@ public class SlimeTallGrass extends BlockBush implements IShearable
|
||||
* (inclusive).
|
||||
*/
|
||||
@Override
|
||||
public int quantityDroppedWithBonus (int par1, Random par2Random)
|
||||
{
|
||||
public int quantityDroppedWithBonus(int par1, Random par2Random) {
|
||||
return 1 + par2Random.nextInt(par1 * 2 + 1);
|
||||
}
|
||||
|
||||
@@ -60,8 +56,7 @@ public class SlimeTallGrass extends BlockBush implements IShearable
|
||||
* Get the block's damage value (for use with pick block).
|
||||
*/
|
||||
@Override
|
||||
public int getDamageValue (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
public int getDamageValue(World par1World, int par2, int par3, int par4) {
|
||||
return par1World.getBlockMetadata(par2, par3, par4);
|
||||
}
|
||||
|
||||
@@ -69,10 +64,8 @@ public class SlimeTallGrass extends BlockBush implements IShearable
|
||||
/**
|
||||
* returns a list of blocks with the same ID, but different meta (eg: wood returns 4 blocks)
|
||||
*/
|
||||
public void getSubBlocks (Block b, CreativeTabs par2CreativeTabs, List par3List)
|
||||
{
|
||||
for (int j = 0; j < 1; ++j)
|
||||
{
|
||||
public void getSubBlocks(Block b, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
for (int j = 0; j < 1; ++j) {
|
||||
par3List.add(new ItemStack(b, 1, j));
|
||||
}
|
||||
}
|
||||
@@ -83,42 +76,35 @@ public class SlimeTallGrass extends BlockBush implements IShearable
|
||||
* When this method is called, your block should register all the icons it needs with the given IconRegister. This
|
||||
* is the only chance you get to register icons.
|
||||
*/
|
||||
public void registerBlockIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {
|
||||
this.iconArray = new IIcon[grassTypes.length];
|
||||
|
||||
for (int i = 0; i < this.iconArray.length; ++i)
|
||||
{
|
||||
for (int i = 0; i < this.iconArray.length; ++i) {
|
||||
this.iconArray[i] = par1IconRegister.registerIcon("tinker:" + grassTypes[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> getDrops (World world, int x, int y, int z, int meta, int fortune)
|
||||
{
|
||||
public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int meta, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
if (world.rand.nextInt(8) != 0)
|
||||
{
|
||||
if (world.rand.nextInt(8) != 0) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
ItemStack item = ForgeHooks.getGrassSeed(world);
|
||||
if (item != null)
|
||||
{
|
||||
if (item != null) {
|
||||
ret.add(item);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isShearable (ItemStack item, IBlockAccess world, int x, int y, int z)
|
||||
{
|
||||
public boolean isShearable(ItemStack item, IBlockAccess world, int x, int y, int z) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArrayList<ItemStack> onSheared (ItemStack item, IBlockAccess world, int x, int y, int z, int fortune)
|
||||
{
|
||||
public ArrayList<ItemStack> onSheared(ItemStack item, IBlockAccess world, int x, int y, int z, int fortune) {
|
||||
ArrayList<ItemStack> ret = new ArrayList<ItemStack>();
|
||||
ret.add(new ItemStack(this, 1, world.getBlockMetadata(x, y, z)));
|
||||
return ret;
|
||||
|
||||
@@ -13,13 +13,11 @@ import net.minecraft.world.*;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.world.model.BarricadeRender;
|
||||
|
||||
public class BarricadeBlock extends MantleBlock
|
||||
{
|
||||
public class BarricadeBlock extends MantleBlock {
|
||||
Block modelBlock;
|
||||
int modelMeta;
|
||||
|
||||
public BarricadeBlock(Block model, int meta)
|
||||
{
|
||||
public BarricadeBlock(Block model, int meta) {
|
||||
super(Material.wood);
|
||||
this.modelBlock = model;
|
||||
this.modelMeta = meta;
|
||||
@@ -29,79 +27,69 @@ public class BarricadeBlock extends MantleBlock
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return modelBlock.getIcon(2, modelMeta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
|
||||
}
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {}
|
||||
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return BarricadeRender.model;
|
||||
}
|
||||
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World par1World, int x, int y, int z)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int x, int y, int z) {
|
||||
return AxisAlignedBB.getBoundingBox(x, y, z, x + 1, y + 1, z + 1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess par1IBlockAccess, int x, int y, int z)
|
||||
{
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int x, int y, int z) {
|
||||
setBlockBounds(0.0F, 0.0F, 0.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void harvestBlock (World world, EntityPlayer player, int x, int y, int z, int meta)
|
||||
{
|
||||
if (meta % 4 > 0)
|
||||
{
|
||||
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta) {
|
||||
if (meta % 4 > 0) {
|
||||
world.setBlock(x, y, z, this, meta - 1, 3);
|
||||
dropBlockAsItem(world, x, y, z, new ItemStack(this));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
dropBlockAsItem(world, x, y, z, new ItemStack(this));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9)
|
||||
{
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int par6, float par7, float par8, float par9) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if ((stack != null) && (stack.getItem() == Item.getItemFromBlock(this)) && (!player.isSneaking()))
|
||||
{
|
||||
if ((stack != null) && (stack.getItem() == Item.getItemFromBlock(this)) && (!player.isSneaking())) {
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta % 4 != 3)
|
||||
{
|
||||
if (meta % 4 != 3) {
|
||||
world.setBlock(x, y, z, this, meta + 1, 3);
|
||||
this.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
this.onPostBlockPlaced(world, x, y, z, meta);
|
||||
|
||||
Block var9 = this;
|
||||
world.playSoundEffect(x + 0.5F, y + 0.5F, z + 0.5F, var9.stepSound.soundName, (var9.stepSound.getVolume() + 1.0F) / 2.0F, var9.stepSound.getPitch() * 0.8F);
|
||||
world.playSoundEffect(
|
||||
x + 0.5F,
|
||||
y + 0.5F,
|
||||
z + 0.5F,
|
||||
var9.stepSound.soundName,
|
||||
(var9.stepSound.getVolume() + 1.0F) / 2.0F,
|
||||
var9.stepSound.getPitch() * 0.8F);
|
||||
player.swingItem();
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
stack.stackSize -= 1;
|
||||
if (!player.capabilities.isCreativeMode) stack.stackSize -= 1;
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -110,25 +98,21 @@ public class BarricadeBlock extends MantleBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockExploded (World world, int x, int y, int z, Explosion explosion)
|
||||
{
|
||||
public void onBlockExploded(World world, int x, int y, int z, Explosion explosion) {
|
||||
double distance = (x - explosion.explosionX) + (y - explosion.explosionY) + (z - explosion.explosionZ);
|
||||
distance = Math.abs(distance);
|
||||
double power = (explosion.explosionSize * 2) / distance;
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
int trueMeta = meta % 4;
|
||||
trueMeta -= power;
|
||||
if (trueMeta < 0)
|
||||
world.setBlock(x, y, z, Blocks.air, 0, 0);
|
||||
else
|
||||
world.setBlockMetadataWithNotify(x, y, z, (int) (meta - power), 3);
|
||||
if (trueMeta < 0) world.setBlock(x, y, z, Blocks.air, 0, 0);
|
||||
else world.setBlockMetadataWithNotify(x, y, z, (int) (meta - power), 3);
|
||||
onBlockDestroyedByExplosion(world, x, y, z, explosion);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -13,13 +13,11 @@ import net.minecraft.util.*;
|
||||
import net.minecraft.world.*;
|
||||
import tconstruct.library.TConstructRegistry;
|
||||
|
||||
public class Landmine extends MantleBlock
|
||||
{
|
||||
public class Landmine extends MantleBlock {
|
||||
/** The mob type that can trigger this pressure plate. */
|
||||
private EnumCreatureType triggerMobType;
|
||||
|
||||
public Landmine(EnumCreatureType par3EnumCreatureType, Material par4Material)
|
||||
{
|
||||
public Landmine(EnumCreatureType par3EnumCreatureType, Material par4Material) {
|
||||
super(par4Material);
|
||||
this.triggerMobType = EnumCreatureType.monster;
|
||||
this.setCreativeTab(TConstructRegistry.blockTab);
|
||||
@@ -30,11 +28,9 @@ public class Landmine extends MantleBlock
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
public IIcon getIcon(IBlockAccess world, int x, int y, int z, int side) {
|
||||
Block block = world.getBlock(x, y - 1, z);
|
||||
if (block != null)
|
||||
{
|
||||
if (block != null) {
|
||||
return block.getIcon(world, x, y - 1, z, side);
|
||||
}
|
||||
return Blocks.sponge.getIcon(side, world.getBlockMetadata(x, y, z));
|
||||
@@ -42,22 +38,17 @@ public class Landmine extends MantleBlock
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon (int side, int meta)
|
||||
{
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return Blocks.sponge.getIcon(1, meta);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerBlockIcons (IIconRegister par1IconRegister)
|
||||
{
|
||||
|
||||
}
|
||||
public void registerBlockIcons(IIconRegister par1IconRegister) {}
|
||||
|
||||
/**
|
||||
* How many world ticks before ticking
|
||||
*/
|
||||
public int tickRate ()
|
||||
{
|
||||
public int tickRate() {
|
||||
return 20;
|
||||
}
|
||||
|
||||
@@ -66,8 +57,7 @@ public class Landmine extends MantleBlock
|
||||
* box can change after the pool has been cleared to be reused)
|
||||
*/
|
||||
@Override
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
public AxisAlignedBB getCollisionBoundingBoxFromPool(World par1World, int par2, int par3, int par4) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -77,8 +67,7 @@ public class Landmine extends MantleBlock
|
||||
* the player can attach torches, redstone wire, etc to this block.
|
||||
*/
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -87,14 +76,12 @@ public class Landmine extends MantleBlock
|
||||
* (examples: signs, buttons, stairs, etc)
|
||||
*/
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean getBlocksMovement (IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
||||
{
|
||||
public boolean getBlocksMovement(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -103,9 +90,9 @@ public class Landmine extends MantleBlock
|
||||
* coordinates. Args: world, x, y, z
|
||||
*/
|
||||
@Override
|
||||
public boolean canPlaceBlockAt (World par1World, int par2, int par3, int par4)
|
||||
{
|
||||
return par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4) || BlockFence.func_149825_a(par1World.getBlock(par2, par3 - 1, par4));
|
||||
public boolean canPlaceBlockAt(World par1World, int par2, int par3, int par4) {
|
||||
return par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4)
|
||||
|| BlockFence.func_149825_a(par1World.getBlock(par2, par3 - 1, par4));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -113,17 +100,15 @@ public class Landmine extends MantleBlock
|
||||
* neighbor changed (coordinates passed are their own) Args: x, y, z,
|
||||
* neighbor blockID
|
||||
*/
|
||||
public void onNeighborBlockChange (World par1World, int par2, int par3, int par4, Block par5)
|
||||
{
|
||||
public void onNeighborBlockChange(World par1World, int par2, int par3, int par4, Block par5) {
|
||||
boolean var6 = false;
|
||||
|
||||
if (!par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4) && !BlockFence.func_149825_a(par1World.getBlock(par2, par3 - 1, par4)))
|
||||
{
|
||||
if (!par1World.doesBlockHaveSolidTopSurface(par1World, par2, par3 - 1, par4)
|
||||
&& !BlockFence.func_149825_a(par1World.getBlock(par2, par3 - 1, par4))) {
|
||||
var6 = true;
|
||||
}
|
||||
|
||||
if (var6)
|
||||
{
|
||||
if (var6) {
|
||||
this.dropBlockAsItem(par1World, par2, par3, par4, par1World.getBlockMetadata(par2, par3, par4), 0);
|
||||
// par1World.setBlock(par2, par3, par4, 0);
|
||||
}
|
||||
@@ -133,12 +118,9 @@ public class Landmine extends MantleBlock
|
||||
* Ticks the block if it's been scheduled
|
||||
*/
|
||||
@Override
|
||||
public void updateTick (World par1World, int par2, int par3, int par4, Random par5Random)
|
||||
{
|
||||
if (!par1World.isRemote)
|
||||
{
|
||||
if (par1World.getBlockMetadata(par2, par3, par4) != 0)
|
||||
{
|
||||
public void updateTick(World par1World, int par2, int par3, int par4, Random par5Random) {
|
||||
if (!par1World.isRemote) {
|
||||
if (par1World.getBlockMetadata(par2, par3, par4) != 0) {
|
||||
this.setStateIfMobInteractsWithPlate(par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
@@ -149,12 +131,9 @@ public class Landmine extends MantleBlock
|
||||
* block). Args: world, x, y, z, entity
|
||||
*/
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (World par1World, int par2, int par3, int par4, Entity par5Entity)
|
||||
{
|
||||
if (!par1World.isRemote)
|
||||
{
|
||||
if (par1World.getBlockMetadata(par2, par3, par4) != 1)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World par1World, int par2, int par3, int par4, Entity par5Entity) {
|
||||
if (!par1World.isRemote) {
|
||||
if (par1World.getBlockMetadata(par2, par3, par4) != 1) {
|
||||
this.setStateIfMobInteractsWithPlate(par1World, par2, par3, par4);
|
||||
}
|
||||
}
|
||||
@@ -164,21 +143,34 @@ public class Landmine extends MantleBlock
|
||||
* Checks if there are mobs on the plate. If a mob is on the plate and it is
|
||||
* off, it turns it on, and vice versa.
|
||||
*/
|
||||
private void setStateIfMobInteractsWithPlate (World world, int posX, int posY, int posZ)
|
||||
{
|
||||
private void setStateIfMobInteractsWithPlate(World world, int posX, int posY, int posZ) {
|
||||
boolean var5 = world.getBlockMetadata(posX, posY, posZ) == 1;
|
||||
boolean var6 = false;
|
||||
float var7 = 0.125F;
|
||||
List var8 = null;
|
||||
|
||||
if (this.triggerMobType == EnumCreatureType.creature)
|
||||
{
|
||||
var8 = world.getEntitiesWithinAABBExcludingEntity((Entity) null, AxisAlignedBB.getBoundingBox((double) ((float) posX + var7), (double) posY, (double) ((float) posZ + var7), (double) ((float) (posX + 1) - var7), (double) posY + 0.25D, (double) ((float) (posZ + 1) - var7)));
|
||||
if (this.triggerMobType == EnumCreatureType.creature) {
|
||||
var8 = world.getEntitiesWithinAABBExcludingEntity(
|
||||
(Entity) null,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) ((float) posX + var7),
|
||||
(double) posY,
|
||||
(double) ((float) posZ + var7),
|
||||
(double) ((float) (posX + 1) - var7),
|
||||
(double) posY + 0.25D,
|
||||
(double) ((float) (posZ + 1) - var7)));
|
||||
}
|
||||
|
||||
if (this.triggerMobType == EnumCreatureType.monster)
|
||||
{
|
||||
var8 = world.getEntitiesWithinAABB(EntityLiving.class, AxisAlignedBB.getBoundingBox((double) ((float) posX + var7), (double) posY, (double) ((float) posZ + var7), (double) ((float) (posX + 1) - var7), (double) posY + 0.25D, (double) ((float) (posZ + 1) - var7)));
|
||||
if (this.triggerMobType == EnumCreatureType.monster) {
|
||||
var8 = world.getEntitiesWithinAABB(
|
||||
EntityLiving.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) ((float) posX + var7),
|
||||
(double) posY,
|
||||
(double) ((float) posZ + var7),
|
||||
(double) ((float) (posX + 1) - var7),
|
||||
(double) posY + 0.25D,
|
||||
(double) ((float) (posZ + 1) - var7)));
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -190,24 +182,20 @@ public class Landmine extends MantleBlock
|
||||
* 1) - var7))); }
|
||||
*/
|
||||
|
||||
if (!var8.isEmpty())
|
||||
{
|
||||
if (!var8.isEmpty()) {
|
||||
Iterator var9 = var8.iterator();
|
||||
|
||||
while (var9.hasNext())
|
||||
{
|
||||
while (var9.hasNext()) {
|
||||
Entity var10 = (Entity) var9.next();
|
||||
|
||||
if (!var10.doesEntityNotTriggerPressurePlate())
|
||||
{
|
||||
if (!var10.doesEntityNotTriggerPressurePlate()) {
|
||||
var6 = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (var6 && !var5)
|
||||
{
|
||||
if (var6 && !var5) {
|
||||
WorldHelper.setBlockToAir(world, posX, posY, posZ);
|
||||
world.createExplosion((Entity) null, posX, posY, posZ, 2.0F, true);
|
||||
/*
|
||||
@@ -230,7 +218,7 @@ public class Landmine extends MantleBlock
|
||||
* posY, posZ, posX, posY, posZ); par1World.playSoundEffect((double)posX
|
||||
* + 0.5D, (double)posY + 0.1D, (double)posZ + 0.5D, "random.click",
|
||||
* 0.3F, 0.5F); }
|
||||
*
|
||||
*
|
||||
* if (var6) { par1World.scheduleBlockUpdate(posX, posY, posZ,
|
||||
* this.blockID, this.tickRate()); }
|
||||
*/
|
||||
@@ -241,10 +229,8 @@ public class Landmine extends MantleBlock
|
||||
* update, as appropriate
|
||||
*/
|
||||
@Override
|
||||
public void breakBlock (World par1World, int par2, int par3, int par4, Block par5, int par6)
|
||||
{
|
||||
if (par6 > 0)
|
||||
{
|
||||
public void breakBlock(World par1World, int par2, int par3, int par4, Block par5, int par6) {
|
||||
if (par6 > 0) {
|
||||
par1World.notifyBlocksOfNeighborChange(par2, par3, par4, this);
|
||||
par1World.notifyBlocksOfNeighborChange(par2, par3 - 1, par4, this);
|
||||
}
|
||||
@@ -257,17 +243,13 @@ public class Landmine extends MantleBlock
|
||||
* z
|
||||
*/
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState (IBlockAccess par1IBlockAccess, int par2, int par3, int par4)
|
||||
{
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess par1IBlockAccess, int par2, int par3, int par4) {
|
||||
boolean var5 = par1IBlockAccess.getBlockMetadata(par2, par3, par4) == 1;
|
||||
float var6 = 0.0625F;
|
||||
|
||||
if (var5)
|
||||
{
|
||||
if (var5) {
|
||||
this.setBlockBounds(var6, 0.0F, var6, 1.0F - var6, 0.03125F, 1.0F - var6);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.setBlockBounds(var6, 0.0F, var6, 1.0F - var6, 0.0625F, 1.0F - var6);
|
||||
}
|
||||
}
|
||||
@@ -276,8 +258,7 @@ public class Landmine extends MantleBlock
|
||||
* Sets the block's bounds for rendering it as an item
|
||||
*/
|
||||
@Override
|
||||
public void setBlockBoundsForItemRender ()
|
||||
{
|
||||
public void setBlockBoundsForItemRender() {
|
||||
float var1 = 0.5F;
|
||||
float var2 = 0.125F;
|
||||
float var3 = 0.5F;
|
||||
@@ -289,8 +270,7 @@ public class Landmine extends MantleBlock
|
||||
* but can move over, 2 = total immobility and stop pistons
|
||||
*/
|
||||
@Override
|
||||
public int getMobilityFlag ()
|
||||
{
|
||||
public int getMobilityFlag() {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,9 @@ import tconstruct.library.TConstructRegistry;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
import tconstruct.world.model.PunjiRender;
|
||||
|
||||
public class Punji extends MantleBlock
|
||||
{
|
||||
public class Punji extends MantleBlock {
|
||||
|
||||
public Punji()
|
||||
{
|
||||
public Punji() {
|
||||
super(Material.plants);
|
||||
this.setBlockBounds(0.125f, 0, 0.125f, 0.875f, 0.375f, 0.875f);
|
||||
this.stepSound = Block.soundTypeGrass;
|
||||
@@ -29,13 +27,10 @@ public class Punji extends MantleBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock (World world, int x, int y, int z, Entity entity)
|
||||
{
|
||||
if (entity instanceof EntityLivingBase)
|
||||
{
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
if (entity instanceof EntityLivingBase) {
|
||||
int damage = world.getBlockMetadata(x, y, z) / 2 + 1;
|
||||
if (entity.fallDistance > 0)
|
||||
damage += ((entity.fallDistance) * 1.5 + 2);
|
||||
if (entity.fallDistance > 0) damage += ((entity.fallDistance) * 1.5 + 2);
|
||||
entity.attackEntityFrom(DamageSource.cactus, damage);
|
||||
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(Potion.moveSlowdown.id, 20, 1));
|
||||
}
|
||||
@@ -43,26 +38,28 @@ public class Punji extends MantleBlock
|
||||
|
||||
/* Right-click adds sticks */
|
||||
@Override
|
||||
public boolean onBlockActivated (World world, int x, int y, int z, EntityPlayer player, int par6, float hitX, float hitY, float hitZ)
|
||||
{
|
||||
public boolean onBlockActivated(
|
||||
World world, int x, int y, int z, EntityPlayer player, int par6, float hitX, float hitY, float hitZ) {
|
||||
/*
|
||||
* if (world.isRemote) return false;
|
||||
*/
|
||||
|
||||
int meta = world.getBlockMetadata(x, y, z);
|
||||
if (meta < 4)
|
||||
{
|
||||
if (meta < 4) {
|
||||
ItemStack stack = player.getCurrentEquippedItem();
|
||||
if (stack != null && stack.getItem() == Item.getItemFromBlock(TinkerWorld.punji))
|
||||
{
|
||||
if (stack != null && stack.getItem() == Item.getItemFromBlock(TinkerWorld.punji)) {
|
||||
world.setBlockMetadataWithNotify(x, y, z, meta + 1, 3);
|
||||
world.playSoundEffect((double) ((float) x + 0.5F), (double) ((float) y + 0.5F), (double) ((float) z + 0.5F), this.stepSound.soundName, (this.stepSound.getVolume() + 1.0F) / 2.0F, this.stepSound.getPitch() * 0.8F);
|
||||
world.playSoundEffect(
|
||||
(double) ((float) x + 0.5F),
|
||||
(double) ((float) y + 0.5F),
|
||||
(double) ((float) z + 0.5F),
|
||||
this.stepSound.soundName,
|
||||
(this.stepSound.getVolume() + 1.0F) / 2.0F,
|
||||
this.stepSound.getPitch() * 0.8F);
|
||||
player.swingItem();
|
||||
if (!player.capabilities.isCreativeMode)
|
||||
{
|
||||
if (!player.capabilities.isCreativeMode) {
|
||||
stack.stackSize--;
|
||||
if (stack.stackSize <= 0)
|
||||
player.destroyCurrentEquippedItem();
|
||||
if (stack.stackSize <= 0) player.destroyCurrentEquippedItem();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -70,8 +67,7 @@ public class Punji extends MantleBlock
|
||||
}
|
||||
|
||||
@Override
|
||||
public int quantityDropped (int meta, int fortune, Random random)
|
||||
{
|
||||
public int quantityDropped(int meta, int fortune, Random random) {
|
||||
return meta + 1;
|
||||
}
|
||||
|
||||
@@ -81,8 +77,7 @@ public class Punji extends MantleBlock
|
||||
* the player can attach torches, redstone wire, etc to this block.
|
||||
*/
|
||||
@Override
|
||||
public boolean isOpaqueCube ()
|
||||
{
|
||||
public boolean isOpaqueCube() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -91,29 +86,24 @@ public class Punji extends MantleBlock
|
||||
* (examples: signs, buttons, stairs, etc)
|
||||
*/
|
||||
@Override
|
||||
public boolean renderAsNormalBlock ()
|
||||
{
|
||||
public boolean renderAsNormalBlock() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType ()
|
||||
{
|
||||
public int getRenderType() {
|
||||
return PunjiRender.model;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerBlockIcons(IIconRegister iconRegister) {
|
||||
this.blockIcon = iconRegister.registerIcon("tinker:punji");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean shouldSideBeRendered (IBlockAccess world, int x, int y, int z, int side)
|
||||
{
|
||||
public boolean shouldSideBeRendered(IBlockAccess world, int x, int y, int z, int side) {
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,23 +1,24 @@
|
||||
package tconstruct.client;
|
||||
|
||||
import tconstruct.library.weaponry.IAmmo;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
import tconstruct.library.weaponry.IAmmo;
|
||||
|
||||
public class AmmoItemRenderer extends FlexibleToolRenderer {
|
||||
//public static FontRenderer fontRenderer;
|
||||
// public static FontRenderer fontRenderer;
|
||||
|
||||
public AmmoItemRenderer() {
|
||||
// super(true);
|
||||
//fontRenderer = new FontRenderer(Minecraft.getMinecraft().gameSettings, new ResourceLocation(Reference.RESOURCE, "textures/font/border_numbers.png"), Minecraft.getMinecraft().renderEngine, false);
|
||||
// super(true);
|
||||
// fontRenderer = new FontRenderer(Minecraft.getMinecraft().gameSettings, new
|
||||
// ResourceLocation(Reference.RESOURCE, "textures/font/border_numbers.png"),
|
||||
// Minecraft.getMinecraft().renderEngine, false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
if(type == ItemRenderType.INVENTORY)
|
||||
return true;
|
||||
if (type == ItemRenderType.INVENTORY) return true;
|
||||
|
||||
return super.handleRenderType(item, type);
|
||||
}
|
||||
@@ -26,19 +27,17 @@ public class AmmoItemRenderer extends FlexibleToolRenderer {
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
// render the item regularly
|
||||
super.renderItem(type, item, data);
|
||||
//RenderItem.getInstance().renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer, Minecraft.getMinecraft().renderEngine, item, 0,0);
|
||||
// RenderItem.getInstance().renderItemIntoGUI(Minecraft.getMinecraft().fontRenderer,
|
||||
// Minecraft.getMinecraft().renderEngine, item, 0,0);
|
||||
|
||||
if(item.getTagCompound() == null || type != ItemRenderType.INVENTORY)
|
||||
return;
|
||||
if (item.getTagCompound() == null || type != ItemRenderType.INVENTORY) return;
|
||||
|
||||
// render custom stacksize
|
||||
renderAmmoCount(item);
|
||||
}
|
||||
|
||||
public void renderAmmoCount(ItemStack item)
|
||||
{
|
||||
if(!(item.getItem() instanceof IAmmo))
|
||||
return;
|
||||
public void renderAmmoCount(ItemStack item) {
|
||||
if (!(item.getItem() instanceof IAmmo)) return;
|
||||
int amount = ((IAmmo) item.getItem()).getAmmoCount(item);
|
||||
String str = String.valueOf(amount);
|
||||
|
||||
|
||||
@@ -25,186 +25,188 @@ import tconstruct.util.network.GogglePacket;
|
||||
|
||||
public class ArmorControls {
|
||||
|
||||
public static final String keybindCategory = "tconstruct.keybindings";
|
||||
public static final String[] keyDescs = new String[]{"key.tarmor", "key.tgoggles", "key.tbelt", "key.tzoom"};
|
||||
public static KeyBinding armorKey = new KeyBinding(keyDescs[0], 24, keybindCategory);
|
||||
public static KeyBinding toggleGoggles = new KeyBinding(keyDescs[1], 34, keybindCategory);
|
||||
public static KeyBinding beltSwap = new KeyBinding(keyDescs[2], 48, keybindCategory);
|
||||
public static KeyBinding zoomKey = new KeyBinding(keyDescs[3], 44, keybindCategory); //TODO: Make this hold, not toggle
|
||||
static KeyBinding jumpKey;
|
||||
static KeyBinding invKey;
|
||||
static Minecraft mc;
|
||||
public static final String keybindCategory = "tconstruct.keybindings";
|
||||
public static final String[] keyDescs = new String[] {"key.tarmor", "key.tgoggles", "key.tbelt", "key.tzoom"};
|
||||
public static KeyBinding armorKey = new KeyBinding(keyDescs[0], 24, keybindCategory);
|
||||
public static KeyBinding toggleGoggles = new KeyBinding(keyDescs[1], 34, keybindCategory);
|
||||
public static KeyBinding beltSwap = new KeyBinding(keyDescs[2], 48, keybindCategory);
|
||||
public static KeyBinding zoomKey =
|
||||
new KeyBinding(keyDescs[3], 44, keybindCategory); // TODO: Make this hold, not toggle
|
||||
static KeyBinding jumpKey;
|
||||
static KeyBinding invKey;
|
||||
static Minecraft mc;
|
||||
|
||||
boolean jumping;
|
||||
int midairJumps = 0;
|
||||
boolean climbing = false;
|
||||
boolean onGround = false;
|
||||
public static boolean zoom = false;
|
||||
boolean activeGoggles = false; //TODO: Set this on server login
|
||||
boolean jumping;
|
||||
int midairJumps = 0;
|
||||
boolean climbing = false;
|
||||
boolean onGround = false;
|
||||
public static boolean zoom = false;
|
||||
boolean activeGoggles = false; // TODO: Set this on server login
|
||||
|
||||
int currentTab = 1;
|
||||
// boolean onStilts = false;
|
||||
int currentTab = 1;
|
||||
// boolean onStilts = false;
|
||||
|
||||
private final KeyBinding[] keys;
|
||||
private final KeyBinding[] keys;
|
||||
|
||||
public ArmorControls() {
|
||||
getVanillaKeyBindings();
|
||||
keys = new KeyBinding[]{
|
||||
armorKey,
|
||||
toggleGoggles,
|
||||
beltSwap,
|
||||
zoomKey,
|
||||
null, null
|
||||
};
|
||||
}
|
||||
public ArmorControls() {
|
||||
getVanillaKeyBindings();
|
||||
keys = new KeyBinding[] {armorKey, toggleGoggles, beltSwap, zoomKey, null, null};
|
||||
}
|
||||
|
||||
public void registerKeys() {
|
||||
// Register bindings
|
||||
for (KeyBinding key : keys) {
|
||||
if (key != null) {
|
||||
ClientRegistry.registerKeyBinding(key);
|
||||
}
|
||||
}
|
||||
if (Loader.isModLoaded("notenoughkeys")) {
|
||||
Api.registerMod(TConstruct.modID, keyDescs);
|
||||
}
|
||||
// Add mc keys
|
||||
keys[4] = jumpKey;
|
||||
keys[5] = invKey;
|
||||
}
|
||||
public void registerKeys() {
|
||||
// Register bindings
|
||||
for (KeyBinding key : keys) {
|
||||
if (key != null) {
|
||||
ClientRegistry.registerKeyBinding(key);
|
||||
}
|
||||
}
|
||||
if (Loader.isModLoaded("notenoughkeys")) {
|
||||
Api.registerMod(TConstruct.modID, keyDescs);
|
||||
}
|
||||
// Add mc keys
|
||||
keys[4] = jumpKey;
|
||||
keys[5] = invKey;
|
||||
}
|
||||
|
||||
private static void getVanillaKeyBindings() {
|
||||
mc = Minecraft.getMinecraft();
|
||||
jumpKey = mc.gameSettings.keyBindJump;
|
||||
invKey = mc.gameSettings.keyBindInventory;
|
||||
}
|
||||
private static void getVanillaKeyBindings() {
|
||||
mc = Minecraft.getMinecraft();
|
||||
jumpKey = mc.gameSettings.keyBindJump;
|
||||
invKey = mc.gameSettings.keyBindInventory;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void keyEvent(KeyInputEvent event) {
|
||||
if (!Loader.isModLoaded("notenoughkeys")) {
|
||||
checkAndPerformKeyActions(null, false);
|
||||
}
|
||||
}
|
||||
@SubscribeEvent
|
||||
public void keyEvent(KeyInputEvent event) {
|
||||
if (!Loader.isModLoaded("notenoughkeys")) {
|
||||
checkAndPerformKeyActions(null, false);
|
||||
}
|
||||
}
|
||||
|
||||
@Optional.Method(modid = "notenoughkeys")
|
||||
@SubscribeEvent
|
||||
public void keyEventSpecial(KeyBindingPressedEvent event) {
|
||||
if (event.keyBinding != null && event.isKeyBindingPressed) {
|
||||
checkAndPerformKeyActions(event.keyBinding, true);
|
||||
}
|
||||
}
|
||||
@Optional.Method(modid = "notenoughkeys")
|
||||
@SubscribeEvent
|
||||
public void keyEventSpecial(KeyBindingPressedEvent event) {
|
||||
if (event.keyBinding != null && event.isKeyBindingPressed) {
|
||||
checkAndPerformKeyActions(event.keyBinding, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAndPerformKeyActions(KeyBinding keyBinding, boolean inputFromNotEnoughKeys) {
|
||||
if (inputFromNotEnoughKeys ? keyBinding == armorKey : armorKey.isPressed()) {
|
||||
openArmorGui();
|
||||
return;
|
||||
}
|
||||
if (inputFromNotEnoughKeys ? keyBinding == jumpKey : jumpKey.isPressed()) {
|
||||
performHigherJump();
|
||||
return;
|
||||
}
|
||||
if (mc.currentScreen == null) {
|
||||
if (inputFromNotEnoughKeys ? keyBinding == toggleGoggles : toggleGoggles.isPressed()) {
|
||||
checkAndToggleNightVision();
|
||||
return;
|
||||
}
|
||||
if (inputFromNotEnoughKeys ? keyBinding == beltSwap : beltSwap.isPressed()) {
|
||||
doBeltSwapIfPossible();
|
||||
return;
|
||||
}
|
||||
if (inputFromNotEnoughKeys ? keyBinding == zoomKey : zoomKey.isPressed()) {
|
||||
zoom = !zoom;
|
||||
}
|
||||
}
|
||||
}
|
||||
private void checkAndPerformKeyActions(KeyBinding keyBinding, boolean inputFromNotEnoughKeys) {
|
||||
if (inputFromNotEnoughKeys ? keyBinding == armorKey : armorKey.isPressed()) {
|
||||
openArmorGui();
|
||||
return;
|
||||
}
|
||||
if (inputFromNotEnoughKeys ? keyBinding == jumpKey : jumpKey.isPressed()) {
|
||||
performHigherJump();
|
||||
return;
|
||||
}
|
||||
if (mc.currentScreen == null) {
|
||||
if (inputFromNotEnoughKeys ? keyBinding == toggleGoggles : toggleGoggles.isPressed()) {
|
||||
checkAndToggleNightVision();
|
||||
return;
|
||||
}
|
||||
if (inputFromNotEnoughKeys ? keyBinding == beltSwap : beltSwap.isPressed()) {
|
||||
doBeltSwapIfPossible();
|
||||
return;
|
||||
}
|
||||
if (inputFromNotEnoughKeys ? keyBinding == zoomKey : zoomKey.isPressed()) {
|
||||
zoom = !zoom;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void performHigherJump() {
|
||||
if (mc.thePlayer.capabilities.isCreativeMode) {
|
||||
return;
|
||||
}
|
||||
if (jumping && midairJumps > 0) {
|
||||
mc.thePlayer.motionY = 0.42D;
|
||||
mc.thePlayer.fallDistance = 0;
|
||||
if (mc.thePlayer.isPotionActive(Potion.jump)) {
|
||||
mc.thePlayer.motionY += (float) (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F;
|
||||
}
|
||||
midairJumps--;
|
||||
resetFallDamage();
|
||||
}
|
||||
if (!jumping) {
|
||||
jumping = mc.thePlayer.isAirBorne;
|
||||
ItemStack shoes = mc.thePlayer.getCurrentArmor(0);
|
||||
if (shoes != null && shoes.hasTagCompound() && shoes.getTagCompound().hasKey("TinkerArmor")) {
|
||||
NBTTagCompound shoeTag = shoes.getTagCompound().getCompoundTag("TinkerArmor");
|
||||
midairJumps += shoeTag.getInteger("Double-Jump");
|
||||
}
|
||||
ItemStack wings = mc.thePlayer.getCurrentArmor(1);
|
||||
if (wings != null && wings.hasTagCompound() && wings.getTagCompound().hasKey("TinkerArmor")) {
|
||||
NBTTagCompound shoeTag = wings.getTagCompound().getCompoundTag("TinkerArmor");
|
||||
midairJumps += shoeTag.getInteger("Double-Jump");
|
||||
}
|
||||
}
|
||||
}
|
||||
private void performHigherJump() {
|
||||
if (mc.thePlayer.capabilities.isCreativeMode) {
|
||||
return;
|
||||
}
|
||||
if (jumping && midairJumps > 0) {
|
||||
mc.thePlayer.motionY = 0.42D;
|
||||
mc.thePlayer.fallDistance = 0;
|
||||
if (mc.thePlayer.isPotionActive(Potion.jump)) {
|
||||
mc.thePlayer.motionY +=
|
||||
(float) (mc.thePlayer.getActivePotionEffect(Potion.jump).getAmplifier() + 1) * 0.1F;
|
||||
}
|
||||
midairJumps--;
|
||||
resetFallDamage();
|
||||
}
|
||||
if (!jumping) {
|
||||
jumping = mc.thePlayer.isAirBorne;
|
||||
ItemStack shoes = mc.thePlayer.getCurrentArmor(0);
|
||||
if (shoes != null
|
||||
&& shoes.hasTagCompound()
|
||||
&& shoes.getTagCompound().hasKey("TinkerArmor")) {
|
||||
NBTTagCompound shoeTag = shoes.getTagCompound().getCompoundTag("TinkerArmor");
|
||||
midairJumps += shoeTag.getInteger("Double-Jump");
|
||||
}
|
||||
ItemStack wings = mc.thePlayer.getCurrentArmor(1);
|
||||
if (wings != null
|
||||
&& wings.hasTagCompound()
|
||||
&& wings.getTagCompound().hasKey("TinkerArmor")) {
|
||||
NBTTagCompound shoeTag = wings.getTagCompound().getCompoundTag("TinkerArmor");
|
||||
midairJumps += shoeTag.getInteger("Double-Jump");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void checkAndToggleNightVision() {
|
||||
ItemStack goggles = mc.thePlayer.getCurrentArmor(3);
|
||||
if (goggles != null && goggles.getItem() instanceof TravelGear) { // TODO: Genericize this
|
||||
if (goggles.hasTagCompound() && goggles.getTagCompound().getCompoundTag(((TravelGear) goggles.getItem()).getBaseTagName()).getBoolean("Night Vision")) {
|
||||
activeGoggles = !activeGoggles;
|
||||
PlayerAbilityHelper.toggleGoggles(mc.thePlayer, activeGoggles);
|
||||
toggleGoggles();
|
||||
}
|
||||
}
|
||||
}
|
||||
private void checkAndToggleNightVision() {
|
||||
ItemStack goggles = mc.thePlayer.getCurrentArmor(3);
|
||||
if (goggles != null && goggles.getItem() instanceof TravelGear) { // TODO: Genericize this
|
||||
if (goggles.hasTagCompound()
|
||||
&& goggles.getTagCompound()
|
||||
.getCompoundTag(((TravelGear) goggles.getItem()).getBaseTagName())
|
||||
.getBoolean("Night Vision")) {
|
||||
activeGoggles = !activeGoggles;
|
||||
PlayerAbilityHelper.toggleGoggles(mc.thePlayer, activeGoggles);
|
||||
toggleGoggles();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean doBeltSwapIfPossible() {
|
||||
if (ArmorProxyClient.armorExtended.inventory[3] != null) {
|
||||
PlayerAbilityHelper.swapBelt(mc.thePlayer, ArmorProxyClient.armorExtended);
|
||||
toggleBelt();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public static boolean doBeltSwapIfPossible() {
|
||||
if (ArmorProxyClient.armorExtended.inventory[3] != null) {
|
||||
PlayerAbilityHelper.swapBelt(mc.thePlayer, ArmorProxyClient.armorExtended);
|
||||
toggleBelt();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void landOnGround() {
|
||||
midairJumps = 0;
|
||||
jumping = false;
|
||||
}
|
||||
public void landOnGround() {
|
||||
midairJumps = 0;
|
||||
jumping = false;
|
||||
}
|
||||
|
||||
public void resetControls() {
|
||||
midairJumps = 0;
|
||||
jumping = false;
|
||||
climbing = false;
|
||||
onGround = false;
|
||||
}
|
||||
public void resetControls() {
|
||||
midairJumps = 0;
|
||||
jumping = false;
|
||||
climbing = false;
|
||||
onGround = false;
|
||||
}
|
||||
|
||||
void resetFallDamage() {
|
||||
AbstractPacket packet = new DoubleJumpPacket();
|
||||
updateServer(packet);
|
||||
}
|
||||
void resetFallDamage() {
|
||||
AbstractPacket packet = new DoubleJumpPacket();
|
||||
updateServer(packet);
|
||||
}
|
||||
|
||||
public static void openArmorGui() {
|
||||
AbstractPacket packet = new AccessoryInventoryPacket(ArmorProxyCommon.armorGuiID);
|
||||
updateServer(packet);
|
||||
}
|
||||
public static void openArmorGui() {
|
||||
AbstractPacket packet = new AccessoryInventoryPacket(ArmorProxyCommon.armorGuiID);
|
||||
updateServer(packet);
|
||||
}
|
||||
|
||||
public static void openKnapsackGui() {
|
||||
AbstractPacket packet = new AccessoryInventoryPacket(ArmorProxyCommon.knapsackGuiID);
|
||||
updateServer(packet);
|
||||
}
|
||||
public static void openKnapsackGui() {
|
||||
AbstractPacket packet = new AccessoryInventoryPacket(ArmorProxyCommon.knapsackGuiID);
|
||||
updateServer(packet);
|
||||
}
|
||||
|
||||
private void toggleGoggles() {
|
||||
AbstractPacket packet = new GogglePacket(activeGoggles);
|
||||
updateServer(packet);
|
||||
}
|
||||
private void toggleGoggles() {
|
||||
AbstractPacket packet = new GogglePacket(activeGoggles);
|
||||
updateServer(packet);
|
||||
}
|
||||
|
||||
private static void toggleBelt() {
|
||||
AbstractPacket packet = new BeltPacket();
|
||||
updateServer(packet);
|
||||
}
|
||||
|
||||
static void updateServer(AbstractPacket abstractPacket) {
|
||||
TConstruct.packetPipeline.sendToServer(abstractPacket);
|
||||
}
|
||||
private static void toggleBelt() {
|
||||
AbstractPacket packet = new BeltPacket();
|
||||
updateServer(packet);
|
||||
}
|
||||
|
||||
static void updateServer(AbstractPacket abstractPacket) {
|
||||
TConstruct.packetPipeline.sendToServer(abstractPacket);
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -8,15 +8,12 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class BreakingFX extends EntityFX
|
||||
{
|
||||
public BreakingFX(World par1World, double par2, double par4, double par6, Item par8Item)
|
||||
{
|
||||
public class BreakingFX extends EntityFX {
|
||||
public BreakingFX(World par1World, double par2, double par4, double par6, Item par8Item) {
|
||||
this(par1World, par2, par4, par6, par8Item, 0);
|
||||
}
|
||||
|
||||
public BreakingFX(World par1World, double par2, double par4, double par6, Item par8Item, int par9)
|
||||
{
|
||||
public BreakingFX(World par1World, double par2, double par4, double par6, Item par8Item, int par9) {
|
||||
super(par1World, par2, par4, par6, 0.0D, 0.0D, 0.0D);
|
||||
this.setParticleIcon(par8Item.getIconFromDamage(par9));
|
||||
this.particleRed = this.particleGreen = this.particleBlue = 1.0F;
|
||||
@@ -24,8 +21,16 @@ public class BreakingFX extends EntityFX
|
||||
this.particleScale /= 2.0F;
|
||||
}
|
||||
|
||||
public BreakingFX(World par1World, double par2, double par4, double par6, double par8, double par10, double par12, Item par14Item, int par15)
|
||||
{
|
||||
public BreakingFX(
|
||||
World par1World,
|
||||
double par2,
|
||||
double par4,
|
||||
double par6,
|
||||
double par8,
|
||||
double par10,
|
||||
double par12,
|
||||
Item par14Item,
|
||||
int par15) {
|
||||
this(par1World, par2, par4, par6, par14Item, par15);
|
||||
this.motionX *= 0.10000000149011612D;
|
||||
this.motionY *= 0.10000000149011612D;
|
||||
@@ -36,22 +41,20 @@ public class BreakingFX extends EntityFX
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFXLayer ()
|
||||
{
|
||||
public int getFXLayer() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderParticle (Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
public void renderParticle(
|
||||
Tessellator par1Tessellator, float par2, float par3, float par4, float par5, float par6, float par7) {
|
||||
float f6 = ((float) this.particleTextureIndexX + this.particleTextureJitterX / 4.0F) / 16.0F;
|
||||
float f7 = f6 + 0.015609375F;
|
||||
float f8 = ((float) this.particleTextureIndexY + this.particleTextureJitterY / 4.0F) / 16.0F;
|
||||
float f9 = f8 + 0.015609375F;
|
||||
float f10 = 0.1F * this.particleScale;
|
||||
|
||||
if (this.particleIcon != null)
|
||||
{
|
||||
if (this.particleIcon != null) {
|
||||
f6 = this.particleIcon.getInterpolatedU((double) (this.particleTextureJitterX / 4.0F * 16.0F));
|
||||
f7 = this.particleIcon.getInterpolatedU((double) ((this.particleTextureJitterX + 1.0F) / 4.0F * 16.0F));
|
||||
f8 = this.particleIcon.getInterpolatedV((double) (this.particleTextureJitterY / 4.0F * 16.0F));
|
||||
@@ -63,9 +66,29 @@ public class BreakingFX extends EntityFX
|
||||
float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) par2 - interpPosZ);
|
||||
float f14 = 1.0F;
|
||||
par1Tessellator.setColorOpaque_F(f14 * this.particleRed, f14 * this.particleGreen, f14 * this.particleBlue);
|
||||
par1Tessellator.addVertexWithUV((double) (f11 - par3 * f10 - par6 * f10), (double) (f12 - par4 * f10), (double) (f13 - par5 * f10 - par7 * f10), (double) f6, (double) f9);
|
||||
par1Tessellator.addVertexWithUV((double) (f11 - par3 * f10 + par6 * f10), (double) (f12 + par4 * f10), (double) (f13 - par5 * f10 + par7 * f10), (double) f6, (double) f8);
|
||||
par1Tessellator.addVertexWithUV((double) (f11 + par3 * f10 + par6 * f10), (double) (f12 + par4 * f10), (double) (f13 + par5 * f10 + par7 * f10), (double) f7, (double) f8);
|
||||
par1Tessellator.addVertexWithUV((double) (f11 + par3 * f10 - par6 * f10), (double) (f12 - par4 * f10), (double) (f13 + par5 * f10 - par7 * f10), (double) f7, (double) f9);
|
||||
par1Tessellator.addVertexWithUV(
|
||||
(double) (f11 - par3 * f10 - par6 * f10),
|
||||
(double) (f12 - par4 * f10),
|
||||
(double) (f13 - par5 * f10 - par7 * f10),
|
||||
(double) f6,
|
||||
(double) f9);
|
||||
par1Tessellator.addVertexWithUV(
|
||||
(double) (f11 - par3 * f10 + par6 * f10),
|
||||
(double) (f12 + par4 * f10),
|
||||
(double) (f13 - par5 * f10 + par7 * f10),
|
||||
(double) f6,
|
||||
(double) f8);
|
||||
par1Tessellator.addVertexWithUV(
|
||||
(double) (f11 + par3 * f10 + par6 * f10),
|
||||
(double) (f12 + par4 * f10),
|
||||
(double) (f13 + par5 * f10 + par7 * f10),
|
||||
(double) f7,
|
||||
(double) f8);
|
||||
par1Tessellator.addVertexWithUV(
|
||||
(double) (f11 + par3 * f10 - par6 * f10),
|
||||
(double) (f12 - par4 * f10),
|
||||
(double) (f13 + par5 * f10 - par7 * f10),
|
||||
(double) f7,
|
||||
(double) f9);
|
||||
}
|
||||
}
|
||||
@@ -11,64 +11,52 @@ import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
public class CustomBowRenderer implements IItemRenderer
|
||||
{
|
||||
public class CustomBowRenderer implements IItemRenderer {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
private RenderBlocks renderBlocksInstance = new RenderBlocks();
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType (ItemStack item, ItemRenderType type)
|
||||
{
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
return type == ItemRenderType.EQUIPPED || type == ItemRenderType.EQUIPPED_FIRST_PERSON;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderItem (ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
EntityLivingBase living = (EntityLivingBase) data[1];
|
||||
ItemRenderer renderer = RenderManager.instance.itemRenderer;
|
||||
for (int i = 0; i < item.getItem().getRenderPasses(item.getItemDamage()) + 1; i++)
|
||||
renderItem(living, item, i, type);
|
||||
}
|
||||
|
||||
public void renderItem (EntityLivingBase living, ItemStack stack, int renderPass, ItemRenderType type)
|
||||
{
|
||||
public void renderItem(EntityLivingBase living, ItemStack stack, int renderPass, ItemRenderType type) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
IIcon icon = null;
|
||||
if (living instanceof EntityPlayer)
|
||||
{
|
||||
if (living instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) living;
|
||||
if (player.getItemInUse() != null)
|
||||
icon = stack.getItem().getIcon(stack, renderPass, player, player.getItemInUse(), player.getItemInUseCount());
|
||||
else
|
||||
icon = living.getItemIcon(stack, renderPass);
|
||||
}
|
||||
else
|
||||
{
|
||||
icon = stack.getItem()
|
||||
.getIcon(stack, renderPass, player, player.getItemInUse(), player.getItemInUseCount());
|
||||
else icon = living.getItemIcon(stack, renderPass);
|
||||
} else {
|
||||
icon = living.getItemIcon(stack, renderPass);
|
||||
}
|
||||
|
||||
if (icon == null)
|
||||
{
|
||||
if (icon == null) {
|
||||
GL11.glPopMatrix();
|
||||
return;
|
||||
}
|
||||
TextureManager texturemanager = this.mc.getTextureManager();
|
||||
texturemanager.bindTexture(texturemanager.getResourceLocation(stack.getItemSpriteNumber()));
|
||||
|
||||
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON)
|
||||
{
|
||||
if (type == ItemRenderType.EQUIPPED_FIRST_PERSON) {
|
||||
GL11.glTranslatef(0.6F, 0.5F, 0.5F);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GL11.glRotatef(180.0F, 0F, 0F, 1.0F);
|
||||
GL11.glRotatef(45.0F, 1.0F, 0.0F, 0.75F);
|
||||
GL11.glTranslatef(-0.6F, -0.25F, 1.0F);
|
||||
@@ -95,5 +83,4 @@ public class CustomBowRenderer implements IItemRenderer
|
||||
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,14 +10,13 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* @author TheObliterator
|
||||
*
|
||||
*
|
||||
* A class to create and draw true type fonts onto the Minecraft game
|
||||
* engine.
|
||||
*/
|
||||
public class CustomFont
|
||||
{
|
||||
public class CustomFont {
|
||||
private int texID;
|
||||
private int[] xPos;
|
||||
private int[] yPos;
|
||||
@@ -28,9 +27,9 @@ public class CustomFont
|
||||
/**
|
||||
* Instantiates the font, filling in default start and end character
|
||||
* parameters.
|
||||
*
|
||||
*
|
||||
* 'new CustomFont(ModLoader.getMinecraftInstance(), "Arial", 12);
|
||||
*
|
||||
*
|
||||
* @param mc
|
||||
* The Minecraft instance for the font to be bound to.
|
||||
* @param fontName
|
||||
@@ -38,8 +37,7 @@ public class CustomFont
|
||||
* @param size
|
||||
* The size of the font to be drawn.
|
||||
*/
|
||||
public CustomFont(Minecraft mc, Object font, int size)
|
||||
{
|
||||
public CustomFont(Minecraft mc, Object font, int size) {
|
||||
this(mc, font, size, 0, 4000);
|
||||
}
|
||||
|
||||
@@ -47,9 +45,9 @@ public class CustomFont
|
||||
* Instantiates the font, pre-rendering a sprite font image by using a true
|
||||
* type font on a bitmap. Then allocating that bitmap to the Minecraft
|
||||
* rendering engine for later use.
|
||||
*
|
||||
*
|
||||
* 'new CustomFont(ModLoader.getMinecraftInstance(), "Arial", 12, 32, 126);'
|
||||
*
|
||||
*
|
||||
* @param mc
|
||||
* The Minecraft instance for the font to be bound to.
|
||||
* @param fontName
|
||||
@@ -61,8 +59,7 @@ public class CustomFont
|
||||
* @param endChar
|
||||
* The ending ASCII character id to be drawable. (Default 126)
|
||||
*/
|
||||
public CustomFont(Minecraft mc, Object font, int size, int startChar, int endChar)
|
||||
{
|
||||
public CustomFont(Minecraft mc, Object font, int size, int startChar, int endChar) {
|
||||
this.startChar = startChar;
|
||||
this.endChar = endChar;
|
||||
xPos = new int[endChar - startChar];
|
||||
@@ -74,27 +71,20 @@ public class CustomFont
|
||||
// it is not the Minecraft engine will not draw it properly.
|
||||
BufferedImage img = new BufferedImage(256, 256, BufferedImage.TYPE_INT_ARGB);
|
||||
Graphics g = img.getGraphics();
|
||||
try
|
||||
{
|
||||
if (font instanceof String)
|
||||
{
|
||||
try {
|
||||
if (font instanceof String) {
|
||||
String fontName = (String) font;
|
||||
if (fontName.contains("/"))
|
||||
g.setFont(Font.createFont(Font.TRUETYPE_FONT, new File(fontName)).deriveFont((float) size));
|
||||
else
|
||||
g.setFont(new Font(fontName, 0, size));
|
||||
}
|
||||
else if (font instanceof InputStream)
|
||||
{
|
||||
g.setFont(Font.createFont(Font.TRUETYPE_FONT, (InputStream) font).deriveFont((float) size));
|
||||
}
|
||||
else if (font instanceof File)
|
||||
{
|
||||
g.setFont(Font.createFont(Font.TRUETYPE_FONT, new File(fontName))
|
||||
.deriveFont((float) size));
|
||||
else g.setFont(new Font(fontName, 0, size));
|
||||
} else if (font instanceof InputStream) {
|
||||
g.setFont(
|
||||
Font.createFont(Font.TRUETYPE_FONT, (InputStream) font).deriveFont((float) size));
|
||||
} else if (font instanceof File) {
|
||||
g.setFont(Font.createFont(Font.TRUETYPE_FONT, (File) font).deriveFont((float) size));
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
@@ -110,14 +100,12 @@ public class CustomFont
|
||||
// later when drawing.
|
||||
int x = 2;
|
||||
int y = 2;
|
||||
for (int i = startChar; i < endChar; i++)
|
||||
{
|
||||
for (int i = startChar; i < endChar; i++) {
|
||||
g.drawString("" + ((char) i), x, y + g.getFontMetrics().getAscent());
|
||||
xPos[i - startChar] = x;
|
||||
yPos[i - startChar] = y - metrics.getMaxDescent();
|
||||
x += metrics.stringWidth("" + (char) i) + 2;
|
||||
if (x >= 250 - metrics.getMaxAdvance())
|
||||
{
|
||||
if (x >= 250 - metrics.getMaxAdvance()) {
|
||||
x = 2;
|
||||
y += metrics.getMaxAscent() + metrics.getMaxDescent() + size / 2;
|
||||
}
|
||||
@@ -131,7 +119,7 @@ public class CustomFont
|
||||
|
||||
/**
|
||||
* Draws a given string with an automatically calculated shadow below it.
|
||||
*
|
||||
*
|
||||
* @param gui
|
||||
* The gui/subclass to be drawn on
|
||||
* @param text
|
||||
@@ -143,8 +131,7 @@ public class CustomFont
|
||||
* @param color
|
||||
* The color of the non-shadowed text (Hex)
|
||||
*/
|
||||
public void drawStringS (Gui gui, String text, int x, int y, int color)
|
||||
{
|
||||
public void drawStringS(Gui gui, String text, int x, int y, int color) {
|
||||
int l = color & 0xff000000;
|
||||
int shade = (color & 0xfcfcfc) >> 2;
|
||||
shade += l;
|
||||
@@ -154,7 +141,7 @@ public class CustomFont
|
||||
|
||||
/**
|
||||
* Draws a given string onto a gui/subclass.
|
||||
*
|
||||
*
|
||||
* @param gui
|
||||
* The gui/subclass to be drawn on
|
||||
* @param text
|
||||
@@ -166,8 +153,7 @@ public class CustomFont
|
||||
* @param color
|
||||
* The color of the non-shadowed text (Hex)
|
||||
*/
|
||||
public void drawString (Gui gui, String text, int x, int y, int color)
|
||||
{
|
||||
public void drawString(Gui gui, String text, int x, int y, int color) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
GL11.glEnable(3553 /* GL_TEXTURE_2D */);
|
||||
GL11.glBindTexture(3553 /* GL_TEXTURE_2D */, texID);
|
||||
@@ -177,14 +163,11 @@ public class CustomFont
|
||||
float alpha = (float) (color >> 24 & 0xff) / 255F;
|
||||
GL11.glColor4f(red, green, blue, alpha);
|
||||
int startX = x;
|
||||
for (int i = 0; i < text.length(); i++)
|
||||
{
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
char c = text.charAt(i);
|
||||
if (c == '\\')
|
||||
{
|
||||
if (c == '\\') {
|
||||
char type = text.charAt(i + 1);
|
||||
if (type == 'n')
|
||||
{
|
||||
if (type == 'n') {
|
||||
y += metrics.getAscent() + 2;
|
||||
x = startX;
|
||||
}
|
||||
@@ -199,64 +182,56 @@ public class CustomFont
|
||||
/**
|
||||
* Returns the created FontMetrics which is used to retrive various
|
||||
* information about the True Type Font
|
||||
*
|
||||
*
|
||||
* @return FontMetrics of the created font.
|
||||
*/
|
||||
public FontMetrics getMetrics ()
|
||||
{
|
||||
public FontMetrics getMetrics() {
|
||||
return metrics;
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the drawing width of a given string of string.
|
||||
*
|
||||
*
|
||||
* @param text
|
||||
* The string to be measured
|
||||
* @return The width of the given string.
|
||||
*/
|
||||
public int getStringWidth (String text)
|
||||
{
|
||||
public int getStringWidth(String text) {
|
||||
return (int) getBounds(text).getWidth();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the drawing height of a given string of string.
|
||||
*
|
||||
*
|
||||
* @param text
|
||||
* The string to be measured
|
||||
* @return The height of the given string.
|
||||
*/
|
||||
public int getStringHeight (String text)
|
||||
{
|
||||
public int getStringHeight(String text) {
|
||||
return (int) getBounds(text).getHeight();
|
||||
}
|
||||
|
||||
/**
|
||||
* A method that returns a Rectangle that contains the width and height
|
||||
* demensions of the given string.
|
||||
*
|
||||
*
|
||||
* @param text
|
||||
* The string to be measured
|
||||
* @return Rectangle containing width and height that the text will consume
|
||||
* when drawn.
|
||||
*/
|
||||
private Rectangle getBounds (String text)
|
||||
{
|
||||
private Rectangle getBounds(String text) {
|
||||
int w = 0;
|
||||
int h = 0;
|
||||
int tw = 0;
|
||||
for (int i = 0; i < text.length(); i++)
|
||||
{
|
||||
for (int i = 0; i < text.length(); i++) {
|
||||
char c = text.charAt(i);
|
||||
if (c == '\\')
|
||||
{
|
||||
if (c == '\\') {
|
||||
char type = text.charAt(i + 1);
|
||||
|
||||
if (type == 'n')
|
||||
{
|
||||
if (type == 'n') {
|
||||
h += metrics.getAscent() + 2;
|
||||
if (tw > w)
|
||||
w = tw;
|
||||
if (tw > w) w = tw;
|
||||
tw = 0;
|
||||
}
|
||||
i++;
|
||||
@@ -264,8 +239,7 @@ public class CustomFont
|
||||
}
|
||||
tw += metrics.stringWidth("" + c);
|
||||
}
|
||||
if (tw > w)
|
||||
w = tw;
|
||||
if (tw > w) w = tw;
|
||||
h += metrics.getAscent();
|
||||
return new Rectangle(0, 0, w, h);
|
||||
}
|
||||
@@ -273,22 +247,27 @@ public class CustomFont
|
||||
/**
|
||||
* Private drawing method used within other drawing methods.
|
||||
*/
|
||||
private void drawChar (Gui gui, char c, int x, int y)
|
||||
{
|
||||
private void drawChar(Gui gui, char c, int x, int y) {
|
||||
Rectangle2D bounds = metrics.getStringBounds("" + c, null);
|
||||
drawTexturedModalRect(x, y, xPos[(byte) c - startChar], yPos[(byte) c - startChar], (int) bounds.getWidth(), (int) bounds.getHeight() + metrics.getMaxDescent());
|
||||
drawTexturedModalRect(
|
||||
x,
|
||||
y,
|
||||
xPos[(byte) c - startChar],
|
||||
yPos[(byte) c - startChar],
|
||||
(int) bounds.getWidth(),
|
||||
(int) bounds.getHeight() + metrics.getMaxDescent());
|
||||
}
|
||||
|
||||
public void drawTexturedModalRect (int x, int y, int u, int v, int width, int height)
|
||||
{
|
||||
public void drawTexturedModalRect(int x, int y, int u, int v, int width, int height) {
|
||||
float offsetWidth = 0.00390625F;
|
||||
float offsetHeight = 0.00390625F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((x + 0), (y + height), 0, ((u + 0) * offsetWidth), ((v + height) * offsetHeight));
|
||||
tessellator.addVertexWithUV((x + width), (y + height), 0, ((u + width) * offsetWidth), ((v + height) * offsetHeight));
|
||||
tessellator.addVertexWithUV(
|
||||
(x + width), (y + height), 0, ((u + width) * offsetWidth), ((v + height) * offsetHeight));
|
||||
tessellator.addVertexWithUV((x + width), (y + 0), 0, ((u + width) * offsetWidth), ((v + 0) * offsetHeight));
|
||||
tessellator.addVertexWithUV((x + 0), (y + 0), 0, ((u + 0) * offsetWidth), ((v + 0) * offsetHeight));
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -12,23 +12,22 @@ import tconstruct.TConstruct;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class FlexibleToolRenderer implements IItemRenderer {
|
||||
public float depth = 1/32f;
|
||||
public float depth = 1 / 32f;
|
||||
|
||||
public void setDepth(float d) { depth = d; }
|
||||
public void setDepth(float d) {
|
||||
depth = d;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType (ItemStack item, ItemRenderType type)
|
||||
{
|
||||
if(!item.hasTagCompound())
|
||||
return false;
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
if (!item.hasTagCompound()) return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
//GL11.glTranslatef(-0.0625F, -0.0625F, 0F);
|
||||
// GL11.glTranslatef(-0.0625F, -0.0625F, 0F);
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
//GL11.glTranslatef(0.03f, 0F, -0.09375F);
|
||||
// GL11.glTranslatef(0.03f, 0F, -0.09375F);
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
return true;
|
||||
case INVENTORY:
|
||||
@@ -41,8 +40,7 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return handleRenderType(item, type) & helper.ordinal() < ItemRendererHelper.EQUIPPED_BLOCK.ordinal();
|
||||
}
|
||||
|
||||
@@ -51,13 +49,11 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
protected void specialAnimation(ItemRenderType type, ItemStack item) {}
|
||||
|
||||
@Override
|
||||
public void renderItem (ItemRenderType type, ItemStack item, Object... data) {
|
||||
if(item == null || item.getItem() == null || !(item.getItem() instanceof ToolCore))
|
||||
return;
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
if (item == null || item.getItem() == null || !(item.getItem() instanceof ToolCore)) return;
|
||||
|
||||
Entity ent = null;
|
||||
if (data.length > 1)
|
||||
ent = (Entity) data[1];
|
||||
if (data.length > 1) ent = (Entity) data[1];
|
||||
|
||||
IIcon[] parts = new IIcon[toolIcons];
|
||||
int iconParts = getIcons(item, type, ent, parts);
|
||||
@@ -80,8 +76,7 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
float[] yDiff = new float[iconParts];
|
||||
float[] xSub = new float[iconParts];
|
||||
float[] ySub = new float[iconParts];
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
IIcon icon = parts[i];
|
||||
xMin[i] = icon.getMinU();
|
||||
xMax[i] = icon.getMaxU();
|
||||
@@ -98,22 +93,18 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
if(type != ItemRenderType.ENTITY) {
|
||||
if (type != ItemRenderType.ENTITY) {
|
||||
specialAnimation(type, item);
|
||||
}
|
||||
else
|
||||
GL11.glTranslatef(-0.5f, -0.25f, 0); // why? because.. minecraft.
|
||||
} else GL11.glTranslatef(-0.5f, -0.25f, 0); // why? because.. minecraft.
|
||||
|
||||
// prepare colors
|
||||
int[] color = new int[iconParts];
|
||||
for(int i = 0; i < iconParts; i++)
|
||||
color[i] = item.getItem().getColorFromItemStack(item, i);
|
||||
for (int i = 0; i < iconParts; i++) color[i] = item.getItem().getColorFromItemStack(item, i);
|
||||
|
||||
// one side
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 0, 1);
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
tess.addVertexWithUV(0, 0, +depth, xMax[i], yMax[i]);
|
||||
tess.addVertexWithUV(1, 0, +depth, xMin[i], yMax[i]);
|
||||
@@ -125,8 +116,7 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
// other side
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 0, -1);
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
tess.addVertexWithUV(0, 1, -depth, xMax[i], yMin[i]);
|
||||
tess.addVertexWithUV(1, 1, -depth, xMin[i], yMin[i]);
|
||||
@@ -141,12 +131,10 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
float pos;
|
||||
float iconPos;
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i];
|
||||
for (int k = 0, e = (int)w; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) w; k < e; ++k) {
|
||||
pos = k / w;
|
||||
iconPos = m + d * pos - s;
|
||||
tess.addVertexWithUV(pos, 0, -depth, iconPos, yMax[i]);
|
||||
@@ -161,13 +149,11 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
tess.setNormal(1, 0, 0);
|
||||
float posEnd;
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i];
|
||||
float d2 = 1f / w;
|
||||
for (int k = 0, e = (int)w; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) w; k < e; ++k) {
|
||||
pos = k / w;
|
||||
iconPos = m + d * pos - s;
|
||||
posEnd = pos + d2;
|
||||
@@ -182,13 +168,11 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 1, 0);
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i];
|
||||
float d2 = 1f / h;
|
||||
for (int k = 0, e = (int)h; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) h; k < e; ++k) {
|
||||
pos = k / h;
|
||||
iconPos = m + d * pos - s;
|
||||
posEnd = pos + d2;
|
||||
@@ -203,12 +187,10 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, -1, 0);
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i];
|
||||
for (int k = 0, e = (int)h; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) h; k < e; ++k) {
|
||||
pos = k / h;
|
||||
iconPos = m + d * pos - s;
|
||||
tess.addVertexWithUV(1, pos, +depth, xMin[i], iconPos);
|
||||
@@ -223,21 +205,19 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public void renderInventory(int count, IIcon[] icons, ItemStack item)
|
||||
{
|
||||
public void renderInventory(int count, IIcon[] icons, ItemStack item) {
|
||||
Tessellator tess = Tessellator.instance;
|
||||
GL11.glPushMatrix();
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.5F);
|
||||
//GL11.glDisable(GL11.GL_BLEND);
|
||||
// GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
tess.startDrawingQuads();
|
||||
|
||||
// draw a simple rectangle for the inventory icon
|
||||
for (int i = 0; i < count; ++i)
|
||||
{
|
||||
for (int i = 0; i < count; ++i) {
|
||||
tess.setColorOpaque_I(item.getItem().getColorFromItemStack(item, i));
|
||||
|
||||
final IIcon icon = icons[i];
|
||||
@@ -245,23 +225,22 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
final float xmax = icon.getMaxU();
|
||||
final float ymin = icon.getMinV();
|
||||
final float ymax = icon.getMaxV();
|
||||
tess.addVertexWithUV( 0, 16, 0, xmin, ymax);
|
||||
tess.addVertexWithUV(0, 16, 0, xmin, ymax);
|
||||
tess.addVertexWithUV(16, 16, 0, xmax, ymax);
|
||||
tess.addVertexWithUV(16, 0, 0, xmax, ymin);
|
||||
tess.addVertexWithUV( 0, 0, 0, xmin, ymin);
|
||||
tess.addVertexWithUV(16, 0, 0, xmax, ymin);
|
||||
tess.addVertexWithUV(0, 0, 0, xmin, ymin);
|
||||
}
|
||||
tess.draw();
|
||||
|
||||
//GL11.glEnable(GL11.GL_BLEND);
|
||||
// GL11.glEnable(GL11.GL_BLEND);
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
public int getIcons(ItemStack item, ItemRenderType type, Entity ent, IIcon[] parts)
|
||||
{
|
||||
int iconParts = toolIcons;//tool.getRenderPasses(item.getItemDamage());
|
||||
public int getIcons(ItemStack item, ItemRenderType type, Entity ent, IIcon[] parts) {
|
||||
int iconParts = toolIcons; // tool.getRenderPasses(item.getItemDamage());
|
||||
// TODO: have the tools define how many render passes they have
|
||||
// (requires more logic rewrite than it sounds like)
|
||||
|
||||
@@ -271,35 +250,28 @@ public class FlexibleToolRenderer implements IItemRenderer {
|
||||
IIcon[] tempParts = new IIcon[iconParts];
|
||||
label:
|
||||
{
|
||||
if (!isInventory && ent instanceof EntityPlayer)
|
||||
{
|
||||
if (!isInventory && ent instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) ent;
|
||||
ItemStack itemInUse = player.getItemInUse();
|
||||
if (itemInUse != null)
|
||||
{
|
||||
if (itemInUse != null) {
|
||||
int useCount = player.getItemInUseCount();
|
||||
for (int i = iconParts; i-- > 0;)
|
||||
for (int i = iconParts; i-- > 0; )
|
||||
tempParts[i] = tool.getIcon(item, i, player, itemInUse, useCount);
|
||||
break label;
|
||||
}
|
||||
}
|
||||
for (int i = iconParts; i-- > 0;)
|
||||
tempParts[i] = tool.getIcon(item, i);
|
||||
for (int i = iconParts; i-- > 0; ) tempParts[i] = tool.getIcon(item, i);
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
IIcon part = tempParts[i];
|
||||
if (part == null || part == ToolCore.blankSprite || part == ToolCore.emptyIcon)
|
||||
++count;
|
||||
else
|
||||
parts[i - count] = part;
|
||||
if (part == null || part == ToolCore.blankSprite || part == ToolCore.emptyIcon) ++count;
|
||||
else parts[i - count] = part;
|
||||
}
|
||||
iconParts -= count;
|
||||
|
||||
if (iconParts <= 0)
|
||||
{
|
||||
if (iconParts <= 0) {
|
||||
iconParts = 1;
|
||||
parts[0] = ToolCore.blankSprite;
|
||||
}
|
||||
|
||||
@@ -15,8 +15,7 @@ public class IconFlipped extends net.minecraft.client.renderer.IconFlipped {
|
||||
}
|
||||
|
||||
// has a faulty implementation in original class
|
||||
public float getMinV()
|
||||
{
|
||||
public float getMinV() {
|
||||
return this.flipV ? this.baseIcon.getMaxV() : this.baseIcon.getMinV();
|
||||
}
|
||||
}
|
||||
@@ -2,11 +2,9 @@ package tconstruct.client;
|
||||
|
||||
import net.minecraft.block.Block.SoundType;
|
||||
|
||||
public class StepSoundSlime extends SoundType
|
||||
{
|
||||
public class StepSoundSlime extends SoundType {
|
||||
|
||||
public StepSoundSlime(String par1Str, float par2, float par3)
|
||||
{
|
||||
public StepSoundSlime(String par1Str, float par2, float par3) {
|
||||
super(par1Str, par2, par3);
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
@@ -15,8 +13,7 @@ public class StepSoundSlime extends SoundType
|
||||
* Used when a block breaks, EXA: Player break, Shep eating grass, etc..
|
||||
*/
|
||||
@Override
|
||||
public String getBreakSound ()
|
||||
{
|
||||
public String getBreakSound() {
|
||||
return this.soundName + ".big";
|
||||
}
|
||||
|
||||
@@ -24,9 +21,7 @@ public class StepSoundSlime extends SoundType
|
||||
* Used when a entity walks over, or otherwise interacts with the block.
|
||||
*/
|
||||
@Override
|
||||
public String getStepResourcePath ()
|
||||
{
|
||||
public String getStepResourcePath() {
|
||||
return this.soundName + ".small";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3,7 +3,6 @@ package tconstruct.client;
|
||||
import java.io.InputStream;
|
||||
import java.text.DecimalFormat;
|
||||
import javax.xml.parsers.*;
|
||||
|
||||
import mantle.client.SmallFontRenderer;
|
||||
import mantle.lib.client.MantleClientRegistry;
|
||||
import net.minecraft.client.Minecraft;
|
||||
@@ -35,7 +34,8 @@ public class TProxyClient extends TProxyCommon {
|
||||
/* Registers any rendering code. */
|
||||
public void registerRenderer() {
|
||||
Minecraft mc = Minecraft.getMinecraft();
|
||||
smallFontRenderer = new SmallFontRenderer(mc.gameSettings, new ResourceLocation("textures/font/ascii.png"), mc.renderEngine, false);
|
||||
smallFontRenderer = new SmallFontRenderer(
|
||||
mc.gameSettings, new ResourceLocation("textures/font/ascii.png"), mc.renderEngine, false);
|
||||
}
|
||||
|
||||
public static Document diary;
|
||||
@@ -47,7 +47,10 @@ public class TProxyClient extends TProxyCommon {
|
||||
|
||||
public void readManuals() {
|
||||
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
|
||||
String CurrentLanguage = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage().getLanguageCode();
|
||||
String CurrentLanguage = Minecraft.getMinecraft()
|
||||
.getLanguageManager()
|
||||
.getCurrentLanguage()
|
||||
.getLanguageCode();
|
||||
|
||||
Document diary_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/diary.xml", dbFactory);
|
||||
Document volume1_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/firstday.xml", dbFactory);
|
||||
@@ -59,7 +62,8 @@ public class TProxyClient extends TProxyCommon {
|
||||
volume1 = volume1_cl != null ? volume1_cl : readManual("/assets/tinker/manuals/en_US/firstday.xml", dbFactory);
|
||||
volume2 = volume2_cl != null ? volume2_cl : readManual("/assets/tinker/manuals/en_US/materials.xml", dbFactory);
|
||||
smelter = smelter_cl != null ? smelter_cl : readManual("/assets/tinker/manuals/en_US/smeltery.xml", dbFactory);
|
||||
weaponry = weaponry_cl != null ? weaponry_cl : readManual("/assets/tinker/manuals/en_US/weaponry.xml", dbFactory);
|
||||
weaponry =
|
||||
weaponry_cl != null ? weaponry_cl : readManual("/assets/tinker/manuals/en_US/weaponry.xml", dbFactory);
|
||||
|
||||
initManualIcons();
|
||||
initManualRecipes();
|
||||
@@ -96,12 +100,9 @@ public class TProxyClient extends TProxyCommon {
|
||||
MantleClientRegistry.registerManualIcon("netherrack", new ItemStack(Blocks.netherrack));
|
||||
}
|
||||
|
||||
public void initManualRecipes() {
|
||||
}
|
||||
public void initManualRecipes() {}
|
||||
|
||||
void initManualPages() {
|
||||
|
||||
}
|
||||
void initManualPages() {}
|
||||
|
||||
public static Document getManualFromStack(ItemStack stack) {
|
||||
switch (stack.getItemDamage()) {
|
||||
@@ -121,5 +122,4 @@ public class TProxyClient extends TProxyCommon {
|
||||
public void recalculateHealth() {
|
||||
ArmorProxyClient.armorExtended.recalculateHealth(mc.thePlayer, TPlayerStats.get(mc.thePlayer));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,10 +1,6 @@
|
||||
package tconstruct.client;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.ItemRenderer;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@@ -14,105 +10,88 @@ import org.lwjgl.opengl.*;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.library.tools.ToolCore;
|
||||
|
||||
public class ToolCoreRenderer implements IItemRenderer
|
||||
{
|
||||
public class ToolCoreRenderer implements IItemRenderer {
|
||||
private final boolean isEntity;
|
||||
private final boolean noEntityTranslation;
|
||||
|
||||
public ToolCoreRenderer()
|
||||
{
|
||||
public ToolCoreRenderer() {
|
||||
this(false, false);
|
||||
}
|
||||
|
||||
public ToolCoreRenderer(boolean isEntity)
|
||||
{
|
||||
public ToolCoreRenderer(boolean isEntity) {
|
||||
this(isEntity, false);
|
||||
}
|
||||
|
||||
public ToolCoreRenderer(boolean isEntity, boolean noEntityTranslation)
|
||||
{
|
||||
public ToolCoreRenderer(boolean isEntity, boolean noEntityTranslation) {
|
||||
this.isEntity = isEntity;
|
||||
this.noEntityTranslation = noEntityTranslation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean handleRenderType (ItemStack item, ItemRenderType type)
|
||||
{
|
||||
if (!item.hasTagCompound())
|
||||
return false;
|
||||
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
|
||||
if (!item.hasTagCompound()) return false;
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case ENTITY:
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
GL11.glTranslatef(0.03f, 0F, -0.09375F);
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
return !isEntity;
|
||||
case INVENTORY:
|
||||
return true;
|
||||
default:
|
||||
TConstruct.logger.warn("[TCon] Unhandled render case!");
|
||||
case FIRST_PERSON_MAP:
|
||||
return false;
|
||||
switch (type) {
|
||||
case ENTITY:
|
||||
return true;
|
||||
case EQUIPPED:
|
||||
GL11.glTranslatef(0.03f, 0F, -0.09375F);
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
return !isEntity;
|
||||
case INVENTORY:
|
||||
return true;
|
||||
default:
|
||||
TConstruct.logger.warn("[TCon] Unhandled render case!");
|
||||
case FIRST_PERSON_MAP:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldUseRenderHelper (ItemRenderType type, ItemStack item, ItemRendererHelper helper)
|
||||
{
|
||||
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
|
||||
return handleRenderType(item, type) & helper.ordinal() < ItemRendererHelper.EQUIPPED_BLOCK.ordinal();
|
||||
}
|
||||
|
||||
private static final int toolIcons = 10;
|
||||
|
||||
@Override
|
||||
public void renderItem (ItemRenderType type, ItemStack item, Object... data)
|
||||
{
|
||||
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
|
||||
ToolCore tool = (ToolCore) item.getItem();
|
||||
|
||||
boolean isInventory = type == ItemRenderType.INVENTORY;
|
||||
Entity ent = null;
|
||||
if (data.length > 1)
|
||||
ent = (Entity) data[1];
|
||||
if (data.length > 1) ent = (Entity) data[1];
|
||||
|
||||
int iconParts = toolIcons;//tool.getRenderPasses(item.getItemDamage());
|
||||
int iconParts = toolIcons; // tool.getRenderPasses(item.getItemDamage());
|
||||
// TODO: have the tools define how many render passes they have
|
||||
// (requires more logic rewrite than it sounds like)
|
||||
|
||||
IIcon[] tempParts = new IIcon[iconParts];
|
||||
label:
|
||||
{
|
||||
if (!isInventory && ent instanceof EntityPlayer)
|
||||
{
|
||||
if (!isInventory && ent instanceof EntityPlayer) {
|
||||
EntityPlayer player = (EntityPlayer) ent;
|
||||
ItemStack itemInUse = player.getItemInUse();
|
||||
if (itemInUse != null)
|
||||
{
|
||||
if (itemInUse != null) {
|
||||
int useCount = player.getItemInUseCount();
|
||||
for (int i = iconParts; i-- > 0;)
|
||||
for (int i = iconParts; i-- > 0; )
|
||||
tempParts[i] = tool.getIcon(item, i, player, itemInUse, useCount);
|
||||
break label;
|
||||
}
|
||||
}
|
||||
for (int i = iconParts; i-- > 0;)
|
||||
tempParts[i] = tool.getIcon(item, i);
|
||||
for (int i = iconParts; i-- > 0; ) tempParts[i] = tool.getIcon(item, i);
|
||||
}
|
||||
|
||||
int count = 0;
|
||||
IIcon[] parts = new IIcon[iconParts];
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
IIcon part = tempParts[i];
|
||||
if (part == null || part == ToolCore.blankSprite || part == ToolCore.emptyIcon)
|
||||
++count;
|
||||
else
|
||||
parts[i - count] = part;
|
||||
if (part == null || part == ToolCore.blankSprite || part == ToolCore.emptyIcon) ++count;
|
||||
else parts[i - count] = part;
|
||||
}
|
||||
iconParts -= count;
|
||||
|
||||
if (iconParts <= 0)
|
||||
{
|
||||
if (iconParts <= 0) {
|
||||
iconParts = 1;
|
||||
// TODO: assign default sprite
|
||||
// parts = new Icon[]{ defaultSprite };
|
||||
@@ -131,8 +110,7 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
float[] yDiff = new float[iconParts];
|
||||
float[] xSub = new float[iconParts];
|
||||
float[] ySub = new float[iconParts];
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
IIcon icon = parts[i];
|
||||
xMin[i] = icon.getMinU();
|
||||
xMax[i] = icon.getMaxU();
|
||||
@@ -149,26 +127,22 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
|
||||
// color
|
||||
int[] color = new int[iconParts];
|
||||
for(int i = 0; i < iconParts; i++)
|
||||
color[i] = item.getItem().getColorFromItemStack(item, i);
|
||||
|
||||
for (int i = 0; i < iconParts; i++) color[i] = item.getItem().getColorFromItemStack(item, i);
|
||||
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
if (type == ItemRenderType.INVENTORY)
|
||||
{
|
||||
if (type == ItemRenderType.INVENTORY) {
|
||||
|
||||
//TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
//texturemanager.getResourceLocation(item.getItemSpriteNumber());
|
||||
//TextureUtil.func_152777_a(false, false, 1.0F);
|
||||
// TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
// texturemanager.getResourceLocation(item.getItemSpriteNumber());
|
||||
// TextureUtil.func_152777_a(false, false, 1.0F);
|
||||
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glDisable(GL11.GL_BLEND);
|
||||
|
||||
tess.startDrawingQuads();
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
tess.addVertexWithUV(0, 16, 0, xMin[i], yMax[i]);
|
||||
tess.addVertexWithUV(16, 16, 0, xMax[i], yMax[i]);
|
||||
@@ -180,31 +154,28 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
GL11.glDisable(GL11.GL_ALPHA_TEST);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
|
||||
//GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
//texturemanager.bindTexture(texturemanager.getResourceLocation(item.getItemSpriteNumber()));
|
||||
//TextureUtil.func_147945_b();
|
||||
}
|
||||
else
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
break;
|
||||
case EQUIPPED:
|
||||
GL11.glTranslatef(0, -4 / 16f, 0);
|
||||
break;
|
||||
case ENTITY:
|
||||
if (!noEntityTranslation)
|
||||
GL11.glTranslatef(-0.5f, 0f, depth); // correction of the rotation point when items lie on the ground
|
||||
break;
|
||||
default:
|
||||
// GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
// texturemanager.bindTexture(texturemanager.getResourceLocation(item.getItemSpriteNumber()));
|
||||
// TextureUtil.func_147945_b();
|
||||
} else {
|
||||
switch (type) {
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
break;
|
||||
case EQUIPPED:
|
||||
GL11.glTranslatef(0, -4 / 16f, 0);
|
||||
break;
|
||||
case ENTITY:
|
||||
if (!noEntityTranslation)
|
||||
GL11.glTranslatef(
|
||||
-0.5f, 0f, depth); // correction of the rotation point when items lie on the ground
|
||||
break;
|
||||
default:
|
||||
}
|
||||
|
||||
// one side
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 0, 1);
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
tess.addVertexWithUV(0, 0, 0, xMax[i], yMax[i]);
|
||||
tess.addVertexWithUV(1, 0, 0, xMin[i], yMax[i]);
|
||||
@@ -216,8 +187,7 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
// other side
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 0, -1);
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
tess.addVertexWithUV(0, 1, -depth, xMax[i], yMin[i]);
|
||||
tess.addVertexWithUV(1, 1, -depth, xMin[i], yMin[i]);
|
||||
@@ -232,12 +202,10 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
float pos;
|
||||
float iconPos;
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i];
|
||||
for (int k = 0, e = (int) w; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) w; k < e; ++k) {
|
||||
pos = k / w;
|
||||
iconPos = m + d * pos - s;
|
||||
tess.addVertexWithUV(pos, 0, -depth, iconPos, yMax[i]);
|
||||
@@ -252,13 +220,11 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
tess.setNormal(1, 0, 0);
|
||||
float posEnd;
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float w = width[i], m = xMax[i], d = xDiff[i], s = xSub[i];
|
||||
float d2 = 1f / w;
|
||||
for (int k = 0, e = (int) w; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) w; k < e; ++k) {
|
||||
pos = k / w;
|
||||
iconPos = m + d * pos - s;
|
||||
posEnd = pos + d2;
|
||||
@@ -273,13 +239,11 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, 1, 0);
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i];
|
||||
float d2 = 1f / h;
|
||||
for (int k = 0, e = (int) h; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) h; k < e; ++k) {
|
||||
pos = k / h;
|
||||
iconPos = m + d * pos - s;
|
||||
posEnd = pos + d2;
|
||||
@@ -294,12 +258,10 @@ public class ToolCoreRenderer implements IItemRenderer
|
||||
tess.startDrawingQuads();
|
||||
tess.setNormal(0, -1, 0);
|
||||
|
||||
for (int i = 0; i < iconParts; ++i)
|
||||
{
|
||||
for (int i = 0; i < iconParts; ++i) {
|
||||
tess.setColorOpaque_I(color[i]);
|
||||
float h = height[i], m = yMax[i], d = yDiff[i], s = ySub[i];
|
||||
for (int k = 0, e = (int) h; k < e; ++k)
|
||||
{
|
||||
for (int k = 0, e = (int) h; k < e; ++k) {
|
||||
pos = k / h;
|
||||
iconPos = m + d * pos - s;
|
||||
tess.addVertexWithUV(1, pos, 0, xMin[i], iconPos);
|
||||
|
||||
@@ -12,32 +12,27 @@ import tconstruct.mechworks.entity.item.ExplosivePrimed;
|
||||
import tconstruct.world.TinkerWorld;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class ExplosiveRender extends Render
|
||||
{
|
||||
public class ExplosiveRender extends Render {
|
||||
private RenderBlocks blockRenderer = new RenderBlocks();
|
||||
|
||||
public ExplosiveRender()
|
||||
{
|
||||
public ExplosiveRender() {
|
||||
this.shadowSize = 0.5F;
|
||||
}
|
||||
|
||||
public void renderPrimedTNT (ExplosivePrimed par1EntityTNTPrimed, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void renderPrimedTNT(
|
||||
ExplosivePrimed par1EntityTNTPrimed, double par2, double par4, double par6, float par8, float par9) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
|
||||
float f2;
|
||||
|
||||
if ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F < 10.0F)
|
||||
{
|
||||
if ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F < 10.0F) {
|
||||
f2 = 1.0F - ((float) par1EntityTNTPrimed.fuse - par9 + 1.0F) / 10.0F;
|
||||
|
||||
if (f2 < 0.0F)
|
||||
{
|
||||
if (f2 < 0.0F) {
|
||||
f2 = 0.0F;
|
||||
}
|
||||
|
||||
if (f2 > 1.0F)
|
||||
{
|
||||
if (f2 > 1.0F) {
|
||||
f2 = 1.0F;
|
||||
}
|
||||
|
||||
@@ -51,8 +46,7 @@ public class ExplosiveRender extends Render
|
||||
this.bindEntityTexture(par1EntityTNTPrimed);
|
||||
this.blockRenderer.renderBlockAsItem(TinkerWorld.slimeExplosive, 0, par1EntityTNTPrimed.getBrightness(par9));
|
||||
|
||||
if (par1EntityTNTPrimed.fuse / 5 % 2 == 0)
|
||||
{
|
||||
if (par1EntityTNTPrimed.fuse / 5 % 2 == 0) {
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
@@ -68,8 +62,7 @@ public class ExplosiveRender extends Render
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110808_a (ExplosivePrimed par1EntityTNTPrimed)
|
||||
{
|
||||
protected ResourceLocation func_110808_a(ExplosivePrimed par1EntityTNTPrimed) {
|
||||
return TextureMap.locationBlocksTexture;
|
||||
}
|
||||
|
||||
@@ -78,8 +71,7 @@ public class ExplosiveRender extends Render
|
||||
* unless you call Render.bindEntityTexture.
|
||||
*/
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
protected ResourceLocation getEntityTexture(Entity par1Entity) {
|
||||
return this.func_110808_a((ExplosivePrimed) par1Entity);
|
||||
}
|
||||
|
||||
@@ -92,8 +84,7 @@ public class ExplosiveRender extends Render
|
||||
* f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
||||
this.renderPrimedTNT((ExplosivePrimed) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
}
|
||||
@@ -16,21 +16,22 @@ import tconstruct.tools.entity.ArrowEntity;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Deprecated
|
||||
public class ArrowRender extends Render
|
||||
{
|
||||
private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
||||
public class ArrowRender extends Render {
|
||||
private static final ResourceLocation RES_ITEM_GLINT =
|
||||
new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
||||
private RenderBlocks itemRenderBlocks = new RenderBlocks();
|
||||
|
||||
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
|
||||
private Random random = new Random();
|
||||
|
||||
public boolean renderWithColor = true;
|
||||
|
||||
/** Defines the zLevel of rendering of item on GUI. */
|
||||
public float zLevel;
|
||||
|
||||
public static boolean renderInFrame;
|
||||
|
||||
public ArrowRender()
|
||||
{
|
||||
public ArrowRender() {
|
||||
this.shadowSize = 0.15F;
|
||||
this.shadowOpaque = 0.75F;
|
||||
}
|
||||
@@ -38,14 +39,13 @@ public class ArrowRender extends Render
|
||||
/**
|
||||
* Renders the item
|
||||
*/
|
||||
public void doRenderItem (ArrowEntity par1ArrowEntity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRenderItem(
|
||||
ArrowEntity par1ArrowEntity, double par2, double par4, double par6, float par8, float par9) {
|
||||
this.bindEntityTexture(par1ArrowEntity);
|
||||
this.random.setSeed(187L);
|
||||
ItemStack itemstack = par1ArrowEntity.getEntityItem();
|
||||
|
||||
if (itemstack.getItem() != null)
|
||||
{
|
||||
if (itemstack.getItem() != null) {
|
||||
GL11.glPushMatrix();
|
||||
float f2 = shouldBob() ? MathHelper.sin(((float) 0 + par9) / 10.0F + 0) * 0.1F + 0.1F : 0F;
|
||||
float f3 = (((float) 0 + par9) / 20.0F + 0) * (180F / (float) Math.PI);
|
||||
@@ -61,26 +61,25 @@ public class ArrowRender extends Render
|
||||
Block block = null;
|
||||
block = BlockUtils.getBlockFromItem(itemstack.getItem());
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(BlockUtils.getBlockFromItem(itemstack.getItem()).getRenderType()))
|
||||
{
|
||||
if (itemstack.getItemSpriteNumber() == 0
|
||||
&& block != null
|
||||
&& RenderBlocks.renderItemIn3d(
|
||||
BlockUtils.getBlockFromItem(itemstack.getItem()).getRenderType())) {
|
||||
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
float f7 = 0.25F;
|
||||
int j = block.getRenderType();
|
||||
|
||||
if (j == 1 || j == 19 || j == 12 || j == 2)
|
||||
{
|
||||
if (j == 1 || j == 19 || j == 12 || j == 2) {
|
||||
f7 = 0.5F;
|
||||
}
|
||||
|
||||
GL11.glScalef(f7, f7, f7);
|
||||
|
||||
for (i = 0; i < b0; ++i)
|
||||
{
|
||||
for (i = 0; i < b0; ++i) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
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;
|
||||
@@ -91,53 +90,41 @@ public class ArrowRender extends Render
|
||||
this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
float f8;
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses())
|
||||
{
|
||||
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses()) {
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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(par1ArrowEntity, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.renderDroppedItem(par1ArrowEntity, icon, b0, par9, 1.0F, 1.0F, 1.0F, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
IIcon icon1 = itemstack.getIconIndex();
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
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(par1ArrowEntity, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.renderDroppedItem(par1ArrowEntity, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@@ -148,27 +135,27 @@ public class ArrowRender extends Render
|
||||
}
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110796_a (ArrowEntity par1ArrowEntity)
|
||||
{
|
||||
return this.renderManager.renderEngine.getResourceLocation(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
protected ResourceLocation func_110796_a(ArrowEntity par1ArrowEntity) {
|
||||
return this.renderManager.renderEngine.getResourceLocation(
|
||||
par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a dropped item
|
||||
*/
|
||||
private void renderDroppedItem (ArrowEntity par1ArrowEntity, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
private void renderDroppedItem(
|
||||
ArrowEntity par1ArrowEntity, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7) {
|
||||
renderDroppedItem(par1ArrowEntity, par2Icon, par3, par4, par5, par6, par7, 0);
|
||||
}
|
||||
|
||||
private void renderDroppedItem (ArrowEntity arrow, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
|
||||
{
|
||||
private void renderDroppedItem(
|
||||
ArrowEntity arrow, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (par2Icon == null)
|
||||
{
|
||||
if (par2Icon == null) {
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
ResourceLocation resourcelocation = texturemanager.getResourceLocation(arrow.getEntityItem().getItemSpriteNumber());
|
||||
ResourceLocation resourcelocation =
|
||||
texturemanager.getResourceLocation(arrow.getEntityItem().getItemSpriteNumber());
|
||||
par2Icon = ((TextureMap) texturemanager.getTexture(resourcelocation)).getAtlasSprite("missingno");
|
||||
}
|
||||
|
||||
@@ -193,39 +180,47 @@ public class ArrowRender extends Render
|
||||
|
||||
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
|
||||
|
||||
for (int k = 0; k < b0; ++k)
|
||||
{
|
||||
GL11.glRotatef(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par4 - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par4 - 45.0F, 0.0F, 0.0F, 1.0F);
|
||||
for (int k = 0; k < b0; ++k) {
|
||||
GL11.glRotatef(
|
||||
arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par4 - 90.0F,
|
||||
0.0F,
|
||||
1.0F,
|
||||
0.0F);
|
||||
GL11.glRotatef(
|
||||
arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par4 - 45.0F,
|
||||
0.0F,
|
||||
0.0F,
|
||||
1.0F);
|
||||
// Makes items offset when in 3D, like when in 2D, looks much
|
||||
// better. Considered a vanilla bug...
|
||||
if (k > 0 && shouldSpreadItems())
|
||||
{
|
||||
if (k > 0 && shouldSpreadItems()) {
|
||||
float x = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
float y = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
float z = (random.nextFloat() * 2.0F - 1.0F) * 0.3F / 0.5F;
|
||||
GL11.glTranslatef(x, y, f12 + f11);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GL11.glTranslatef(0f, 0f, f12 + f11);
|
||||
}
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0)
|
||||
{
|
||||
if (itemstack.getItemSpriteNumber() == 0) {
|
||||
this.bindTexture(TextureMap.locationBlocksTexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.bindTexture(TextureMap.locationItemsTexture);
|
||||
}
|
||||
|
||||
GL11.glColor4f(par5, par6, par7, 1.0F);
|
||||
|
||||
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((IIcon) par2Icon).getIconWidth(), ((IIcon) par2Icon).getIconHeight(), f12);
|
||||
ItemRenderer.renderItemIn2D(
|
||||
tessellator,
|
||||
f5,
|
||||
f6,
|
||||
f4,
|
||||
f7,
|
||||
((IIcon) par2Icon).getIconWidth(),
|
||||
((IIcon) par2Icon).getIconHeight(),
|
||||
f12);
|
||||
|
||||
if (itemstack.hasEffect(pass))
|
||||
{
|
||||
if (itemstack.hasEffect(pass)) {
|
||||
GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
this.renderManager.renderEngine.bindTexture(RES_ITEM_GLINT);
|
||||
@@ -260,8 +255,7 @@ public class ArrowRender extends Render
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
protected ResourceLocation getEntityTexture(Entity par1Entity) {
|
||||
return this.func_110796_a((ArrowEntity) par1Entity);
|
||||
}
|
||||
|
||||
@@ -274,28 +268,25 @@ public class ArrowRender extends Render
|
||||
* f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
||||
this.doRenderItem((ArrowEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should spread out when rendered in 3d?
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldSpreadItems ()
|
||||
{
|
||||
public boolean shouldSpreadItems() {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should have a bob effect
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldBob ()
|
||||
{
|
||||
public boolean shouldBob() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -14,30 +14,30 @@ import tconstruct.tools.entity.ArrowEntity;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Deprecated
|
||||
public class ArrowRenderCustom extends Render
|
||||
{
|
||||
public class ArrowRenderCustom extends Render {
|
||||
private static RenderItem renderer = new RenderItem();
|
||||
private Random random = new Random();
|
||||
|
||||
public ArrowRenderCustom()
|
||||
{
|
||||
}
|
||||
public ArrowRenderCustom() {}
|
||||
|
||||
/**
|
||||
* Renders the item
|
||||
*/
|
||||
public void doRenderItem (ArrowEntity arrow, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRenderItem(ArrowEntity arrow, double par2, double par4, double par6, float par8, float par9) {
|
||||
random.setSeed(187L);
|
||||
ItemStack item = arrow.getEntityItem();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
GL11.glRotatef(arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par9 - 45.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(
|
||||
arrow.prevRotationYaw + (arrow.rotationYaw - arrow.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(
|
||||
arrow.prevRotationPitch + (arrow.rotationPitch - arrow.prevRotationPitch) * par9 - 45.0F,
|
||||
0.0F,
|
||||
0.0F,
|
||||
1.0F);
|
||||
float shake = arrow.arrowShake - par9;
|
||||
if (shake > 0.0F)
|
||||
GL11.glRotatef(-MathHelper.sin(shake * 3) * shake, 0, 0, 1);
|
||||
if (shake > 0.0F) GL11.glRotatef(-MathHelper.sin(shake * 3) * shake, 0, 0, 1);
|
||||
GL11.glTranslatef(-7 / 16f, -8 / 16f, -1 / 32f);
|
||||
float scale = 1.35f;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
@@ -49,16 +49,24 @@ public class ArrowRenderCustom 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) {
|
||||
renderer.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
renderer.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
@@ -66,8 +74,12 @@ public class ArrowRenderCustom 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) {
|
||||
renderer.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
@@ -80,19 +92,17 @@ public class ArrowRenderCustom extends Render
|
||||
* f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
||||
this.doRenderItem((ArrowEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
protected ResourceLocation getEntityTexture(Entity par1Entity) {
|
||||
return this.func_110796_a((ArrowEntity) par1Entity);
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110796_a (ArrowEntity par1ArrowEntity)
|
||||
{
|
||||
return this.renderManager.renderEngine.getResourceLocation(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
protected ResourceLocation func_110796_a(ArrowEntity par1ArrowEntity) {
|
||||
return this.renderManager.renderEngine.getResourceLocation(
|
||||
par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
}
|
||||
}
|
||||
@@ -18,21 +18,22 @@ import tconstruct.tools.entity.DaggerEntity;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Deprecated
|
||||
public class DaggerRender extends Render
|
||||
{
|
||||
private static final ResourceLocation RES_ITEM_GLINT = new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
||||
public class DaggerRender extends Render {
|
||||
private static final ResourceLocation RES_ITEM_GLINT =
|
||||
new ResourceLocation("textures/misc/enchanted_item_glint.png");
|
||||
private RenderBlocks itemRenderBlocks = new RenderBlocks();
|
||||
|
||||
/** The RNG used in RenderItem (for bobbing itemstacks on the ground) */
|
||||
private Random random = new Random();
|
||||
|
||||
public boolean renderWithColor = true;
|
||||
|
||||
/** Defines the zLevel of rendering of item on GUI. */
|
||||
public float zLevel;
|
||||
|
||||
public static boolean renderInFrame = true;
|
||||
|
||||
public DaggerRender()
|
||||
{
|
||||
public DaggerRender() {
|
||||
this.shadowSize = 0.15F;
|
||||
this.shadowOpaque = 0.75F;
|
||||
}
|
||||
@@ -40,14 +41,13 @@ public class DaggerRender extends Render
|
||||
/**
|
||||
* Renders the item
|
||||
*/
|
||||
public void doRenderItem (DaggerEntity par1ArrowEntity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRenderItem(
|
||||
DaggerEntity par1ArrowEntity, double par2, double par4, double par6, float par8, float par9) {
|
||||
this.bindEntityTexture(par1ArrowEntity);
|
||||
this.random.setSeed(187L);
|
||||
ItemStack itemstack = par1ArrowEntity.getEntityItem();
|
||||
|
||||
if (itemstack.getItem() != null)
|
||||
{
|
||||
if (itemstack.getItem() != null) {
|
||||
GL11.glPushMatrix();
|
||||
float f2 = shouldBob() ? MathHelper.sin(((float) 0 + par9) / 10.0F + 0) * 0.1F + 0.1F : 0F;
|
||||
float f3 = (((float) 0 + par9) / 20.0F + 0) * (180F / (float) Math.PI);
|
||||
@@ -62,12 +62,13 @@ public class DaggerRender extends Render
|
||||
|
||||
Block block = BlockUtils.getBlockFromItem(itemstack.getItem());
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(BlockUtils.getBlockFromItem(itemstack.getItem()).getRenderType()))
|
||||
{
|
||||
if (itemstack.getItemSpriteNumber() == 0
|
||||
&& block != null
|
||||
&& RenderBlocks.renderItemIn3d(
|
||||
BlockUtils.getBlockFromItem(itemstack.getItem()).getRenderType())) {
|
||||
GL11.glRotatef(f3, 0.0F, 1.0F, 0.0F);
|
||||
|
||||
if (renderInFrame)
|
||||
{
|
||||
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);
|
||||
@@ -76,19 +77,16 @@ public class DaggerRender extends Render
|
||||
float f7 = 0.25F;
|
||||
int j = block.getRenderType();
|
||||
|
||||
if (j == 1 || j == 19 || j == 12 || j == 2)
|
||||
{
|
||||
if (j == 1 || j == 19 || j == 12 || j == 2) {
|
||||
f7 = 0.5F;
|
||||
}
|
||||
|
||||
GL11.glScalef(f7, f7, f7);
|
||||
|
||||
for (i = 0; i < b0; ++i)
|
||||
{
|
||||
for (i = 0; i < b0; ++i) {
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (i > 0)
|
||||
{
|
||||
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;
|
||||
@@ -99,69 +97,51 @@ public class DaggerRender extends Render
|
||||
this.itemRenderBlocks.renderBlockAsItem(block, itemstack.getItemDamage(), f5);
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
float f8;
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 1 && itemstack.getItem().requiresMultipleRenderPasses())
|
||||
{
|
||||
if (renderInFrame)
|
||||
{
|
||||
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
|
||||
{
|
||||
} else {
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
for (int k = 0; k < itemstack.getItem().getRenderPasses(itemstack.getItemDamage()); ++k)
|
||||
{
|
||||
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)
|
||||
{
|
||||
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(par1ArrowEntity, icon, b0, par9, f5 * f8, f4 * f8, f6 * f8, k);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.renderDroppedItem(par1ArrowEntity, icon, b0, par9, 1.0F, 1.0F, 1.0F, k);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (renderInFrame)
|
||||
{
|
||||
} else {
|
||||
if (renderInFrame) {
|
||||
GL11.glScalef(0.5128205F, 0.5128205F, 0.5128205F);
|
||||
GL11.glTranslatef(0.0F, -0.05F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
}
|
||||
|
||||
IIcon icon1 = itemstack.getIconIndex();
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
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(par1ArrowEntity, icon1, b0, par9, f8 * f4, f9 * f4, f5 * f4);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.renderDroppedItem(par1ArrowEntity, icon1, b0, par9, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
@@ -172,27 +152,27 @@ public class DaggerRender extends Render
|
||||
}
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110796_a (DaggerEntity par1ArrowEntity)
|
||||
{
|
||||
return this.renderManager.renderEngine.getResourceLocation(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
protected ResourceLocation func_110796_a(DaggerEntity par1ArrowEntity) {
|
||||
return this.renderManager.renderEngine.getResourceLocation(
|
||||
par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
}
|
||||
|
||||
/**
|
||||
* Renders a dropped item
|
||||
*/
|
||||
private void renderDroppedItem (DaggerEntity par1ArrowEntity, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7)
|
||||
{
|
||||
private void renderDroppedItem(
|
||||
DaggerEntity par1ArrowEntity, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7) {
|
||||
renderDroppedItem(par1ArrowEntity, par2Icon, par3, par4, par5, par6, par7, 0);
|
||||
}
|
||||
|
||||
private void renderDroppedItem (DaggerEntity dagger, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass)
|
||||
{
|
||||
private void renderDroppedItem(
|
||||
DaggerEntity dagger, IIcon par2Icon, int par3, float par4, float par5, float par6, float par7, int pass) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (par2Icon == null)
|
||||
{
|
||||
if (par2Icon == null) {
|
||||
TextureManager texturemanager = Minecraft.getMinecraft().getTextureManager();
|
||||
ResourceLocation resourcelocation = texturemanager.getResourceLocation(dagger.getEntityItem().getItemSpriteNumber());
|
||||
ResourceLocation resourcelocation =
|
||||
texturemanager.getResourceLocation(dagger.getEntityItem().getItemSpriteNumber());
|
||||
par2Icon = ((TextureMap) texturemanager.getTexture(resourcelocation)).getAtlasSprite("missingno");
|
||||
}
|
||||
|
||||
@@ -213,12 +193,9 @@ public class DaggerRender extends Render
|
||||
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if (renderInFrame)
|
||||
{
|
||||
if (renderInFrame) {
|
||||
GL11.glRotatef(180.0F, 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
GL11.glRotatef((((float) 0 + par4) / 20.0F + 0) * (180F / (float) Math.PI), 0.0F, 1.0F, 0.0F);
|
||||
}
|
||||
|
||||
@@ -230,25 +207,29 @@ public class DaggerRender extends Render
|
||||
|
||||
GL11.glTranslatef(-f9, -f10, -((f12 + f11) * (float) b0 / 2.0F));
|
||||
|
||||
for (int k = 0; k < b0; ++k)
|
||||
{
|
||||
for (int k = 0; k < b0; ++k) {
|
||||
// Makes items offset when in 3D, like when in 2D, looks much
|
||||
// better. Considered a vanilla bug...
|
||||
GL11.glTranslatef(0f, 0f, f12 + f11);
|
||||
|
||||
if (itemstack.getItemSpriteNumber() == 0)
|
||||
{
|
||||
if (itemstack.getItemSpriteNumber() == 0) {
|
||||
this.bindTexture(TextureMap.locationBlocksTexture);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
this.bindTexture(TextureMap.locationItemsTexture);
|
||||
}
|
||||
|
||||
GL11.glColor4f(par5, par6, par7, 1.0F);
|
||||
GL11.glRotatef(90, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(rotation, 0.0F, 0.0F, 1.0F);
|
||||
ItemRenderer.renderItemIn2D(tessellator, f5, f6, f4, f7, ((IIcon) par2Icon).getIconWidth(), ((IIcon) par2Icon).getIconHeight(), f12);
|
||||
ItemRenderer.renderItemIn2D(
|
||||
tessellator,
|
||||
f5,
|
||||
f6,
|
||||
f4,
|
||||
f7,
|
||||
((IIcon) par2Icon).getIconWidth(),
|
||||
((IIcon) par2Icon).getIconHeight(),
|
||||
f12);
|
||||
|
||||
/*
|
||||
* if (itemstack.hasEffect(pass)) { GL11.glDepthFunc(GL11.GL_EQUAL);
|
||||
@@ -280,13 +261,22 @@ public class DaggerRender 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();
|
||||
Object object = par3ItemStack.getIconIndex();
|
||||
@@ -296,8 +286,9 @@ public class DaggerRender extends Render
|
||||
float f2;
|
||||
|
||||
Block block = BlockUtils.getBlockFromItem(k);
|
||||
if (par3ItemStack.getItemSpriteNumber() == 0 && block != null && RenderBlocks.renderItemIn3d(BlockUtils.getBlockFromItem(k).getRenderType()))
|
||||
{
|
||||
if (par3ItemStack.getItemSpriteNumber() == 0
|
||||
&& block != null
|
||||
&& RenderBlocks.renderItemIn3d(BlockUtils.getBlockFromItem(k).getRenderType())) {
|
||||
par2TextureManager.bindTexture(TextureMap.locationBlocksTexture);
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) (par4 - 2), (float) (par5 + 3), -3.0F + this.zLevel);
|
||||
@@ -311,8 +302,7 @@ public class DaggerRender extends Render
|
||||
f1 = (float) (i1 >> 8 & 255) / 255.0F;
|
||||
f2 = (float) (i1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
if (this.renderWithColor) {
|
||||
GL11.glColor4f(f, f1, f2, 1.0F);
|
||||
}
|
||||
|
||||
@@ -321,44 +311,42 @@ public class DaggerRender extends Render
|
||||
this.itemRenderBlocks.renderBlockAsItem(block, l, 1.0F);
|
||||
this.itemRenderBlocks.useInventoryTint = true;
|
||||
GL11.glPopMatrix();
|
||||
}
|
||||
else if (k.requiresMultipleRenderPasses())
|
||||
{
|
||||
} else if (k.requiresMultipleRenderPasses()) {
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
|
||||
for (int j1 = 0; j1 < k.getRenderPasses(l); ++j1)
|
||||
{
|
||||
par2TextureManager.bindTexture(par3ItemStack.getItemSpriteNumber() == 0 ? TextureMap.locationBlocksTexture : TextureMap.locationItemsTexture);
|
||||
for (int j1 = 0; j1 < k.getRenderPasses(l); ++j1) {
|
||||
par2TextureManager.bindTexture(
|
||||
par3ItemStack.getItemSpriteNumber() == 0
|
||||
? TextureMap.locationBlocksTexture
|
||||
: TextureMap.locationItemsTexture);
|
||||
IIcon icon = k.getIcon(par3ItemStack, j1);
|
||||
int k1 = k.getColorFromItemStack(par3ItemStack, j1);
|
||||
f1 = (float) (k1 >> 16 & 255) / 255.0F;
|
||||
f2 = (float) (k1 >> 8 & 255) / 255.0F;
|
||||
float f3 = (float) (k1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
if (this.renderWithColor) {
|
||||
GL11.glColor4f(f1, f2, f3, 1.0F);
|
||||
}
|
||||
|
||||
this.renderIcon(par4, par5, icon, 16, 16);
|
||||
|
||||
if (par3ItemStack.hasEffect(j1))
|
||||
{
|
||||
if (par3ItemStack.hasEffect(j1)) {
|
||||
renderEffect(par2TextureManager, par4, par5);
|
||||
}
|
||||
}
|
||||
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
}
|
||||
else
|
||||
{
|
||||
} 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)).getAtlasSprite("missingno");
|
||||
if (object == null) {
|
||||
object = ((TextureMap)
|
||||
Minecraft.getMinecraft().getTextureManager().getTexture(resourcelocation))
|
||||
.getAtlasSprite("missingno");
|
||||
}
|
||||
|
||||
i1 = k.getColorFromItemStack(par3ItemStack, 0);
|
||||
@@ -366,16 +354,14 @@ public class DaggerRender extends Render
|
||||
f1 = (float) (i1 >> 8 & 255) / 255.0F;
|
||||
f2 = (float) (i1 & 255) / 255.0F;
|
||||
|
||||
if (this.renderWithColor)
|
||||
{
|
||||
if (this.renderWithColor) {
|
||||
GL11.glColor4f(f, f1, f2, 1.0F);
|
||||
}
|
||||
|
||||
this.renderIcon(par4, par5, (IIcon) object, 16, 16);
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
|
||||
if (par3ItemStack.hasEffect(0))
|
||||
{
|
||||
if (par3ItemStack.hasEffect(0)) {
|
||||
renderEffect(par2TextureManager, par4, par5);
|
||||
}
|
||||
}
|
||||
@@ -383,8 +369,7 @@ public class DaggerRender extends Render
|
||||
GL11.glEnable(GL11.GL_CULL_FACE);
|
||||
}
|
||||
|
||||
private void renderEffect (TextureManager manager, int x, int y)
|
||||
{
|
||||
private void renderEffect(TextureManager manager, int x, int y) {
|
||||
GL11.glDepthFunc(GL11.GL_GREATER);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDepthMask(false);
|
||||
@@ -404,12 +389,16 @@ public class DaggerRender 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)
|
||||
{
|
||||
if (par3ItemStack != null)
|
||||
{
|
||||
if (!ForgeHooksClient.renderInventoryItem(field_147909_c, par2TextureManager, par3ItemStack, renderWithColor, zLevel, (float) par4, (float) 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)) {
|
||||
this.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5, true);
|
||||
}
|
||||
|
||||
@@ -430,37 +419,51 @@ public class DaggerRender extends Render
|
||||
}
|
||||
}
|
||||
|
||||
private void renderGlint (int par1, int par2, int par3, int par4, int par5)
|
||||
{
|
||||
for (int j1 = 0; j1 < 2; ++j1)
|
||||
{
|
||||
if (j1 == 0)
|
||||
{
|
||||
private void renderGlint(int par1, int par2, int par3, int par4, int par5) {
|
||||
for (int j1 = 0; j1 < 2; ++j1) {
|
||||
if (j1 == 0) {
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
if (j1 == 1)
|
||||
{
|
||||
if (j1 == 1) {
|
||||
GL11.glBlendFunc(GL11.GL_SRC_COLOR, GL11.GL_ONE);
|
||||
}
|
||||
|
||||
float f = 0.00390625F;
|
||||
float f1 = 0.00390625F;
|
||||
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873)) / (3000.0F + (float) (j1 * 1873)) * 256.0F;
|
||||
float f2 = (float) (Minecraft.getSystemTime() % (long) (3000 + j1 * 1873))
|
||||
/ (3000.0F + (float) (j1 * 1873))
|
||||
* 256.0F;
|
||||
float f3 = 0.0F;
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
float f4 = 4.0F;
|
||||
|
||||
if (j1 == 1)
|
||||
{
|
||||
if (j1 == 1) {
|
||||
f4 = -1.0F;
|
||||
}
|
||||
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + par5), (double) this.zLevel, (double) ((f2 + (float) par4 + (float) par5 * f4) * f), (double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + par4), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + (float) par4) * f), (double) ((f3 + 0.0F) * f1));
|
||||
tessellator.addVertexWithUV((double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double) ((f3 + 0.0F) * f1));
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par2 + 0),
|
||||
(double) (par3 + par5),
|
||||
(double) this.zLevel,
|
||||
(double) ((f2 + (float) par5 * f4) * f),
|
||||
(double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par2 + par4),
|
||||
(double) (par3 + par5),
|
||||
(double) this.zLevel,
|
||||
(double) ((f2 + (float) par4 + (float) par5 * f4) * f),
|
||||
(double) ((f3 + (float) par5) * f1));
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par2 + par4),
|
||||
(double) (par3 + 0),
|
||||
(double) this.zLevel,
|
||||
(double) ((f2 + (float) par4) * f),
|
||||
(double) ((f3 + 0.0F) * f1));
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par2 + 0), (double) (par3 + 0), (double) this.zLevel, (double) ((f2 + 0.0F) * f), (double)
|
||||
((f3 + 0.0F) * f1));
|
||||
tessellator.draw();
|
||||
}
|
||||
}
|
||||
@@ -469,29 +472,42 @@ public class DaggerRender 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, (String) null);
|
||||
}
|
||||
|
||||
public void renderItemOverlayIntoGUI (FontRenderer par1FontRenderer, TextureManager par2TextureManager, ItemStack par3ItemStack, int par4, int par5, String par6Str)
|
||||
{
|
||||
if (par3ItemStack != null)
|
||||
{
|
||||
if (par3ItemStack.stackSize > 1 || par6Str != null)
|
||||
{
|
||||
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);
|
||||
par1FontRenderer.drawStringWithShadow(
|
||||
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 / (double) par3ItemStack.getMaxDamage());
|
||||
int l = (int) Math.round(255.0D - (double) par3ItemStack.getItemDamageForDisplay() * 255.0D / (double) par3ItemStack.getMaxDamage());
|
||||
if (par3ItemStack.isItemDamaged()) {
|
||||
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
|
||||
/ (double) par3ItemStack.getMaxDamage());
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glDisable(GL11.GL_DEPTH_TEST);
|
||||
GL11.glDisable(GL11.GL_TEXTURE_2D);
|
||||
@@ -513,8 +529,7 @@ public class DaggerRender extends Render
|
||||
* 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)
|
||||
{
|
||||
private void renderQuad(Tessellator par1Tessellator, int par2, int par3, int par4, int par5, int par6) {
|
||||
par1Tessellator.startDrawingQuads();
|
||||
par1Tessellator.setColorOpaque_I(par6);
|
||||
par1Tessellator.addVertex((double) (par2 + 0), (double) (par3 + 0), 0.0D);
|
||||
@@ -524,20 +539,29 @@ public class DaggerRender extends Render
|
||||
par1Tessellator.draw();
|
||||
}
|
||||
|
||||
public void renderIcon (int par1, int par2, IIcon par3Icon, int par4, int par5)
|
||||
{
|
||||
public void renderIcon(int par1, int par2, IIcon par3Icon, int par4, int par5) {
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV((double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double) par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV((double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double) par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par1 + 0), (double) (par2 + par5), (double) this.zLevel, (double) par3Icon.getMinU(), (double)
|
||||
par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par1 + par4),
|
||||
(double) (par2 + par5),
|
||||
(double) this.zLevel,
|
||||
(double) par3Icon.getMaxU(),
|
||||
(double) par3Icon.getMaxV());
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par1 + par4), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMaxU(), (double)
|
||||
par3Icon.getMinV());
|
||||
tessellator.addVertexWithUV(
|
||||
(double) (par1 + 0), (double) (par2 + 0), (double) this.zLevel, (double) par3Icon.getMinU(), (double)
|
||||
par3Icon.getMinV());
|
||||
tessellator.draw();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
protected ResourceLocation getEntityTexture(Entity par1Entity) {
|
||||
return this.func_110796_a((DaggerEntity) par1Entity);
|
||||
}
|
||||
|
||||
@@ -550,61 +574,49 @@ public class DaggerRender extends Render
|
||||
* f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
||||
this.doRenderItem((DaggerEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should spread out when rendered in 3d?
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldSpreadItems ()
|
||||
{
|
||||
public boolean shouldSpreadItems() {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Items should have a bob effect
|
||||
*
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
public boolean shouldBob ()
|
||||
{
|
||||
public boolean shouldBob() {
|
||||
return true;
|
||||
}
|
||||
|
||||
public byte getMiniBlockCount (ItemStack stack)
|
||||
{
|
||||
public byte getMiniBlockCount(ItemStack stack) {
|
||||
byte ret = 1;
|
||||
if (stack.stackSize > 1)
|
||||
ret = 2;
|
||||
if (stack.stackSize > 5)
|
||||
ret = 3;
|
||||
if (stack.stackSize > 20)
|
||||
ret = 4;
|
||||
if (stack.stackSize > 40)
|
||||
ret = 5;
|
||||
if (stack.stackSize > 1) ret = 2;
|
||||
if (stack.stackSize > 5) ret = 3;
|
||||
if (stack.stackSize > 20) ret = 4;
|
||||
if (stack.stackSize > 40) ret = 5;
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows for a subclass to override how many rendered items appear in a
|
||||
* "mini item 3d stack"
|
||||
*
|
||||
*
|
||||
* @param stack
|
||||
* @return
|
||||
*/
|
||||
public byte getMiniItemCount (ItemStack stack)
|
||||
{
|
||||
public byte getMiniItemCount(ItemStack stack) {
|
||||
byte ret = 1;
|
||||
if (stack.stackSize > 1)
|
||||
ret = 2;
|
||||
if (stack.stackSize > 15)
|
||||
ret = 3;
|
||||
if (stack.stackSize > 31)
|
||||
ret = 4;
|
||||
if (stack.stackSize > 1) ret = 2;
|
||||
if (stack.stackSize > 15) ret = 3;
|
||||
if (stack.stackSize > 31) ret = 4;
|
||||
return ret;
|
||||
}
|
||||
}
|
||||
@@ -15,14 +15,12 @@ import tconstruct.tools.entity.DaggerEntity;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Deprecated
|
||||
public class DaggerRenderCustom extends Render
|
||||
{
|
||||
public class DaggerRenderCustom extends Render {
|
||||
private static RenderItem renderer = new RenderItem();
|
||||
private static ToolCoreRenderer toolCoreRenderer = new ToolCoreRenderer(true, true);
|
||||
private Random random = new Random();
|
||||
|
||||
public DaggerRenderCustom()
|
||||
{
|
||||
public DaggerRenderCustom() {
|
||||
this.shadowSize = 0.15F;
|
||||
this.shadowOpaque = 0.75F;
|
||||
}
|
||||
@@ -30,25 +28,33 @@ public class DaggerRenderCustom extends Render
|
||||
/**
|
||||
* Renders the item
|
||||
*/
|
||||
public void doRenderItem (DaggerEntity dagger, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRenderItem(DaggerEntity dagger, double par2, double par4, double par6, float par8, float par9) {
|
||||
random.setSeed(187L);
|
||||
ItemStack item = dagger.getEntityItem();
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
GL11.glRotatef(dagger.prevRotationYaw + (dagger.rotationYaw - dagger.prevRotationYaw) * par9 - 90.0F, 0.0F, 1.0F, 0.0F);
|
||||
GL11.glRotatef(dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par9 - 45.0F, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(
|
||||
dagger.prevRotationYaw + (dagger.rotationYaw - dagger.prevRotationYaw) * par9 - 90.0F,
|
||||
0.0F,
|
||||
1.0F,
|
||||
0.0F);
|
||||
GL11.glRotatef(
|
||||
dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par9 - 45.0F,
|
||||
0.0F,
|
||||
0.0F,
|
||||
1.0F);
|
||||
|
||||
float rotation = dagger.prevRotationPitch + (dagger.rotationPitch - dagger.prevRotationPitch) * par9;
|
||||
GL11.glRotatef(dagger.rotationYaw + 90, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glRotatef(rotation * 15, 0.0F, 0.0F, 1.0F);
|
||||
GL11.glTranslatef(-0.25f, -0.25f, 0f); // translate to the middle. This makes it so that the dagger rotates around its center
|
||||
GL11.glTranslatef(
|
||||
-0.25f, -0.25f,
|
||||
0f); // translate to the middle. This makes it so that the dagger rotates around its center
|
||||
float shake = dagger.arrowShake - par9;
|
||||
if (shake > 0.0F)
|
||||
GL11.glRotatef(-MathHelper.sin(shake * 3) * shake, 0, 0, 1);
|
||||
//GL11.glTranslatef(-7 / 16f, -8 / 16f, -1 / 32f);
|
||||
if (shake > 0.0F) GL11.glRotatef(-MathHelper.sin(shake * 3) * shake, 0, 0, 1);
|
||||
// GL11.glTranslatef(-7 / 16f, -8 / 16f, -1 / 32f);
|
||||
float scale = 1.35f;
|
||||
GL11.glScalef(scale, scale, scale);
|
||||
|
||||
@@ -66,16 +72,24 @@ public class DaggerRenderCustom 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) {
|
||||
renderer.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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) {
|
||||
renderer.renderItemIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
@@ -83,8 +97,12 @@ public class DaggerRenderCustom 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) {
|
||||
renderer.renderItemOverlayIntoGUI(par1FontRenderer, par2TextureManager, par3ItemStack, par4, par5);
|
||||
}
|
||||
|
||||
@@ -97,19 +115,17 @@ public class DaggerRenderCustom extends Render
|
||||
* f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
||||
this.doRenderItem((DaggerEntity) par1Entity, par2, par4, par6, par8, par9);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
protected ResourceLocation getEntityTexture(Entity par1Entity) {
|
||||
return this.func_110796_a((DaggerEntity) par1Entity);
|
||||
}
|
||||
|
||||
protected ResourceLocation func_110796_a (DaggerEntity par1ArrowEntity)
|
||||
{
|
||||
return this.renderManager.renderEngine.getResourceLocation(par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
protected ResourceLocation func_110796_a(DaggerEntity par1ArrowEntity) {
|
||||
return this.renderManager.renderEngine.getResourceLocation(
|
||||
par1ArrowEntity.getEntityItem().getItemSpriteNumber());
|
||||
}
|
||||
}
|
||||
@@ -12,19 +12,16 @@ import org.lwjgl.opengl.*;
|
||||
import tconstruct.tools.entity.LaunchedPotion;
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public class LaunchedItemRender extends Render
|
||||
{
|
||||
public class LaunchedItemRender extends Render {
|
||||
private Item field_94151_a;
|
||||
private int field_94150_f;
|
||||
|
||||
public LaunchedItemRender(Item par1Item, int par2)
|
||||
{
|
||||
public LaunchedItemRender(Item par1Item, int par2) {
|
||||
this.field_94151_a = par1Item;
|
||||
this.field_94150_f = par2;
|
||||
}
|
||||
|
||||
public LaunchedItemRender(Item par1Item)
|
||||
{
|
||||
public LaunchedItemRender(Item par1Item) {
|
||||
this(par1Item, 0);
|
||||
}
|
||||
|
||||
@@ -37,12 +34,10 @@ public class LaunchedItemRender extends Render
|
||||
* f1). But JAD is pre 1.5 so doesn't do that.
|
||||
*/
|
||||
@Override
|
||||
public void doRender (Entity par1Entity, double par2, double par4, double par6, float par8, float par9)
|
||||
{
|
||||
public void doRender(Entity par1Entity, double par2, double par4, double par6, float par8, float par9) {
|
||||
IIcon icon = this.field_94151_a.getIconFromDamage(this.field_94150_f);
|
||||
|
||||
if (icon != null)
|
||||
{
|
||||
if (icon != null) {
|
||||
GL11.glPushMatrix();
|
||||
GL11.glTranslatef((float) par2, (float) par4, (float) par6);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
@@ -50,8 +45,7 @@ public class LaunchedItemRender extends Render
|
||||
this.bindEntityTexture(par1Entity);
|
||||
Tessellator tessellator = Tessellator.instance;
|
||||
|
||||
if (icon == ItemPotion.func_94589_d("bottle_splash"))
|
||||
{
|
||||
if (icon == ItemPotion.func_94589_d("bottle_splash")) {
|
||||
int i = PotionHelper.func_77915_a(((LaunchedPotion) par1Entity).getPotionDamage(), false);
|
||||
float f2 = (float) (i >> 16 & 255) / 255.0F;
|
||||
float f3 = (float) (i >> 8 & 255) / 255.0F;
|
||||
@@ -70,13 +64,11 @@ public class LaunchedItemRender extends Render
|
||||
}
|
||||
|
||||
@Override
|
||||
protected ResourceLocation getEntityTexture (Entity par1Entity)
|
||||
{
|
||||
protected ResourceLocation getEntityTexture(Entity par1Entity) {
|
||||
return TextureMap.locationItemsTexture;
|
||||
}
|
||||
|
||||
private void func_77026_a (Tessellator par1Tessellator, IIcon par2Icon)
|
||||
{
|
||||
private void func_77026_a(Tessellator par1Tessellator, IIcon par2Icon) {
|
||||
float f = par2Icon.getMinU();
|
||||
float f1 = par2Icon.getMaxU();
|
||||
float f2 = par2Icon.getMinV();
|
||||
@@ -94,5 +86,4 @@ public class LaunchedItemRender extends Render
|
||||
par1Tessellator.addVertexWithUV((double) (0.0F - f5), (double) (f4 - f6), 0.0D, (double) f, (double) f2);
|
||||
par1Tessellator.draw();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,19 +4,13 @@ import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.entity.Render;
|
||||
import net.minecraft.entity.Entity;
|
||||
|
||||
public abstract class RangedRenderBase extends Render
|
||||
{
|
||||
public RangedRenderBase()
|
||||
{
|
||||
}
|
||||
public abstract class RangedRenderBase extends Render {
|
||||
public RangedRenderBase() {}
|
||||
|
||||
@Override
|
||||
public void doRender (Entity entity, double d, double d1, double d2, float f, float f1)
|
||||
{
|
||||
}
|
||||
public void doRender(Entity entity, double d, double d1, double d2, float f, float f1) {}
|
||||
|
||||
public void renderItem (Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5)
|
||||
{
|
||||
public void renderItem(Tessellator tessellator, float f, float f1, float f2, float f3, float f4, float f5) {
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 0.0F, 1.0F);
|
||||
tessellator.addVertexWithUV(0.0D, 0.0D - (double) f5, 0.0D, f1, f3);
|
||||
@@ -33,8 +27,7 @@ public abstract class RangedRenderBase extends Render
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(-1F, 0.0F, 0.0F);
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
for (int i = 0; i < 16; i++) {
|
||||
float f6 = (float) i / 16F;
|
||||
float f10 = (f1 + (f - f1) * f6) - 0.001953125F;
|
||||
float f14 = f4 * f6 + 0.0625F;
|
||||
@@ -47,8 +40,7 @@ public abstract class RangedRenderBase extends Render
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(1.0F, 0.0F, 0.0F);
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
for (int j = 0; j < 16; j++) {
|
||||
float f7 = (float) j / 16F;
|
||||
float f11 = (f1 + (f - f1) * f7) - 0.001953125F;
|
||||
float f15 = f4 * f7;
|
||||
@@ -61,8 +53,7 @@ public abstract class RangedRenderBase extends Render
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, 1.0F, 0.0F);
|
||||
for (int k = 0; k < 16; k++)
|
||||
{
|
||||
for (int k = 0; k < 16; k++) {
|
||||
float f8 = (float) k / 16F;
|
||||
float f12 = (f3 + (f2 - f3) * f8) - 0.001953125F;
|
||||
float f16 = f4 * f8;
|
||||
@@ -75,8 +66,7 @@ public abstract class RangedRenderBase extends Render
|
||||
tessellator.draw();
|
||||
tessellator.startDrawingQuads();
|
||||
tessellator.setNormal(0.0F, -1F, 0.0F);
|
||||
for (int l = 0; l < 16; l++)
|
||||
{
|
||||
for (int l = 0; l < 16; l++) {
|
||||
float f9 = (float) l / 16F;
|
||||
float f13 = (f3 + (f2 - f3) * f9) - 0.001953125F;
|
||||
float f17 = f4 * f9 + 0.0625F;
|
||||
|
||||
@@ -8,17 +8,14 @@ import net.minecraft.util.*;
|
||||
import org.lwjgl.opengl.*;
|
||||
import org.w3c.dom.*;
|
||||
|
||||
public class BlockCastPage extends BookPage
|
||||
{
|
||||
public class BlockCastPage extends BookPage {
|
||||
String text;
|
||||
ItemStack[] icons;
|
||||
|
||||
@Override
|
||||
public void readPageFromXML (Element element)
|
||||
{
|
||||
public void readPageFromXML(Element element) {
|
||||
NodeList nodes = element.getElementsByTagName("text");
|
||||
if (nodes != null)
|
||||
text = nodes.item(0).getTextContent();
|
||||
if (nodes != null) text = nodes.item(0).getTextContent();
|
||||
|
||||
nodes = element.getElementsByTagName("recipe");
|
||||
if (nodes != null)
|
||||
@@ -26,12 +23,9 @@ public class BlockCastPage extends BookPage
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderContentLayer (int localWidth, int localHeight, boolean isTranslatable)
|
||||
{
|
||||
if (text != null)
|
||||
{
|
||||
if (isTranslatable)
|
||||
text = StatCollector.translateToLocal(text);
|
||||
public void renderContentLayer(int localWidth, int localHeight, boolean isTranslatable) {
|
||||
if (text != null) {
|
||||
if (isTranslatable) text = StatCollector.translateToLocal(text);
|
||||
manual.fonts.drawString("\u00a7n" + text, localWidth + 70, localHeight + 4, 0);
|
||||
}
|
||||
GL11.glScalef(2f, 2f, 2f);
|
||||
@@ -39,20 +33,28 @@ public class BlockCastPage extends BookPage
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
manual.renderitem.zLevel = 100;
|
||||
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 138) / 2, (localHeight + 110) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 70) / 2, (localHeight + 74) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth + 70) / 2, (localHeight + 110) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 138) / 2, (localHeight + 110) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 70) / 2, (localHeight + 74) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth + 70) / 2, (localHeight + 110) / 2);
|
||||
|
||||
if (icons[0].stackSize > 1)
|
||||
manual.renderitem.renderItemOverlayIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 106) / 2, (localHeight + 74) / 2, String.valueOf(icons[0].stackSize));
|
||||
manual.renderitem.renderItemOverlayIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[0],
|
||||
(localWidth + 106) / 2,
|
||||
(localHeight + 74) / 2,
|
||||
String.valueOf(icons[0].stackSize));
|
||||
|
||||
manual.renderitem.zLevel = 0;
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
String ingr = StatCollector.translateToLocal("manual.page.casting1");
|
||||
if (isTranslatable)
|
||||
ingr = StatCollector.translateToLocal(ingr);
|
||||
if (isTranslatable) ingr = StatCollector.translateToLocal(ingr);
|
||||
manual.fonts.drawString(ingr + ":", localWidth + 120, localHeight + 32, 0);
|
||||
manual.fonts.drawString("- " + icons[1].getDisplayName(), localWidth + 120, localHeight + 42, 0);
|
||||
if (icons[2] != null)
|
||||
@@ -62,8 +64,7 @@ public class BlockCastPage extends BookPage
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/booksmeltery.png");
|
||||
|
||||
@Override
|
||||
public void renderBackgroundLayer (int localWidth, int localHeight)
|
||||
{
|
||||
public void renderBackgroundLayer(int localWidth, int localHeight) {
|
||||
manual.getMC().getTextureManager().bindTexture(background);
|
||||
manual.drawTexturedModalRect(localWidth, localHeight + 32, 0, 0, 174, 115);
|
||||
manual.drawTexturedModalRect(localWidth + 62, localHeight + 105, 2, 118, 45, 45);
|
||||
|
||||
@@ -12,25 +12,21 @@ import tconstruct.library.crafting.PatternBuilder;
|
||||
import tconstruct.library.tools.ToolMaterial;
|
||||
import tconstruct.library.util.HarvestLevels;
|
||||
|
||||
public class MaterialPage extends BookPage
|
||||
{
|
||||
public class MaterialPage extends BookPage {
|
||||
String title;
|
||||
ItemStack[] icons;
|
||||
String iconText;
|
||||
ToolMaterial material;
|
||||
|
||||
@Override
|
||||
public void readPageFromXML (Element element)
|
||||
{
|
||||
public void readPageFromXML(Element element) {
|
||||
NodeList nodes = element.getElementsByTagName("title");
|
||||
if (nodes != null)
|
||||
title = nodes.item(0).getTextContent();
|
||||
if (nodes != null) title = nodes.item(0).getTextContent();
|
||||
|
||||
icons = new ItemStack[4];
|
||||
|
||||
nodes = element.getElementsByTagName("text");
|
||||
if (nodes != null)
|
||||
iconText = nodes.item(0).getTextContent();
|
||||
if (nodes != null) iconText = nodes.item(0).getTextContent();
|
||||
|
||||
nodes = element.getElementsByTagName("icon");
|
||||
if (nodes != null)
|
||||
@@ -39,8 +35,7 @@ public class MaterialPage extends BookPage
|
||||
nodes = element.getElementsByTagName("toolmaterial");
|
||||
if (nodes != null && nodes.getLength() > 0)
|
||||
material = TConstructRegistry.getMaterial(nodes.item(0).getTextContent());
|
||||
else
|
||||
material = TConstructRegistry.getMaterial(title);
|
||||
else material = TConstructRegistry.getMaterial(title);
|
||||
|
||||
nodes = element.getElementsByTagName("material").item(0).getChildNodes();
|
||||
|
||||
@@ -50,8 +45,7 @@ public class MaterialPage extends BookPage
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderContentLayer (int localWidth, int localHeight, boolean isTranslatable)
|
||||
{
|
||||
public void renderContentLayer(int localWidth, int localHeight, boolean isTranslatable) {
|
||||
String mat = StatCollector.translateToLocal("manual.page.material.material");
|
||||
String shard = StatCollector.translateToLocal("manual.page.material.shard");
|
||||
String rod = StatCollector.translateToLocal("manual.page.material.rod");
|
||||
@@ -70,8 +64,7 @@ public class MaterialPage extends BookPage
|
||||
String stoneboundLevel = StatCollector.translateToLocal("manual.page.material8");
|
||||
String splinteringLevel = StatCollector.translateToLocal("manual.page.material9");
|
||||
|
||||
if (isTranslatable)
|
||||
{
|
||||
if (isTranslatable) {
|
||||
title = StatCollector.translateToLocal(title);
|
||||
iconText = StatCollector.translateToLocal(iconText);
|
||||
mat = StatCollector.translateToLocal(mat);
|
||||
@@ -91,7 +84,6 @@ public class MaterialPage extends BookPage
|
||||
reinforcedLevel = StatCollector.translateToLocal(reinforcedLevel);
|
||||
stoneboundLevel = StatCollector.translateToLocal(stoneboundLevel);
|
||||
splinteringLevel = StatCollector.translateToLocal(splinteringLevel);
|
||||
|
||||
}
|
||||
manual.fonts.drawString("\u00a7n" + title, localWidth + 70, localHeight + 4, 0);
|
||||
manual.fonts.drawSplitString(iconText, localWidth, localHeight + 16, 178, 0);
|
||||
@@ -105,75 +97,98 @@ public class MaterialPage extends BookPage
|
||||
manual.renderitem.zLevel = 100;
|
||||
// renderitem.renderItemAndEffectIntoGUI(fonts, getMC().renderEngine,
|
||||
// icons[0], localWidth + 50, localHeight + 0);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], localWidth + 108, localHeight + 50);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], localWidth + 108, localHeight + 82);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[3], localWidth + 108, localHeight + 114);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[1], localWidth + 108, localHeight + 50);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[2], localWidth + 108, localHeight + 82);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[3], localWidth + 108, localHeight + 114);
|
||||
manual.renderitem.zLevel = 0;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
GL11.glDisable(GL12.GL_RESCALE_NORMAL);
|
||||
|
||||
String icon = icons[1].getTooltip(manual.getMC().thePlayer, false).get((0)).toString();
|
||||
if (isTranslatable)
|
||||
icon = StatCollector.translateToLocal(icon);
|
||||
String icon =
|
||||
icons[1].getTooltip(manual.getMC().thePlayer, false).get((0)).toString();
|
||||
if (isTranslatable) icon = StatCollector.translateToLocal(icon);
|
||||
int iconOffset = icon.length() > 12 ? 0 : 3;
|
||||
manual.fonts.drawSplitString(icon, localWidth + 128, localHeight + 50 + iconOffset, 52, 0);
|
||||
|
||||
if (icons[2] != null)
|
||||
{
|
||||
if (icons[2] != null) {
|
||||
icon = icons[2].getTooltip(manual.getMC().thePlayer, false).get((0)).toString();
|
||||
if (isTranslatable)
|
||||
icon = StatCollector.translateToLocal(icon);
|
||||
if (isTranslatable) icon = StatCollector.translateToLocal(icon);
|
||||
iconOffset = icon.length() > 12 ? 0 : 3;
|
||||
manual.fonts.drawSplitString(icons[2].getTooltip(manual.getMC().thePlayer, false).get((0)).toString(), localWidth + 128, localHeight + 82 + iconOffset, 52, 0);
|
||||
manual.fonts.drawSplitString(
|
||||
icons[2].getTooltip(manual.getMC().thePlayer, false)
|
||||
.get((0))
|
||||
.toString(),
|
||||
localWidth + 128,
|
||||
localHeight + 82 + iconOffset,
|
||||
52,
|
||||
0);
|
||||
}
|
||||
if (icons[3] != null)
|
||||
{
|
||||
if (icons[3] != null) {
|
||||
icon = icons[3].getTooltip(manual.getMC().thePlayer, false).get((0)).toString();
|
||||
if (isTranslatable)
|
||||
icon = StatCollector.translateToLocal(icon);
|
||||
if (isTranslatable) icon = StatCollector.translateToLocal(icon);
|
||||
iconOffset = icon.length() > 12 ? 0 : 3;
|
||||
manual.fonts.drawSplitString(icons[3].getTooltip(manual.getMC().thePlayer, false).get((0)).toString(), localWidth + 128, localHeight + 114 + iconOffset, 52, 0);
|
||||
manual.fonts.drawSplitString(
|
||||
icons[3].getTooltip(manual.getMC().thePlayer, false)
|
||||
.get((0))
|
||||
.toString(),
|
||||
localWidth + 128,
|
||||
localHeight + 114 + iconOffset,
|
||||
52,
|
||||
0);
|
||||
}
|
||||
|
||||
manual.fonts.drawString(durability + ": " + material.durability(), localWidth, localHeight + 40, 0);
|
||||
manual.fonts.drawString(handleModifier + ": " + material.handleDurability() + "x", localWidth, localHeight + 50, 0);
|
||||
manual.fonts.drawString(fullToolDurability + ": " + (int) (material.durability() * material.handleDurability()), localWidth, localHeight + 60, 0);
|
||||
manual.fonts.drawString(
|
||||
handleModifier + ": " + material.handleDurability() + "x", localWidth, localHeight + 50, 0);
|
||||
manual.fonts.drawString(
|
||||
fullToolDurability + ": " + (int) (material.durability() * material.handleDurability()),
|
||||
localWidth,
|
||||
localHeight + 60,
|
||||
0);
|
||||
|
||||
manual.fonts.drawString(miningSpeed + ": " + material.toolSpeed() / 100f, localWidth, localHeight + 80, 0);
|
||||
manual.fonts.drawString(miningLevel + ": " + material.harvestLevel() + " (" + HarvestLevels.getHarvestLevelName(material.harvestLevel()) + ")", localWidth, localHeight + 90, 0);
|
||||
manual.fonts.drawString(
|
||||
miningLevel + ": " + material.harvestLevel() + " ("
|
||||
+ HarvestLevels.getHarvestLevelName(material.harvestLevel()) + ")",
|
||||
localWidth,
|
||||
localHeight + 90,
|
||||
0);
|
||||
int attack = material.attack();
|
||||
String heart = attack == 2 ? " " + heart_ : " " + hearts;
|
||||
if (attack % 2 == 0)
|
||||
manual.fonts.drawString(baseAttack + ": " + material.attack() / 2 + heart, localWidth, localHeight + 100, 0);
|
||||
manual.fonts.drawString(
|
||||
baseAttack + ": " + material.attack() / 2 + heart, localWidth, localHeight + 100, 0);
|
||||
else
|
||||
manual.fonts.drawString(baseAttack + ": " + material.attack() / 2f + heart, localWidth, localHeight + 100, 0);
|
||||
manual.fonts.drawString(
|
||||
baseAttack + ": " + material.attack() / 2f + heart, localWidth, localHeight + 100, 0);
|
||||
|
||||
int offset = 0;
|
||||
String ability = material.ability();
|
||||
if (!ability.equals(""))
|
||||
{
|
||||
if (!ability.equals("")) {
|
||||
manual.fonts.drawString(materialTrait + ": " + ability, localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
offset++;
|
||||
if (material.name().equals("Paper") || material.name().equals("Thaumium"))
|
||||
manual.fonts.drawString(extraMod, localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
}
|
||||
|
||||
if (material.reinforced() > 0)
|
||||
{
|
||||
if (material.reinforced() > 0) {
|
||||
manual.fonts.drawString(traitReinforced, localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
offset++;
|
||||
manual.fonts.drawString(reinforcedLevel + ": " + material.reinforced(), localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
manual.fonts.drawString(
|
||||
reinforcedLevel + ": " + material.reinforced(), localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
offset++;
|
||||
}
|
||||
|
||||
if (material.shoddy() > 0)
|
||||
{
|
||||
manual.fonts.drawString(stoneboundLevel + ": " + material.shoddy(), localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
if (material.shoddy() > 0) {
|
||||
manual.fonts.drawString(
|
||||
stoneboundLevel + ": " + material.shoddy(), localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
offset++;
|
||||
}
|
||||
else if (material.shoddy() < 0)
|
||||
{
|
||||
manual.fonts.drawString(splinteringLevel + ": " + -material.shoddy(), localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
} else if (material.shoddy() < 0) {
|
||||
manual.fonts.drawString(
|
||||
splinteringLevel + ": " + -material.shoddy(), localWidth, localHeight + 120 + 10 * offset, 0);
|
||||
offset++;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,8 +9,7 @@ import net.minecraft.util.*;
|
||||
import org.lwjgl.opengl.*;
|
||||
import org.w3c.dom.*;
|
||||
|
||||
public class ModifierPage extends BookPage
|
||||
{
|
||||
public class ModifierPage extends BookPage {
|
||||
String type;
|
||||
ItemStack[] icons;
|
||||
ItemStack[][] iconsMulti;
|
||||
@@ -20,28 +19,23 @@ public class ModifierPage extends BookPage
|
||||
int counter;
|
||||
|
||||
@Override
|
||||
public void readPageFromXML (Element element)
|
||||
{
|
||||
public void readPageFromXML(Element element) {
|
||||
NodeList nodes = element.getElementsByTagName("tooltype");
|
||||
if (nodes != null)
|
||||
type = nodes.item(0).getTextContent();
|
||||
if (nodes != null) type = nodes.item(0).getTextContent();
|
||||
|
||||
nodes = element.getElementsByTagName("recipe");
|
||||
if (nodes != null)
|
||||
{
|
||||
if (nodes != null) {
|
||||
String recipe = nodes.item(0).getTextContent();
|
||||
icons = MantleClientRegistry.getRecipeIcons(recipe);
|
||||
|
||||
if (type.equals("travelmulti"))
|
||||
{
|
||||
if (type.equals("travelmulti")) {
|
||||
List<ItemStack[]> stacks = new LinkedList<ItemStack[]>();
|
||||
List<String> tools = new LinkedList<String>();
|
||||
String[] suffixes = new String[] { "goggles", "vest", "wings", "boots", "glove", "belt" };
|
||||
for (String suffix : suffixes)
|
||||
{
|
||||
ItemStack[] icons2 = MantleClientRegistry.getRecipeIcons(nodes.item(0).getTextContent() + suffix);
|
||||
if (icons2 != null)
|
||||
{
|
||||
String[] suffixes = new String[] {"goggles", "vest", "wings", "boots", "glove", "belt"};
|
||||
for (String suffix : suffixes) {
|
||||
ItemStack[] icons2 =
|
||||
MantleClientRegistry.getRecipeIcons(nodes.item(0).getTextContent() + suffix);
|
||||
if (icons2 != null) {
|
||||
stacks.add(icons2);
|
||||
tools.add(suffix);
|
||||
}
|
||||
@@ -49,8 +43,7 @@ public class ModifierPage extends BookPage
|
||||
|
||||
iconsMulti = new ItemStack[stacks.size()][];
|
||||
toolMulti = new ItemStack[stacks.size()];
|
||||
for (int i = 0; i < stacks.size(); i++)
|
||||
{
|
||||
for (int i = 0; i < stacks.size(); i++) {
|
||||
iconsMulti[i] = stacks.get(i);
|
||||
toolMulti[i] = MantleClientRegistry.getManualIcon("travel" + tools.get(i));
|
||||
}
|
||||
@@ -64,67 +57,87 @@ public class ModifierPage extends BookPage
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderContentLayer (int localWidth, int localHeight, boolean isTranslatable)
|
||||
{
|
||||
public void renderContentLayer(int localWidth, int localHeight, boolean isTranslatable) {
|
||||
String tStation = StatCollector.translateToLocal("manual.page.modifier1");
|
||||
if (icons.length > 3)
|
||||
tStation = StatCollector.translateToLocal("manual.page.modifier2");
|
||||
if (icons.length > 4)
|
||||
tStation = StatCollector.translateToLocal("manual.page.modifier3");
|
||||
if (isTranslatable)
|
||||
tStation = StatCollector.translateToLocal(tStation);
|
||||
if (icons.length > 3) tStation = StatCollector.translateToLocal("manual.page.modifier2");
|
||||
if (icons.length > 4) tStation = StatCollector.translateToLocal("manual.page.modifier3");
|
||||
if (isTranslatable) tStation = StatCollector.translateToLocal(tStation);
|
||||
manual.fonts.drawString("\u00a7n" + tStation, localWidth + 60, localHeight + 4, 0);
|
||||
GL11.glScalef(2f, 2f, 2f);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
|
||||
ItemStack toolstack = MantleClientRegistry.getManualIcon("ironpick");
|
||||
if (type.equals("weapon"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("ironlongsword");
|
||||
if (type.equals("travelgoggles"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelgoggles");
|
||||
if (type.equals("travelvest"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelvest");
|
||||
if (type.equals("travelwings"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelwings");
|
||||
if (type.equals("travelboots"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelboots");
|
||||
if (type.equals("travelbelt"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelbelt");
|
||||
if (type.equals("travelglove"))
|
||||
toolstack = MantleClientRegistry.getManualIcon("travelglove");
|
||||
if (type.equals("travelmulti"))
|
||||
toolstack = toolMulti[counter];
|
||||
if (type.equals("weapon")) toolstack = MantleClientRegistry.getManualIcon("ironlongsword");
|
||||
if (type.equals("travelgoggles")) toolstack = MantleClientRegistry.getManualIcon("travelgoggles");
|
||||
if (type.equals("travelvest")) toolstack = MantleClientRegistry.getManualIcon("travelvest");
|
||||
if (type.equals("travelwings")) toolstack = MantleClientRegistry.getManualIcon("travelwings");
|
||||
if (type.equals("travelboots")) toolstack = MantleClientRegistry.getManualIcon("travelboots");
|
||||
if (type.equals("travelbelt")) toolstack = MantleClientRegistry.getManualIcon("travelbelt");
|
||||
if (type.equals("travelglove")) toolstack = MantleClientRegistry.getManualIcon("travelglove");
|
||||
if (type.equals("travelmulti")) toolstack = toolMulti[counter];
|
||||
|
||||
// update displayed item
|
||||
if (iconsMulti != null && iconsMulti.length > 0 && type.equals("travelmulti") && System.currentTimeMillis() - lastUpdate > 1000)
|
||||
{
|
||||
if (iconsMulti != null
|
||||
&& iconsMulti.length > 0
|
||||
&& type.equals("travelmulti")
|
||||
&& System.currentTimeMillis() - lastUpdate > 1000) {
|
||||
lastUpdate = System.currentTimeMillis();
|
||||
counter++;
|
||||
if (counter >= iconsMulti.length)
|
||||
counter = 0;
|
||||
if (counter >= iconsMulti.length) counter = 0;
|
||||
icons = iconsMulti[counter];
|
||||
toolstack = toolMulti[counter];
|
||||
}
|
||||
|
||||
manual.renderitem.zLevel = 100;
|
||||
if (icons.length < 4)
|
||||
{
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, toolstack, (localWidth + 54) / 2, (localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 130) / 2, (localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 18) / 2, (localHeight + 36) / 2);
|
||||
if (icons.length < 4) {
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
toolstack,
|
||||
(localWidth + 54) / 2,
|
||||
(localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[0],
|
||||
(localWidth + 130) / 2,
|
||||
(localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth + 18) / 2, (localHeight + 36) / 2);
|
||||
if (icons[2] != null)
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth + 18) / 2, (localHeight + 74) / 2);
|
||||
}
|
||||
else
|
||||
{
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, toolstack, (localWidth + 74) / 2, (localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], (localWidth + 140) / 2, (localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth - 2) / 2, (localHeight + 36) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth - 2) / 2, (localHeight + 74) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[3], (localWidth + 36) / 2, (localHeight + 36) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[2],
|
||||
(localWidth + 18) / 2,
|
||||
(localHeight + 74) / 2);
|
||||
} else {
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
toolstack,
|
||||
(localWidth + 74) / 2,
|
||||
(localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[0],
|
||||
(localWidth + 140) / 2,
|
||||
(localHeight + 54) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[1], (localWidth - 2) / 2, (localHeight + 36) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[2], (localWidth - 2) / 2, (localHeight + 74) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[3], (localWidth + 36) / 2, (localHeight + 36) / 2);
|
||||
if (icons[4] != null)
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[4], (localWidth + 36) / 2, (localHeight + 74) / 2);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[4],
|
||||
(localWidth + 36) / 2,
|
||||
(localHeight + 74) / 2);
|
||||
}
|
||||
manual.renderitem.zLevel = 0;
|
||||
|
||||
@@ -136,12 +149,9 @@ public class ModifierPage extends BookPage
|
||||
private static final ResourceLocation background = new ResourceLocation("tinker", "textures/gui/bookmodify.png");
|
||||
|
||||
@Override
|
||||
public void renderBackgroundLayer (int localWidth, int localHeight)
|
||||
{
|
||||
public void renderBackgroundLayer(int localWidth, int localHeight) {
|
||||
manual.getMC().getTextureManager().bindTexture(background);
|
||||
if (icons.length > 3)
|
||||
manual.drawTexturedModalRect(localWidth - 7, localHeight + 32, 0, 80, 182, 78);
|
||||
else
|
||||
manual.drawTexturedModalRect(localWidth + 12, localHeight + 32, 0, 0, 154, 78);
|
||||
if (icons.length > 3) manual.drawTexturedModalRect(localWidth - 7, localHeight + 32, 0, 80, 182, 78);
|
||||
else manual.drawTexturedModalRect(localWidth + 12, localHeight + 32, 0, 0, 154, 78);
|
||||
}
|
||||
}
|
||||
@@ -8,33 +8,28 @@ import net.minecraft.util.StatCollector;
|
||||
import org.lwjgl.opengl.*;
|
||||
import org.w3c.dom.*;
|
||||
|
||||
public class ToolPage extends BookPage
|
||||
{
|
||||
public class ToolPage extends BookPage {
|
||||
String title;
|
||||
ItemStack[] icons;
|
||||
String[] iconText;
|
||||
|
||||
@Override
|
||||
public void readPageFromXML (Element element)
|
||||
{
|
||||
public void readPageFromXML(Element element) {
|
||||
NodeList nodes = element.getElementsByTagName("title");
|
||||
if (nodes != null)
|
||||
title = nodes.item(0).getTextContent();
|
||||
if (nodes != null) title = nodes.item(0).getTextContent();
|
||||
|
||||
nodes = element.getElementsByTagName("item");
|
||||
iconText = new String[nodes.getLength() + 2];
|
||||
icons = new ItemStack[nodes.getLength() + 1];
|
||||
|
||||
for (int i = 0; i < nodes.getLength(); i++)
|
||||
{
|
||||
for (int i = 0; i < nodes.getLength(); i++) {
|
||||
NodeList children = nodes.item(i).getChildNodes();
|
||||
iconText[i + 2] = children.item(1).getTextContent();
|
||||
icons[i + 1] = MantleClientRegistry.getManualIcon(children.item(3).getTextContent());
|
||||
}
|
||||
|
||||
nodes = element.getElementsByTagName("text");
|
||||
if (nodes != null)
|
||||
{
|
||||
if (nodes != null) {
|
||||
iconText[0] = nodes.item(0).getTextContent();
|
||||
iconText[1] = nodes.item(1).getTextContent();
|
||||
}
|
||||
@@ -45,11 +40,9 @@ public class ToolPage extends BookPage
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderContentLayer (int localWidth, int localHeight, boolean isTranslatable)
|
||||
{
|
||||
public void renderContentLayer(int localWidth, int localHeight, boolean isTranslatable) {
|
||||
String cParts = StatCollector.translateToLocal("manual.page.tool1");
|
||||
if (isTranslatable)
|
||||
{
|
||||
if (isTranslatable) {
|
||||
title = StatCollector.translateToLocal(title);
|
||||
iconText[0] = StatCollector.translateToLocal(iconText[0]);
|
||||
iconText[1] = StatCollector.translateToLocal(iconText[1]);
|
||||
@@ -66,12 +59,18 @@ public class ToolPage extends BookPage
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
RenderHelper.enableGUIStandardItemLighting();
|
||||
manual.renderitem.zLevel = 100;
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[0], localWidth + 50, localHeight + 0);
|
||||
for (int i = 1; i < icons.length; i++)
|
||||
{
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(manual.fonts, manual.getMC().renderEngine, icons[i], localWidth + 120, localHeight + 20 + 10 * size + 18 * i);
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts, manual.getMC().renderEngine, icons[0], localWidth + 50, localHeight + 0);
|
||||
for (int i = 1; i < icons.length; i++) {
|
||||
manual.renderitem.renderItemAndEffectIntoGUI(
|
||||
manual.fonts,
|
||||
manual.getMC().renderEngine,
|
||||
icons[i],
|
||||
localWidth + 120,
|
||||
localHeight + 20 + 10 * size + 18 * i);
|
||||
int partOffset = iconText[i + 1].length() > 11 ? -3 : 0;
|
||||
manual.fonts.drawSplitString(iconText[i + 1], localWidth + 140, localHeight + 24 + 10 * size + 18 * i + partOffset, 44, 0);
|
||||
manual.fonts.drawSplitString(
|
||||
iconText[i + 1], localWidth + 140, localHeight + 24 + 10 * size + 18 * i + partOffset, 44, 0);
|
||||
}
|
||||
manual.renderitem.zLevel = 0;
|
||||
RenderHelper.disableStandardItemLighting();
|
||||
|
||||
@@ -8,23 +8,19 @@ import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import org.lwjgl.opengl.*;
|
||||
|
||||
public abstract class AbstractTab extends GuiButton
|
||||
{
|
||||
public abstract class AbstractTab extends GuiButton {
|
||||
ResourceLocation texture = new ResourceLocation("textures/gui/container/creative_inventory/tabs.png");
|
||||
ItemStack renderStack;
|
||||
RenderItem itemRenderer = new RenderItem();
|
||||
|
||||
public AbstractTab(int id, int posX, int posY, ItemStack renderStack)
|
||||
{
|
||||
public AbstractTab(int id, int posX, int posY, ItemStack renderStack) {
|
||||
super(id, posX, posY, 28, 32, "");
|
||||
this.renderStack = renderStack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawButton (Minecraft mc, int mouseX, int mouseY)
|
||||
{
|
||||
if (this.visible)
|
||||
{
|
||||
public void drawButton(Minecraft mc, int mouseX, int mouseY) {
|
||||
if (this.visible) {
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
|
||||
int yTexPos = this.enabled ? 3 : 32;
|
||||
@@ -40,8 +36,10 @@ public abstract class AbstractTab extends GuiButton
|
||||
this.itemRenderer.zLevel = 100.0F;
|
||||
GL11.glEnable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||
this.itemRenderer.renderItemAndEffectIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8);
|
||||
this.itemRenderer.renderItemOverlayIntoGUI(mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8);
|
||||
this.itemRenderer.renderItemAndEffectIntoGUI(
|
||||
mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8);
|
||||
this.itemRenderer.renderItemOverlayIntoGUI(
|
||||
mc.fontRenderer, mc.renderEngine, renderStack, xPosition + 6, yPosition + 8);
|
||||
GL11.glDisable(GL11.GL_LIGHTING);
|
||||
GL11.glEnable(GL11.GL_BLEND);
|
||||
this.itemRenderer.zLevel = 0.0F;
|
||||
@@ -51,19 +49,22 @@ public abstract class AbstractTab extends GuiButton
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean mousePressed (Minecraft mc, int mouseX, int mouseY)
|
||||
{
|
||||
boolean inWindow = this.enabled && this.visible && mouseX >= this.xPosition && mouseY >= this.yPosition && mouseX < this.xPosition + this.width && mouseY < this.yPosition + this.height;
|
||||
public boolean mousePressed(Minecraft mc, int mouseX, int mouseY) {
|
||||
boolean inWindow = this.enabled
|
||||
&& this.visible
|
||||
&& mouseX >= this.xPosition
|
||||
&& mouseY >= this.yPosition
|
||||
&& mouseX < this.xPosition + this.width
|
||||
&& mouseY < this.yPosition + this.height;
|
||||
|
||||
if (inWindow)
|
||||
{
|
||||
if (inWindow) {
|
||||
this.onTabClicked();
|
||||
}
|
||||
|
||||
return inWindow;
|
||||
}
|
||||
|
||||
public abstract void onTabClicked ();
|
||||
public abstract void onTabClicked();
|
||||
|
||||
public abstract boolean shouldAddToList ();
|
||||
public abstract boolean shouldAddToList();
|
||||
}
|
||||
@@ -4,22 +4,18 @@ import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import tconstruct.client.ArmorControls;
|
||||
|
||||
public class InventoryTabArmorExtended extends AbstractTab
|
||||
{
|
||||
public InventoryTabArmorExtended()
|
||||
{
|
||||
public class InventoryTabArmorExtended extends AbstractTab {
|
||||
public InventoryTabArmorExtended() {
|
||||
super(0, 0, 0, new ItemStack(Items.diamond_chestplate));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabClicked ()
|
||||
{
|
||||
public void onTabClicked() {
|
||||
ArmorControls.openArmorGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldAddToList ()
|
||||
{
|
||||
public boolean shouldAddToList() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -4,22 +4,18 @@ import net.minecraft.item.ItemStack;
|
||||
import tconstruct.armor.*;
|
||||
import tconstruct.client.ArmorControls;
|
||||
|
||||
public class InventoryTabKnapsack extends AbstractTab
|
||||
{
|
||||
public InventoryTabKnapsack()
|
||||
{
|
||||
public class InventoryTabKnapsack extends AbstractTab {
|
||||
public InventoryTabKnapsack() {
|
||||
super(0, 0, 0, new ItemStack(TinkerArmor.knapsack));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabClicked ()
|
||||
{
|
||||
public void onTabClicked() {
|
||||
ArmorControls.openKnapsackGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldAddToList ()
|
||||
{
|
||||
public boolean shouldAddToList() {
|
||||
return ArmorProxyClient.armorExtended != null
|
||||
&& ArmorProxyClient.armorExtended.inventory[2] != null
|
||||
&& ArmorProxyClient.armorExtended.inventory[2].getItem() == TinkerArmor.knapsack;
|
||||
|
||||
@@ -3,22 +3,18 @@ package tconstruct.client.tabs;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class InventoryTabVanilla extends AbstractTab
|
||||
{
|
||||
public InventoryTabVanilla()
|
||||
{
|
||||
public class InventoryTabVanilla extends AbstractTab {
|
||||
public InventoryTabVanilla() {
|
||||
super(0, 0, 0, new ItemStack(Blocks.crafting_table));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabClicked ()
|
||||
{
|
||||
public void onTabClicked() {
|
||||
TabRegistry.openInventoryGui();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean shouldAddToList ()
|
||||
{
|
||||
public boolean shouldAddToList() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -1,44 +1,37 @@
|
||||
package tconstruct.client.tabs;
|
||||
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.network.play.client.C0DPacketCloseWindow;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
import cpw.mods.fml.client.FMLClientHandler;
|
||||
import cpw.mods.fml.common.Loader;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.lang.reflect.*;
|
||||
import java.util.*;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.inventory.GuiInventory;
|
||||
import net.minecraft.network.play.client.C0DPacketCloseWindow;
|
||||
import net.minecraftforge.client.event.GuiScreenEvent;
|
||||
|
||||
public class TabRegistry
|
||||
{
|
||||
public class TabRegistry {
|
||||
private static ArrayList<AbstractTab> tabList = new ArrayList<AbstractTab>();
|
||||
|
||||
public static void registerTab (AbstractTab tab)
|
||||
{
|
||||
public static void registerTab(AbstractTab tab) {
|
||||
tabList.add(tab);
|
||||
}
|
||||
|
||||
public static ArrayList<AbstractTab> getTabList ()
|
||||
{
|
||||
public static ArrayList<AbstractTab> getTabList() {
|
||||
return tabList;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@SubscribeEvent
|
||||
public void guiPostInit (GuiScreenEvent.InitGuiEvent.Post event)
|
||||
{
|
||||
if ((event.gui instanceof GuiInventory))
|
||||
{
|
||||
public void guiPostInit(GuiScreenEvent.InitGuiEvent.Post event) {
|
||||
if ((event.gui instanceof GuiInventory)) {
|
||||
int xSize = 176;
|
||||
int ySize = 166;
|
||||
int guiLeft = (event.gui.width - xSize) / 2;
|
||||
int guiTop = (event.gui.height - ySize) / 2;
|
||||
guiLeft += getPotionOffset();
|
||||
guiLeft += getPotionOffset();
|
||||
|
||||
updateTabValues(guiLeft, guiTop, InventoryTabVanilla.class);
|
||||
addTabsToList(event.gui.buttonList);
|
||||
@@ -47,22 +40,18 @@ public class TabRegistry
|
||||
|
||||
private static Minecraft mc = FMLClientHandler.instance().getClient();
|
||||
|
||||
public static void openInventoryGui ()
|
||||
{
|
||||
public static void openInventoryGui() {
|
||||
mc.thePlayer.sendQueue.addToSendQueue(new C0DPacketCloseWindow(mc.thePlayer.openContainer.windowId));
|
||||
GuiInventory inventory = new GuiInventory(mc.thePlayer);
|
||||
mc.displayGuiScreen(inventory);
|
||||
}
|
||||
|
||||
public static void updateTabValues (int cornerX, int cornerY, Class<?> selectedButton)
|
||||
{
|
||||
public static void updateTabValues(int cornerX, int cornerY, Class<?> selectedButton) {
|
||||
int count = 2;
|
||||
for (int i = 0; i < tabList.size(); i++)
|
||||
{
|
||||
for (int i = 0; i < tabList.size(); i++) {
|
||||
AbstractTab t = tabList.get(i);
|
||||
|
||||
if (t.shouldAddToList())
|
||||
{
|
||||
if (t.shouldAddToList()) {
|
||||
t.id = count;
|
||||
t.xPosition = cornerX + (count - 2) * 28;
|
||||
t.yPosition = cornerY - 28;
|
||||
@@ -72,51 +61,38 @@ public class TabRegistry
|
||||
}
|
||||
}
|
||||
|
||||
public static void addTabsToList (List buttonList)
|
||||
{
|
||||
for (AbstractTab tab : tabList)
|
||||
{
|
||||
if (tab.shouldAddToList())
|
||||
{
|
||||
public static void addTabsToList(List buttonList) {
|
||||
for (AbstractTab tab : tabList) {
|
||||
if (tab.shouldAddToList()) {
|
||||
buttonList.add(tab);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static int getPotionOffset()
|
||||
{
|
||||
// If at least one potion is active...
|
||||
if (!mc.thePlayer.getActivePotionEffects().isEmpty())
|
||||
{
|
||||
if (Loader.isModLoaded("NotEnoughItems"))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Check whether NEI is hidden and enabled
|
||||
Class<?> c = Class.forName("codechicken.nei.NEIClientConfig");
|
||||
Object hidden = c.getMethod("isHidden").invoke(null);
|
||||
Object enabled = c.getMethod("isEnabled").invoke(null);
|
||||
if (hidden != null && hidden instanceof Boolean && enabled != null && enabled instanceof Boolean)
|
||||
{
|
||||
if ((Boolean)hidden || !((Boolean)enabled))
|
||||
{
|
||||
// If NEI is disabled or hidden, offset the tabs by 60
|
||||
return 60;
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// If NEI is not installed, offset the tabs
|
||||
return 60;
|
||||
}
|
||||
}
|
||||
|
||||
// No potions, no offset needed
|
||||
return 0;
|
||||
}
|
||||
|
||||
public static int getPotionOffset() {
|
||||
// If at least one potion is active...
|
||||
if (!mc.thePlayer.getActivePotionEffects().isEmpty()) {
|
||||
if (Loader.isModLoaded("NotEnoughItems")) {
|
||||
try {
|
||||
// Check whether NEI is hidden and enabled
|
||||
Class<?> c = Class.forName("codechicken.nei.NEIClientConfig");
|
||||
Object hidden = c.getMethod("isHidden").invoke(null);
|
||||
Object enabled = c.getMethod("isEnabled").invoke(null);
|
||||
if (hidden != null && hidden instanceof Boolean && enabled != null && enabled instanceof Boolean) {
|
||||
if ((Boolean) hidden || !((Boolean) enabled)) {
|
||||
// If NEI is disabled or hidden, offset the tabs by 60
|
||||
return 60;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
}
|
||||
} else {
|
||||
// If NEI is not installed, offset the tabs
|
||||
return 60;
|
||||
}
|
||||
}
|
||||
|
||||
// No potions, no offset needed
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -5,41 +5,31 @@ import java.util.HashMap;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class TProxyCommon implements IGuiHandler
|
||||
{
|
||||
public void initialize ()
|
||||
{
|
||||
|
||||
}
|
||||
public class TProxyCommon implements IGuiHandler {
|
||||
public void initialize() {}
|
||||
|
||||
@Override
|
||||
public Object getServerGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
public Object getServerGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
IGuiHandler handler = serverGuiHandlers.get(ID);
|
||||
if (handler != null)
|
||||
return handler.getServerGuiElement(ID, player, world, x, y, z);
|
||||
if (handler != null) return handler.getServerGuiElement(ID, player, world, x, y, z);
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getClientGuiElement (int ID, EntityPlayer player, World world, int x, int y, int z)
|
||||
{
|
||||
public Object getClientGuiElement(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
||||
IGuiHandler handler = clientGuiHandlers.get(ID);
|
||||
if (handler != null)
|
||||
return handler.getClientGuiElement(ID, player, world, x, y, z);
|
||||
if (handler != null) return handler.getClientGuiElement(ID, player, world, x, y, z);
|
||||
return null;
|
||||
}
|
||||
|
||||
private static HashMap<Integer, IGuiHandler> serverGuiHandlers = new HashMap<Integer, IGuiHandler>();
|
||||
private static HashMap<Integer, IGuiHandler> clientGuiHandlers = new HashMap<Integer, IGuiHandler>();
|
||||
|
||||
public static void registerServerGuiHandler (int gui, IGuiHandler handler)
|
||||
{
|
||||
public static void registerServerGuiHandler(int gui, IGuiHandler handler) {
|
||||
serverGuiHandlers.put(gui, handler);
|
||||
}
|
||||
|
||||
public static void registerClientGuiHandler (int gui, IGuiHandler handler)
|
||||
{
|
||||
public static void registerClientGuiHandler(int gui, IGuiHandler handler) {
|
||||
clientGuiHandlers.put(gui, handler);
|
||||
}
|
||||
}
|
||||
@@ -3,18 +3,15 @@ package tconstruct.common.itemblocks;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
|
||||
public class MetadataItemBlock extends ItemBlock
|
||||
{
|
||||
public MetadataItemBlock(Block b)
|
||||
{
|
||||
public class MetadataItemBlock extends ItemBlock {
|
||||
public MetadataItemBlock(Block b) {
|
||||
super(b);
|
||||
setMaxDamage(0);
|
||||
setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata (int meta)
|
||||
{
|
||||
public int getMetadata(int meta) {
|
||||
return meta;
|
||||
}
|
||||
}
|
||||
@@ -1,14 +1,10 @@
|
||||
package tconstruct.gadgets;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import cpw.mods.fml.common.event.FMLInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
|
||||
import cpw.mods.fml.common.event.FMLPreInitializationEvent;
|
||||
import cpw.mods.fml.common.registry.GameRegistry;
|
||||
import java.util.Locale;
|
||||
import mantle.pulsar.pulse.Handler;
|
||||
import mantle.pulsar.pulse.Pulse;
|
||||
import net.minecraft.init.Items;
|
||||
@@ -16,6 +12,8 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.oredict.ShapedOreRecipe;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import tconstruct.TConstruct;
|
||||
import tconstruct.gadgets.item.ItemSlimeBoots;
|
||||
import tconstruct.gadgets.item.ItemSlimeSling;
|
||||
@@ -25,58 +23,54 @@ import tconstruct.library.TConstructRegistry;
|
||||
@Pulse(id = "Tinkers' Gadgets", description = "All the fun toys.")
|
||||
public class TinkerGadgets {
|
||||
|
||||
public static final String PulseId = "TinkerGadgets";
|
||||
public static final Logger log = LogManager.getLogger(PulseId);
|
||||
public static final String PulseId = "TinkerGadgets";
|
||||
public static final Logger log = LogManager.getLogger(PulseId);
|
||||
|
||||
// Gadgets
|
||||
public static ItemSlimeSling slimeSling;
|
||||
public static ItemSlimeBoots slimeBoots;
|
||||
// Gadgets
|
||||
public static ItemSlimeSling slimeSling;
|
||||
public static ItemSlimeBoots slimeBoots;
|
||||
|
||||
@Handler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
@Handler
|
||||
public void preInit(FMLPreInitializationEvent event) {
|
||||
|
||||
SlimeBounceHandler.init();
|
||||
slimeSling = registerItem(new ItemSlimeSling(), "slimesling");
|
||||
slimeBoots = registerItem(new ItemSlimeBoots(), "slime_boots");
|
||||
SlimeBounceHandler.init();
|
||||
slimeSling = registerItem(new ItemSlimeSling(), "slimesling");
|
||||
slimeBoots = registerItem(new ItemSlimeBoots(), "slime_boots");
|
||||
}
|
||||
|
||||
}
|
||||
@Handler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
String ore = "blockSlime";
|
||||
|
||||
@Handler
|
||||
public void init(FMLInitializationEvent event) {
|
||||
String ore = "blockSlime";
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(new ItemStack(slimeBoots), " ", "s s", "b b", 's', "slimeball", 'b', ore));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(
|
||||
new ItemStack(slimeSling), "fbf", "s s", " s ", 'f', Items.string, 's', "slimeball", 'b', ore));
|
||||
TConstructRegistry.gadgetsTab.init(new ItemStack(slimeBoots));
|
||||
}
|
||||
|
||||
GameRegistry.addRecipe(
|
||||
new ShapedOreRecipe(new ItemStack(slimeBoots), " ", "s s", "b b", 's', "slimeball", 'b', ore));
|
||||
GameRegistry.addRecipe(new ShapedOreRecipe(new ItemStack(slimeSling), "fbf", "s s", " s ", 'f', Items.string,
|
||||
's', "slimeball", 'b', ore));
|
||||
TConstructRegistry.gadgetsTab.init(new ItemStack(slimeBoots));
|
||||
@Handler
|
||||
public void postInit(FMLPostInitializationEvent evt) {}
|
||||
|
||||
}
|
||||
public static String resource(String res) {
|
||||
return String.format("%s:%s", "tinker", res);
|
||||
}
|
||||
|
||||
@Handler
|
||||
public void postInit(FMLPostInitializationEvent evt) {
|
||||
public static ResourceLocation getResource(String res) {
|
||||
return new ResourceLocation("tinker", res);
|
||||
}
|
||||
|
||||
}
|
||||
public static String prefix(String name) {
|
||||
return String.format("%s.%s", TConstruct.modID, name.toLowerCase(Locale.US));
|
||||
}
|
||||
|
||||
public static String resource(String res) {
|
||||
return String.format("%s:%s", "tinker", res);
|
||||
}
|
||||
|
||||
public static ResourceLocation getResource(String res) {
|
||||
return new ResourceLocation("tinker", res);
|
||||
}
|
||||
|
||||
public static String prefix(String name) {
|
||||
return String.format("%s.%s", TConstruct.modID, name.toLowerCase(Locale.US));
|
||||
}
|
||||
|
||||
protected static <T extends Item> T registerItem(T item, String name) {
|
||||
if (!name.equals(name.toLowerCase(Locale.US))) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Unlocalized names need to be all lowercase! Item: %s", name));
|
||||
}
|
||||
item.setUnlocalizedName(prefix(name));
|
||||
GameRegistry.registerItem(item, name);
|
||||
return item;
|
||||
}
|
||||
protected static <T extends Item> T registerItem(T item, String name) {
|
||||
if (!name.equals(name.toLowerCase(Locale.US))) {
|
||||
throw new IllegalArgumentException(
|
||||
String.format("Unlocalized names need to be all lowercase! Item: %s", name));
|
||||
}
|
||||
item.setUnlocalizedName(prefix(name));
|
||||
GameRegistry.registerItem(item, name);
|
||||
return item;
|
||||
}
|
||||
}
|
||||
@@ -1,12 +1,10 @@
|
||||
package tconstruct.gadgets.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.vecmath.Vector3d;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import java.util.List;
|
||||
import javax.vecmath.Vector3d;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.client.resources.I18n;
|
||||
@@ -32,208 +30,208 @@ import tconstruct.tools.entity.FancyEntityItem;
|
||||
|
||||
public class ItemSlimeBoots extends ItemArmor implements ISpecialArmor {
|
||||
|
||||
public static ArmorMaterial SLIME_MATERIAL = EnumHelper.addArmorMaterial("SLIME", 100, new int[] { 0, 0, 0, 0 }, 0);
|
||||
public static ArmorMaterial SLIME_MATERIAL = EnumHelper.addArmorMaterial("SLIME", 100, new int[] {0, 0, 0, 0}, 0);
|
||||
|
||||
public final ArmorPart armorPart;
|
||||
protected final String textureFolder;
|
||||
protected final String textureName;
|
||||
public final ArmorPart armorPart;
|
||||
protected final String textureFolder;
|
||||
protected final String textureName;
|
||||
|
||||
public ItemSlimeBoots() {
|
||||
super(SLIME_MATERIAL, 0, 3);
|
||||
this.setCreativeTab(TConstructRegistry.gadgetsTab);
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(100);
|
||||
SLIME_MATERIAL.customCraftingMaterial = Items.slime_ball;
|
||||
armorPart = ArmorPart.Feet;
|
||||
textureFolder = "armor";
|
||||
textureName = "slime";
|
||||
SlimeBounceHandler.registerEvent(this);
|
||||
}
|
||||
public ItemSlimeBoots() {
|
||||
super(SLIME_MATERIAL, 0, 3);
|
||||
this.setCreativeTab(TConstructRegistry.gadgetsTab);
|
||||
this.setMaxStackSize(1);
|
||||
this.setMaxDamage(100);
|
||||
SLIME_MATERIAL.customCraftingMaterial = Items.slime_ball;
|
||||
armorPart = ArmorPart.Feet;
|
||||
textureFolder = "armor";
|
||||
textureName = "slime";
|
||||
SlimeBounceHandler.registerEvent(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isValidArmor(ItemStack stack, int armorType1, Entity entity) {
|
||||
// can be worn as boots
|
||||
return armorType1 == 3;
|
||||
}
|
||||
@Override
|
||||
public boolean isValidArmor(ItemStack stack, int armorType1, Entity entity) {
|
||||
// can be worn as boots
|
||||
return armorType1 == 3;
|
||||
}
|
||||
|
||||
// equipping with rightclick
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) {
|
||||
int slot = 1; // 0 = current item, 1 = feet
|
||||
ItemStack itemstack = playerIn.getEquipmentInSlot(slot);
|
||||
if (itemstack == null) {
|
||||
playerIn.setCurrentItemOrArmor(slot, itemStackIn.copy());
|
||||
itemStackIn.stackSize--;
|
||||
}
|
||||
else {
|
||||
itemstack = itemstack.copy();
|
||||
playerIn.setCurrentItemOrArmor(1, itemStackIn.copy());
|
||||
//playerIn.setCurrentItemOrArmor(0, itemstack);
|
||||
playerIn.entityDropItem(itemstack, 0);
|
||||
itemStackIn.stackSize--;
|
||||
}
|
||||
return itemStackIn;
|
||||
}
|
||||
|
||||
/** Called when an entity lands to handle the event */
|
||||
@SubscribeEvent
|
||||
// RUBBERY BOUNCY BOUNCERY WOOOOO
|
||||
public void onFall(LivingFallEvent event) {
|
||||
EntityLivingBase living = event.entityLiving;
|
||||
//TinkerGadgets.log.info("Fall event.");
|
||||
// using fall distance as the event distance could be reduced by jump boost
|
||||
if (living == null || living.fallDistance <= 2f) {
|
||||
//TinkerGadgets.log.info("Invalid event.");
|
||||
return;
|
||||
}
|
||||
// can the entity bounce?
|
||||
if (!SlimeBounceHandler.hasSlimeBoots(living)) {
|
||||
//TinkerGadgets.log.info("No Boots.");
|
||||
return;
|
||||
}
|
||||
// equipping with rightclick
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) {
|
||||
int slot = 1; // 0 = current item, 1 = feet
|
||||
ItemStack itemstack = playerIn.getEquipmentInSlot(slot);
|
||||
if (itemstack == null) {
|
||||
playerIn.setCurrentItemOrArmor(slot, itemStackIn.copy());
|
||||
itemStackIn.stackSize--;
|
||||
} else {
|
||||
itemstack = itemstack.copy();
|
||||
playerIn.setCurrentItemOrArmor(1, itemStackIn.copy());
|
||||
// playerIn.setCurrentItemOrArmor(0, itemstack);
|
||||
playerIn.entityDropItem(itemstack, 0);
|
||||
itemStackIn.stackSize--;
|
||||
}
|
||||
return itemStackIn;
|
||||
}
|
||||
|
||||
// reduced fall damage when crouching
|
||||
if (living.isSneaking()) {
|
||||
//TinkerGadgets.log.info("Sneaking");
|
||||
event.distance = 1;
|
||||
return;
|
||||
}
|
||||
/** Called when an entity lands to handle the event */
|
||||
@SubscribeEvent
|
||||
// RUBBERY BOUNCY BOUNCERY WOOOOO
|
||||
public void onFall(LivingFallEvent event) {
|
||||
EntityLivingBase living = event.entityLiving;
|
||||
// TinkerGadgets.log.info("Fall event.");
|
||||
// using fall distance as the event distance could be reduced by jump boost
|
||||
if (living == null || living.fallDistance <= 2f) {
|
||||
// TinkerGadgets.log.info("Invalid event.");
|
||||
return;
|
||||
}
|
||||
// can the entity bounce?
|
||||
if (!SlimeBounceHandler.hasSlimeBoots(living)) {
|
||||
// TinkerGadgets.log.info("No Boots.");
|
||||
return;
|
||||
}
|
||||
|
||||
// thing is wearing slime boots. let's get bouncyyyyy
|
||||
event.setCanceled(true);
|
||||
// skip further client processing on players
|
||||
if (living.worldObj.isRemote) {
|
||||
//TinkerGadgets.log.info("Client Fall Handler.");
|
||||
living.playSound("mob.slime.small", 1f, 1f);
|
||||
SlimeBounceHandler.addBounceHandler(living);
|
||||
//TConstruct.packetPipeline.sendToServer(new BouncedPacket(living));
|
||||
return;
|
||||
}
|
||||
// reduced fall damage when crouching
|
||||
if (living.isSneaking()) {
|
||||
// TinkerGadgets.log.info("Sneaking");
|
||||
event.distance = 1;
|
||||
return;
|
||||
}
|
||||
|
||||
// server players behave differently than non-server players, they have no
|
||||
// velocity during the event, so we need to reverse engineer it
|
||||
Vector3d motion = SlimeBounceHandler.getMotion(living);
|
||||
if (living instanceof EntityPlayerMP) {
|
||||
// velocity is lost on server players, but we dont have to defer the bounce
|
||||
double gravity = 0.2353455252;
|
||||
double time = Math.sqrt(living.fallDistance / gravity);
|
||||
double velocity = gravity * time;
|
||||
living.setVelocity(motion.x / 0.95f, velocity, motion.z / 0.95f);
|
||||
living.velocityChanged = true;
|
||||
// preserve momentum
|
||||
SlimeBounceHandler.addBounceHandler(living);
|
||||
//TinkerGadgets.log.info("Player");
|
||||
}
|
||||
else {
|
||||
// for non-players, need to defer the bounce
|
||||
// only slow down half as much when bouncing
|
||||
living.setVelocity(motion.x / 0.95f, motion.y * -0.9, motion.z / 0.95f);
|
||||
SlimeBounceHandler.addBounceHandler(living, SlimeBounceHandler.getMotion(living).y);
|
||||
//TinkerGadgets.log.info("Not Player");
|
||||
}
|
||||
//TinkerGadgets.log.info("Server Fall Handler.");
|
||||
// update airborn status
|
||||
living.isAirBorne = true;
|
||||
living.onGround = false;
|
||||
event.distance = 0f;
|
||||
living.playSound("mob.slime.small", 1f, 1f);
|
||||
}
|
||||
// thing is wearing slime boots. let's get bouncyyyyy
|
||||
event.setCanceled(true);
|
||||
// skip further client processing on players
|
||||
if (living.worldObj.isRemote) {
|
||||
// TinkerGadgets.log.info("Client Fall Handler.");
|
||||
living.playSound("mob.slime.small", 1f, 1f);
|
||||
SlimeBounceHandler.addBounceHandler(living);
|
||||
// TConstruct.packetPipeline.sendToServer(new BouncedPacket(living));
|
||||
return;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
|
||||
return 2;
|
||||
}
|
||||
// server players behave differently than non-server players, they have no
|
||||
// velocity during the event, so we need to reverse engineer it
|
||||
Vector3d motion = SlimeBounceHandler.getMotion(living);
|
||||
if (living instanceof EntityPlayerMP) {
|
||||
// velocity is lost on server players, but we dont have to defer the bounce
|
||||
double gravity = 0.2353455252;
|
||||
double time = Math.sqrt(living.fallDistance / gravity);
|
||||
double velocity = gravity * time;
|
||||
living.setVelocity(motion.x / 0.95f, velocity, motion.z / 0.95f);
|
||||
living.velocityChanged = true;
|
||||
// preserve momentum
|
||||
SlimeBounceHandler.addBounceHandler(living);
|
||||
// TinkerGadgets.log.info("Player");
|
||||
} else {
|
||||
// for non-players, need to defer the bounce
|
||||
// only slow down half as much when bouncing
|
||||
living.setVelocity(motion.x / 0.95f, motion.y * -0.9, motion.z / 0.95f);
|
||||
SlimeBounceHandler.addBounceHandler(living, SlimeBounceHandler.getMotion(living).y);
|
||||
// TinkerGadgets.log.info("Not Player");
|
||||
}
|
||||
// TinkerGadgets.log.info("Server Fall Handler.");
|
||||
// update airborn status
|
||||
living.isAirBorne = true;
|
||||
living.onGround = false;
|
||||
event.distance = 0f;
|
||||
living.playSound("mob.slime.small", 1f, 1f);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
||||
return "tinker:textures/armor/" + textureName + "_" + 1 + ".png";
|
||||
}
|
||||
@Override
|
||||
public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon[] modifiers;
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) {
|
||||
return "tinker:textures/armor/" + textureName + "_" + 1 + ".png";
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon("tinker:" + textureFolder + "/" + textureName + "_boots");
|
||||
@SideOnly(Side.CLIENT)
|
||||
protected IIcon[] modifiers;
|
||||
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon("tinker:" + textureFolder + "/" + textureName + "_boots");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int renderPass) {
|
||||
return itemIcon;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(ItemStack stack, int renderPass) {
|
||||
return itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean requiresMultipleRenderPasses() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect(ItemStack par1ItemStack) {
|
||||
return false;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean hasEffect(ItemStack par1ItemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
// ISpecialArmor overrides
|
||||
@Override
|
||||
public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage,
|
||||
int slot) {
|
||||
return new ArmorProperties(0, armor.getItemDamage() / 100, 100);
|
||||
}
|
||||
// ISpecialArmor overrides
|
||||
@Override
|
||||
public ArmorProperties getProperties(
|
||||
EntityLivingBase player, ItemStack armor, DamageSource source, double damage, int slot) {
|
||||
return new ArmorProperties(0, armor.getItemDamage() / 100, 100);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void damageArmor(EntityLivingBase entity, ItemStack armor, DamageSource source, int damage, int slot) {
|
||||
if (source == DamageSource.fall) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
@Override
|
||||
public void damageArmor(EntityLivingBase entity, ItemStack armor, DamageSource source, int damage, int slot) {
|
||||
if (source == DamageSource.fall) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
par3List.add(new ItemStack(par1));
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void getSubItems(Item par1, CreativeTabs par2CreativeTabs, List par3List) {
|
||||
par3List.add(new ItemStack(par1));
|
||||
}
|
||||
|
||||
// Vanilla overrides
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack par1ItemStack) {
|
||||
return false;
|
||||
}
|
||||
// Vanilla overrides
|
||||
@Override
|
||||
public boolean isItemTool(ItemStack par1ItemStack) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isRepairable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemEnchantability() {
|
||||
return 0;
|
||||
}
|
||||
@Override
|
||||
public int getItemEnchantability() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
@Override
|
||||
public boolean isFull3D() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
list.add("Boooounce!");
|
||||
list.add("Hold "+(I18n.format(Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyDescription(), new Object[0]))+" to stop bouncing.");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
list.add("Boooounce!");
|
||||
list.add("Hold "
|
||||
+ (I18n.format(
|
||||
Minecraft.getMinecraft().gameSettings.keyBindSneak.getKeyDescription(), new Object[0]))
|
||||
+ " to stop bouncing.");
|
||||
}
|
||||
|
||||
/* Prevent armor from dying */
|
||||
@Override
|
||||
public boolean hasCustomEntity(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
/* Prevent armor from dying */
|
||||
@Override
|
||||
public boolean hasCustomEntity(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
|
||||
return new FancyEntityItem(world, location, itemstack);
|
||||
}
|
||||
@Override
|
||||
public Entity createEntity(World world, Entity location, ItemStack itemstack) {
|
||||
return new FancyEntityItem(world, location, itemstack);
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
package tconstruct.gadgets.item;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import java.util.List;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
@@ -24,85 +22,85 @@ import tconstruct.util.network.MovementUpdatePacket;
|
||||
|
||||
public class ItemSlimeSling extends Item {
|
||||
|
||||
public ItemSlimeSling() {
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(TConstructRegistry.gadgetsTab);
|
||||
}
|
||||
public ItemSlimeSling() {
|
||||
this.setMaxStackSize(1);
|
||||
this.setCreativeTab(TConstructRegistry.gadgetsTab);
|
||||
}
|
||||
|
||||
/**
|
||||
* Called whenever this item is equipped and the right mouse button is pressed.
|
||||
* Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) {
|
||||
playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
|
||||
return itemStackIn;
|
||||
}
|
||||
/**
|
||||
* Called whenever this item is equipped and the right mouse button is pressed.
|
||||
* Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack itemStackIn, World worldIn, EntityPlayer playerIn) {
|
||||
playerIn.setItemInUse(itemStackIn, this.getMaxItemUseDuration(itemStackIn));
|
||||
return itemStackIn;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return this.itemIcon;
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIconFromDamage(int meta) {
|
||||
return this.itemIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon("tinker:gadgets/slimesling");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
this.itemIcon = iconRegister.registerIcon("tinker:gadgets/slimesling");
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack stack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
@Override
|
||||
public EnumAction getItemUseAction(ItemStack stack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return 72000;
|
||||
}
|
||||
@Override
|
||||
public int getMaxItemUseDuration(ItemStack stack) {
|
||||
return 72000;
|
||||
}
|
||||
|
||||
// sling logic
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int timeLeft) {
|
||||
// has to be on ground to do something
|
||||
if (!player.onGround) {
|
||||
return;
|
||||
}
|
||||
// sling logic
|
||||
@Override
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int timeLeft) {
|
||||
// has to be on ground to do something
|
||||
if (!player.onGround) {
|
||||
return;
|
||||
}
|
||||
|
||||
// copy chargeup code from bow \o/
|
||||
int i = this.getMaxItemUseDuration(stack) - timeLeft;
|
||||
float f = i / 20.0F;
|
||||
f = (f * f + f * 2.0F) / 3.0F;
|
||||
f *= 4f;
|
||||
// copy chargeup code from bow \o/
|
||||
int i = this.getMaxItemUseDuration(stack) - timeLeft;
|
||||
float f = i / 20.0F;
|
||||
f = (f * f + f * 2.0F) / 3.0F;
|
||||
f *= 4f;
|
||||
|
||||
if (f > 6f) {
|
||||
f = 6f;
|
||||
}
|
||||
if (f > 6f) {
|
||||
f = 6f;
|
||||
}
|
||||
|
||||
// check if player was targeting a block
|
||||
MovingObjectPosition mop = getMovingObjectPositionFromPlayer(world, player, false);
|
||||
// check if player was targeting a block
|
||||
MovingObjectPosition mop = getMovingObjectPositionFromPlayer(world, player, false);
|
||||
|
||||
if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
// we fling the inverted player look vector
|
||||
Vec3 vec = player.getLookVec().normalize();
|
||||
if (mop != null && mop.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) {
|
||||
// we fling the inverted player look vector
|
||||
Vec3 vec = player.getLookVec().normalize();
|
||||
|
||||
player.addVelocity(vec.xCoord * -f, vec.yCoord * -f / 3f, vec.zCoord * -f);
|
||||
player.addVelocity(vec.xCoord * -f, vec.yCoord * -f / 3f, vec.zCoord * -f);
|
||||
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP playerMP = (EntityPlayerMP) player;
|
||||
TConstruct.packetPipeline.sendTo(new MovementUpdatePacket(player), playerMP);
|
||||
playerMP.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(player));
|
||||
}
|
||||
player.playSound(TinkerGadgets.resource("slimesling"), 1f, 1f);
|
||||
SlimeBounceHandler.addBounceHandler(player);
|
||||
// TinkerCommons.potionSlimeBounce.apply(player);
|
||||
}
|
||||
}
|
||||
if (player instanceof EntityPlayerMP) {
|
||||
EntityPlayerMP playerMP = (EntityPlayerMP) player;
|
||||
TConstruct.packetPipeline.sendTo(new MovementUpdatePacket(player), playerMP);
|
||||
playerMP.playerNetServerHandler.sendPacket(new S12PacketEntityVelocity(player));
|
||||
}
|
||||
player.playSound(TinkerGadgets.resource("slimesling"), 1f, 1f);
|
||||
SlimeBounceHandler.addBounceHandler(player);
|
||||
// TinkerCommons.potionSlimeBounce.apply(player);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
list.add("Aim at a block behind you to get thrown into the air.");
|
||||
list.add(player.onGround ? "Shoot for the moon!" : "Must be on the ground to use.");
|
||||
}
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
list.add("Aim at a block behind you to get thrown into the air.");
|
||||
list.add(player.onGround ? "Shoot for the moon!" : "Must be on the ground to use.");
|
||||
}
|
||||
}
|
||||
@@ -16,11 +16,9 @@ import tconstruct.library.tools.ToolCore;
|
||||
import tconstruct.weaponry.TinkerWeaponry;
|
||||
|
||||
@Deprecated
|
||||
public class Arrow extends ToolCore
|
||||
{
|
||||
public class Arrow extends ToolCore {
|
||||
|
||||
public Arrow()
|
||||
{
|
||||
public Arrow() {
|
||||
super(3);
|
||||
this.setUnlocalizedName("InfiTool.Arrow");
|
||||
this.setMaxStackSize(64);
|
||||
@@ -28,95 +26,87 @@ public class Arrow extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_arrow_head";
|
||||
case 1:
|
||||
return ""; // Doesn't break
|
||||
case 2:
|
||||
return "_arrow_shaft";
|
||||
case 3:
|
||||
return "_arrow_fletching";
|
||||
default:
|
||||
return "";
|
||||
public String getIconSuffix(int partType) {
|
||||
switch (partType) {
|
||||
case 0:
|
||||
return "_arrow_head";
|
||||
case 1:
|
||||
return ""; // Doesn't break
|
||||
case 2:
|
||||
return "_arrow_shaft";
|
||||
case 3:
|
||||
return "_arrow_fletching";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected int getDefaultColor(int renderPass, int materialID) {
|
||||
// fletchling uses custom material
|
||||
if(renderPass == 2) {
|
||||
if (renderPass == 2) {
|
||||
CustomMaterial mat = TConstructRegistry.getCustomMaterial(materialID, FletchingMaterial.class);
|
||||
if(mat != null)
|
||||
return mat.color;
|
||||
if (mat != null) return mat.color;
|
||||
}
|
||||
|
||||
return super.getDefaultColor(renderPass, materialID);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_arrow_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "arrow";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
public void registerPartPaths(int index, String[] location) {
|
||||
headStrings.put(index, location[0]);
|
||||
handleStrings.put(index, location[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAlternatePartPaths (int index, String[] location)
|
||||
{
|
||||
public void registerAlternatePartPaths(int index, String[] location) {
|
||||
accessoryStrings.put(index, location[3]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerWeaponry.arrowhead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerWeaponry.fletching;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "ammo" };
|
||||
public String[] getTraits() {
|
||||
return new String[] {"ammo"};
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDamageModifier ()
|
||||
{
|
||||
public float getDamageModifier() {
|
||||
return 0.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getSubItems (Item id, CreativeTabs tab, List list)
|
||||
{
|
||||
public void getSubItems(Item id, CreativeTabs tab, List list) {
|
||||
// Vanilla style arrow
|
||||
Item accessory = getAccessoryItem();
|
||||
ItemStack accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, 0) : null;
|
||||
Item extra = getExtraItem();
|
||||
ItemStack extraStack = extra != null ? new ItemStack(extra, 1, 0) : null;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, 3), new ItemStack(getHandleItem(), 1, 0), accessoryStack, extraStack, "");
|
||||
if (tool != null)
|
||||
{
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(
|
||||
new ItemStack(getHeadItem(), 1, 3),
|
||||
new ItemStack(getHandleItem(), 1, 0),
|
||||
accessoryStack,
|
||||
extraStack,
|
||||
"");
|
||||
if (tool != null) {
|
||||
tool.stackSize = 1;
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
@@ -127,10 +117,14 @@ public class Arrow extends ToolCore
|
||||
accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, random.nextInt(4)) : null;
|
||||
extra = getExtraItem();
|
||||
extraStack = extra != null ? new ItemStack(extra, 1, 0) : null;
|
||||
tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, random.nextInt(18)), new ItemStack(getHandleItem(), 1, random.nextInt(18)), accessoryStack, extraStack, StatCollector.translateToLocal("item.tool.randomarrow"));
|
||||
tool = ToolBuilder.instance.buildTool(
|
||||
new ItemStack(getHeadItem(), 1, random.nextInt(18)),
|
||||
new ItemStack(getHandleItem(), 1, random.nextInt(18)),
|
||||
accessoryStack,
|
||||
extraStack,
|
||||
StatCollector.translateToLocal("item.tool.randomarrow"));
|
||||
|
||||
if (tool != null)
|
||||
{
|
||||
if (tool != null) {
|
||||
tool.stackSize = 1;
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
@@ -139,15 +133,18 @@ public class Arrow extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTool (int id, String name, List list)
|
||||
{
|
||||
public void buildTool(int id, String name, List list) {
|
||||
Item accessory = getAccessoryItem();
|
||||
ItemStack accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, 0) : null;
|
||||
Item extra = getExtraItem();
|
||||
ItemStack extraStack = extra != null ? new ItemStack(getExtraItem(), 1, id) : null;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, id), new ItemStack(getHandleItem(), 1, id), accessoryStack, extraStack, name);
|
||||
if (tool != null)
|
||||
{
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(
|
||||
new ItemStack(getHeadItem(), 1, id),
|
||||
new ItemStack(getHandleItem(), 1, id),
|
||||
accessoryStack,
|
||||
extraStack,
|
||||
name);
|
||||
if (tool != null) {
|
||||
tool.stackSize = 1;
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
@@ -155,76 +152,75 @@ public class Arrow extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
public boolean onItemUse(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int side,
|
||||
float clickX,
|
||||
float clickY,
|
||||
float clickZ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void addInformation (ItemStack stack, EntityPlayer player, List list, boolean par4)
|
||||
{
|
||||
if (!stack.hasTagCompound())
|
||||
return;
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean par4) {
|
||||
if (!stack.hasTagCompound()) return;
|
||||
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
if (tags.hasKey("Energy"))
|
||||
{
|
||||
if (tags.hasKey("Energy")) {
|
||||
String color = "";
|
||||
// double joules = this.getJoules(stack);
|
||||
int power = tags.getInteger("Energy");
|
||||
|
||||
if (power != 0)
|
||||
{
|
||||
if (power <= this.getMaxEnergyStored(stack) / 3)
|
||||
color = "\u00a74";
|
||||
else if (power > this.getMaxEnergyStored(stack) * 2 / 3)
|
||||
color = "\u00a72";
|
||||
else
|
||||
color = "\u00a76";
|
||||
if (power != 0) {
|
||||
if (power <= this.getMaxEnergyStored(stack) / 3) color = "\u00a74";
|
||||
else if (power > this.getMaxEnergyStored(stack) * 2 / 3) color = "\u00a72";
|
||||
else color = "\u00a76";
|
||||
}
|
||||
|
||||
String energy = new StringBuilder().append(color).append(tags.getInteger("Energy")).append("/").append(getMaxEnergyStored(stack)).append(" RF").toString();
|
||||
String energy = new StringBuilder()
|
||||
.append(color)
|
||||
.append(tags.getInteger("Energy"))
|
||||
.append("/")
|
||||
.append(getMaxEnergyStored(stack))
|
||||
.append(" RF")
|
||||
.toString();
|
||||
list.add(energy);
|
||||
}
|
||||
if (tags.hasKey("InfiTool"))
|
||||
{
|
||||
if (tags.hasKey("InfiTool")) {
|
||||
boolean broken = tags.getCompoundTag("InfiTool").getBoolean("Broken");
|
||||
if (broken)
|
||||
list.add("\u00A7oBroken");
|
||||
else
|
||||
{
|
||||
if (broken) list.add("\u00A7oBroken");
|
||||
else {
|
||||
int head = tags.getCompoundTag("InfiTool").getInteger("Head");
|
||||
int handle = tags.getCompoundTag("InfiTool").getInteger("Handle");
|
||||
|
||||
String headName = getAbilityNameForType(head, 0);
|
||||
if (!headName.equals(""))
|
||||
list.add(getStyleForType(head) + headName);
|
||||
if (!headName.equals("")) list.add(getStyleForType(head) + headName);
|
||||
|
||||
String handleName = getAbilityNameForType(handle, 0);
|
||||
if (!handleName.equals("") && handle != head)
|
||||
list.add(getStyleForType(handle) + handleName);
|
||||
if (!handleName.equals("") && handle != head) list.add(getStyleForType(handle) + handleName);
|
||||
|
||||
boolean displayToolTips = true;
|
||||
int tipNum = 0;
|
||||
while (displayToolTips)
|
||||
{
|
||||
while (displayToolTips) {
|
||||
tipNum++;
|
||||
String tooltip = "Tooltip" + tipNum;
|
||||
if (tags.getCompoundTag("InfiTool").hasKey(tooltip))
|
||||
{
|
||||
if (tags.getCompoundTag("InfiTool").hasKey(tooltip)) {
|
||||
String tipName = tags.getCompoundTag("InfiTool").getString(tooltip);
|
||||
if (!tipName.equals(""))
|
||||
list.add(tipName);
|
||||
}
|
||||
else
|
||||
displayToolTips = false;
|
||||
if (!tipName.equals("")) list.add(tipName);
|
||||
} else displayToolTips = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
int attack = (int) (tags.getCompoundTag("InfiTool").getInteger("Attack") * this.getDamageModifier());
|
||||
list.add("\u00A79+" + attack + " " + StatCollector.translateToLocalFormatted("attribute.name.generic.attackDamage"));
|
||||
list.add("\u00A79+" + tags.getCompoundTag("InfiTool").getInteger("Attack") + " " + StatCollector.translateToLocalFormatted("attribute.name.ammo.attackDamage"));
|
||||
list.add("\u00A79+" + attack + " "
|
||||
+ StatCollector.translateToLocalFormatted("attribute.name.generic.attackDamage"));
|
||||
list.add("\u00A79+" + tags.getCompoundTag("InfiTool").getInteger("Attack") + " "
|
||||
+ StatCollector.translateToLocalFormatted("attribute.name.ammo.attackDamage"));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,122 +10,105 @@ import tconstruct.library.tools.Weapon;
|
||||
import tconstruct.tools.*;
|
||||
import tconstruct.tools.logic.EquipLogic;
|
||||
|
||||
public class BattleSign extends Weapon
|
||||
{
|
||||
public BattleSign()
|
||||
{
|
||||
public class BattleSign extends Weapon {
|
||||
public BattleSign() {
|
||||
super(1);
|
||||
this.setUnlocalizedName("InfiTool.Battlesign");
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getToolName ()
|
||||
{
|
||||
public String getToolName() {
|
||||
return "Battlesign";
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.signHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
public int getPartAmount() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
public void registerPartPaths(int index, String[] location) {
|
||||
headStrings.put(index, location[0]);
|
||||
brokenPartStrings.put(index, location[1]);
|
||||
handleStrings.put(index, location[2]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_battlesign_head";
|
||||
case 1:
|
||||
return "_battlesign_head_broken";
|
||||
case 2:
|
||||
return "_battlesign_handle";
|
||||
default:
|
||||
return "";
|
||||
public String getIconSuffix(int partType) {
|
||||
switch (partType) {
|
||||
case 0:
|
||||
return "_battlesign_head";
|
||||
case 1:
|
||||
return "_battlesign_head_broken";
|
||||
case 2:
|
||||
return "_battlesign_handle";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_battlesign_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "battlesign";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
if (side == 0 || !player.isSneaking())
|
||||
{
|
||||
public boolean onItemUse(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int side,
|
||||
float clickX,
|
||||
float clickY,
|
||||
float clickZ) {
|
||||
if (side == 0 || !player.isSneaking()) {
|
||||
return false;
|
||||
}
|
||||
else if (!world.getBlock(x, y, z).getMaterial().isSolid())
|
||||
{
|
||||
} else if (!world.getBlock(x, y, z).getMaterial().isSolid()) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (side == 1)
|
||||
{
|
||||
} else {
|
||||
if (side == 1) {
|
||||
++y;
|
||||
}
|
||||
|
||||
if (side == 2)
|
||||
{
|
||||
if (side == 2) {
|
||||
--z;
|
||||
}
|
||||
|
||||
if (side == 3)
|
||||
{
|
||||
if (side == 3) {
|
||||
++z;
|
||||
}
|
||||
|
||||
if (side == 4)
|
||||
{
|
||||
if (side == 4) {
|
||||
--x;
|
||||
}
|
||||
|
||||
if (side == 5)
|
||||
{
|
||||
if (side == 5) {
|
||||
++x;
|
||||
}
|
||||
|
||||
if (!player.canPlayerEdit(x, y, z, side, stack))
|
||||
{
|
||||
if (!player.canPlayerEdit(x, y, z, side, stack)) {
|
||||
return false;
|
||||
}
|
||||
else if (!TinkerTools.battlesignBlock.canPlaceBlockAt(world, x, y, z))
|
||||
{
|
||||
} else if (!TinkerTools.battlesignBlock.canPlaceBlockAt(world, x, y, z)) {
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
world.setBlock(x, y, z, TinkerTools.battlesignBlock, 0, 3);
|
||||
TinkerTools.battlesignBlock.onBlockPlacedBy(world, x, y, z, player, stack);
|
||||
|
||||
@@ -133,8 +116,7 @@ public class BattleSign extends Weapon
|
||||
logic.setEquipmentItem(stack);
|
||||
--stack.stackSize;
|
||||
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT)
|
||||
{
|
||||
if (FMLCommonHandler.instance().getSide() == Side.CLIENT) {
|
||||
player.openGui(TConstruct.instance, ToolProxyClient.battlesignTextID, world, x, y, z);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
package tconstruct.items.tools;
|
||||
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import mods.battlegear2.api.PlayerEventChild;
|
||||
import mods.battlegear2.api.weapons.IBattlegearWeapon;
|
||||
import net.minecraft.block.Block;
|
||||
@@ -19,152 +22,139 @@ import net.minecraftforge.event.entity.player.PlayerInteractEvent;
|
||||
import tconstruct.library.tools.AOEHarvestTool;
|
||||
import tconstruct.library.tools.AbilityHelper;
|
||||
import tconstruct.tools.TinkerTools;
|
||||
import cpw.mods.fml.common.Optional;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
|
||||
@Optional.InterfaceList({ @Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.weapons.IBattlegearWeapon"),
|
||||
@Optional.Interface(modid = "ZeldaItemAPI", iface = "zeldaswordskills.api.item.ISword") })
|
||||
public class Battleaxe extends AOEHarvestTool implements IBattlegearWeapon
|
||||
{
|
||||
public Battleaxe()
|
||||
{
|
||||
@Optional.InterfaceList({
|
||||
@Optional.Interface(modid = "battlegear2", iface = "mods.battlegear2.api.weapons.IBattlegearWeapon"),
|
||||
@Optional.Interface(modid = "ZeldaItemAPI", iface = "zeldaswordskills.api.item.ISword")
|
||||
})
|
||||
public class Battleaxe extends AOEHarvestTool implements IBattlegearWeapon {
|
||||
public Battleaxe() {
|
||||
super(4, 1, 1);
|
||||
this.setUnlocalizedName("InfiTool.Battleaxe");
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Material[] getEffectiveMaterials ()
|
||||
{
|
||||
protected Material[] getEffectiveMaterials() {
|
||||
return materials;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getHarvestType ()
|
||||
{
|
||||
protected String getHarvestType() {
|
||||
return "axe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockDestroyed (ItemStack itemstack, World world, Block b, int x, int y, int z, EntityLivingBase player)
|
||||
{
|
||||
if (b != null && b.getMaterial() == Material.leaves)
|
||||
return false;
|
||||
public boolean onBlockDestroyed(
|
||||
ItemStack itemstack, World world, Block b, int x, int y, int z, EntityLivingBase player) {
|
||||
if (b != null && b.getMaterial() == Material.leaves) return false;
|
||||
|
||||
return AbilityHelper.onBlockChanged(itemstack, world, b, x, y, z, player, random);
|
||||
}
|
||||
|
||||
static Material[] materials = { Material.wood, Material.vine, Material.circuits, Material.cactus, Material.gourd };
|
||||
static Material[] materials = {Material.wood, Material.vine, Material.circuits, Material.cactus, Material.gourd};
|
||||
|
||||
@Override
|
||||
public Item getHeadItem ()
|
||||
{
|
||||
public Item getHeadItem() {
|
||||
return TinkerTools.broadAxeHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getHandleItem ()
|
||||
{
|
||||
public Item getHandleItem() {
|
||||
return TinkerTools.toughRod;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getAccessoryItem ()
|
||||
{
|
||||
public Item getAccessoryItem() {
|
||||
return TinkerTools.broadAxeHead;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getExtraItem ()
|
||||
{
|
||||
public Item getExtraItem() {
|
||||
return TinkerTools.toughBinding;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
public int durabilityTypeAccessory() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeExtra ()
|
||||
{
|
||||
public int durabilityTypeExtra() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getRepairCost ()
|
||||
{
|
||||
public float getRepairCost() {
|
||||
return 4.0f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getDurabilityModifier ()
|
||||
{
|
||||
public float getDurabilityModifier() {
|
||||
return 2.5f;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getPartAmount ()
|
||||
{
|
||||
public int getPartAmount() {
|
||||
return 4;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getIconSuffix (int partType)
|
||||
{
|
||||
switch (partType)
|
||||
{
|
||||
case 0:
|
||||
return "_battleaxe_fronthead";
|
||||
case 1:
|
||||
return "_battleaxe_fronthead_broken";
|
||||
case 2:
|
||||
return "_battleaxe_handle";
|
||||
case 3:
|
||||
return "_battleaxe_backhead";
|
||||
case 4:
|
||||
return "_battleaxe_binding";
|
||||
default:
|
||||
return "";
|
||||
public String getIconSuffix(int partType) {
|
||||
switch (partType) {
|
||||
case 0:
|
||||
return "_battleaxe_fronthead";
|
||||
case 1:
|
||||
return "_battleaxe_fronthead_broken";
|
||||
case 2:
|
||||
return "_battleaxe_handle";
|
||||
case 3:
|
||||
return "_battleaxe_backhead";
|
||||
case 4:
|
||||
return "_battleaxe_binding";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getEffectSuffix ()
|
||||
{
|
||||
public String getEffectSuffix() {
|
||||
return "_battleaxe_effect";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDefaultFolder ()
|
||||
{
|
||||
public String getDefaultFolder() {
|
||||
return "battleaxe";
|
||||
}
|
||||
|
||||
@Override
|
||||
public String[] getTraits ()
|
||||
{
|
||||
return new String[] { "weapon", "harvest", "melee", "slicing" };
|
||||
public String[] getTraits() {
|
||||
return new String[] {"weapon", "harvest", "melee", "slicing"};
|
||||
}
|
||||
|
||||
/* Battleaxe Specific */
|
||||
|
||||
@Override
|
||||
public boolean onItemUse (ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float clickX, float clickY, float clickZ)
|
||||
{
|
||||
public boolean onItemUse(
|
||||
ItemStack stack,
|
||||
EntityPlayer player,
|
||||
World world,
|
||||
int x,
|
||||
int y,
|
||||
int z,
|
||||
int side,
|
||||
float clickX,
|
||||
float clickY,
|
||||
float clickZ) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack par1ItemStack)
|
||||
{
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World world, EntityPlayer player)
|
||||
{
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
// player.rotationYaw += 1;
|
||||
// if (player.onGround)
|
||||
// {
|
||||
@@ -174,66 +164,59 @@ public class Battleaxe extends AOEHarvestTool implements IBattlegearWeapon
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPlayerStoppedUsing (ItemStack stack, World world, EntityPlayer player, int useCount)
|
||||
{
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int useCount) {
|
||||
// if (player.onGround)
|
||||
{
|
||||
int time = this.getMaxItemUseDuration(stack) - useCount;
|
||||
int boost = time / 100;
|
||||
if (boost > 2)
|
||||
boost = 2;
|
||||
if (boost > 2) boost = 2;
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
player.addPotionEffect(new PotionEffect(Potion.moveSpeed.id, time * 4, boost));
|
||||
player.addPotionEffect(new PotionEffect(Potion.jump.id, time * 4, boost));
|
||||
player.addPotionEffect(new PotionEffect(Potion.damageBoost.id, time * 4, 0));
|
||||
player.addPotionEffect(new PotionEffect(Potion.hunger.id, time * 2, 0));
|
||||
}
|
||||
if (time > 5 && player.onGround)
|
||||
{
|
||||
if (time > 5 && player.onGround) {
|
||||
player.addExhaustion(0.2F);
|
||||
player.setSprinting(true);
|
||||
|
||||
float speed = 0.025F * time;
|
||||
if (speed > 0.925f)
|
||||
speed = 0.925f;
|
||||
if (speed > 0.925f) speed = 0.925f;
|
||||
|
||||
float increase = (float) (0.02 * time + 0.2);
|
||||
if (increase > 0.56f)
|
||||
increase = 0.56f;
|
||||
if (increase > 0.56f) increase = 0.56f;
|
||||
player.motionY += increase;
|
||||
|
||||
player.motionX = (double) (-MathHelper.sin(player.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * speed);
|
||||
player.motionZ = (double) (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI) * MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI) * speed);
|
||||
player.motionX = (double) (-MathHelper.sin(player.rotationYaw / 180.0F * (float) Math.PI)
|
||||
* MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI)
|
||||
* speed);
|
||||
player.motionZ = (double) (MathHelper.cos(player.rotationYaw / 180.0F * (float) Math.PI)
|
||||
* MathHelper.cos(player.rotationPitch / 180.0F * (float) Math.PI)
|
||||
* speed);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxItemUseDuration (ItemStack par1ItemStack)
|
||||
{
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
|
||||
return 72000;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean hitEntity (ItemStack stack, EntityLivingBase mob, EntityLivingBase player)
|
||||
{
|
||||
public boolean hitEntity(ItemStack stack, EntityLivingBase mob, EntityLivingBase player) {
|
||||
AbilityHelper.knockbackEntity(mob, 1.5f);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void onUpdate (ItemStack stack, World world, Entity entity, int par4, boolean par5)
|
||||
{
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int par4, boolean par5) {
|
||||
super.onUpdate(stack, world, entity, par4, par5);
|
||||
if (entity instanceof EntityPlayerSP)
|
||||
{
|
||||
if (entity instanceof EntityPlayerSP) {
|
||||
EntityPlayerSP player = (EntityPlayerSP) entity;
|
||||
ItemStack usingItem = player.getItemInUse();
|
||||
if (usingItem != null && usingItem.getItem() == this)
|
||||
{
|
||||
if (usingItem != null && usingItem.getItem() == this) {
|
||||
player.movementInput.moveForward *= 5.0F;
|
||||
player.movementInput.moveStrafe *= 5.0F;
|
||||
}
|
||||
@@ -244,54 +227,49 @@ public class Battleaxe extends AOEHarvestTool implements IBattlegearWeapon
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "battlegear2")
|
||||
public boolean sheatheOnBack (ItemStack item)
|
||||
{
|
||||
public boolean sheatheOnBack(ItemStack item) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "battlegear2")
|
||||
public boolean isOffhandHandDual (ItemStack off)
|
||||
{
|
||||
public boolean isOffhandHandDual(ItemStack off) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "battlegear2")
|
||||
public boolean offhandAttackEntity (PlayerEventChild.OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem)
|
||||
{
|
||||
public boolean offhandAttackEntity(
|
||||
PlayerEventChild.OffhandAttackEvent event, ItemStack mainhandItem, ItemStack offhandItem) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "battlegear2")
|
||||
public boolean offhandClickAir (PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem)
|
||||
{
|
||||
public boolean offhandClickAir(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "battlegear2")
|
||||
public boolean offhandClickBlock (PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem)
|
||||
{
|
||||
public boolean offhandClickBlock(PlayerInteractEvent event, ItemStack mainhandItem, ItemStack offhandItem) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "battlegear2")
|
||||
public void performPassiveEffects (Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem)
|
||||
{
|
||||
public void performPassiveEffects(Side effectiveSide, ItemStack mainhandItem, ItemStack offhandItem) {
|
||||
// unused
|
||||
}
|
||||
|
||||
@Override
|
||||
@Optional.Method(modid = "battlegear2")
|
||||
public boolean allowOffhand (ItemStack mainhand, ItemStack offhand)
|
||||
{
|
||||
if (offhand == null)
|
||||
return true;
|
||||
public boolean allowOffhand(ItemStack mainhand, ItemStack offhand) {
|
||||
if (offhand == null) return true;
|
||||
|
||||
return (mainhand != null && mainhand.getItem() != TinkerTools.cleaver && mainhand.getItem() != TinkerTools.battleaxe)
|
||||
return (mainhand != null
|
||||
&& mainhand.getItem() != TinkerTools.cleaver
|
||||
&& mainhand.getItem() != TinkerTools.battleaxe)
|
||||
&& (offhand.getItem() != TinkerTools.cleaver && offhand.getItem() != TinkerTools.battleaxe);
|
||||
}
|
||||
|
||||
|
||||
@@ -20,81 +20,68 @@ import tconstruct.tools.entity.ArrowEntity;
|
||||
import tconstruct.util.config.PHConstruct;
|
||||
|
||||
@Deprecated
|
||||
public abstract class BowBase extends ToolCore
|
||||
{
|
||||
public BowBase()
|
||||
{
|
||||
public abstract class BowBase extends ToolCore {
|
||||
public BowBase() {
|
||||
super(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int durabilityTypeAccessory ()
|
||||
{
|
||||
public int durabilityTypeAccessory() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
/* Bow usage */
|
||||
@Override
|
||||
public void onPlayerStoppedUsing (ItemStack stack, World world, EntityPlayer player, int useRemaining)
|
||||
{
|
||||
public void onPlayerStoppedUsing(ItemStack stack, World world, EntityPlayer player, int useRemaining) {
|
||||
int time = this.getMaxItemUseDuration(stack) - useRemaining;
|
||||
|
||||
ArrowLooseEvent event = new ArrowLooseEvent(player, stack, time);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
if (event.isCanceled())
|
||||
{
|
||||
if (event.isCanceled()) {
|
||||
return;
|
||||
}
|
||||
time = event.charge;
|
||||
|
||||
boolean creative = player.capabilities.isCreativeMode || EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
|
||||
boolean creative = player.capabilities.isCreativeMode
|
||||
|| EnchantmentHelper.getEnchantmentLevel(Enchantment.infinity.effectId, stack) > 0;
|
||||
int slotID = getInventorySlotContainItem(TinkerTools.arrow, player.inventory);
|
||||
int arrowID = getInventorySlotContainItem(Items.arrow, player.inventory);
|
||||
int arrowState = 0;
|
||||
ItemStack tinkerArrow = null;
|
||||
if (slotID != -1)
|
||||
tinkerArrow = player.inventory.getStackInSlot(slotID);
|
||||
if (slotID != -1) tinkerArrow = player.inventory.getStackInSlot(slotID);
|
||||
|
||||
if (creative || tinkerArrow != null || arrowID != -1)
|
||||
{
|
||||
if (creative || tinkerArrow != null || arrowID != -1) {
|
||||
NBTTagCompound toolTag = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
float drawTime = toolTag.getInteger("DrawSpeed");
|
||||
float flightSpeed = toolTag.getFloat("FlightSpeed");
|
||||
float speedBase = (float) time / drawTime;
|
||||
speedBase = (speedBase * speedBase + speedBase * 2.0F) / 3.0F;
|
||||
|
||||
if ((double) speedBase < 0.1D)
|
||||
{
|
||||
if ((double) speedBase < 0.1D) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (speedBase > flightSpeed)
|
||||
{
|
||||
if (speedBase > flightSpeed) {
|
||||
speedBase = flightSpeed;
|
||||
}
|
||||
|
||||
EntityArrow arrowEntity = null;
|
||||
// if (tinkerArrow != null)
|
||||
if (slotID != -1 && (arrowID == -1 || slotID < arrowID))
|
||||
{
|
||||
if (slotID != -1 && (arrowID == -1 || slotID < arrowID)) {
|
||||
ItemStack arrowStack = tinkerArrow.copy();
|
||||
arrowStack.stackSize = 1;
|
||||
arrowEntity = new ArrowEntity(world, player, speedBase * 2.0F, arrowStack);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
arrowEntity = new EntityArrow(world, player, speedBase * 2.0F);
|
||||
}
|
||||
|
||||
if (speedBase >= 1.0F)
|
||||
{
|
||||
if (speedBase >= 1.0F) {
|
||||
arrowEntity.setIsCritical(true);
|
||||
}
|
||||
|
||||
int var9 = EnchantmentHelper.getEnchantmentLevel(Enchantment.power.effectId, stack);
|
||||
|
||||
if (var9 > 0)
|
||||
{
|
||||
if (var9 > 0) {
|
||||
arrowEntity.setDamage(arrowEntity.getDamage() + (double) var9 * 0.5D + 0.5D);
|
||||
}
|
||||
|
||||
@@ -104,57 +91,44 @@ public abstract class BowBase extends ToolCore
|
||||
((ArrowEntity) arrowEntity).setKnockbackModStrength(toolTag.getFloat("Knockback"));
|
||||
// var10 += toolTag.getFloat("Knockback");
|
||||
|
||||
if (var10 > 0)
|
||||
{
|
||||
if (var10 > 0) {
|
||||
arrowEntity.setKnockbackStrength(var10);
|
||||
}
|
||||
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0)
|
||||
{
|
||||
if (EnchantmentHelper.getEnchantmentLevel(Enchantment.flame.effectId, stack) > 0) {
|
||||
arrowEntity.setFire(100);
|
||||
}
|
||||
|
||||
int reinforced = 0;
|
||||
|
||||
if (toolTag.hasKey("Unbreaking"))
|
||||
reinforced = toolTag.getInteger("Unbreaking");
|
||||
if (toolTag.hasKey("Unbreaking")) reinforced = toolTag.getInteger("Unbreaking");
|
||||
|
||||
if (random.nextInt(10) < 10 - reinforced)
|
||||
{
|
||||
if (random.nextInt(10) < 10 - reinforced) {
|
||||
AbilityHelper.damageTool(stack, 1, player, false);
|
||||
}
|
||||
world.playSoundAtEntity(player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + speedBase * 0.5F);
|
||||
world.playSoundAtEntity(
|
||||
player, "random.bow", 1.0F, 1.0F / (itemRand.nextFloat() * 0.4F + 1.2F) + speedBase * 0.5F);
|
||||
|
||||
if (creative)
|
||||
{
|
||||
if (creative) {
|
||||
arrowEntity.canBePickedUp = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
// if (tinkerArrow != null)
|
||||
if (slotID != -1 && (arrowID == -1 || slotID < arrowID))
|
||||
{
|
||||
if (slotID != -1 && (arrowID == -1 || slotID < arrowID)) {
|
||||
player.inventory.consumeInventoryItem(TinkerTools.arrow);
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
player.inventory.consumeInventoryItem(Items.arrow);
|
||||
}
|
||||
}
|
||||
|
||||
if (!world.isRemote)
|
||||
{
|
||||
if (!world.isRemote) {
|
||||
world.spawnEntityInWorld(arrowEntity);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
int getInventorySlotContainItem (Item item, InventoryPlayer inventory)
|
||||
{
|
||||
for (int j = 0; j < inventory.mainInventory.length; ++j)
|
||||
{
|
||||
if (inventory.mainInventory[j] != null && inventory.mainInventory[j].getItem() == item)
|
||||
{
|
||||
int getInventorySlotContainItem(Item item, InventoryPlayer inventory) {
|
||||
for (int j = 0; j < inventory.mainInventory.length; ++j) {
|
||||
if (inventory.mainInventory[j] != null && inventory.mainInventory[j].getItem() == item) {
|
||||
return j;
|
||||
}
|
||||
}
|
||||
@@ -162,8 +136,7 @@ public abstract class BowBase extends ToolCore
|
||||
return -1;
|
||||
}
|
||||
|
||||
public ItemStack onFoodEaten (ItemStack stack, World par2World, EntityPlayer par3EntityPlayer)
|
||||
{
|
||||
public ItemStack onFoodEaten(ItemStack stack, World par2World, EntityPlayer par3EntityPlayer) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@@ -171,8 +144,7 @@ public abstract class BowBase extends ToolCore
|
||||
* How long it takes to use or consume an item
|
||||
*/
|
||||
@Override
|
||||
public int getMaxItemUseDuration (ItemStack par1ItemStack)
|
||||
{
|
||||
public int getMaxItemUseDuration(ItemStack par1ItemStack) {
|
||||
return 72000;
|
||||
}
|
||||
|
||||
@@ -181,8 +153,7 @@ public abstract class BowBase extends ToolCore
|
||||
* is being used
|
||||
*/
|
||||
@Override
|
||||
public EnumAction getItemUseAction (ItemStack par1ItemStack)
|
||||
{
|
||||
public EnumAction getItemUseAction(ItemStack par1ItemStack) {
|
||||
return EnumAction.bow;
|
||||
}
|
||||
|
||||
@@ -191,22 +162,19 @@ public abstract class BowBase extends ToolCore
|
||||
* pressed. Args: itemStack, world, entityPlayer
|
||||
*/
|
||||
@Override
|
||||
public ItemStack onItemRightClick (ItemStack stack, World par2World, EntityPlayer player)
|
||||
{
|
||||
if (stack.hasTagCompound())
|
||||
{
|
||||
public ItemStack onItemRightClick(ItemStack stack, World par2World, EntityPlayer player) {
|
||||
if (stack.hasTagCompound()) {
|
||||
NBTTagCompound toolTag = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (!toolTag.getBoolean("Broken"))
|
||||
{
|
||||
if (!toolTag.getBoolean("Broken")) {
|
||||
ArrowNockEvent event = new ArrowNockEvent(player, stack);
|
||||
MinecraftForge.EVENT_BUS.post(event);
|
||||
if (event.isCanceled())
|
||||
{
|
||||
if (event.isCanceled()) {
|
||||
return event.result;
|
||||
}
|
||||
|
||||
if (player.capabilities.isCreativeMode || player.inventory.hasItemStack(new ItemStack(Items.arrow)) || player.inventory.hasItemStack(new ItemStack(TinkerTools.arrow)))
|
||||
{
|
||||
if (player.capabilities.isCreativeMode
|
||||
|| player.inventory.hasItemStack(new ItemStack(Items.arrow))
|
||||
|| player.inventory.hasItemStack(new ItemStack(TinkerTools.arrow))) {
|
||||
player.setItemInUse(stack, this.getMaxItemUseDuration(stack));
|
||||
}
|
||||
}
|
||||
@@ -217,45 +185,50 @@ public abstract class BowBase extends ToolCore
|
||||
|
||||
/* Rendering */
|
||||
@Override
|
||||
public void registerIcons (IIconRegister iconRegister)
|
||||
{
|
||||
public void registerIcons(IIconRegister iconRegister) {
|
||||
super.registerIcons(iconRegister);
|
||||
if(PHConstruct.minimalTextures)
|
||||
{
|
||||
if (PHConstruct.minimalTextures) {
|
||||
headIcons1.clear();
|
||||
headIcons1.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(0) + "_1"));
|
||||
headIcons1.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(0) + "_1"));
|
||||
handleIcons1.clear();
|
||||
handleIcons1.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(2) + "_1"));
|
||||
handleIcons1.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(2) + "_1"));
|
||||
accessoryIcons1.clear();
|
||||
accessoryIcons1.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(3) + "_1"));
|
||||
accessoryIcons1.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(3) + "_1"));
|
||||
|
||||
headIcons2.clear();
|
||||
headIcons2.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(0) + "_2"));
|
||||
headIcons2.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(0) + "_2"));
|
||||
handleIcons2.clear();
|
||||
handleIcons2.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(2) + "_2"));
|
||||
handleIcons2.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(2) + "_2"));
|
||||
accessoryIcons2.clear();
|
||||
accessoryIcons2.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(3) + "_2"));
|
||||
accessoryIcons2.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(3) + "_2"));
|
||||
|
||||
headIcons3.clear();
|
||||
headIcons3.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(0) + "_3"));
|
||||
headIcons3.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(0) + "_3"));
|
||||
handleIcons3.clear();
|
||||
handleIcons3.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(2) + "_3"));
|
||||
handleIcons3.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(2) + "_3"));
|
||||
accessoryIcons3.clear();
|
||||
accessoryIcons3.put(-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(3) + "_3"));
|
||||
|
||||
accessoryIcons3.put(
|
||||
-1, iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/" + getIconSuffix(3) + "_3"));
|
||||
|
||||
// effect icons
|
||||
effectIcons1.clear();
|
||||
effectIcons2.clear();
|
||||
effectIcons3.clear();
|
||||
for(Map.Entry<Integer, String> entry : effectStrings.entrySet()) {
|
||||
for (Map.Entry<Integer, String> entry : effectStrings.entrySet()) {
|
||||
effectIcons.put(entry.getKey(), iconRegister.registerIcon(entry.getValue()));
|
||||
effectIcons1.put(entry.getKey(), iconRegister.registerIcon(entry.getValue() + "_1"));
|
||||
effectIcons2.put(entry.getKey(), iconRegister.registerIcon(entry.getValue() + "_2"));
|
||||
effectIcons3.put(entry.getKey(), iconRegister.registerIcon(entry.getValue() + "_3"));
|
||||
}
|
||||
}
|
||||
else {
|
||||
} else {
|
||||
headIcons1.clear();
|
||||
handleIcons1.clear();
|
||||
accessoryIcons1.clear();
|
||||
@@ -277,7 +250,8 @@ public abstract class BowBase extends ToolCore
|
||||
iterOne = accessoryStrings.entrySet().iterator();
|
||||
while (iterOne.hasNext()) {
|
||||
Map.Entry pairs = (Map.Entry) iterOne.next();
|
||||
accessoryIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
|
||||
accessoryIcons1.put(
|
||||
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -285,7 +259,8 @@ public abstract class BowBase extends ToolCore
|
||||
iterOne = extraStrings.entrySet().iterator();
|
||||
while (iterOne.hasNext()) {
|
||||
Map.Entry pairs = (Map.Entry) iterOne.next();
|
||||
extraIcons1.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
|
||||
extraIcons1.put(
|
||||
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_1"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -316,7 +291,8 @@ public abstract class BowBase extends ToolCore
|
||||
iterTwo = accessoryStrings.entrySet().iterator();
|
||||
while (iterTwo.hasNext()) {
|
||||
Map.Entry pairs = (Map.Entry) iterTwo.next();
|
||||
accessoryIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
|
||||
accessoryIcons2.put(
|
||||
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -324,7 +300,8 @@ public abstract class BowBase extends ToolCore
|
||||
iterTwo = extraStrings.entrySet().iterator();
|
||||
while (iterTwo.hasNext()) {
|
||||
Map.Entry pairs = (Map.Entry) iterTwo.next();
|
||||
extraIcons2.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
|
||||
extraIcons2.put(
|
||||
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_2"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -355,7 +332,8 @@ public abstract class BowBase extends ToolCore
|
||||
iterThree = accessoryStrings.entrySet().iterator();
|
||||
while (iterThree.hasNext()) {
|
||||
Map.Entry pairs = (Map.Entry) iterThree.next();
|
||||
accessoryIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
|
||||
accessoryIcons3.put(
|
||||
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -363,7 +341,8 @@ public abstract class BowBase extends ToolCore
|
||||
iterThree = extraStrings.entrySet().iterator();
|
||||
while (iterThree.hasNext()) {
|
||||
Map.Entry pairs = (Map.Entry) iterThree.next();
|
||||
extraIcons3.put((Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
|
||||
extraIcons3.put(
|
||||
(Integer) pairs.getKey(), iconRegister.registerIcon((String) pairs.getValue() + "_3"));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -376,82 +355,46 @@ public abstract class BowBase extends ToolCore
|
||||
registerArrows(iconRegister);
|
||||
}
|
||||
|
||||
void registerArrows (IIconRegister iconRegister)
|
||||
{
|
||||
void registerArrows(IIconRegister iconRegister) {
|
||||
arrow1 = iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/arrow_1");
|
||||
arrow2 = iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/arrow_2");
|
||||
arrow3 = iconRegister.registerIcon("tinker:" + getDefaultFolder() + "/arrow_3");
|
||||
}
|
||||
|
||||
@Override
|
||||
public IIcon getIcon (ItemStack stack, int renderPass)
|
||||
{
|
||||
public IIcon getIcon(ItemStack stack, int renderPass) {
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
|
||||
if (tags != null)
|
||||
{
|
||||
if (tags != null) {
|
||||
tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (renderPass < getPartAmount())
|
||||
{
|
||||
if (renderPass < getPartAmount()) {
|
||||
if (renderPass == 0) // Handle
|
||||
{
|
||||
if (tags.getBoolean("Broken"))
|
||||
return getCorrectIcon(brokenIcons, tags.getInteger("RenderHandle"));
|
||||
if (tags.getBoolean("Broken")) return getCorrectIcon(brokenIcons, tags.getInteger("RenderHandle"));
|
||||
return getCorrectIcon(handleIcons, tags.getInteger("RenderHandle"));
|
||||
}
|
||||
|
||||
else if (renderPass == 1) // Head
|
||||
} else if (renderPass == 1) // Head
|
||||
{
|
||||
return getCorrectIcon(headIcons, tags.getInteger("RenderHead"));
|
||||
}
|
||||
|
||||
else if (renderPass == 2) // Accessory
|
||||
} else if (renderPass == 2) // Accessory
|
||||
{
|
||||
return getCorrectIcon(accessoryIcons, tags.getInteger("RenderAccessory"));
|
||||
}
|
||||
|
||||
else if (renderPass == 3) // Extra
|
||||
} else if (renderPass == 3) // Extra
|
||||
{
|
||||
return getCorrectIcon(extraIcons, tags.getInteger("RenderExtra"));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (renderPass == getPartAmount())
|
||||
{
|
||||
if (tags.hasKey("Effect1"))
|
||||
return getCorrectIcon2(effectIcons, tags.getInteger("Effect1"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 1)
|
||||
{
|
||||
if (tags.hasKey("Effect2"))
|
||||
return getCorrectIcon2(effectIcons, tags.getInteger("Effect2"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 2)
|
||||
{
|
||||
if (tags.hasKey("Effect3"))
|
||||
return getCorrectIcon2(effectIcons, tags.getInteger("Effect3"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 3)
|
||||
{
|
||||
if (tags.hasKey("Effect4"))
|
||||
return getCorrectIcon2(effectIcons, tags.getInteger("Effect4"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 4)
|
||||
{
|
||||
if (tags.hasKey("Effect5"))
|
||||
return getCorrectIcon2(effectIcons, tags.getInteger("Effect5"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 5)
|
||||
{
|
||||
if (tags.hasKey("Effect6"))
|
||||
return getCorrectIcon2(effectIcons, tags.getInteger("Effect6"));
|
||||
} else {
|
||||
if (renderPass == getPartAmount()) {
|
||||
if (tags.hasKey("Effect1")) return getCorrectIcon2(effectIcons, tags.getInteger("Effect1"));
|
||||
} else if (renderPass == getPartAmount() + 1) {
|
||||
if (tags.hasKey("Effect2")) return getCorrectIcon2(effectIcons, tags.getInteger("Effect2"));
|
||||
} else if (renderPass == getPartAmount() + 2) {
|
||||
if (tags.hasKey("Effect3")) return getCorrectIcon2(effectIcons, tags.getInteger("Effect3"));
|
||||
} else if (renderPass == getPartAmount() + 3) {
|
||||
if (tags.hasKey("Effect4")) return getCorrectIcon2(effectIcons, tags.getInteger("Effect4"));
|
||||
} else if (renderPass == getPartAmount() + 4) {
|
||||
if (tags.hasKey("Effect5")) return getCorrectIcon2(effectIcons, tags.getInteger("Effect5"));
|
||||
} else if (renderPass == getPartAmount() + 5) {
|
||||
if (tags.hasKey("Effect6")) return getCorrectIcon2(effectIcons, tags.getInteger("Effect6"));
|
||||
}
|
||||
}
|
||||
return blankSprite;
|
||||
@@ -459,30 +402,24 @@ public abstract class BowBase extends ToolCore
|
||||
return emptyIcon;
|
||||
}
|
||||
|
||||
protected IIcon getCorrectIcon2(Map<Integer, IIcon> icons, int id)
|
||||
{
|
||||
if(!icons.containsKey(id))
|
||||
return blankSprite;
|
||||
|
||||
protected IIcon getCorrectIcon2(Map<Integer, IIcon> icons, int id) {
|
||||
if (!icons.containsKey(id)) return blankSprite;
|
||||
|
||||
return icons.get(id);
|
||||
}
|
||||
|
||||
/* Animations */
|
||||
@Override
|
||||
public void registerPartPaths (int index, String[] location)
|
||||
{
|
||||
public void registerPartPaths(int index, String[] location) {
|
||||
headStrings.put(index, location[0]);
|
||||
// brokenHeadStrings.put(index, location[1]);
|
||||
// handleStrings.put(index, location[2]);
|
||||
if (location.length > 3)
|
||||
accessoryStrings.put(index, location[3]);
|
||||
if (location.length > 4)
|
||||
extraStrings.put(index, location[4]);
|
||||
if (location.length > 3) accessoryStrings.put(index, location[3]);
|
||||
if (location.length > 4) extraStrings.put(index, location[4]);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerAlternatePartPaths (int index, String[] location)
|
||||
{
|
||||
public void registerAlternatePartPaths(int index, String[] location) {
|
||||
brokenPartStrings.put(index, location[1]);
|
||||
handleStrings.put(index, location[2]);
|
||||
}
|
||||
@@ -510,100 +447,59 @@ public abstract class BowBase extends ToolCore
|
||||
public HashMap<Integer, IIcon> effectIcons3 = new HashMap<Integer, IIcon>();
|
||||
|
||||
@Override
|
||||
public IIcon getIcon (ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining)
|
||||
{
|
||||
public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) {
|
||||
int useTime = stack.getMaxItemUseDuration() - useRemaining;
|
||||
if (!stack.hasTagCompound())
|
||||
return emptyIcon;
|
||||
if (!stack.hasTagCompound()) return emptyIcon;
|
||||
|
||||
NBTTagCompound toolTag = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
int drawTime = toolTag.getInteger("DrawSpeed");
|
||||
float flightSpeed = toolTag.getFloat("FlightSpeed");
|
||||
drawTime *= flightSpeed;
|
||||
if (usingItem == null)
|
||||
{
|
||||
if (usingItem == null) {
|
||||
return getIcon(stack, renderPass);
|
||||
}
|
||||
if (useTime >= drawTime - 2)
|
||||
{
|
||||
if (useTime >= drawTime - 2) {
|
||||
return getIcon3(stack, renderPass);
|
||||
}
|
||||
if (useTime >= (drawTime * 2 / 3))
|
||||
{
|
||||
if (useTime >= (drawTime * 2 / 3)) {
|
||||
return getIcon2(stack, renderPass);
|
||||
}
|
||||
return getIcon1(stack, renderPass);
|
||||
}
|
||||
|
||||
public IIcon getIcon1 (ItemStack stack, int renderPass)
|
||||
{
|
||||
public IIcon getIcon1(ItemStack stack, int renderPass) {
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
|
||||
if (tags != null)
|
||||
{
|
||||
if (tags != null) {
|
||||
tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (renderPass < getPartAmount())
|
||||
{
|
||||
if (renderPass < getPartAmount()) {
|
||||
if (renderPass == 0) // Handle
|
||||
{
|
||||
return getCorrectIcon(handleIcons1, tags.getInteger("RenderHandle"));
|
||||
}
|
||||
|
||||
else if (renderPass == 1) // Head
|
||||
} else if (renderPass == 1) // Head
|
||||
{
|
||||
return getCorrectIcon(headIcons1, tags.getInteger("RenderHead"));
|
||||
}
|
||||
|
||||
else if (renderPass == 2) // Accessory
|
||||
} else if (renderPass == 2) // Accessory
|
||||
{
|
||||
return getCorrectIcon(accessoryIcons1, tags.getInteger("RenderAccessory"));
|
||||
}
|
||||
|
||||
else if (renderPass == 3) // Extra
|
||||
} else if (renderPass == 3) // Extra
|
||||
{
|
||||
return getCorrectIcon(extraIcons1, tags.getInteger("RenderExtra"));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (renderPass == getPartAmount())
|
||||
{
|
||||
if (tags.hasKey("Effect1"))
|
||||
return getCorrectIcon2(effectIcons1, tags.getInteger("Effect1"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 1)
|
||||
{
|
||||
if (tags.hasKey("Effect2"))
|
||||
return getCorrectIcon2(effectIcons1, tags.getInteger("Effect2"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 2)
|
||||
{
|
||||
if (tags.hasKey("Effect3"))
|
||||
return getCorrectIcon2(effectIcons1, tags.getInteger("Effect3"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 3)
|
||||
{
|
||||
if (tags.hasKey("Effect4"))
|
||||
return getCorrectIcon2(effectIcons1, tags.getInteger("Effect4"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 4)
|
||||
{
|
||||
if (tags.hasKey("Effect5"))
|
||||
return getCorrectIcon2(effectIcons1, tags.getInteger("Effect5"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 5)
|
||||
{
|
||||
if (tags.hasKey("Effect6"))
|
||||
return getCorrectIcon2(effectIcons1, tags.getInteger("Effect6"));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (renderPass == getPartAmount()) {
|
||||
if (tags.hasKey("Effect1")) return getCorrectIcon2(effectIcons1, tags.getInteger("Effect1"));
|
||||
} else if (renderPass == getPartAmount() + 1) {
|
||||
if (tags.hasKey("Effect2")) return getCorrectIcon2(effectIcons1, tags.getInteger("Effect2"));
|
||||
} else if (renderPass == getPartAmount() + 2) {
|
||||
if (tags.hasKey("Effect3")) return getCorrectIcon2(effectIcons1, tags.getInteger("Effect3"));
|
||||
} else if (renderPass == getPartAmount() + 3) {
|
||||
if (tags.hasKey("Effect4")) return getCorrectIcon2(effectIcons1, tags.getInteger("Effect4"));
|
||||
} else if (renderPass == getPartAmount() + 4) {
|
||||
if (tags.hasKey("Effect5")) return getCorrectIcon2(effectIcons1, tags.getInteger("Effect5"));
|
||||
} else if (renderPass == getPartAmount() + 5) {
|
||||
if (tags.hasKey("Effect6")) return getCorrectIcon2(effectIcons1, tags.getInteger("Effect6"));
|
||||
} else {
|
||||
return arrow1;
|
||||
}
|
||||
}
|
||||
@@ -612,75 +508,39 @@ public abstract class BowBase extends ToolCore
|
||||
return emptyIcon;
|
||||
}
|
||||
|
||||
public IIcon getIcon2 (ItemStack stack, int renderPass)
|
||||
{
|
||||
public IIcon getIcon2(ItemStack stack, int renderPass) {
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
|
||||
if (tags != null)
|
||||
{
|
||||
if (tags != null) {
|
||||
tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (renderPass < getPartAmount())
|
||||
{
|
||||
if (renderPass < getPartAmount()) {
|
||||
if (renderPass == 0) // Handle
|
||||
{
|
||||
return getCorrectIcon(handleIcons2, tags.getInteger("RenderHandle"));
|
||||
}
|
||||
|
||||
else if (renderPass == 1) // Head
|
||||
} else if (renderPass == 1) // Head
|
||||
{
|
||||
return getCorrectIcon(headIcons2, tags.getInteger("RenderHead"));
|
||||
}
|
||||
|
||||
else if (renderPass == 2) // Accessory
|
||||
} else if (renderPass == 2) // Accessory
|
||||
{
|
||||
return getCorrectIcon(accessoryIcons2, tags.getInteger("RenderAccessory"));
|
||||
}
|
||||
|
||||
else if (renderPass == 3) // Extra
|
||||
} else if (renderPass == 3) // Extra
|
||||
{
|
||||
return getCorrectIcon(extraIcons2, tags.getInteger("RenderExtra"));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (renderPass == getPartAmount())
|
||||
{
|
||||
if (tags.hasKey("Effect1"))
|
||||
return getCorrectIcon2(effectIcons2, tags.getInteger("Effect1"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 1)
|
||||
{
|
||||
if (tags.hasKey("Effect2"))
|
||||
return getCorrectIcon2(effectIcons2, tags.getInteger("Effect2"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 2)
|
||||
{
|
||||
if (tags.hasKey("Effect3"))
|
||||
return getCorrectIcon2(effectIcons2, tags.getInteger("Effect3"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 3)
|
||||
{
|
||||
if (tags.hasKey("Effect4"))
|
||||
return getCorrectIcon2(effectIcons2, tags.getInteger("Effect4"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 4)
|
||||
{
|
||||
if (tags.hasKey("Effect5"))
|
||||
return getCorrectIcon2(effectIcons2, tags.getInteger("Effect5"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 5)
|
||||
{
|
||||
if (tags.hasKey("Effect6"))
|
||||
return getCorrectIcon2(effectIcons2, tags.getInteger("Effect6"));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (renderPass == getPartAmount()) {
|
||||
if (tags.hasKey("Effect1")) return getCorrectIcon2(effectIcons2, tags.getInteger("Effect1"));
|
||||
} else if (renderPass == getPartAmount() + 1) {
|
||||
if (tags.hasKey("Effect2")) return getCorrectIcon2(effectIcons2, tags.getInteger("Effect2"));
|
||||
} else if (renderPass == getPartAmount() + 2) {
|
||||
if (tags.hasKey("Effect3")) return getCorrectIcon2(effectIcons2, tags.getInteger("Effect3"));
|
||||
} else if (renderPass == getPartAmount() + 3) {
|
||||
if (tags.hasKey("Effect4")) return getCorrectIcon2(effectIcons2, tags.getInteger("Effect4"));
|
||||
} else if (renderPass == getPartAmount() + 4) {
|
||||
if (tags.hasKey("Effect5")) return getCorrectIcon2(effectIcons2, tags.getInteger("Effect5"));
|
||||
} else if (renderPass == getPartAmount() + 5) {
|
||||
if (tags.hasKey("Effect6")) return getCorrectIcon2(effectIcons2, tags.getInteger("Effect6"));
|
||||
} else {
|
||||
return arrow2;
|
||||
}
|
||||
}
|
||||
@@ -689,75 +549,39 @@ public abstract class BowBase extends ToolCore
|
||||
return emptyIcon;
|
||||
}
|
||||
|
||||
public IIcon getIcon3 (ItemStack stack, int renderPass)
|
||||
{
|
||||
public IIcon getIcon3(ItemStack stack, int renderPass) {
|
||||
NBTTagCompound tags = stack.getTagCompound();
|
||||
|
||||
if (tags != null)
|
||||
{
|
||||
if (tags != null) {
|
||||
tags = stack.getTagCompound().getCompoundTag("InfiTool");
|
||||
if (renderPass < getPartAmount())
|
||||
{
|
||||
if (renderPass < getPartAmount()) {
|
||||
if (renderPass == 0) // Handle
|
||||
{
|
||||
return getCorrectIcon(handleIcons3, tags.getInteger("RenderHandle"));
|
||||
}
|
||||
|
||||
else if (renderPass == 1) // Head
|
||||
} else if (renderPass == 1) // Head
|
||||
{
|
||||
return getCorrectIcon(headIcons3, tags.getInteger("RenderHead"));
|
||||
}
|
||||
|
||||
else if (renderPass == 2) // Accessory
|
||||
} else if (renderPass == 2) // Accessory
|
||||
{
|
||||
return getCorrectIcon(accessoryIcons3, tags.getInteger("RenderAccessory"));
|
||||
}
|
||||
|
||||
else if (renderPass == 3) // Extra
|
||||
} else if (renderPass == 3) // Extra
|
||||
{
|
||||
return getCorrectIcon(extraIcons3, tags.getInteger("RenderExtra"));
|
||||
}
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
if (renderPass == getPartAmount())
|
||||
{
|
||||
if (tags.hasKey("Effect1"))
|
||||
return getCorrectIcon2(effectIcons3, tags.getInteger("Effect1"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 1)
|
||||
{
|
||||
if (tags.hasKey("Effect2"))
|
||||
return getCorrectIcon2(effectIcons3, tags.getInteger("Effect2"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 2)
|
||||
{
|
||||
if (tags.hasKey("Effect3"))
|
||||
return getCorrectIcon2(effectIcons3, tags.getInteger("Effect3"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 3)
|
||||
{
|
||||
if (tags.hasKey("Effect4"))
|
||||
return getCorrectIcon2(effectIcons3, tags.getInteger("Effect4"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 4)
|
||||
{
|
||||
if (tags.hasKey("Effect5"))
|
||||
return getCorrectIcon2(effectIcons3, tags.getInteger("Effect5"));
|
||||
}
|
||||
|
||||
else if (renderPass == getPartAmount() + 5)
|
||||
{
|
||||
if (tags.hasKey("Effect6"))
|
||||
return getCorrectIcon2(effectIcons3, tags.getInteger("Effect6"));
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
if (renderPass == getPartAmount()) {
|
||||
if (tags.hasKey("Effect1")) return getCorrectIcon2(effectIcons3, tags.getInteger("Effect1"));
|
||||
} else if (renderPass == getPartAmount() + 1) {
|
||||
if (tags.hasKey("Effect2")) return getCorrectIcon2(effectIcons3, tags.getInteger("Effect2"));
|
||||
} else if (renderPass == getPartAmount() + 2) {
|
||||
if (tags.hasKey("Effect3")) return getCorrectIcon2(effectIcons3, tags.getInteger("Effect3"));
|
||||
} else if (renderPass == getPartAmount() + 3) {
|
||||
if (tags.hasKey("Effect4")) return getCorrectIcon2(effectIcons3, tags.getInteger("Effect4"));
|
||||
} else if (renderPass == getPartAmount() + 4) {
|
||||
if (tags.hasKey("Effect5")) return getCorrectIcon2(effectIcons3, tags.getInteger("Effect5"));
|
||||
} else if (renderPass == getPartAmount() + 5) {
|
||||
if (tags.hasKey("Effect6")) return getCorrectIcon2(effectIcons3, tags.getInteger("Effect6"));
|
||||
} else {
|
||||
return arrow3;
|
||||
}
|
||||
}
|
||||
@@ -767,15 +591,18 @@ public abstract class BowBase extends ToolCore
|
||||
}
|
||||
|
||||
@Override
|
||||
public void buildTool (int id, String name, List list)
|
||||
{
|
||||
public void buildTool(int id, String name, List list) {
|
||||
Item accessory = getAccessoryItem();
|
||||
ItemStack accessoryStack = accessory != null ? new ItemStack(getAccessoryItem(), 1, id) : null;
|
||||
Item extra = getExtraItem();
|
||||
ItemStack extraStack = extra != null ? new ItemStack(getExtraItem(), 1, id) : null;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(new ItemStack(getHeadItem(), 1, id), new ItemStack(getHandleItem(), 1, id), accessoryStack, extraStack, name);
|
||||
if (tool == null)
|
||||
return;
|
||||
ItemStack tool = ToolBuilder.instance.buildTool(
|
||||
new ItemStack(getHeadItem(), 1, id),
|
||||
new ItemStack(getHandleItem(), 1, id),
|
||||
accessoryStack,
|
||||
extraStack,
|
||||
name);
|
||||
if (tool == null) return;
|
||||
|
||||
tool.getTagCompound().getCompoundTag("InfiTool").setBoolean("Built", true);
|
||||
list.add(tool);
|
||||
|
||||
Loaded 100 of 571 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user