Fix PvP damage, fix boilers, added config and changelog

This commit is contained in:
JAWolfe04 2016-02-11 19:39:00 -06:00
parent 980bc6e0b1
commit 4264127715
34 changed files with 1523 additions and 103 deletions

View File

@ -61,6 +61,11 @@ allprojects
repositories
{
maven {
// The repo from which to get waila
name "Mobius Repo"
url "http://mobiusstrip.eu/maven"
}
maven {
// the repo from which to get NEI and stuff
name 'CB Repo'
@ -73,6 +78,7 @@ dependencies
compile "codechicken:CodeChickenCore:1.7.10-1.0.4.35:dev"
compile "codechicken:CodeChickenLib:1.7.10-1.1.3.127:dev"
compile "codechicken:NotEnoughItems:1.7.10-1.0.4.95:dev"
compile "mcp.mobius.waila:Waila:1.5.11-RC2-NONEI_1.7.10"
}
//Creates a compiled de-obfuscated jar

View File

@ -1,6 +1,6 @@
minecraft_version=1.7.10
forge_version=10.13.4.1558-1.7.10
tfc_version=0.79.27
mod_version=1.05
mod_version=1.06
mod_id=TerraFirmaPunkTweaks
group_name=com.JAWolfe.tfptweaks

View File

@ -1,5 +1,5 @@
//========================================================================
// Heating items
// Heating items
//========================================================================
//Add Recipe
@ -18,7 +18,7 @@
//mods.tfptweaks.ItemHeat.removeRecipe(<terrafirmacraft:Sand>);
//========================================================================
// Loom Recipes
// Loom Recipes
//========================================================================
//Add Recipe
@ -36,7 +36,7 @@
//mods.tfptweaks.Loom.removeRecipe(<terrafirmacraft:item.WoolYarn> * 16);
//========================================================================
// Quern Recipes
// Quern Recipes
//========================================================================
//Add Recipe
@ -47,5 +47,18 @@
//Remove Recipe
//OutputStack, InputStack {Stack sizes must be the same as the recipe to be removed}
//mods.tfptweaks.Quern.removeRecipe(<terrafirmacraft:item.dyePowder:15> * 2, <minecraft:bone>);
//mods.tfptweaks.Quern.removeRecipe(<terrafirmacraft:item.dyePowder:15>, <minecraft:bone>);
//mods.tfptweaks.Quern.removeRecipe(<terrafirmacraft:item.dyePowder:15>, <minecraft:bone>);
//========================================================================
// Barrel Recipe(NOT FULLY IMPLEMENTED DO NOT USE)
//========================================================================
//Add Recipe
//OutputStack, OutputFluid, InputStack, InputFluid, sealtime, removesLiquid, sealed, minTechLevel, allowAnyStack
//mods.tfptweaks.Barrel.addRecipe();
//Add Multi-Item Recipe
//OutputStack, InputStack, inputFS, sealed, minTechLevel, allowAnyStack, keepstacksize
//mods.tfptweaks.Barrel.addMultiItemRecipe();

Binary file not shown.

Binary file not shown.

Binary file not shown.

49
changelog.txt Normal file
View File

@ -0,0 +1,49 @@
Changelog
=================================================
-------------------------------------------------
TFP Tweaks 1.06
-------------------------------------------------
New Features
+Added TFC water support for Flaxbeard's Steam Power boilers and flash boilers
+Added Config file to control most features of this mod
+Added Changelog
Tweaks
+Added integration of Flaxbeard's Steam Power with Waila
+Added withering to be treated like poison/magic instead of hit damage
Bug Fixes
+Fixed vanilla PvP 1 HP scaling to TFC doing 500 HPs; it should now scale to the config value
+Fixed required mods and dependencies
+Applied appropriate mod checks to prevent crashes from lacking a referenced mod
-------------------------------------------------
TFP Tweaks 1.05
-------------------------------------------------
New Features
+Added Minetweaker support for heating items in a firepit or forge, making items with the loom, and crushing items with the quern
-------------------------------------------------
TFP Tweaks 1.03
-------------------------------------------------
New Features
+All player damage less than 20 hit points is scaled to TFC levels with armour taken into account; 1 hit point is multiplied by 50
-------------------------------------------------
TFP Tweaks 1.02
-------------------------------------------------
New Features
+Player damage from magic less than 20 hit points is scaled to TFC levels; 1 hit point is multiplied by 50
+Vanilla healing between 2-8 healing points have been scaled to give TFC level healing; 1 healing point is multiplied by 50
-------------------------------------------------
TFP Tweaks 1.01
-------------------------------------------------
New Features
+Added Steamcraft 2 Flesh Block can no longer being crafted and does not appear in NEI
-------------------------------------------------
TFP Tweaks 1.00
-------------------------------------------------
New Features
+Added Vanilla chests are converted to TFC Oak chests when the vanilla chest is picked up from the ground by a player

View File

@ -3,6 +3,8 @@ package com.JAWolfe.tfptweaks;
import cpw.mods.fml.common.FMLLog;
import org.apache.logging.log4j.Level;
import com.JAWolfe.tfptweaks.reference.References;
public class LogHelper
{
public static void log(Level logLevel, Object object)

View File

@ -1,7 +1,12 @@
package com.JAWolfe.tfptweaks;
import com.JAWolfe.tfptweaks.blocks.TFPBlocks;
import com.JAWolfe.tfptweaks.reference.ConfigSettings;
import com.JAWolfe.tfptweaks.reference.References;
import codechicken.nei.api.API;
import codechicken.nei.api.IConfigureNEI;
import cpw.mods.fml.common.Loader;
import net.minecraft.item.ItemStack;
import steamcraft.common.init.InitBlocks;
@ -21,7 +26,15 @@ public class NEIConfig implements IConfigureNEI
@Override
public void loadConfig()
{
API.hideItem(new ItemStack(InitBlocks.blockFlesh, 1));
if(Loader.isModLoaded("steamcraft2") && !ConfigSettings.FleshBlockRecipe)
API.hideItem(new ItemStack(InitBlocks.blockFlesh, 1));
if(Loader.isModLoaded("Steamcraft"))
{
API.hideItem(new ItemStack(TFPBlocks.tweakedboiler, 1));
API.hideItem(new ItemStack(TFPBlocks.tweakedboilerOn, 1));
API.hideItem(new ItemStack(TFPBlocks.tweakedFlashBoiler, 1));
}
}
}

View File

@ -2,15 +2,14 @@ package com.JAWolfe.tfptweaks;
import java.util.List;
import com.JAWolfe.tfptweaks.reference.ConfigSettings;
import cpw.mods.fml.common.Loader;
import flaxbeard.steamcraft.SteamcraftItems;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.CraftingManager;
import net.minecraft.item.crafting.IRecipe;
import net.minecraftforge.oredict.OreDictionary;
import steamcraft.common.init.InitBlocks;
import steamcraft.common.init.InitItems;
public class RecipeTweaks
{
@ -19,19 +18,24 @@ public class RecipeTweaks
{
if(Loader.isModLoaded("steamcraft2"))
{
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for (int i = 0; i < recipes.size(); i++)
if(!ConfigSettings.FleshBlockRecipe)
{
if (recipes.get(i) != null)
List<IRecipe> recipes = CraftingManager.getInstance().getRecipeList();
for (int i = 0; i < recipes.size(); i++)
{
ItemStack recipeResult = recipes.get(i).getRecipeOutput();
if (recipeResult != null && recipeResult.getItem() == Item.getItemFromBlock(InitBlocks.blockFlesh))
recipes.remove(i--);
if (recipes.get(i) != null)
{
ItemStack recipeResult = recipes.get(i).getRecipeOutput();
if (recipeResult != null && recipeResult.getItem() == Item.getItemFromBlock(InitBlocks.blockFlesh))
{
recipes.remove(i--);
}
}
}
}
OreDictionary.registerOre("itemAxe", new ItemStack(InitItems.axeSteam, 1, OreDictionary.WILDCARD_VALUE));
//OreDictionary.registerOre("itemAxe", new ItemStack(InitItems.axeSteam, 1, OreDictionary.WILDCARD_VALUE));
}
}
@ -39,7 +43,7 @@ public class RecipeTweaks
{
if(Loader.isModLoaded("Steamcraft"))
{
OreDictionary.registerOre("itemAxe", new ItemStack(SteamcraftItems.steamAxe, 1, OreDictionary.WILDCARD_VALUE));
//OreDictionary.registerOre("itemAxe", new ItemStack(SteamcraftItems.steamAxe, 1, OreDictionary.WILDCARD_VALUE));
}
}
}

View File

@ -1,15 +0,0 @@
package com.JAWolfe.tfptweaks;
public class References
{
public static final String ModID = "terrafirmapunktweaks";
public static final String ModName = "TerraFirmaPunk Tweaks";
public static final String MODID_TFC = "terrafirmacraft";
public static final String MODNAME_TFC = "TerraFirmaCraft";
public static final String MODID_SC2 = "steamcraft2";
public static final String ModVersion = "@MOD_VERSION@";
public static final String ModDependencies = "required-after:" + MODID_TFC + MODID_SC2;
}

View File

@ -1,21 +1,40 @@
package com.JAWolfe.tfptweaks;
import com.JAWolfe.tfptweaks.blocks.TFPBlocks;
import com.JAWolfe.tfptweaks.handlers.*;
import com.JAWolfe.tfptweaks.minetweaker.TFCTweaker;
import com.JAWolfe.tfptweaks.proxy.CommonProxy;
import com.JAWolfe.tfptweaks.reference.References;
import cpw.mods.fml.common.FMLCommonHandler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.SidedProxy;
import cpw.mods.fml.common.Mod.EventHandler;
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.ExistingSubstitutionException;
import net.minecraftforge.common.MinecraftForge;
@Mod(modid = References.ModID, name = References.ModName, version = References.ModVersion, dependencies = References.ModDependencies)
public class TerraFirmaPunkTweaks
{
{
@Mod.Instance(References.ModID)
public static TerraFirmaPunkTweaks instance;
@SidedProxy(clientSide = References.CLIENT_PROXY_CLASS, serverSide = References.SERVER_PROXY_CLASS)
public static CommonProxy proxy;
@EventHandler
public void preInit(FMLPreInitializationEvent event)
{
ConfigHandler.init(event.getSuggestedConfigurationFile());
FMLCommonHandler.instance().bus().register(new ConfigHandler());
TFPBlocks.setup();
proxy.registerTileEntities();
}
@EventHandler
@ -23,12 +42,16 @@ public class TerraFirmaPunkTweaks
{
RecipeTweaks.RecipeFixes();
MinecraftForge.EVENT_BUS.register(new PlayerHandler());
MinecraftForge.EVENT_BUS.register(new PlayerInteractionHandler());
MinecraftForge.EVENT_BUS.register(new PlayerDamageHandler());
MinecraftForge.EVENT_BUS.register(new SpawnHandler());
proxy.registerWAILA();
}
@EventHandler
public void postInit(FMLPostInitializationEvent event)
{
{
TFCTweaker.postInit();
RecipeTweaks.SC2RecipeTweaks();

View File

@ -0,0 +1,84 @@
package com.JAWolfe.tfptweaks;
import java.util.List;
import com.JAWolfe.tfptweaks.reference.ConfigSettings;
import com.JAWolfe.tfptweaks.tiles.TEBoiler;
import com.JAWolfe.tfptweaks.tiles.TEFlashBoiler;
import cpw.mods.fml.common.Loader;
import mcp.mobius.waila.api.IWailaConfigHandler;
import mcp.mobius.waila.api.IWailaDataAccessor;
import mcp.mobius.waila.api.IWailaDataProvider;
import mcp.mobius.waila.api.IWailaRegistrar;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.StatCollector;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class WAILAInfo implements IWailaDataProvider
{
public static void callbackRegister(IWailaRegistrar reg)
{
if(Loader.isModLoaded("Steamcraft"))
{
reg.registerBodyProvider(new WAILAInfo(), TEBoiler.class);
reg.registerNBTProvider(new WAILAInfo(), TEBoiler.class);
reg.registerBodyProvider(new WAILAInfo(), TEFlashBoiler.class);
reg.registerNBTProvider(new WAILAInfo(), TEFlashBoiler.class);
}
}
@Override
public ItemStack getWailaStack(IWailaDataAccessor accessor, IWailaConfigHandler config)
{
return accessor.getStack();
}
@Override
public List<String> getWailaHead(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
return currenttip;
}
@Override
public List<String> getWailaBody(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
NBTTagCompound tag = accessor.getNBTData();
TileEntity tileEntity = accessor.getTileEntity();
if(Loader.isModLoaded("Steamcraft") && ConfigSettings.FSPWailaIntegration)
{
if (tileEntity != null && tileEntity instanceof TEBoiler)
{
currenttip.add(StatCollector.translateToLocal("gui.tfptweaks.watertank") + ": " + tag.getInteger("water") + " / " + ((TEBoiler)tileEntity).myTank.getCapacity());
currenttip.add(StatCollector.translateToLocal("gui.tfptweaks.steamtank") + ": " + tag.getInteger("steam") + " / " + ((TEBoiler)tileEntity).getCapacity());
}
else if (tileEntity != null && tileEntity instanceof TEFlashBoiler && ((TEFlashBoiler)tileEntity).hasMaster())
{
currenttip.add(StatCollector.translateToLocal("gui.tfptweaks.watertank") + ": " + ((TEFlashBoiler)tileEntity).getMasterTileEntity().getTank().getFluidAmount() + " / " + ((TEFlashBoiler)tileEntity).getMasterTileEntity().getTank().getCapacity());
currenttip.add(StatCollector.translateToLocal("gui.tfptweaks.steamtank") + ": "+ tag.getInteger("steam") + " / " + ((TEFlashBoiler)tileEntity).getMasterTileEntity().getCapacity());
}
}
return currenttip;
}
@Override
public List<String> getWailaTail(ItemStack itemStack, List<String> currenttip, IWailaDataAccessor accessor, IWailaConfigHandler config)
{
return currenttip;
}
@Override
public NBTTagCompound getNBTData(EntityPlayerMP player, TileEntity te, NBTTagCompound tag, World world, int x, int y, int z)
{
if (te != null)
te.writeToNBT(tag);
return tag;
}
}

View File

@ -0,0 +1,27 @@
package com.JAWolfe.tfptweaks.blocks;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.registry.GameRegistry;
import flaxbeard.steamcraft.SteamcraftBlocks;
import net.minecraft.block.Block;
public class TFPBlocks
{
public static Block tweakedboiler;
public static Block tweakedboilerOn;
public static Block tweakedFlashBoiler;
public static void setup()
{
if(Loader.isModLoaded("Steamcraft"))
{
tweakedboiler = new TweakedBoiler(false).setBlockName(SteamcraftBlocks.boiler.getUnlocalizedName().substring(5)).setHardness(5.0F).setResistance(10.0F);
tweakedboilerOn = new TweakedBoiler(true).setBlockName(SteamcraftBlocks.boilerOn.getUnlocalizedName().substring(5)).setHardness(5.0F).setResistance(10.0F);
tweakedFlashBoiler = new TweakedFlashBoiler().setBlockName(SteamcraftBlocks.flashBoiler.getUnlocalizedName().substring(5)).setHardness(5.0f).setResistance(10.0F);
GameRegistry.registerBlock(tweakedboiler, "tweakedboiler");
GameRegistry.registerBlock(tweakedboilerOn, "tweakedboilerOn");
GameRegistry.registerBlock(tweakedFlashBoiler, "tweakedFlashBoiler");
}
}
}

View File

@ -0,0 +1,139 @@
package com.JAWolfe.tfptweaks.blocks;
import java.util.Random;
import com.JAWolfe.tfptweaks.tiles.TEBoiler;
import com.bioxx.tfc.api.TFCFluids;
import flaxbeard.steamcraft.Steamcraft;
import flaxbeard.steamcraft.SteamcraftBlocks;
import flaxbeard.steamcraft.api.IWrenchable;
import flaxbeard.steamcraft.block.BlockBoiler;
import flaxbeard.steamcraft.tile.TileEntityBoiler;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
///////////////////////////////////////////////////////////////////////////////
//Only here till FSP updates then this is redundant
///////////////////////////////////////////////////////////////////////////////
public class TweakedBoiler extends BlockBoiler implements IWrenchable
{
private final Random rand = new Random();
public TweakedBoiler(boolean on)
{
super(on);
}
@Override
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta)
{
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
player.addExhaustion(0.025F);
float f = this.rand.nextFloat() * 0.8F + 0.1F;
float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(SteamcraftBlocks.boiler, 1, 0));
float f3 = 0.05F;
entityitem.motionX = (double) ((float) this.rand.nextGaussian() * f3);
entityitem.motionY = (double) ((float) this.rand.nextGaussian() * f3 + 0.2F);
entityitem.motionZ = (double) ((float) this.rand.nextGaussian() * f3);
world.spawnEntityInWorld(entityitem);
}
@Override
public TileEntity createNewTileEntity(World var1, int var2) {
return new TEBoiler();
}
@Override
public boolean onBlockActivated(World par1World, int par2, int par3, int par4, EntityPlayer player, int par6, float par7, float par8, float par9)
{
TileEntityBoiler tileentityboiler = (TileEntityBoiler) par1World.getTileEntity(par2, par3, par4);
if(tileentityboiler != null)
{
ItemStack heldItem = player.getHeldItem();
if(heldItem != null)
{
if (heldItem.getItem() instanceof IFluidContainerItem)
{
IFluidContainerItem fluidContainerItem = (IFluidContainerItem) heldItem.getItem();
FluidStack fluid = fluidContainerItem.getFluid(heldItem);
if(fluid != null && (fluid.getFluid() == FluidRegistry.WATER || fluid.getFluid() == TFCFluids.FRESHWATER))
{
int containerSpace = tileentityboiler.getTank().getCapacity() - tileentityboiler.getTank().getFluidAmount();
if(containerSpace > 0)
{
FluidStack drained;
if(!player.capabilities.isCreativeMode)
drained = fluidContainerItem.drain(heldItem, containerSpace, true);
else
drained = fluidContainerItem.drain(heldItem, containerSpace, false);
if(drained != null)
{
tileentityboiler.getTank().fill(new FluidStack(FluidRegistry.WATER, drained.amount), true);
return true;
}
}
}
}
else
{
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(heldItem);
if(fluid != null && (fluid.getFluid() == FluidRegistry.WATER || fluid.getFluid() == TFCFluids.FRESHWATER))
{
int amountAdded = tileentityboiler.getTank().fill(new FluidStack(FluidRegistry.WATER, fluid.amount), true);
if (amountAdded > 0)
{
FluidStack leftovers = fluid.copy();
leftovers.amount = fluid.amount - amountAdded;
ItemStack oldContainer = FluidContainerRegistry.drainFluidContainer(heldItem);
if (leftovers.amount > 0)
{
ItemStack newContainer = FluidContainerRegistry.fillFluidContainer(leftovers, oldContainer);
if(newContainer != null)
oldContainer = newContainer;
}
if(!player.capabilities.isCreativeMode)
player.setCurrentItemOrArmor(0, oldContainer);
return true;
}
}
}
}
if (!par1World.isRemote)
{
if (tileentityboiler != null)
{
player.openGui(Steamcraft.instance, 0, par1World, par2, par3, par4);
}
}
return true;
}
return false;
}
}

View File

@ -0,0 +1,135 @@
package com.JAWolfe.tfptweaks.blocks;
import java.util.Random;
import com.JAWolfe.tfptweaks.tiles.TEFlashBoiler;
import com.bioxx.tfc.api.TFCFluids;
import flaxbeard.steamcraft.Steamcraft;
import flaxbeard.steamcraft.SteamcraftBlocks;
import flaxbeard.steamcraft.block.BlockFlashBoiler;
import flaxbeard.steamcraft.tile.TileEntityFlashBoiler;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
public class TweakedFlashBoiler extends BlockFlashBoiler
{
private final Random rand = new Random();
public TweakedFlashBoiler()
{
super();
}
@Override
public TileEntity createNewTileEntity(World world, int meta) {
return new TEFlashBoiler();
}
@Override
public void harvestBlock(World world, EntityPlayer player, int x, int y, int z, int meta)
{
player.addStat(StatList.mineBlockStatArray[getIdFromBlock(this)], 1);
player.addExhaustion(0.025F);
float f = this.rand.nextFloat() * 0.8F + 0.1F;
float f1 = this.rand.nextFloat() * 0.8F + 0.1F;
float f2 = this.rand.nextFloat() * 0.8F + 0.1F;
EntityItem entityitem = new EntityItem(world, (double) ((float) x + f), (double) ((float) y + f1), (double) ((float) z + f2), new ItemStack(SteamcraftBlocks.flashBoiler, 1, 0));
float f3 = 0.05F;
entityitem.motionX = (double) ((float) this.rand.nextGaussian() * f3);
entityitem.motionY = (double) ((float) this.rand.nextGaussian() * f3 + 0.2F);
entityitem.motionZ = (double) ((float) this.rand.nextGaussian() * f3);
world.spawnEntityInWorld(entityitem);
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float xf, float yf, float zf)
{
TileEntityFlashBoiler tileentityboiler = (TileEntityFlashBoiler) world.getTileEntity(x, y, z);
if (world.getBlockMetadata(x, y, z) > 0 && tileentityboiler != null)
{
ItemStack heldItem = player.getHeldItem();
if(heldItem != null)
{
if (heldItem.getItem() instanceof IFluidContainerItem)
{
IFluidContainerItem fluidContainerItem = (IFluidContainerItem) heldItem.getItem();
FluidStack fluid = fluidContainerItem.getFluid(heldItem);
if(fluid != null && (fluid.getFluid() == FluidRegistry.WATER || fluid.getFluid() == TFCFluids.FRESHWATER))
{
int containerSpace = tileentityboiler.getTank().getCapacity() - tileentityboiler.getTank().getFluidAmount();
if(containerSpace > 0)
{
FluidStack drained;
if(!player.capabilities.isCreativeMode)
drained = fluidContainerItem.drain(heldItem, containerSpace, true);
else
drained = fluidContainerItem.drain(heldItem, containerSpace, false);
if(drained != null)
{
tileentityboiler.fill(ForgeDirection.UP, new FluidStack(FluidRegistry.WATER, drained.amount), true);
return true;
}
}
}
}
else
{
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(heldItem);
if(fluid != null && (fluid.getFluid() == FluidRegistry.WATER || fluid.getFluid() == TFCFluids.FRESHWATER))
{
int amountAdded = tileentityboiler.fill(ForgeDirection.UP, new FluidStack(FluidRegistry.WATER, fluid.amount), true);
if (amountAdded > 0)
{
FluidStack leftovers = fluid.copy();
leftovers.amount = fluid.amount - amountAdded;
ItemStack oldContainer = FluidContainerRegistry.drainFluidContainer(heldItem);
if (leftovers.amount > 0)
{
ItemStack newContainer = FluidContainerRegistry.fillFluidContainer(leftovers, oldContainer);
if(newContainer != null)
oldContainer = newContainer;
}
if(!player.capabilities.isCreativeMode)
player.setCurrentItemOrArmor(0, oldContainer);
return true;
}
}
}
}
if (!world.isRemote)
{
if (tileentityboiler != null)
player.openGui(Steamcraft.instance, 0, world, x, y, z);
}
return true;
}
return false;
}
}

View File

@ -0,0 +1,83 @@
package com.JAWolfe.tfptweaks.handlers;
import java.io.File;
import com.JAWolfe.tfptweaks.reference.ConfigSettings;
import com.JAWolfe.tfptweaks.reference.References;
import cpw.mods.fml.client.event.ConfigChangedEvent;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.common.config.Configuration;
public class ConfigHandler
{
public static Configuration config;
public static void init(File configFile)
{
if(config == null)
{
config = new Configuration(configFile);
loadConfig();
}
}
@SubscribeEvent
public void onConfigChangedEvent(ConfigChangedEvent.OnConfigChangedEvent event)
{
if(event.modID.equalsIgnoreCase(References.ModID))
loadConfig();
}
private static void loadConfig()
{
ConfigSettings.VanillaChestConversion = config.getBoolean("VanillaChestConversion", Configuration.CATEGORY_GENERAL,
true, "Enable vanilla chest conversion: ");
ConfigSettings.FleshBlockRecipe = config.getBoolean("FleshBlockRecipe", Configuration.CATEGORY_GENERAL,
false, "Enable Steamcraft 2 Flesh Block Recipe: ");
ConfigSettings.FSPBoilerWaterFix = config.getBoolean("FSPBoilerWaterFix", Configuration.CATEGORY_GENERAL,
true, "Enable Flaxbeard's Steam Power Boiler TFC water fix: ");
ConfigSettings.FSPFlashBoilerWaterFix = config.getBoolean("FSPFlashBoilerWaterFix", Configuration.CATEGORY_GENERAL,
true, "Enable Flaxbeard's Steam Power Flash Boiler TFC water fix: ");
ConfigSettings.FSPWailaIntegration = config.getBoolean("FSPWailaIntegration", Configuration.CATEGORY_GENERAL,
true, "Enable Flaxbeard's Steam Power Waila integration: ");
ConfigSettings.VanillaMagicScaling = config.getBoolean("EnableVanillaMagicScaling", "MagicScaling",
true, "Enable vanilla magic damage to TFC scaling: ");
ConfigSettings.VanillaMagicMultipier = config.getInt("VanillaMagicMultipier", "MagicScaling",
25, 20, 1000, "Multiplier used to scale vanilla magic damage to TFC levels: ");
ConfigSettings.VanillaDamageScaling = config.getBoolean("EnableVanillaDamageScaling", "HitScaling",
true, "Enable vanilla hit damage to TFC scaling: ");
ConfigSettings.VanillaPvPDamageScaling = config.getBoolean("EnableVanillaPvPDamageScaling", "HitScaling.PvP",
true, "Enable vanilla PvP hit damage to TFC scaling: ");
ConfigSettings.VanillaPvPDamageMultipier = config.getInt("VanillaPvPDamageMultipier", "HitScaling.PvP",
25, 20, 1000, "Multiplier used to scale vanilla PvP hit damage to TFC levels: ");
ConfigSettings.VanillaMobDamageScaling = config.getBoolean("EnableVanillaMobDamageScaling", "HitScaling.mob",
true, "Enable vanilla mob hit damage to TFC scaling: ");
ConfigSettings.VanillaMobDamageMultipier = config.getInt("VanillaMobDamageMultipier", "HitScaling.mob",
50, 20, 1000, "Multiplier used to scale vanilla mob hit damage to TFC levels: ");
ConfigSettings.InstantHealingScaling = config.getBoolean("EnableInstantHealingScaling", "HealScaling",
true, "Enable vanilla instant healing potion to TFC scaling: ");
ConfigSettings.VanillaHealingMultipier = config.getInt("VanillaHealingMultipier", "HealScaling",
50, 10, 1000, "Multiplier used to scale vanilla instant healing potion to TFC levels: ");
ConfigSettings.MineTweakerSupport = config.getBoolean("MineTweakerSupport", Configuration.CATEGORY_GENERAL,
true, "Enable Minetweaker support for TFC: ");
if(config.hasChanged())
config.save();
}
}

View File

@ -2,22 +2,20 @@ package com.JAWolfe.tfptweaks.handlers;
import java.util.Random;
import com.JAWolfe.tfptweaks.reference.ConfigSettings;
import com.bioxx.tfc.Items.ItemTFCArmor;
import com.bioxx.tfc.api.TFCBlocks;
import com.bioxx.tfc.api.Enums.EnumDamageType;
import com.bioxx.tfc.api.Events.EntityArmorCalcEvent;
import com.bioxx.tfc.api.Interfaces.ICausesDamage;
import com.bioxx.tfc.api.Interfaces.IInnateArmor;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import net.minecraft.enchantment.EnchantmentHelper;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLiving;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.potion.Potion;
@ -27,91 +25,123 @@ import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingAttackEvent;
import net.minecraftforge.event.entity.living.LivingHealEvent;
import net.minecraftforge.event.entity.living.LivingHurtEvent;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
public class PlayerHandler
public class PlayerDamageHandler
{
@SubscribeEvent
public void onItemPickup(EntityItemPickupEvent event)
{
EntityItem item = event.item;
ItemStack is = item.getEntityItem();
EntityPlayer player = event.entityPlayer;
Item droppedItem = is.getItem();
if(droppedItem.equals(Item.getItemFromBlock(Blocks.chest)))
{
item.delayBeforeCanPickup = 100;
item.setDead();
item.setInvisible(true);
Random rand = player.worldObj.rand;
player.worldObj.playSoundAtEntity(player, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
player.inventory.addItemStackToInventory(new ItemStack(TFCBlocks.chest, 1, 0));
}
}
@SubscribeEvent
public void onDamaged(LivingHurtEvent event)
{
if(event.entity instanceof EntityPlayer)
{
{
if (event.source == DamageSource.onFire || event.source == DamageSource.fall || event.source == DamageSource.drown ||
event.source == DamageSource.lava || event.source == DamageSource.inWall || event.source == DamageSource.fallingBlock ||
event.source.isExplosion() || event.source == DamageSource.inFire || event.source == DamageSource.starve)
return;
else if(event.source == DamageSource.magic && event.ammount <= 20)
else if((event.source == DamageSource.magic || event.source == DamageSource.wither) && event.ammount < 20 && ConfigSettings.VanillaMagicScaling)
{
event.ammount = event.ammount * 50;
event.ammount = event.ammount * ConfigSettings.VanillaMagicMultipier;
if(event.source == DamageSource.magic && (event.entityLiving.getHealth() - event.ammount) <= 0)
if((event.source == DamageSource.magic || event.source == DamageSource.wither) && (event.entityLiving.getHealth() - event.ammount) <= 0)
event.setCanceled(true);
}
else
{
if(!event.source.isUnblockable())
{
event.ammount = applyArmorCalculations(event.entityLiving, event.source, event.ammount);
}
else if(event.source.isUnblockable() && event.source.getSourceOfDamage() instanceof EntityLivingBase)
{
float damage = (float)((EntityLivingBase)event.source.getSourceOfDamage()).getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
if(damage <= 20)
damage *= 50;
event.ammount = applyArmorCalculations(event.entityLiving, event.source, damage);
}
if(event.source.getSourceOfDamage() instanceof EntityLivingBase && ConfigSettings.VanillaDamageScaling)
{
if(event.source.isUnblockable())
{
float damage = (float)((EntityLivingBase)event.source.getSourceOfDamage()).getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
if(event.source.getSourceOfDamage() instanceof EntityPlayer && damage < 20 && ConfigSettings.VanillaPvPDamageScaling)
damage *= ConfigSettings.VanillaPvPDamageMultipier;
if(!(event.source.getSourceOfDamage() instanceof EntityPlayer) && damage < 20 && ConfigSettings.VanillaMobDamageScaling)
damage *= ConfigSettings.VanillaMobDamageMultipier;
event.ammount = applyArmorCalculations(event.entityLiving, event.source, event.ammount > damage ? event.ammount : damage);
}
}
}
}
}
@SubscribeEvent
public void onHeal(LivingHealEvent event)
{
if(event.amount > 1 && event.amount < 9)
event.amount = event.amount * 50;
}
@SubscribeEvent
public void entityAttack(LivingAttackEvent event)
{
if(event.entityLiving.worldObj.isRemote)
return;
if(event.entity instanceof EntityPlayerMP)
{
if(event.source == DamageSource.onFire || event.source == DamageSource.fall || event.source == DamageSource.drown ||
event.source == DamageSource.lava || event.source == DamageSource.inWall || event.source == DamageSource.fallingBlock ||
event.source.isExplosion() || event.source == DamageSource.inFire || event.source == DamageSource.starve)
return;
else if(event.ammount < 20)
{
event.entity.attackEntityFrom(event.source, event.ammount * 50);
if(event.source == DamageSource.onFire || event.source == DamageSource.fall || event.source == DamageSource.drown ||
event.source == DamageSource.lava || event.source == DamageSource.inWall || event.source == DamageSource.fallingBlock ||
event.source.isExplosion() || event.source == DamageSource.inFire || event.source == DamageSource.starve ||
event.source == DamageSource.magic || event.source == DamageSource.wither)
return;
else if(event.ammount < 20 && event.entity instanceof EntityPlayer && ConfigSettings.VanillaDamageScaling)
{
if(event.source.getEntity() instanceof EntityPlayer && ConfigSettings.VanillaPvPDamageScaling)
{
EntityLivingBase attacker = (EntityLivingBase)event.source.getEntity();
EntityPlayer player = (EntityPlayer)event.source.getEntity();
Entity target = event.entity;
ItemStack stack = attacker.getHeldItem();
if (stack != null && stack.getItem().onLeftClickEntity(stack, player, target))
return;
if (target.canAttackWithItem())
{
if (!target.hitByEntity(target))
{
float damageAmount = ConfigSettings.VanillaPvPDamageMultipier;
if(attacker.getHeldItem() != null)
{
damageAmount = (float)player.getEntityAttribute(SharedMonsterAttributes.attackDamage).getAttributeValue();
damageAmount *= ConfigSettings.VanillaPvPDamageMultipier;
}
if (player.isPotionActive(Potion.damageBoost))
damageAmount += 3 << player.getActivePotionEffect(Potion.damageBoost).getAmplifier();
float enchantmentDamage = 0;
if (target instanceof EntityLiving)
{
enchantmentDamage = EnchantmentHelper.getEnchantmentModifierLiving(player, (EntityLiving) target);
}
if (damageAmount > 0 || enchantmentDamage > 0)
{
boolean criticalHit = player.fallDistance > 0.0F && !player.onGround &&
!player.isOnLadder() && !player.isInWater() &&
!player.isPotionActive(Potion.blindness) && player.ridingEntity == null &&
target instanceof EntityLiving;
if (criticalHit && damageAmount > 0)
damageAmount += event.entity.worldObj.rand.nextInt((int) (damageAmount / 2 + 2));
damageAmount += enchantmentDamage;
target.attackEntityFrom(DamageSource.causePlayerDamage(player), damageAmount);
}
}
}
}
if(!(event.source.getEntity() instanceof EntityPlayer) && event.source.getEntity() != null &&
!event.source.getEntity().getClass().getName().contains("bioxx.tfc") && ConfigSettings.VanillaMobDamageScaling)
{
event.entity.attackEntityFrom(event.source, event.ammount * ConfigSettings.VanillaMobDamageMultipier);
}
}
}
@SubscribeEvent
public void onHeal(LivingHealEvent event)
{
if(event.amount > 1 && event.amount < 9 && ConfigSettings.InstantHealingScaling)
event.amount = event.amount * ConfigSettings.VanillaHealingMultipier;
}
protected int applyArmorCalculations(EntityLivingBase entity, DamageSource source, float originalDamage)
{
ItemStack[] armor = entity.getLastActiveItems();

View File

@ -0,0 +1,142 @@
package com.JAWolfe.tfptweaks.handlers;
import java.util.Random;
import com.JAWolfe.tfptweaks.blocks.TFPBlocks;
import com.JAWolfe.tfptweaks.reference.ConfigSettings;
import com.bioxx.tfc.api.TFCBlocks;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.eventhandler.Event.Result;
import flaxbeard.steamcraft.SteamcraftBlocks;
import net.minecraft.block.Block;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.world.World;
import net.minecraftforge.event.entity.player.EntityItemPickupEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent.Action;
public class PlayerInteractionHandler
{
/*@SubscribeEvent
public void onToolTip(ItemTooltipEvent event)
{
ItemStack object = event.itemStack;
if(!(object.getItem() instanceof ISize))
event.toolTip.add("\u2696" + TFC_Core.translate("gui.Weight." + EnumWeight.LIGHT.getName()) + " \u21F2" +
TFC_Core.translate("gui.Size." + EnumSize.VERYSMALL.getName().replace(" ", "")));
}*/
@SubscribeEvent
public void onItemPickup(EntityItemPickupEvent event)
{
EntityItem item = event.item;
ItemStack is = item.getEntityItem();
EntityPlayer player = event.entityPlayer;
Item droppedItem = is.getItem();
if(droppedItem.equals(Item.getItemFromBlock(Blocks.chest)) && ConfigSettings.VanillaChestConversion)
{
item.delayBeforeCanPickup = 100;
item.setDead();
item.setInvisible(true);
Random rand = player.worldObj.rand;
player.worldObj.playSoundAtEntity(player, "random.pop", 0.2F, ((rand.nextFloat() - rand.nextFloat()) * 0.7F + 1.0F) * 2.0F);
player.inventory.addItemStackToInventory(new ItemStack(TFCBlocks.chest, 1, 0));
}
}
@SubscribeEvent
public void onBlockPlaced(PlayerInteractEvent event)
{
if (event.entityPlayer.worldObj.isRemote)
return;
ItemStack itemInHand = event.entityPlayer.getCurrentEquippedItem();
if(itemInHand == null)
return;
if(event.action == Action.RIGHT_CLICK_BLOCK && event.getResult() != Result.DENY)
{
if(Loader.isModLoaded("Steamcraft"))
{
if(event.entityPlayer.getCurrentEquippedItem().getItem() == Item.getItemFromBlock(SteamcraftBlocks.boiler) && ConfigSettings.FSPBoilerWaterFix)
{
event.setCanceled(true);
handleBlockPlacement(event.entityPlayer, event.entityLiving, event.world, TFPBlocks.tweakedboiler, event.x, event.y, event.z, event.face);
}
else if(event.entityPlayer.getCurrentEquippedItem().getItem() == Item.getItemFromBlock(SteamcraftBlocks.flashBoiler) && ConfigSettings.FSPFlashBoilerWaterFix)
{
event.setCanceled(true);
switch(event.face)
{
case 0: PlaceBlock(event.entityLiving, event.world, event.x, event.y - 1, event.z, TFPBlocks.tweakedFlashBoiler, 0); break;
case 1: PlaceBlock(event.entityLiving, event.world, event.x, event.y + 1, event.z, TFPBlocks.tweakedFlashBoiler, 0); break;
case 2: PlaceBlock(event.entityLiving, event.world, event.x, event.y, event.z - 1, TFPBlocks.tweakedFlashBoiler, 0); break;
case 3: PlaceBlock(event.entityLiving, event.world, event.x, event.y, event.z + 1, TFPBlocks.tweakedFlashBoiler, 0); break;
case 4: PlaceBlock(event.entityLiving, event.world, event.x - 1, event.y, event.z, TFPBlocks.tweakedFlashBoiler, 0); break;
case 5: PlaceBlock(event.entityLiving, event.world, event.x + 1, event.y, event.z, TFPBlocks.tweakedFlashBoiler, 0); break;
default: break;
}
if(event.entityPlayer.getCurrentEquippedItem().stackSize == 1)
event.entityPlayer.setCurrentItemOrArmor(0, null);
else
event.entityPlayer.getCurrentEquippedItem().stackSize--;
}
}
}
}
private void PlaceBlockRotation(EntityLivingBase player, World world, int x, int y, int z, Block block)
{
int l = MathHelper.floor_double((double) (player.rotationYaw * 4.0F / 360.0F) + 0.5D) & 3;
int meta = 2;
switch(l)
{
case 1: meta = 5; break;
case 2: meta = 3; break;
case 3: meta = 4; break;
}
PlaceBlock(player, world, x, y, z, block, meta);
}
private void PlaceBlock(EntityLivingBase player, World world, int x, int y, int z, Block block, int meta)
{
if(world.setBlock(x, y, z, block, meta, 3))
{
block.onBlockPlacedBy(world, x, y, z, player, new ItemStack(Item.getItemFromBlock(block)));
block.onPostBlockPlaced(world, x, y, z, 0);
}
}
private void handleBlockPlacement(EntityPlayer player, EntityLivingBase elb, World world, Block block, int x, int y, int z, int face)
{
switch(face)
{
case 0: PlaceBlockRotation(elb, world, x, y - 1, z, block); break;
case 1: PlaceBlockRotation(elb, world, x, y + 1, z, block); break;
case 2: PlaceBlockRotation(elb, world, x, y, z - 1, block); break;
case 3: PlaceBlockRotation(elb, world, x, y, z + 1, block); break;
case 4: PlaceBlockRotation(elb, world, x - 1, y, z, block); break;
case 5: PlaceBlockRotation(elb, world, x + 1, y, z, block); break;
default: break;
}
if(player.getCurrentEquippedItem().stackSize == 1)
player.setCurrentItemOrArmor(0, null);
else
player.getCurrentEquippedItem().stackSize--;
}
}

View File

@ -0,0 +1,18 @@
package com.JAWolfe.tfptweaks.handlers;
public class SpawnHandler
{
/*@SubscribeEvent
public void onSpawn(EntityJoinWorldEvent event)
{
/*if(event.entity instanceof EntityProjectileBase)
{
EntityProjectileBase projectile = (EntityProjectileBase)event.entity;
projectile.baseDamage = 2;
LogHelper.info(projectile.getDamage(null));
}
/*if(!event.entity.getClass().getSimpleName().contains("EntityItem") && !event.entity.getClass().getSimpleName().contains("EntityBat")
&& !event.entity.getClass().getSimpleName().contains("TFC"))
LogHelper.info(event.entity.getClass().getSimpleName());
}*/
}

View File

@ -0,0 +1,9 @@
package com.JAWolfe.tfptweaks.minetweaker;
import stanhebben.zenscript.annotations.ZenClass;
@ZenClass("mods.tfptweaks.Anvil")
public class Anvil
{
}

View File

@ -0,0 +1,232 @@
package com.JAWolfe.tfptweaks.minetweaker;
import java.util.List;
import com.bioxx.tfc.api.Crafting.BarrelManager;
import com.bioxx.tfc.api.Crafting.BarrelMultiItemRecipe;
import com.bioxx.tfc.api.Crafting.BarrelRecipe;
import minetweaker.IUndoableAction;
import minetweaker.MineTweakerAPI;
import minetweaker.api.item.IItemStack;
import minetweaker.api.liquid.ILiquidStack;
import minetweaker.api.minecraft.MineTweakerMC;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidStack;
import stanhebben.zenscript.annotations.ZenClass;
import stanhebben.zenscript.annotations.ZenMethod;
@ZenClass("mods.tfptweaks.Barrel")
public class Barrel
{
@ZenMethod
public static void convertFluid(ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS, int sealtime, boolean removesLiquid, boolean sealed, int minTechLevel, boolean allowAnyStack)
{
ItemStack inputStack = MineTweakerMC.getItemStack(inputIS);
FluidStack inputFluid = MineTweakerMC.getLiquidStack(inputFS);
FluidStack outputFluid = MineTweakerMC.getLiquidStack(outputFS);
MineTweakerAPI.apply(new convertFluidAction(inputStack, inputFluid, outputFluid, sealtime, removesLiquid, sealed, minTechLevel, allowAnyStack));
}
@ZenMethod
public static void convertFluid(ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS, int sealtime, boolean removesLiquid, boolean sealed, int minTechLevel)
{
convertFluid(outputFS, inputIS, inputFS, sealtime, removesLiquid, sealed, minTechLevel, true);
}
@ZenMethod
public static void convertFluid(ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS, int sealtime, boolean removesLiquid, boolean sealed)
{
convertFluid(outputFS, inputIS, inputFS, sealtime, removesLiquid, sealed, 1, true);
}
@ZenMethod
public static void convertFluid(ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS, int sealtime, boolean removesLiquid)
{
convertFluid(outputFS, inputIS, inputFS, sealtime, removesLiquid, true, 1, true);
}
@ZenMethod
public static void convertFluid(ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS, int sealtime)
{
convertFluid(outputFS, inputIS, inputFS, sealtime, true, true, 1, true);
}
@ZenMethod
public static void convertFluid(ILiquidStack outputFS, IItemStack inputIS, ILiquidStack inputFS)
{
convertFluid(outputFS, inputIS, inputFS, 8, true, true, 1, true);
}
@ZenMethod
public static void convertItem(IItemStack outputIS, IItemStack inputIS, ILiquidStack inputFS, boolean sealed, int minTechLevel, boolean allowAnyStack, boolean keepstacksize)
{
ItemStack inputStack = MineTweakerMC.getItemStack(inputIS);
ItemStack outputStack = MineTweakerMC.getItemStack(outputIS);
FluidStack inputFluid = MineTweakerMC.getLiquidStack(inputFS);
MineTweakerAPI.apply(new addBarrelMultiItemAction(inputStack, inputFluid, outputStack, sealed, minTechLevel, allowAnyStack, keepstacksize));
}
@ZenMethod
public static void convertItem(IItemStack outputIS, IItemStack inputIS, ILiquidStack inputFS, boolean sealed, int minTechLevel, boolean allowAnyStack)
{
convertItem(outputIS, inputIS, inputFS, sealed, minTechLevel, allowAnyStack, true);
}
@ZenMethod
public static void convertItem(IItemStack outputIS, IItemStack inputIS, ILiquidStack inputFS, boolean sealed, int minTechLevel)
{
convertItem(outputIS, inputIS, inputFS, sealed, minTechLevel, true, true);
}
@ZenMethod
public static void convertItem(IItemStack outputIS, IItemStack inputIS, ILiquidStack inputFS, boolean sealed)
{
convertItem(outputIS, inputIS, inputFS, sealed, 1, true, true);
}
@ZenMethod
public static void convertItem(IItemStack outputIS, IItemStack inputIS, ILiquidStack inputFS)
{
convertItem(outputIS, inputIS, inputFS, true, 1, true, true);
}
private static class convertFluidAction implements IUndoableAction
{
ItemStack inputStack;
ItemStack outputStack;
FluidStack inputFluid;
FluidStack outputFluid;
int sealtime;
boolean removesLiquid;
boolean sealed;
int minTechLevel;
boolean allowAnyStack;
public convertFluidAction(ItemStack inputIS, FluidStack inputFS, FluidStack outputFS, int sealtime, boolean removesLiquid, boolean sealed, int minTechLevel, boolean allowAnyStack)
{
this.inputStack = inputIS;
this.inputFluid = inputFS;
this.outputFluid = outputFS;
this.sealtime = sealtime;
this.removesLiquid = removesLiquid;
this.sealed = sealed;
this.minTechLevel = minTechLevel;
this.allowAnyStack = allowAnyStack;
}
@Override
public void apply()
{
BarrelManager.getInstance().addRecipe(new BarrelRecipe(inputStack, inputFluid, outputStack, outputFluid, sealtime).setRemovesLiquid(removesLiquid).setAllowAnyStack(allowAnyStack).setMinTechLevel(minTechLevel).setSealedRecipe(sealed));
}
@Override
public String describe()
{
if(outputStack != null)
return "Adding item '" + inputStack.getDisplayName() + "' with '" + inputFluid.getLocalizedName()
+ "' to barrel yeilding '" + outputStack.getDisplayName() + "'";
else
return "Adding item '" + inputStack.getDisplayName() + "' with '" + inputFluid.getLocalizedName()
+ "' to barrel yeilding '" + outputFluid.getLocalizedName() + "'";
}
@Override
public boolean canUndo()
{
return true;
}
@Override
public void undo()
{
List<BarrelRecipe> BarrelList = BarrelManager.getInstance().getRecipes();
for (int i = 0; i < BarrelList.size(); i++)
{
if (BarrelList.get(i) != null)
{
if (BarrelList.get(i).matches(inputStack, inputFluid))
BarrelList.remove(i--);
}
}
}
@Override
public String describeUndo()
{
return "Removing item '" + inputStack.getDisplayName() + "' with '" + inputFluid.getLocalizedName() + "' from barrel '";
}
@Override
public Object getOverrideKey() {
return null;
}
}
private static class addBarrelMultiItemAction implements IUndoableAction
{
ItemStack inputStack;
ItemStack outputStack;
FluidStack inputFluid;
boolean sealed;
int minTechLevel;
boolean allowAnyStack;
public addBarrelMultiItemAction(ItemStack inputIS, FluidStack inputFS, ItemStack outputIS, boolean sealed, int minTechLevel, boolean allowAnyStack, boolean keepstacksize)
{
this.inputStack = inputIS;
this.inputFluid = inputFS;
this.outputStack = outputIS;
this.sealed = sealed;
this.minTechLevel = minTechLevel;
this.allowAnyStack = allowAnyStack;
}
@Override
public void apply()
{
BarrelManager.getInstance().addRecipe(new BarrelMultiItemRecipe(inputStack, inputFluid, outputStack, inputFluid).setAllowAnyStack(allowAnyStack).setMinTechLevel(minTechLevel).setSealedRecipe(sealed));
}
@Override
public String describe()
{
return "Adding item '" + inputStack.getDisplayName() + "' with '" + inputFluid.getLocalizedName()
+ "' to barrel yeilding '" + outputStack.getDisplayName() + "'";
}
@Override
public boolean canUndo()
{
return true;
}
@Override
public void undo()
{
List<BarrelRecipe> BarrelList = BarrelManager.getInstance().getRecipes();
for (int i = 0; i < BarrelList.size(); i++)
{
if (BarrelList.get(i) != null)
{
if (BarrelList.get(i).matches(inputStack, inputFluid))
BarrelList.remove(i--);
}
}
}
@Override
public String describeUndo()
{
return "Removing item '" + inputStack.getDisplayName() + "' with '" + inputFluid.getLocalizedName() + "' from barrel '";
}
@Override
public Object getOverrideKey() {
return null;
}
}
}

View File

@ -1,5 +1,7 @@
package com.JAWolfe.tfptweaks.minetweaker;
import com.JAWolfe.tfptweaks.reference.ConfigSettings;
import cpw.mods.fml.common.Loader;
import minetweaker.MineTweakerAPI;
@ -7,11 +9,13 @@ public class TFCTweaker
{
public static void postInit()
{
if (Loader.isModLoaded("MineTweaker3"))
if (Loader.isModLoaded("MineTweaker3") && ConfigSettings.MineTweakerSupport)
{
MineTweakerAPI.registerClass(ItemHeat.class);
MineTweakerAPI.registerClass(Loom.class);
MineTweakerAPI.registerClass(Quern.class);
//MineTweakerAPI.registerClass(Barrel.class);
//MineTweakerAPI.registerClass(Anvil.class);
}
}
}

View File

@ -0,0 +1,9 @@
package com.JAWolfe.tfptweaks.proxy;
public class ClientProxy extends CommonProxy
{
public void registerTileEntities()
{
super.registerTileEntities();
}
}

View File

@ -0,0 +1,25 @@
package com.JAWolfe.tfptweaks.proxy;
import com.JAWolfe.tfptweaks.tiles.TEBoiler;
import com.JAWolfe.tfptweaks.tiles.TEFlashBoiler;
import cpw.mods.fml.common.Loader;
import cpw.mods.fml.common.event.FMLInterModComms;
import cpw.mods.fml.common.registry.GameRegistry;
public class CommonProxy
{
public void registerTileEntities()
{
if(Loader.isModLoaded("Steamcraft"))
{
GameRegistry.registerTileEntity(TEBoiler.class, "TEBoiler");
GameRegistry.registerTileEntity(TEFlashBoiler.class, "TEFlashBoiler");
}
}
public void registerWAILA()
{
FMLInterModComms.sendMessage("Waila", "register", "com.JAWolfe.tfptweaks.WAILAInfo.callbackRegister");
}
}

View File

@ -0,0 +1,21 @@
package com.JAWolfe.tfptweaks.reference;
public class ConfigSettings
{
public static boolean VanillaChestConversion = true;
public static boolean FleshBlockRecipe = false;
public static boolean FSPBoilerWaterFix = true;
public static boolean FSPFlashBoilerWaterFix = true;
public static boolean FSPWailaIntegration = true;
public static boolean VanillaMagicScaling = true;
public static int VanillaMagicMultipier = 25;
public static boolean VanillaDamageScaling = true;
public static boolean VanillaPvPDamageScaling = true;
public static int VanillaPvPDamageMultipier = 25;
public static boolean VanillaMobDamageScaling = true;
public static int VanillaMobDamageMultipier = 50;
public static boolean InstantHealingScaling = true;
public static int VanillaHealingMultipier = 50;
public static boolean MineTweakerSupport = true;
}

View File

@ -0,0 +1,23 @@
package com.JAWolfe.tfptweaks.reference;
public class References
{
public static final String ModID = "TerraFirmaPunkTweaks";
public static final String ModName = "TerraFirmaPunk Tweaks";
public static final String MODID_TFC = "terrafirmacraft";
public static final String MODNAME_TFC = "TerraFirmaCraft";
public static final String MODID_SC2 = "steamcraft2";
public static final String MODID_FSP = "Steamcraft";
public static final String ModVersion = "@MOD_VERSION@";
public static final String ModDependencies = "required-after:" + MODID_TFC +
";required-after:" + MODID_SC2 +
";required-after:" + MODID_FSP;
public static final String SERVER_PROXY_CLASS = "com.JAWolfe.tfptweaks.proxy.CommonProxy";
public static final String CLIENT_PROXY_CLASS = "com.JAWolfe.tfptweaks.proxy.ClientProxy";
}

View File

@ -0,0 +1,71 @@
package com.JAWolfe.tfptweaks.tiles;
import com.bioxx.tfc.api.TFCFluids;
import flaxbeard.steamcraft.tile.TileEntityBoiler;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
public class TEBoiler extends TileEntityBoiler
{
public TEBoiler()
{
super(50000);
}
@Override
public void updateEntity()
{
super.updateEntity();
ItemStack is = this.getStackInSlot(1);
if(is != null && is.getItem() != Items.water_bucket)
{
if (is.getItem() instanceof IFluidContainerItem)
{
IFluidContainerItem fluidContainerItem = (IFluidContainerItem) is.getItem();
FluidStack fluid = fluidContainerItem.getFluid(is);
if(fluid != null && (fluid.getFluid() == TFCFluids.FRESHWATER))
{
int containerSpace = getTank().getCapacity() - getTank().getFluidAmount();
if(containerSpace > 0)
{
FluidStack drained = fluidContainerItem.drain(is, containerSpace, true);
if(drained != null)
getTank().fill(new FluidStack(FluidRegistry.WATER, drained.amount), true);
}
}
}
else
{
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(is);
if(fluid != null && (fluid.getFluid() == FluidRegistry.WATER || fluid.getFluid() == TFCFluids.FRESHWATER))
{
int amountAdded = getTank().fill(new FluidStack(FluidRegistry.WATER, fluid.amount), true);
if (amountAdded > 0)
{
FluidStack leftovers = fluid.copy();
leftovers.amount = fluid.amount - amountAdded;
ItemStack oldContainer = FluidContainerRegistry.drainFluidContainer(is);
if (leftovers.amount > 0)
{
ItemStack newContainer = FluidContainerRegistry.fillFluidContainer(leftovers, oldContainer);
if(newContainer != null)
oldContainer = newContainer;
}
this.setInventorySlotContents(1, oldContainer);
}
}
}
}
}
}

View File

@ -0,0 +1,261 @@
package com.JAWolfe.tfptweaks.tiles;
import java.util.HashSet;
import com.JAWolfe.tfptweaks.blocks.TFPBlocks;
import com.bioxx.tfc.api.TFCFluids;
import flaxbeard.steamcraft.api.ISteamTransporter;
import flaxbeard.steamcraft.api.steamnet.SteamNetwork;
import flaxbeard.steamcraft.tile.TileEntityFlashBoiler;
import net.minecraft.block.Block;
import net.minecraft.init.Items;
import net.minecraft.inventory.ISidedInventory;
import net.minecraft.item.ItemStack;
import net.minecraftforge.fluids.FluidContainerRegistry;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fluids.FluidStack;
import net.minecraftforge.fluids.IFluidContainerItem;
import net.minecraftforge.fluids.IFluidHandler;
public class TEFlashBoiler extends TileEntityFlashBoiler implements IFluidHandler, ISidedInventory, ISteamTransporter
{
private static int[][] bbl = new int[][]{
new int[]{0, 0, 0}, new int[]{1, 0, 0}, new int[]{0, 0, 1}, new int[]{1, 0, 1},
new int[]{0, 1, 0}, new int[]{1, 1, 0}, new int[]{0, 1, 1}, new int[]{1, 1, 1}};
private static int[][] tbl = new int[][]{
new int[]{0, -1, 0}, new int[]{1, -1, 0}, new int[]{0, -1, 1}, new int[]{1, -1, 1},
new int[]{0, 0, 0}, new int[]{1, 0, 0}, new int[]{0, 0, 1}, new int[]{1, 0, 1}};
private static int[][] bbr = new int[][]{
new int[]{-1, 0, 0}, new int[]{0, 0, 0}, new int[]{-1, 0, 1}, new int[]{0, 0, 1},
new int[]{-1, 1, 0}, new int[]{0, 1, 0}, new int[]{-1, 1, 1}, new int[]{0, 1, 1}};
private static int[][] tbr = new int[][]{
new int[]{-1, -1, 0}, new int[]{0, -1, 0}, new int[]{-1, -1, 1}, new int[]{0, -1, 1},
new int[]{-1, 0, 0}, new int[]{0, 0, 0}, new int[]{-1, 0, 1}, new int[]{0, 0, 1}};
private static int[][] btl = new int[][]{
new int[]{0, 0, -1}, new int[]{1, 0, -1}, new int[]{0, 0, 0}, new int[]{1, 0, 0},
new int[]{0, 1, -1}, new int[]{1, 1, -1}, new int[]{0, 1, 0}, new int[]{1, 1, 0}};
private static int[][] ttl = new int[][]{
new int[]{0, -1, -1}, new int[]{1, -1, -1}, new int[]{0, -1, 0}, new int[]{1, -1, 0},
new int[]{0, 0, -1}, new int[]{1, 0, -1}, new int[]{0, 0, 0}, new int[]{1, 0, 0}};
private static int[][] btr = new int[][]{
new int[]{-1, 0, -1}, new int[]{0, 0, -1}, new int[]{-1, 0, 0}, new int[]{0, 0, 0},
new int[]{-1, 1, -1}, new int[]{0, 1, -1}, new int[]{-1, 1, 0}, new int[]{0, 1, 0}};
private static int[][] ttr = new int[][]{
new int[]{-1, -1, -1}, new int[]{0, -1, -1}, new int[]{-1, -1, 0}, new int[]{0, -1, 0},
new int[]{-1, 0, -1}, new int[]{0, 0, -1}, new int[]{-1, 0, 0}, new int[]{0, 0, 0}};
private static int[][][] validConfigs = new int[][][]{
bbl, tbl, bbr, tbr, btl, ttl, btr, ttr};
public TEFlashBoiler()
{
super();
}
@Override
public void updateEntity()
{
super.updateEntity();
if (!worldObj.isRemote && worldObj.getBlockMetadata(xCoord, yCoord, zCoord) == 1)
{
ItemStack is = this.getStackInSlot(1);
if (is != null && is.getItem() != Items.water_bucket)
{
if (is.getItem() instanceof IFluidContainerItem)
{
IFluidContainerItem fluidContainerItem = (IFluidContainerItem) is.getItem();
FluidStack fluid = fluidContainerItem.getFluid(is);
if(fluid != null && (fluid.getFluid() == TFCFluids.FRESHWATER))
{
int containerSpace = getTank().getCapacity() - getTank().getFluidAmount();
if(containerSpace > 0)
{
FluidStack drained = fluidContainerItem.drain(is, containerSpace, true);
if(drained != null)
getTank().fill(new FluidStack(FluidRegistry.WATER, drained.amount), true);
}
}
}
else
{
FluidStack fluid = FluidContainerRegistry.getFluidForFilledItem(is);
if(fluid != null && (fluid.getFluid() == FluidRegistry.WATER || fluid.getFluid() == TFCFluids.FRESHWATER))
{
int amountAdded = getTank().fill(new FluidStack(FluidRegistry.WATER, fluid.amount), true);
if (amountAdded > 0)
{
FluidStack leftovers = fluid.copy();
leftovers.amount = fluid.amount - amountAdded;
ItemStack oldContainer = FluidContainerRegistry.drainFluidContainer(is);
if (leftovers.amount > 0)
{
ItemStack newContainer = FluidContainerRegistry.fillFluidContainer(leftovers, oldContainer);
if(newContainer != null)
oldContainer = newContainer;
}
this.setInventorySlotContents(1, oldContainer);
}
}
}
}
}
}
@Override
public void destroyMultiblock() {
updateMultiblock(this.getValidClusterFromMetadata(), false, -1);
}
@Override
public void checkMultiblock(boolean isBreaking, int frontSide)
{
if (!worldObj.isRemote)
{
if (!isBreaking)
{
int[] validClusters = getValidClusters();
if (validClusters.length == 1)
updateMultiblock(validClusters[0], true, frontSide);
}
}
}
@SuppressWarnings({ "rawtypes", "unchecked" })
private void updateMultiblock(int clusterIndex, boolean isMultiblock, int frontSide) {
int[][] cluster = getClusterCoords(clusterIndex);
HashSet<TEFlashBoiler> boilers = new HashSet();
for (int pos = 7; pos >= 0; pos--) {
int x = cluster[pos][0], y = cluster[pos][1], z = cluster[pos][2];
if (worldObj.getBlock(x, y, z) == TFPBlocks.tweakedFlashBoiler) {
worldObj.setBlockMetadataWithNotify(
cluster[pos][0], cluster[pos][1], cluster[pos][2],
isMultiblock ? pos + 1 : 0,
2
);
TEFlashBoiler boiler = (TEFlashBoiler) worldObj.getTileEntity(cluster[pos][0], cluster[pos][1], cluster[pos][2]);
boiler.setFront(frontSide, false);
boilers.add(boiler);
} else {
////Steamcraft.log.debug("ERROR! ("+x+","+y+","+z+") is not a flashBoiler!");
}
}
for (TEFlashBoiler boiler : boilers) {
if (isMultiblock) {
SteamNetwork.newOrJoin(boiler);
} else {
if (this.getNetwork() != null) {
this.getNetwork().split(boiler, true);
}
}
}
}
private int[] getValidClusters() {
int[] valid = new int[8];
int[] out;
int count = 0;
for (int clusterIndex = 0; clusterIndex < 8; clusterIndex++) {
if (checkCluster(validConfigs[clusterIndex]) == 8) {
valid[count] = clusterIndex;
count++;
}
}
out = new int[count];
for (int i = 0; i < count; i++) {
out[i] = valid[i];
}
return out;
}
private int checkCluster(int[][] cluster) {
int count = 0;
for (int pos = 0; pos < 8; pos++) {
int x = cluster[pos][0] + xCoord, y = cluster[pos][1] + yCoord, z = cluster[pos][2] + zCoord;
Block b = worldObj.getBlock(x, y, z);
if (b == TFPBlocks.tweakedFlashBoiler) {
if (!(worldObj.getBlockMetadata(x, y, z) > 0)) {
count++;
}
}
}
return count;
}
private int[][] getClusterCoords(int clusterIndex) {
int[][] cluster = validConfigs[clusterIndex];
int[][] out = new int[8][3];
for (int pos = 0; pos < 8; pos++) {
out[pos] = new int[]{cluster[pos][0] + xCoord, cluster[pos][1] + yCoord, cluster[pos][2] + zCoord};
}
return out;
}
@Override
public TEFlashBoiler getMasterTileEntity() {
int[][] cluster = getClusterCoords(getValidClusterFromMetadata());
int x = cluster[0][0], y = cluster[0][1], z = cluster[0][2];
TEFlashBoiler boiler = null;
if (worldObj.getBlock(x, y, z) == TFPBlocks.tweakedFlashBoiler && worldObj.getBlockMetadata(x, y, z) > 0) {
boiler = (TEFlashBoiler) worldObj.getTileEntity(x, y, z);
}
return boiler;
}
private int getValidClusterFromMetadata() {
int validCluster = -1;
// Because the clusters at the top are doofy and not in the right order =\
switch (worldObj.getBlockMetadata(xCoord, yCoord, zCoord)) {
case 1:
validCluster = 0;
break;
case 2:
validCluster = 2;
break;
case 3:
validCluster = 4;
break;
case 4:
validCluster = 6;
break;
case 5:
validCluster = 1;
break;
case 6:
validCluster = 3;
break;
case 7:
validCluster = 5;
break;
case 8:
validCluster = 7;
break;
}
return validCluster;
}
@Override
public boolean isInCluster(int x, int y, int z) {
int[][] cluster = this.getClusterCoords(this.getValidClusterFromMetadata());
for (int pos = 0; pos < cluster.length; pos++) {
if (x == cluster[pos][0] && y == cluster[pos][1] && z == cluster[pos][1]) {
return worldObj.getBlock(x, y, z) == TFPBlocks.tweakedFlashBoiler && worldObj.getBlockMetadata(x, y, z) > 0;
}
}
return false;
}
}

View File

@ -0,0 +1,12 @@
#en_US
#This is the Main language configuration file
#
#If you want to color code the text then I recommend you visit http://www.minecraftwiki.net/wiki/Formatting_codes#Color_codes
#To create the § symbol which is used for assigning a color to the following text press Alt + 21 on Windows. For other OSes, view the above link.
#This file needs to be UTF-8 encoded to work with MC 1.7+
#=======
#= GUI =
#=======
gui.tfptweaks.watertank=Water Tank
gui.tfptweaks.steamtank=Steam Tank

View File

@ -1,9 +1,9 @@
{
"modListVersion": 2,
"modList": [{
"modid": "terrafirmapunktweaks",
"modid": "TerraFirmaPunkTweaks",
"name": "TerraFirmaPunk Tweaks",
"description": "Various tweaks for TerraFirmaPunk.",
"description": "Various tweaks for the TerraFirmaPunk Pack.",
"version": "${mod_version}",
"mcversion": "${minecraft_version}",
"url": "",
@ -13,9 +13,9 @@
"logoFile": "",
"screenshots": [],
"parent": "",
"requiredMods": [],
"dependencies": ["terrafirmacraft", "steamcraft2"],
"dependants": [ ],
"requiredMods": ["Forge", "terrafirmacraft"],
"dependencies": ["terrafirmacraft", "steamcraft2", "Steamcraft"],
"dependants": [],
"useDependencyInformation": "true"
}]
}