Merge branch 'master' into weaponry

Conflicts:
	src/main/java/tconstruct/tools/ToolProxyClient.java
This commit is contained in:
Bernhard Bonigl committed 2014-10-26 17:10:09 +01:00
commit 947da8f9df
21 files changed
+2127 -38

No files matched your search

+2
View File
@@ -86,6 +86,8 @@ public class 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)
@@ -49,11 +49,39 @@ public class TProxyClient extends TProxyCommon
public void readManuals ()
{
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
diary = readManual("/assets/tinker/manuals/diary.xml", dbFactory);
volume1 = readManual("/assets/tinker/manuals/firstday.xml", dbFactory);
volume2 = readManual("/assets/tinker/manuals/materials.xml", dbFactory);
smelter = readManual("/assets/tinker/manuals/smeltery.xml", dbFactory);
initManualIcons();
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);
Document volume2_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/materials.xml", dbFactory);
Document smelter_cl = readManual("/assets/tinker/manuals/" + CurrentLanguage + "/smeltery.xml", dbFactory);
diary = readManual("/assets/tinker/manuals/en_US/diary.xml", dbFactory);
volume1 = readManual("/assets/tinker/manuals/en_US/firstday.xml", dbFactory);
volume2 = readManual("/assets/tinker/manuals/en_US/materials.xml", dbFactory);
smelter = readManual("/assets/tinker/manuals/en_US/smeltery.xml", dbFactory);
if(diary_cl != null)
{
diary = diary_cl;
}
if(volume1_cl != null)
{
volume1 = volume1_cl;
}
if(volume2_cl != null)
{
volume2 = volume2_cl;
}
if(smelter_cl != null)
{
smelter = smelter_cl;
}
initManualIcons();
initManualRecipes();
initManualPages();
manualData = new ManualInfo();
@@ -155,7 +155,7 @@ public class DynamicToolPart extends CraftingItem implements IToolPart
if(matId > icons.length)
return super.getColorFromItemStack(stack, renderpass);
if(icons[matId] == null)
if(matId >= 0 && icons[matId] == null)
return TConstructRegistry.getMaterial(matId).primaryColor();
return super.getColorFromItemStack(stack, renderpass);
@@ -16,7 +16,7 @@ import net.minecraft.network.play.client.C07PacketPlayerDigging;
import net.minecraft.network.play.server.S23PacketBlockChange;
import net.minecraft.world.World;
import net.minecraftforge.common.ForgeHooks;
import tconstruct.TConstruct;
import tconstruct.tools.TinkerTools;
import tconstruct.util.config.PHConstruct;
/* Base class for tools that should be harvesting blocks */
@@ -153,7 +153,8 @@ public abstract class HarvestTool extends ToolCore
if (nearbyStack != null)
{
Item item = nearbyStack.getItem();
if (item instanceof ItemBlock)
if (item instanceof ItemBlock || (item != null && item == TinkerTools.openBlocksDevNull))
{
int posX = x;
int posY = y;
@@ -197,8 +198,17 @@ public abstract class HarvestTool extends ToolCore
int dmg = nearbyStack.getItemDamage();
int count = nearbyStack.stackSize;
if (item == TinkerTools.openBlocksDevNull)
{
//Openblocks uses current inventory slot, so we have to do this...
player.inventory.currentItem=itemSlot;
item.onItemUse(nearbyStack, player, world, x, y, z, side, clickX, clickY, clickZ);
player.inventory.currentItem=hotbarSlot;
player.swingItem();
}
else
used = item.onItemUse(nearbyStack, player, world, x, y, z, side, clickX, clickY, clickZ);
used = item.onItemUse(nearbyStack, player, world, x, y, z, side, clickX, clickY, clickZ);
// handle creative mode
if(player.capabilities.isCreativeMode) {
// fun fact: vanilla minecraft does it exactly the same way
@@ -9,6 +9,7 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import tconstruct.library.modifier.IModifyable;
import tconstruct.library.tools.ToolCore;
import tconstruct.util.config.PHConstruct;
/* TE3 support */
@@ -59,7 +60,7 @@ public class ModFlux extends ModBoolean
int maxEnergy = ((IEnergyContainerItem) foundBattery.getItem()).getMaxEnergyStored(foundBattery);
// battery too big for our tool?
if(tags.getInteger("TotalDurability") < maxEnergy/1000) // durability needs to be at least 1/1000th of the charge
if(PHConstruct.balancedFluxModifier && tags.getInteger("TotalDurability") < maxEnergy/1000) // durability needs to be at least 1/1000th of the charge
return false;
// check if we already have a flux modifier
@@ -1,5 +1,6 @@
package tconstruct.smeltery;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import cpw.mods.fml.common.event.FMLPostInitializationEvent;
@@ -46,7 +47,7 @@ import tconstruct.world.TinkerWorld;
import java.util.*;
@ObjectHolder(TConstruct.modID)
@Pulse(id = "Tinkers' Smeltery", description = "Liquid metals, casting, and the multiblock structure.")
@Pulse(id = "Tinkers' Smeltery", description = "Liquid metals, casting, and the multiblock structure.", forced = true)
public class TinkerSmeltery
{
@SidedProxy(clientSide = "tconstruct.smeltery.SmelteryProxyClient", serverSide = "tconstruct.smeltery.SmelteryProxyCommon")
@@ -140,7 +141,9 @@ public class TinkerSmeltery
@Handler
public void preInit (FMLPreInitializationEvent event)
{
MinecraftForge.EVENT_BUS.register(new TinkerSmelteryEvents());
TinkerSmelteryEvents smelteryEvents = new TinkerSmelteryEvents();
MinecraftForge.EVENT_BUS.register(smelteryEvents);
FMLCommonHandler.instance().bus().register(smelteryEvents);
TinkerSmeltery.buckets = new FilledBucket(BlockUtils.getBlockFromItem(TinkerSmeltery.buckets));
GameRegistry.registerItem(TinkerSmeltery.buckets, "buckets");
@@ -39,7 +39,7 @@ import tconstruct.world.itemblocks.CraftedSoilItemBlock;
import static net.minecraft.util.EnumChatFormatting.*;
@ObjectHolder(TConstruct.modID)
@Pulse(id = "Tinkers' Tools", description = "The main core of the mod! All of the tools, the tables, and the patterns are here.")
@Pulse(id = "Tinkers' Tools", description = "The main core of the mod! All of the tools, the tables, and the patterns are here.", forced = true)
public class TinkerTools
{
/* Proxies for sides, used for graphics processing */
@@ -127,11 +127,17 @@ public class TinkerTools
// recipe stuff
public static boolean thaumcraftAvailable;
//Dev/Null Stuff
public static Item openBlocksDevNull;
@Handler
public void preInit (FMLPreInitializationEvent event)
{
MinecraftForge.EVENT_BUS.register(new TinkerToolEvents());
TinkerToolEvents toolEvents = new TinkerToolEvents();
MinecraftForge.EVENT_BUS.register(toolEvents);
FMLCommonHandler.instance().bus().register(toolEvents);
//Blocks
TinkerTools.toolStationWood = new ToolStationBlock(Material.wood).setBlockName("ToolStation");
@@ -714,6 +720,9 @@ public class TinkerTools
{
} // No need to handle
}
//OpenBlocks
openBlocksDevNull = GameRegistry.findItem("OpenBlocks", "devnull");
}
void registerMaterials ()
@@ -44,6 +44,7 @@ public class PHConstruct
keepLevels = config.get("Difficulty Changes", "Keep levels on death", true).getBoolean(true);
beginnerBook = config.get("Difficulty Changes", "Spawn beginner book", true).getBoolean(true);
deathPenality = config.get("Difficulty Changes", "Tools lose 10% durability on death", true).getBoolean(true);
balancedFluxModifier = config.get("Difficulty Changes", "Balanced Flux Modifier", true).getBoolean(true);
enableTWood = config.get("Difficulty Changes", "Enable mod wooden tools", true).getBoolean(true);
enableTStone = config.get("Difficulty Changes", "Enable mod stone tools", true).getBoolean(true);
@@ -290,6 +291,7 @@ public class PHConstruct
public static boolean deathPenality;
public static boolean alphaRegen;
public static boolean alphaHunger;
public static boolean balancedFluxModifier;
public static boolean disableWoodTools;
public static boolean disableStoneTools;
@@ -44,7 +44,7 @@ import tconstruct.world.itemblocks.*;
import tconstruct.world.items.*;
@ObjectHolder(TConstruct.modID)
@Pulse(id = "Tinkers' World", description = "Ores, slime islands, essence berries, and the like.")
@Pulse(id = "Tinkers' World", description = "Ores, slime islands, essence berries, and the like.", forced = true)
public class TinkerWorld
{
@Instance("TinkerWorld")