diff options
author | huajijam <strhuaji@gmail.com> | 2019-04-19 18:29:22 +0800 |
---|---|---|
committer | huajijam <strhuaji@gmail.com> | 2019-04-19 18:29:22 +0800 |
commit | 399674bb9946664a880ee5e26690eb98f9aa7170 (patch) | |
tree | 7da9495cfd23b3582896428e2481afdddceb0e1b /src | |
parent | 98649eab067e2ffd4c6983fe44f75b65ffb0954b (diff) | |
parent | 7f7eecf6a84264ca229f6b8d6759004a9a21ae5d (diff) | |
download | GT5-Unofficial-399674bb9946664a880ee5e26690eb98f9aa7170.tar.gz GT5-Unofficial-399674bb9946664a880ee5e26690eb98f9aa7170.tar.bz2 GT5-Unofficial-399674bb9946664a880ee5e26690eb98f9aa7170.zip |
Automatic synchronization
Diffstat (limited to 'src')
95 files changed, 6357 insertions, 933 deletions
diff --git a/src/Java/gregtech/api/util/SemiFluidFuelHandler.java b/src/Java/gregtech/api/util/SemiFluidFuelHandler.java index 1414b3beb3..c5b1065831 100644 --- a/src/Java/gregtech/api/util/SemiFluidFuelHandler.java +++ b/src/Java/gregtech/api/util/SemiFluidFuelHandler.java @@ -58,6 +58,7 @@ public class SemiFluidFuelHandler { public static boolean generateFuels() { final FluidStack aCreosote = FluidUtils.getFluidStack("creosote", 1000); final FluidStack aHeavyFuel = FluidUtils.getFluidStack("liquid_heavy_fuel", 1000); + final FluidStack aHeavyOil = FluidUtils.getFluidStack("liquid_heavy_oil", 1000); final HashMap<Integer, Pair<FluidStack, Integer>> aFoundFluidsFromItems = new HashMap<Integer, Pair<FluidStack, Integer>>(); // Find Fluids From items for (final GT_Recipe r : gregtech.api.util.GT_Recipe.GT_Recipe_Map.sDenseLiquidFuels.mRecipeList) { @@ -80,7 +81,7 @@ public class SemiFluidFuelHandler { aContainsCreosote = true; } } - g.mSpecialValue *= aContainsCreosote ? 8 : 4; + g.mSpecialValue *= aContainsCreosote ? 6 : 3; Logger.INFO("Added " + g.mFluidInputs[0].getLocalizedName() + " to the Semi-Fluid Generator fuel map. Fuel Produces "+g.mSpecialValue+"EU per 1000L."); sSemiFluidLiquidFuels.add(g); } @@ -89,9 +90,9 @@ public class SemiFluidFuelHandler { if (p != null) { int aFuelValue = p.getValue(); if (p.getKey().isFluidEqual(aCreosote)) { - aFuelValue *= 8; + aFuelValue *= 6; } - else if (p.getKey().isFluidEqual(aHeavyFuel)){ + else if (p.getKey().isFluidEqual(aHeavyFuel) || p.getKey().isFluidEqual(aHeavyOil)){ aFuelValue *= 1.5; } else { diff --git a/src/Java/gtPlusPlus/GTplusplus.java b/src/Java/gtPlusPlus/GTplusplus.java index e10369abe3..424a63e9bf 100644 --- a/src/Java/gtPlusPlus/GTplusplus.java +++ b/src/Java/gtPlusPlus/GTplusplus.java @@ -46,6 +46,7 @@ import gtPlusPlus.core.material.nuclear.FLUORIDES; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.data.LocaleUtils; import gtPlusPlus.core.util.minecraft.FluidUtils; +import gtPlusPlus.core.util.minecraft.HazmatUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.minecraft.RecipeUtils; import gtPlusPlus.core.util.reflect.ReflectionUtils; @@ -124,6 +125,10 @@ public class GTplusplus implements ActionListener { Logger.INFO("Loading some textures on the client."); // Tools Logger.WARNING("Processing texture: " + TexturesGtTools.SKOOKUM_CHOOCHER.getTextureFile().getResourcePath()); + Logger.WARNING("Processing texture: " + TexturesGtTools.ANGLE_GRINDER.getTextureFile().getResourcePath()); + Logger.WARNING("Processing texture: " + TexturesGtTools.ELECTRIC_SNIPS.getTextureFile().getResourcePath()); + Logger.WARNING("Processing texture: " + TexturesGtTools.ELECTRIC_LIGHTER.getTextureFile().getResourcePath()); + Logger.WARNING("Processing texture: " + TexturesGtTools.ELECTRIC_BUTCHER_KNIFE.getTextureFile().getResourcePath()); // Blocks Logger.WARNING("Processing texture: " + TexturesGtBlock.Casing_Machine_Dimensional.getTextureFile().getResourcePath()); @@ -186,6 +191,7 @@ public class GTplusplus implements ActionListener { INIT_PHASE.INIT.setPhaseActive(true); mChunkLoading.init(event); proxy.init(event); + HazmatUtils.init(); proxy.registerNetworkStuff(); instanceGtProxy.init(); Core_Manager.init(); diff --git a/src/Java/gtPlusPlus/api/interfaces/IToolable.java b/src/Java/gtPlusPlus/api/interfaces/IToolable.java new file mode 100644 index 0000000000..24797825a9 --- /dev/null +++ b/src/Java/gtPlusPlus/api/interfaces/IToolable.java @@ -0,0 +1,17 @@ +package gtPlusPlus.api.interfaces; + +public interface IToolable { + + public boolean isScrewdriverable(); + public boolean onScrewdriverLMB(); + public boolean onScrewdriverRMB(); + + public boolean isWrenchable(); + public boolean onWrenchLMB(); + public boolean onWrenchRMB(); + + public boolean isMalletable(); + public boolean onMalletLMB(); + public boolean onMalletRMB(); + +} diff --git a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java index 4663229514..3583a04a74 100644 --- a/src/Java/gtPlusPlus/api/objects/data/AutoMap.java +++ b/src/Java/gtPlusPlus/api/objects/data/AutoMap.java @@ -3,7 +3,7 @@ package gtPlusPlus.api.objects.data; import java.io.Serializable; import java.util.*; -public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable, Collection<V>, Queue<V> { +public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable, Collection<V>, Queue<V>, List<V> { /** * The Internal Map @@ -22,11 +22,55 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable, Collect this(new LinkedHashMap<Integer, V>()); } + public Map<Integer, V> getMap(){ + return mInternalMap; + } + public AutoMap(Map<Integer, V> defaultMapType) { mInternalMap = defaultMapType; mInternalNameMap = new LinkedHashMap<String, Integer>(); } + /** + * Generates an AutoMap from the List. + * @param aList - Data to be inserted into the AutoMap. + */ + public AutoMap(List<V> aList) { + mInternalMap = new LinkedHashMap<Integer, V>(); + mInternalNameMap = new LinkedHashMap<String, Integer>(); + if (aList != null && aList.size() > 0) { + for (V obj : aList) { + add(obj); + } + } + } + /** + * Generates an AutoMap from a Set. + * @param aList - Data to be inserted into the AutoMap. + */ + public AutoMap(Set<V> aList) { + mInternalMap = new LinkedHashMap<Integer, V>(); + mInternalNameMap = new LinkedHashMap<String, Integer>(); + if (aList != null && aList.size() > 0) { + for (V obj : aList) { + add(obj); + } + } + } + /** + * Generates an AutoMap from a Collection. + * @param aList - Data to be inserted into the AutoMap. + */ + public AutoMap(Collection<V> aList) { + mInternalMap = new LinkedHashMap<Integer, V>(); + mInternalNameMap = new LinkedHashMap<String, Integer>(); + if (aList != null && aList.size() > 0) { + for (V obj : aList) { + add(obj); + } + } + } + @Override public Iterator<V> iterator() { return values().iterator(); @@ -211,5 +255,78 @@ public class AutoMap<V> implements Iterable<V>, Cloneable, Serializable, Collect public V peek() { return element(); } + + @Override + public boolean addAll(int index, Collection<? extends V> c) { + for (V y : c) { + add(y); + } + return true; + } + + @Override + public V set(int index, V element) { + return mInternalMap.put(index, element); + } + + @Override + public void add(int index, V element) { + add(element); + } + + @Override + public V remove(int index) { + V h = mInternalMap.get(index); + set(index, null); + return h; + } + + @Override + public int indexOf(Object o) { + int aCount = 0; + for (V of : mInternalMap.values()) { + if (of != o) { + aCount++; + continue; + } + else { + return aCount; + } + } + return -1; + } + + @Override + public int lastIndexOf(Object o) { + //TODO + return indexOf(o); + } + + @Override + public ListIterator<V> listIterator() { + // TODO Auto-generated method stub + return null; + } + + @Override + public ListIterator<V> listIterator(int index) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List<V> subList(int fromIndex, int toIndex) { + AutoMap<V> aNewSubList = new AutoMap<V>(); + for (int slot=fromIndex; slot<=toIndex; slot++) { + V obj = mInternalMap.get(slot); + if (obj == null) { + continue; + } + else { + aNewSubList.put(obj); + } + } + return aNewSubList; + } } diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/AABB.java b/src/Java/gtPlusPlus/api/objects/minecraft/AABB.java new file mode 100644 index 0000000000..722ac00b64 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/minecraft/AABB.java @@ -0,0 +1,65 @@ +package gtPlusPlus.api.objects.minecraft; + +import gtPlusPlus.core.util.minecraft.EntityUtils; +import net.minecraft.entity.Entity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.world.World; + +/** + * Generates an AABB around an entity. + * @author Alkalus + * + */ +public class AABB { + + private final AxisAlignedBB mAabb; + private final World mWorld; + + /** + * Creates a AxisAlignedBB based around an Entity. + * @param aEntity - The Entity to work with. + * @param x - Maximum X from origin. + * @param y - Maximum Y from origin. + * @param z - Maximum Z from origin. + */ + public AABB(Entity aEntity, int x, int y, int z) { + if (aEntity == null) { + mAabb = null; + mWorld = null; + } + else { + mWorld = aEntity.worldObj; + BlockPos aEntityLocation = EntityUtils.findBlockPosUnderEntity(aEntity); + int xMin, xMax, yMin, yMax, zMin, zMax; + xMin = aEntityLocation.xPos; + yMin = aEntityLocation.yPos; + zMin = aEntityLocation.zPos; + xMax = aEntityLocation.xPos + x; + yMax = aEntityLocation.yPos + y; + zMax = aEntityLocation.zPos + z; + mAabb = AxisAlignedBB.getBoundingBox(xMin, yMin, zMin, xMax, yMax, zMax); + } + + } + + /** + * Used to get the AxisAlignedBB from this class. + * @return + */ + public AxisAlignedBB get() { + return mAabb; + } + + /** + * Used to determine if this object is valid or not. + * @return + */ + public boolean valid() { + return mAabb != null && mWorld != null; + } + + public World world() { + return mWorld; + } + +} diff --git a/src/Java/gtPlusPlus/api/objects/minecraft/TexturePackage.java b/src/Java/gtPlusPlus/api/objects/minecraft/TexturePackage.java new file mode 100644 index 0000000000..e610f8fdf0 --- /dev/null +++ b/src/Java/gtPlusPlus/api/objects/minecraft/TexturePackage.java @@ -0,0 +1,55 @@ +package gtPlusPlus.api.objects.minecraft; + +import java.util.LinkedHashMap; +import java.util.Set; + +import gtPlusPlus.api.objects.data.AutoMap; +import net.minecraft.util.IIcon; + +public class TexturePackage { + + private AutoMap<IIcon> mAnimationArray = new AutoMap<IIcon>(); + + public IIcon getFrame(int aFrame) { + if (aFrame < 0 || aFrame >= mAnimationArray.size()) { + return mAnimationArray.get(0); + } + return mAnimationArray.get(aFrame); + } + + public boolean addFrame(IIcon aFrame) { + if (aFrame != null) { + return mAnimationArray.add(aFrame); + } + return false; + } + + public boolean addFrames(AutoMap<IIcon> aFrames) { + for (IIcon h : aFrames) { + if (!addFrame(h)) { + return false; + } + } + return true; + } + + public boolean addFrames(LinkedHashMap<?, IIcon> aFrames) { + for (IIcon h : aFrames.values()) { + if (!addFrame(h)) { + return false; + } + } + return true; + } + + public boolean addFrames(Set<IIcon> aFrames) { + for (IIcon h : aFrames) { + if (!addFrame(h)) { + return false; + } + } + return true; + } + + +} diff --git a/src/Java/gtPlusPlus/core/block/ModBlocks.java b/src/Java/gtPlusPlus/core/block/ModBlocks.java index 2b04356f52..b904b04556 100644 --- a/src/Java/gtPlusPlus/core/block/ModBlocks.java +++ b/src/Java/gtPlusPlus/core/block/ModBlocks.java @@ -11,6 +11,8 @@ import gtPlusPlus.core.block.general.LightGlass; import gtPlusPlus.core.block.general.MiningExplosives; import gtPlusPlus.core.block.general.PlayerDoors; import gtPlusPlus.core.block.general.antigrief.BlockWitherProof; +import gtPlusPlus.core.block.general.redstone.BlockGenericRedstoneDetector; +import gtPlusPlus.core.block.general.redstone.BlockGenericRedstoneTest; import gtPlusPlus.core.block.machine.CircuitProgrammer; import gtPlusPlus.core.block.machine.DecayablesChest; import gtPlusPlus.core.block.machine.FishTrap; @@ -141,6 +143,9 @@ public final class ModBlocks { blockPooCollector = new Machine_PooCollector(); + new BlockGenericRedstoneDetector(); + new BlockGenericRedstoneTest(); + } diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java new file mode 100644 index 0000000000..b84c96be99 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstone.java @@ -0,0 +1,370 @@ +package gtPlusPlus.core.block.general.redstone; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Random; + +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.common.registry.LanguageRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.common.items.GT_MetaGenerated_Tool_01; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.item.base.itemblock.ItemBlockMeta; +import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler; +import gtPlusPlus.core.util.minecraft.InventoryUtils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import net.minecraft.block.Block; +import net.minecraft.block.BlockContainer; +import net.minecraft.block.material.Material; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureType; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public abstract class BlockGenericRedstone extends BlockContainer { + + + @SuppressWarnings("deprecation") + public BlockGenericRedstone(String aUnlocalizedSuffix, String aDisplayName) { + super(Material.redstoneLight); + this.setBlockName("blockGenericRedstone." + aUnlocalizedSuffix); + this.setHardness(3f); + this.setCreativeTab(AddToCreativeTab.tabMachines); + GameRegistry.registerBlock(this, ItemBlockMeta.class, "blockGenericRedstone." + aUnlocalizedSuffix); + LanguageRegistry.addName(this, aDisplayName); + + } + + + private final HashMap<Integer, HashMap<ForgeDirection, IIcon>> mTextures = new HashMap<Integer, HashMap<ForgeDirection, IIcon>>(); + + /** + * A map of the textures used for this blocks. The key is the meta, then each internal map holds textures tied to each forge direction. Do not use unknown direction. + * @return + */ + public HashMap<Integer, HashMap<ForgeDirection, IIcon>> getTextureArray() { + return mTextures; + } + + public abstract void generateTextureArray(final IIconRegister iicon); + + + @Override + @SideOnly(Side.CLIENT) + public final void registerBlockIcons(final IIconRegister iicon) { + generateTextureArray(iicon); + this.blockIcon = iicon.registerIcon("redstone_block"); + } + + + /** + * Called upon block activation (right click on the block.) + */ + @Override + public boolean onBlockActivated(final World world, final int x, final int y, final int z, final EntityPlayer player, + final int side, final float lx, final float ly, final float lz) { + + if (world.isRemote) { + return true; + } + + boolean mDidTool = false; + // Check For Tools + try { + final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(world, player.getDisplayName()); + final Item mHandItem = mHandStack.getItem(); + if (ItemUtils.isItemGregtechTool(mHandStack)) { + + Logger.INFO("Found Tool in players hand!"); + + final TileEntityRedstoneHandler tile = (TileEntityRedstoneHandler) world.getTileEntity(x, y, z); + if (tile != null) { + if (tile.isScrewdriverable()) { + if (ItemUtils.isToolScrewdriver(mHandStack)){ + mDidTool = tile.onScrewdriverRMB(); + PlayerUtils.messagePlayer(player, "Adjusted Light level by 0.0625f. "+tile.getLightBrightness()); + } + } + if (tile.isMalletable()) { + if (ItemUtils.isToolMallet(mHandStack)){ + mDidTool = tile.onMalletRMB(); + PlayerUtils.messagePlayer(player, "Light Mode active: "+mDidTool); + } + } + if (tile.isWrenchable()) { + if (ItemUtils.isToolWrench(mHandStack)){ + mDidTool = tile.onWrenchRMB(); + } + } + } + } + } + catch (final Throwable t) {} + if (mDidTool) { + return true; + } + + return false; + } + + + + @Override + public void onBlockClicked(World aWorld, int aX, int aY, int aZ, EntityPlayer aPlayer) { + + boolean mDidTool = false; + // Check For Tools + try { + final ItemStack mHandStack = PlayerUtils.getItemStackInPlayersHand(aWorld, aPlayer.getDisplayName()); + final Item mHandItem = mHandStack.getItem(); + if (mHandItem instanceof GT_MetaGenerated_Tool_01) { + + final TileEntityRedstoneHandler tile = (TileEntityRedstoneHandler) aWorld.getTileEntity(aX, aY, aZ); + if (tile != null) { + if (tile.isScrewdriverable()) { + if (ItemUtils.isToolScrewdriver(mHandStack)){ + mDidTool = tile.onScrewdriverLMB(); + } + } + if (tile.isMalletable()) { + if (ItemUtils.isToolMallet(mHandStack)){ + mDidTool = tile.onMalletLMB(); + } + } + if (tile.isWrenchable()) { + if (ItemUtils.isToolWrench(mHandStack)){ + mDidTool = tile.onWrenchLMB(); + } + } + } + } + } + catch (Throwable t) {} + + if (!mDidTool && !aPlayer.capabilities.isCreativeMode) { + super.onBlockClicked(aWorld, aX, aY, aZ, aPlayer); + } + else { + return; + } + } + + @Override + public abstract TileEntity createNewTileEntity(final World world, final int p_149915_2_); + + @Override + public void breakBlock(final World world, final int x, final int y, final int z, final Block block, + final int number) { + InventoryUtils.dropInventoryItems(world, x, y, z, block); + super.breakBlock(world, x, y, z, block, number); + } + + @Override + public void onBlockPlacedBy(final World world, final int x, final int y, final int z, final EntityLivingBase entity, + final ItemStack stack) { + if (stack.hasDisplayName()) { + ((TileEntityRedstoneHandler) world.getTileEntity(x, y, z)).setCustomName(stack.getDisplayName()); + } + } + + @Override + public boolean canCreatureSpawn(final EnumCreatureType type, final IBlockAccess world, final int x, final int y, + final int z) { + return false; + } + + @Override + public int getLightValue() { + return super.getLightValue(); + } + + @Override + public int onBlockPlaced(World p_149660_1_, int p_149660_2_, int p_149660_3_, int p_149660_4_, int p_149660_5_, + float p_149660_6_, float p_149660_7_, float p_149660_8_, int p_149660_9_) { + // TODO Auto-generated method stub + return super.onBlockPlaced(p_149660_1_, p_149660_2_, p_149660_3_, p_149660_4_, p_149660_5_, p_149660_6_, + p_149660_7_, p_149660_8_, p_149660_9_); + } + + @Override + public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) { + TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); + if (aThis != null) { + return aThis.isProvidingWeakPower(world, x, y, z, side); + } + return 0; + } + + @Override + public boolean canProvidePower() { + return false; + } + + @Override + public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) { + TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); + if (aThis != null) { + return aThis.isProvidingStrongPower(world, x, y, z, side); + } + return 0; + } + + @Override + public boolean hasComparatorInputOverride() { + // TODO Auto-generated method stub + return super.hasComparatorInputOverride(); + } + + @Override + public int getComparatorInputOverride(World p_149736_1_, int p_149736_2_, int p_149736_3_, int p_149736_4_, + int p_149736_5_) { + // TODO Auto-generated method stub + return super.getComparatorInputOverride(p_149736_1_, p_149736_2_, p_149736_3_, p_149736_4_, p_149736_5_); + } + + @Override + public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) { + TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); + if (aThis != null) { + return aThis.canConnectRedstone(world, x, y, z, side); + } + return false; + } + + @Override + public boolean shouldCheckWeakPower(IBlockAccess world, int x, int y, int z, int side) { + TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); + if (aThis != null) { + return aThis.shouldCheckWeakPower(world, x, y, z, side); + } + return isNormalCube(); + } + + @Override + public boolean getWeakChanges(IBlockAccess world, int x, int y, int z) { + TileEntityRedstoneHandler aThis = getTileEntity(world, x, y, z); + if (aThis != null) { + return aThis.getWeakChanges(world, x, y, z); + } + return false; + } + + + /** + * Gets the block's texture. Args: side, meta + */ + @Override + @SideOnly(Side.CLIENT) + public abstract IIcon getIcon(final int side, final int meta); + + @Override + public int damageDropped(final int damage) { + return damage; + } + + @Override + public abstract void getSubBlocks(final Item item, final CreativeTabs tab, final List list); + + + /** + * Called whenever the block is added into the world. Args: world, x, y, z + */ + public void onBlockAdded(World aWorld, int aX, int aY, int aZ) { + TileEntityRedstoneHandler aThis = getTileEntity(aWorld, aX, aY, aZ); + + if (!aWorld.isRemote) { + if (aThis.hasUpdatedRecently() && !aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ)) { + aWorld.scheduleBlockUpdate(aX, aY, aZ, this, 4); + } else if (!aThis.hasUpdatedRecently() && aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ)) { + aWorld.setBlock(aX, aY, aZ, Blocks.lit_redstone_lamp, 0, 2); + } + } + } + + /** + * Lets the block know when one of its neighbor changes. Doesn't know which + * neighbor changed (coordinates passed are their own) Args: x, y, z, neighbor + * Block + */ + public void onNeighborBlockChange(World aWorld, int aX, int aY, int aZ, Block p_149695_5_) { + + TileEntityRedstoneHandler aThis = getTileEntity(aWorld, aX, aY, aZ); + + if (!aWorld.isRemote) { + if (aThis.hasUpdatedRecently() && !aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ)) { + aWorld.scheduleBlockUpdate(aX, aY, aZ, this, 4); + } else if (!aThis.hasUpdatedRecently() && aWorld.isBlockIndirectlyGettingPowered(aX, aY, aZ)) { + aWorld.setBlock(aX, aY, aZ, Blocks.lit_redstone_lamp, 0, 2); + } + } + } + + /** + * Ticks the block if it's been scheduled + */ + public void updateTick(World aWorld, int aX, int aY, int aZ, Random p_149674_5_) { + TileEntityRedstoneHandler aTile = getTileEntity(aWorld, aX, aY, aZ); + // Client side handling + if (aTile != null) { + this.setLightLevel(aTile.getLightBrightness()); + } + // Only continue on server + if (aWorld.isRemote) { + return; + } + if (aTile != null) { + if (aTile.isGettingIndirectlyPowered()) { + } + } + } + + public TileEntityRedstoneHandler getTileEntity(IBlockAccess world, int aX, int aY, int aZ) { + TileEntity aTemp = world.getTileEntity(aX, aY, aZ); + if (aTemp != null) { + if (aTemp instanceof TileEntityRedstoneHandler) { + TileEntityRedstoneHandler g = (TileEntityRedstoneHandler) aTemp; + if (g != null) { + return g; + } + } + } + return null; + } + + + /** + * Gets an item for the block being called on. Args: world, x, y, z + */ + @SideOnly(Side.CLIENT) + @Override + public abstract Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_); + + /** + * Returns an item stack containing a single instance of the current block type. + * 'i' is the block's subtype/damage and is ignored for blocks which do not + * support subtypes. Blocks which cannot be harvested should return null. + */ + @Override + protected abstract ItemStack createStackedBlock(int p_149644_1_); + + @Override + public abstract ArrayList<ItemStack> getDrops(final World world, final int x, final int y, final int z, final int metadata, final int fortune); + + @Override + public abstract Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_); + + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java new file mode 100644 index 0000000000..43247110f1 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneDetector.java @@ -0,0 +1,131 @@ +package gtPlusPlus.core.block.general.redstone; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Random; + +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class BlockGenericRedstoneDetector extends BlockGenericRedstone { + + public BlockGenericRedstoneDetector() { + super("detector", "Redstone Detector"); + setTickRandomly(true); + } + + @Override + public TileEntity createNewTileEntity(World world, int p_149915_2_) { + return new TileEntityRedstoneDetector(); + } + + public class TileEntityRedstoneDetector extends TileEntityRedstoneHandler { + public TileEntityRedstoneDetector() { + super(0); + } + + @Override + protected Class<? extends TileEntity> getTileEntityClass() { + return this.getClass(); + } + + @Override + protected String getTileEntityNameForRegistration() { + return "TileEntityRedstoneDetector"; + } + } + + @Override + public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List aList) { + aList.add(ItemUtils.getSimpleStack(this)); + } + + + @Override + public void updateTick(World aWorld, int aX, int aY, int aZ, Random aRand) { + super.updateTick(aWorld, aX, aY, aZ, aRand); + } + + @Override + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + // TODO Auto-generated method stub + return ItemUtils.getSimpleStack(this).getItem(); + } + + @Override + public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { + // TODO Auto-generated method stub + return ItemUtils.getSimpleStack(this).getItem(); + } + + @Override + protected ItemStack createStackedBlock(int p_149644_1_) { + return ItemUtils.simpleMetaStack(this, p_149644_1_, 1); + } + + public void generateTextureArray(final IIconRegister iicon) { + HashMap<Integer, HashMap<ForgeDirection, IIcon>> aTextures = new HashMap<Integer, HashMap<ForgeDirection, IIcon>>(); + + + //New Block for Each Meta + int aMeta = 0; + { + HashMap<ForgeDirection, IIcon> aTempMap = new HashMap<ForgeDirection, IIcon>(); + aTempMap.put(ForgeDirection.UP, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.DOWN, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.NORTH, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.SOUTH, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.EAST, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.WEST, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTextures.put(aMeta++, aTempMap); + } + + } + + @Override + public IIcon getIcon(int side, int meta) { + HashMap<ForgeDirection, IIcon> aTemp = getTextureArray().get(meta); + if (aTemp != null) { + IIcon aSide = aTemp.get(ForgeDirection.getOrientation(side)); + if (aSide != null) { + return aSide; + } + else { + //Smart calculate missing sides + if (side <= 1) { + for (int ss = 0; ss < 2; ss++) { + aSide = aTemp.get(ForgeDirection.getOrientation(side)); + if (aSide != null) { + return aSide; + } + } + } + for (int ss = 2; ss < 6; ss++) { + aSide = aTemp.get(ForgeDirection.getOrientation(side)); + if (aSide != null) { + return aSide; + } + } + } + } + return blockIcon; + } + + @Override + public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) { + ArrayList<ItemStack> aDrops = new ArrayList<ItemStack>(); + aDrops.add(ItemUtils.getSimpleStack(this)); + return aDrops; + } + +} diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneEmitter.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneEmitter.java new file mode 100644 index 0000000000..df8a929302 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneEmitter.java @@ -0,0 +1,5 @@ +package gtPlusPlus.core.block.general.redstone; + +public class BlockGenericRedstoneEmitter { + +} diff --git a/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java new file mode 100644 index 0000000000..0f1f983cd0 --- /dev/null +++ b/src/Java/gtPlusPlus/core/block/general/redstone/BlockGenericRedstoneTest.java @@ -0,0 +1,201 @@ +package gtPlusPlus.core.block.general.redstone; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Random; + +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import gtPlusPlus.core.world.explosions.ExplosionHandler; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class BlockGenericRedstoneTest extends BlockGenericRedstone { + + public BlockGenericRedstoneTest() { + super("test", "Redstone Test"); + setTickRandomly(true); + } + + @Override + public TileEntity createNewTileEntity(World world, int p_149915_2_) { + return new TileEntityRedstoneTest(); + } + + public class TileEntityRedstoneTest extends TileEntityRedstoneHandler { + public TileEntityRedstoneTest() { + super(2); + } + + @Override + public boolean isScrewdriverable() { + return true; + } + + @Override + public boolean onScrewdriverLMB() { + return super.onScrewdriverLMB(); + } + + @Override + public boolean onScrewdriverRMB() { + if (this.mLightValue + 0.0625f <= 1) { + this.mLightValue += 0.0625f; + } + else { + this.mLightValue = 0; + } + this.markForUpdate(); + return true; + } + + @Override + public boolean isMalletable() { + return true; + } + + @Override + public boolean onMalletLMB() { + return super.onMalletLMB(); + } + + @Override + public boolean onMalletRMB() { + this.mLightMode = Utils.invertBoolean(mLightMode); + this.markForUpdate(); + return mLightMode; + } + + @Override + public boolean isWrenchable() { + return true; + } + + @Override + public boolean onWrenchLMB() { + return super.onWrenchLMB(); + } + + @Override + public boolean onWrenchRMB() { + Logger.INFO("Found Wrench"); + ExplosionHandler explode = new ExplosionHandler(); + explode.createExplosion(this.worldObj, null, this.xCoord, this.yCoord, this.zCoord, 1f, false, true); + return true; + } + + @Override + protected Class<? extends TileEntity> getTileEntityClass() { + return this.getClass(); + } + + @Override + protected String getTileEntityNameForRegistration() { + return "TileEntityRedstoneTest"; + } + + @Override + public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) { + return super.isProvidingWeakPower(world, x, y, z, side); + } + + @Override + public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) { + return super.isProvidingStrongPower(world, x, y, z, side); + } + } + + @SuppressWarnings("unchecked") + @Override + public void getSubBlocks(Item p_149666_1_, CreativeTabs p_149666_2_, List aList) { + aList.add(ItemUtils.getSimpleStack(this)); + } + + + @Override + public void updateTick(World aWorld, int aX, int aY, int aZ, Random aRand) { + super.updateTick(aWorld, aX, aY, aZ, aRand); + } + + @Override + public Item getItemDropped(int p_149650_1_, Random p_149650_2_, int p_149650_3_) { + return ItemUtils.getSimpleStack(this).getItem(); + } + + @Override + public Item getItem(World p_149694_1_, int p_149694_2_, int p_149694_3_, int p_149694_4_) { + return ItemUtils.getSimpleStack(this).getItem(); + } + + @Override + protected ItemStack createStackedBlock(int p_149644_1_) { + return ItemUtils.simpleMetaStack(this, p_149644_1_, 1); + } + + public void generateTextureArray(final IIconRegister iicon) { + HashMap<Integer, HashMap<ForgeDirection, IIcon>> aTextures = new HashMap<Integer, HashMap<ForgeDirection, IIcon>>(); + + + //New Block for Each Meta + int aMeta = 0; + { + HashMap<ForgeDirection, IIcon> aTempMap = new HashMap<ForgeDirection, IIcon>(); + aTempMap.put(ForgeDirection.UP, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.DOWN, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.NORTH, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.SOUTH, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.EAST, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTempMap.put(ForgeDirection.WEST, iicon.registerIcon(CORE.MODID + ":" + "redstone/redstone_meter/" + "top")); + aTextures.put(aMeta++, aTempMap); + } + + } + + @Override + public IIcon getIcon(int side, int meta) { + HashMap<ForgeDirection, IIcon> aTemp = getTextureArray().get(meta); + if (aTemp != null) { + IIcon aSide = aTemp.get(ForgeDirection.getOrientation(side)); + if (aSide != null) { + return aSide; + } + else { + //Smart calculate missing sides + if (side <= 1) { + for (int ss = 0; ss < 2; ss++) { + aSide = aTemp.get(ForgeDirection.getOrientation(side)); + if (aSide != null) { + return aSide; + } + } + } + for (int ss = 2; ss < 6; ss++) { + aSide = aTemp.get(ForgeDirection.getOrientation(side)); + if (aSide != null) { + return aSide; + } + } + } + } + return blockIcon; + } + + @Override + public ArrayList<ItemStack> getDrops(World world, int x, int y, int z, int metadata, int fortune) { + ArrayList<ItemStack> aDrops = new ArrayList<ItemStack>(); + aDrops.add(ItemUtils.getSimpleStack(this)); + return aDrops; + } + +} diff --git a/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java b/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java index 1600d9944f..6ae1a52aba 100644 --- a/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java +++ b/src/Java/gtPlusPlus/core/block/machine/CircuitProgrammer.java @@ -51,6 +51,8 @@ public class CircuitProgrammer extends BlockContainer implements ITileTooltip @SuppressWarnings("deprecation") public CircuitProgrammer(){ super(Material.iron); + this.setHardness(5f); + this.setResistance(1f); this.setBlockName("blockCircuitProgrammer"); this.setCreativeTab(AddToCreativeTab.tabMachines); GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockCircuitProgrammer"); diff --git a/src/Java/gtPlusPlus/core/block/machine/FishTrap.java b/src/Java/gtPlusPlus/core/block/machine/FishTrap.java index b5e78f23ef..037ec61ced 100644 --- a/src/Java/gtPlusPlus/core/block/machine/FishTrap.java +++ b/src/Java/gtPlusPlus/core/block/machine/FishTrap.java @@ -51,6 +51,7 @@ public class FishTrap extends BlockContainer implements ITileTooltip super(Material.iron); this.setBlockName("blockFishTrap"); this.setHardness(5f); + this.setResistance(1f); this.setCreativeTab(AddToCreativeTab.tabMachines); GameRegistry.registerBlock(this, ItemBlockBasicTile.class, "blockFishTrap"); LanguageRegistry.addName(this, "Fish Catcher"); diff --git a/src/Java/gtPlusPlus/core/block/machine/Machine_PooCollector.java b/src/Java/gtPlusPlus/core/block/machine/Machine_PooCollector.java index 23fdfe9733..945cf7b581 100644 --- a/src/Java/gtPlusPlus/core/block/machine/Machine_PooCollector.java +++ b/src/Java/gtPlusPlus/core/block/machine/Machine_PooCollector.java @@ -38,6 +38,8 @@ public class Machine_PooCollector extends BlockContainer { public Machine_PooCollector() { super(Material.iron); + this.setHardness(5f); + this.setResistance(1f); this.setBlockName("blockPooCollector"); this.setCreativeTab(AddToCreativeTab.tabMachines); GameRegistry.registerBlock(this, ItemBlockMeta.class,"blockPooCollector"); diff --git a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java index f57c09b62d..c6fcc83d01 100644 --- a/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java +++ b/src/Java/gtPlusPlus/core/common/compat/COMPAT_Baubles.java @@ -3,10 +3,20 @@ package gtPlusPlus.core.common.compat; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.item.ModItems; import gtPlusPlus.core.item.bauble.BatteryPackBaseBauble; +import gtPlusPlus.core.item.bauble.MonsterKillerBaseBauble; import gtPlusPlus.core.item.general.ItemCloakingDevice; import gtPlusPlus.core.item.general.ItemHealingDevice; import gtPlusPlus.core.item.general.ItemSlowBuildingRing; import gtPlusPlus.core.lib.LoadedMods; +import net.minecraft.entity.monster.EntityBlaze; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.monster.EntityEnderman; +import net.minecraft.entity.monster.EntityGhast; +import net.minecraft.entity.monster.EntityMagmaCube; +import net.minecraft.entity.monster.EntityPigZombie; +import net.minecraft.entity.monster.EntitySkeleton; +import net.minecraft.entity.monster.EntitySpider; +import net.minecraft.entity.monster.EntityZombie; public class COMPAT_Baubles { @@ -34,6 +44,13 @@ public class COMPAT_Baubles { catch (Throwable t) { t.printStackTrace(); } + + ModItems.itemAmuletMonsterKiller_Zombie = new MonsterKillerBaseBauble(new Class[] {EntityZombie.class}, "Zombie", 3); + ModItems.itemAmuletMonsterKiller_Skeleton = new MonsterKillerBaseBauble(new Class[] {EntitySkeleton.class}, "Skeleton", 3); + ModItems.itemAmuletMonsterKiller_Spider = new MonsterKillerBaseBauble(new Class[] {EntitySpider.class}, "Spider", 3); + ModItems.itemAmuletMonsterKiller_Creeper = new MonsterKillerBaseBauble(new Class[] {EntityCreeper.class}, "Creeper", 4); + ModItems.itemAmuletMonsterKiller_Enderman = new MonsterKillerBaseBauble(new Class[] {EntityEnderman.class}, "Enderman", 4); + ModItems.itemAmuletMonsterKiller_Nether = new MonsterKillerBaseBauble(new Class[] {EntityPigZombie.class, EntityGhast.class, EntityMagmaCube.class, EntityBlaze.class}, "Hellish", 6); if (LoadedMods.PlayerAPI){ ModItems.itemSlowBuildingRing = new ItemSlowBuildingRing(); diff --git a/src/Java/gtPlusPlus/core/handler/AchievementHandler.java b/src/Java/gtPlusPlus/core/handler/AchievementHandler.java index 482ca66f09..4cd5431ebd 100644 --- a/src/Java/gtPlusPlus/core/handler/AchievementHandler.java +++ b/src/Java/gtPlusPlus/core/handler/AchievementHandler.java @@ -71,7 +71,7 @@ public class AchievementHandler { this.registerAchievement("rtg", -16, -10, GregtechItemList.RTG.get(1), aBaseAchievementName, false); this.registerAchievement("dehydrate", -15, -10, GregtechItemList.GT_Dehydrator_HV.get(1), aBaseAchievementName, false); this.registerAchievement("semifluid", -14, -10, GregtechItemList.Generator_SemiFluid_HV.get(1), aBaseAchievementName, false); - this.registerAchievement("earlywasher", -13, -10, GregtechItemList.SimpleDustWasher.get(1), aBaseAchievementName, false); + this.registerAchievement("earlywasher", -13, -10, GregtechItemList.SimpleDustWasher_ULV.get(1), aBaseAchievementName, false); this.registerAchievement("advancedsteam", -12, -10, GregtechItemList.Boiler_Advanced_MV.get(1), aBaseAchievementName, false); this.registerAchievement("pollutionremoval", -11, -10, GregtechItemList.Pollution_Cleaner_IV.get(1), aBaseAchievementName, false); this.registerAchievement("hiampxform", -10, -10, GregtechItemList.Transformer_HA_HV_MV.get(1), aBaseAchievementName, false); diff --git a/src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java b/src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java index ef91647c1a..fda7760607 100644 --- a/src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java +++ b/src/Java/gtPlusPlus/core/handler/events/GeneralTooltipEventHandler.java @@ -1,22 +1,16 @@ package gtPlusPlus.core.handler.events; import cpw.mods.fml.common.eventhandler.SubscribeEvent; - -import net.minecraft.block.Block; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.EnumChatFormatting; - import gregtech.api.enums.ItemList; -import gregtech.api.util.GT_Utility; import gtPlusPlus.GTplusplus; import gtPlusPlus.GTplusplus.INIT_PHASE; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.block.ModBlocks; -import gtPlusPlus.core.handler.events.BlockEventHandler; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.core.util.sys.KeyboardUtils; +import net.minecraft.block.Block; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; import net.minecraftforge.event.entity.player.ItemTooltipEvent; public class GeneralTooltipEventHandler { diff --git a/src/Java/gtPlusPlus/core/item/ModItems.java b/src/Java/gtPlusPlus/core/item/ModItems.java index e8f0e31458..68aacd6943 100644 --- a/src/Java/gtPlusPlus/core/item/ModItems.java +++ b/src/Java/gtPlusPlus/core/item/ModItems.java @@ -32,6 +32,7 @@ import gtPlusPlus.core.item.base.plates.BaseItemPlateDouble; import gtPlusPlus.core.item.bauble.BatteryPackBaseBauble; import gtPlusPlus.core.item.bauble.HealthBoostBauble; import gtPlusPlus.core.item.bauble.ModularBauble; +import gtPlusPlus.core.item.bauble.MonsterKillerBaseBauble; import gtPlusPlus.core.item.chemistry.AgriculturalChem; import gtPlusPlus.core.item.chemistry.CoalTar; import gtPlusPlus.core.item.chemistry.GenericChem; @@ -345,6 +346,15 @@ public final class ModItems { public static CoreItem itemDetCable; public static ItemThrowableBomb itemBomb; + public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Zombie; + public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Skeleton; + public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Spider; + public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Creeper; + public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Enderman; + + public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Nether; + public static MonsterKillerBaseBauble itemAmuletMonsterKiller_Infernal; + static { Logger.INFO("Items!"); //Default item used when recipes fail, handy for debugging. Let's make sure they exist when this class is called upon. @@ -522,7 +532,13 @@ public final class ModItems { MaterialGenerator.generate(ELEMENT.STANDALONE.CELESTIAL_TUNGSTEN); MaterialGenerator.generate(ELEMENT.STANDALONE.HYPOGEN); MaterialGenerator.generate(ELEMENT.STANDALONE.CHRONOMATIC_GLASS); - + + //Custom Materials that are from Runescape + MaterialGenerator.generate(ELEMENT.STANDALONE.BLACK_METAL); + MaterialGenerator.generate(ELEMENT.STANDALONE.WHITE_METAL); + MaterialGenerator.generate(ELEMENT.STANDALONE.GRANITE, false, false); + MaterialGenerator.generate(ELEMENT.STANDALONE.RUNITE, false); + MaterialGenerator.generate(ELEMENT.STANDALONE.DRAGON_METAL, false); //Carbides - Tungsten Carbide exists in .09 so don't generate it. - Should still come before alloys though if (!CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ @@ -634,6 +650,17 @@ public final class ModItems { MaterialGenerator.generate(ALLOY.TITANSTEEL); MaterialGenerator.generate(ALLOY.ARCANITE); MaterialGenerator.generate(ALLOY.OCTIRON); + + MaterialGenerator.generate(ALLOY.BABBIT_ALLOY, false); + MaterialGenerator.generate(ALLOY.BLACK_TITANIUM, false); + + + + + + + + //Must be the final Alloy to Generate MaterialGenerator.generate(ALLOY.QUANTUM); @@ -812,7 +839,7 @@ public final class ModItems { else { itemHotTitaniumIngot = ItemUtils.getItemStackOfAmountFromOreDictNoBroken("ingotHotTitanium", 1); } - GT_Values.RA.addBlastRecipe(ELEMENT.getInstance().TITANIUM.getIngot(1), null, itemHotTitaniumIngot, null, 10 * 20, 512, Materials.Titanium.mBlastFurnaceTemp); + GT_Values.RA.addBlastRecipe(ELEMENT.getInstance().TITANIUM.getIngot(1), CI.getNumberedCircuit(16), itemHotTitaniumIngot, null, 10 * 20, 500, Materials.Titanium.mBlastFurnaceTemp); //Special Sillyness if (true) { diff --git a/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java index cc7979825a..2d9b35ac63 100644 --- a/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java +++ b/src/Java/gtPlusPlus/core/item/bauble/BatteryPackBaseBauble.java @@ -3,20 +3,16 @@ package gtPlusPlus.core.item.bauble; import java.util.List; import baubles.api.BaubleType; -import baubles.api.IBauble; -import cpw.mods.fml.common.Optional; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; import gregtech.api.enums.GT_Values; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.creative.AddToCreativeTab; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; import ic2.api.item.ElectricItem; import ic2.api.item.IElectricItem; -import ic2.api.item.IElectricItemManager; import net.minecraft.creativetab.CreativeTabs; import net.minecraft.entity.Entity; import net.minecraft.entity.EntityLivingBase; @@ -28,23 +24,12 @@ import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.StatCollector; import net.minecraft.world.World; -@Optional.InterfaceList(value = { @Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), - @Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles") }) -public class BatteryPackBaseBauble extends BaseBauble implements IElectricItem, IElectricItemManager, IBauble { +public class BatteryPackBaseBauble extends ElectricBaseBauble { - final int mTier; - private final double maxValueEU; public BatteryPackBaseBauble(int tier) { - super(BaubleType.BELT, "GTPP.BattPack.0" + tier + ".name", 0); - mTier = tier; - maxValueEU = GT_Values.V[mTier] * 20 * 300; - String aUnlocalName = "GTPP.BattPack.0" + mTier + ".name"; - this.setUnlocalizedName(aUnlocalName); - this.setTextureName(CORE.MODID + ":" + "chargepack/"+tier); - this.setMaxDamage(27); - this.setMaxStackSize(1); - this.setNoRepair(); + super(BaubleType.BELT, tier, GT_Values.V[tier] * 20 * 300, "GTPP.BattPack.0" + tier + ".name"); + String aUnlocalName = "GTPP.BattPack.0" + tier + ".name"; this.setCreativeTab(AddToCreativeTab.tabMachines); if (GameRegistry.findItem(CORE.MODID, aUnlocalName) == null) { GameRegistry.registerItem(this, aUnlocalName); @@ -82,46 +67,11 @@ public class BatteryPackBaseBauble extends BaseBauble implements IElectricItem, } @Override - public Item getChargedItem(final ItemStack itemStack) { - final ItemStack x = itemStack.copy(); - x.setItemDamage(27); - return x.getItem(); - } - - @Override - public Item getEmptyItem(final ItemStack itemStack) { - final ItemStack x = itemStack.copy(); - x.setItemDamage(0); - return x.getItem(); - } - - @Override - public double getMaxCharge(final ItemStack itemStack) { - return maxValueEU; - } - - @Override - public int getTier(final ItemStack itemStack) { - return mTier; - } - - @Override - public double getTransferLimit(final ItemStack itemStack) { - return GT_Values.V[mTier]; - } - - @Override public String getItemStackDisplayName(final ItemStack p_77653_1_) { return (EnumChatFormatting.BLUE + super.getItemStackDisplayName(p_77653_1_) + EnumChatFormatting.GRAY); } @Override - public double getDurabilityForDisplay(final ItemStack stack) { - // return 1.0D - getEnergyStored(stack) / this.capacity; - return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack)); - } - - @Override public boolean showDurabilityBar(final ItemStack stack) { return true; } @@ -140,71 +90,17 @@ public class BatteryPackBaseBauble extends BaseBauble implements IElectricItem, String aString2 = StatCollector.translateToLocal("GTPP.battpack.tooltip.2"); String aString3 = StatCollector.translateToLocal("GTPP.battpack.tooltip.3"); String aString4 = StatCollector.translateToLocal("GTPP.battpack.tooltip.4"); - - String aEuInfo = StatCollector.translateToLocal("GTPP.info.euInfo"); - String aTier = StatCollector.translateToLocal("GTPP.machines.tier"); - String aInputLimit = StatCollector.translateToLocal("GTPP.info.inputLimit"); - String aCurrentPower = StatCollector.translateToLocal("GTPP.info.currentPower"); + String aEU = StatCollector.translateToLocal("GTPP.info.eu"); String aEUT = aEU+"/t"; list.add(EnumChatFormatting.GREEN + aString1 + EnumChatFormatting.GRAY); list.add(EnumChatFormatting.GREEN + aString2+" " + (int) getTransferLimit(stack) + aEUT +" "+ aString3 + EnumChatFormatting.GRAY); list.add(EnumChatFormatting.GREEN + aString4 + EnumChatFormatting.GRAY); - list.add(""); - list.add(EnumChatFormatting.GOLD + aEuInfo + EnumChatFormatting.GRAY); - list.add(EnumChatFormatting.GRAY + aTier+": [" + EnumChatFormatting.YELLOW + this.getTier(stack) - + EnumChatFormatting.GRAY + "] "+aInputLimit+": [" + EnumChatFormatting.YELLOW - + this.getTransferLimit(stack) + EnumChatFormatting.GRAY + aEUT); - list.add(EnumChatFormatting.GRAY + aCurrentPower +": [" + EnumChatFormatting.YELLOW + (long) this.getCharge(stack) - + EnumChatFormatting.GRAY + aEU +"] [" + EnumChatFormatting.YELLOW - + MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack)) + EnumChatFormatting.GRAY - + "%]"); super.addInformation(stack, aPlayer, list, bool); } @Override - public double charge(final ItemStack stack, final double amount, final int tier, final boolean ignoreTransferLimit, - final boolean simulate) { - - if (!simulate) { - ElectricItem.manager.charge(stack, amount, tier, true, simulate); - - } - return ElectricItem.manager.charge(stack, amount, tier, true, simulate); - } - - @Override - public double discharge(final ItemStack stack, final double amount, final int tier, - final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) { - if (!simulate) { - ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); - } - - return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); - } - - @Override - public double getCharge(final ItemStack stack) { - return ElectricItem.manager.getCharge(stack); - } - - @Override - public boolean canUse(final ItemStack stack, final double amount) { - return ElectricItem.manager.canUse(stack, amount); - } - - @Override - public boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) { - return ElectricItem.manager.use(stack, amount, entity); - } - - @Override - public void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) { - ElectricItem.manager.chargeFromArmor(stack, entity); - } - - @Override public String getToolTip(final ItemStack stack) { return ElectricItem.manager.getToolTip(stack); } @@ -219,11 +115,6 @@ public class BatteryPackBaseBauble extends BaseBauble implements IElectricItem, return true; } - @Override - public BaubleType getBaubleType(final ItemStack arg0) { - return BaubleType.BELT; - } - @Override // TODO public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { @@ -349,4 +240,10 @@ public class BatteryPackBaseBauble extends BaseBauble implements IElectricItem, } } + @Override + public String getTextureNameForBauble() { + // TODO Auto-generated method stub + return null; + } + } diff --git a/src/Java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java new file mode 100644 index 0000000000..fb490285e9 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/bauble/ElectricBaseBauble.java @@ -0,0 +1,199 @@ +package gtPlusPlus.core.item.bauble; + +import java.util.List; + +import baubles.api.BaubleType; +import baubles.api.IBauble; +import cpw.mods.fml.common.Optional; +import cpw.mods.fml.common.registry.GameRegistry; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.creative.AddToCreativeTab; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; +import ic2.api.item.ElectricItem; +import ic2.api.item.IElectricItem; +import ic2.api.item.IElectricItemManager; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +@Optional.InterfaceList(value = { @Optional.Interface(iface = "baubles.api.IBauble", modid = "Baubles"), +@Optional.Interface(iface = "baubles.api.BaubleType", modid = "Baubles") }) +public abstract class ElectricBaseBauble extends BaseBauble implements IElectricItem, IElectricItemManager, IBauble { + + public final int mTier; + private final double maxValueEU; + private final BaubleType mType; + + public ElectricBaseBauble(BaubleType aType, int aTier, double aMaxEU, String aUnlocalName) { + super(aType, aUnlocalName, 0); + mType = aType; + mTier = aTier; + maxValueEU = aMaxEU; + this.setUnlocalizedName(aUnlocalName); + this.setTextureName(getTextureNameForBauble()); + this.setMaxDamage(27); + this.setMaxStackSize(1); + this.setNoRepair(); + this.setCreativeTab(AddToCreativeTab.tabMachines); + if (GameRegistry.findItem(CORE.MODID, aUnlocalName) == null) { + GameRegistry.registerItem(this, aUnlocalName); + } + } + + public abstract String getTextureNameForBauble(); + + @SideOnly(Side.CLIENT) + @Override + public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + ItemStack charged; + if (this.getEmptyItem(itemStack) == this) { + charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 0.0D, Integer.MAX_VALUE, true, false); + itemList.add(charged); + } + if (this.getChargedItem(itemStack) == this) { + charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, Double.POSITIVE_INFINITY, Integer.MAX_VALUE, true, false); + itemList.add(charged); + } + + } + + @Override + public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, + final boolean p_77663_5_) { + super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); + } + + @Override + public boolean canProvideEnergy(final ItemStack itemStack) { + double aItemCharge = ElectricItem.manager.getCharge(itemStack); + return aItemCharge > 0; + } + + @Override + public final Item getChargedItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); + x.setItemDamage(27); + return x.getItem(); + } + + @Override + public final Item getEmptyItem(final ItemStack itemStack) { + final ItemStack x = itemStack.copy(); + x.setItemDamage(0); + return x.getItem(); + } + + @Override + public final double getMaxCharge(final ItemStack itemStack) { + return maxValueEU; + } + + @Override + public final int getTier(final ItemStack itemStack) { + return mTier; + } + + @Override + public final double getTransferLimit(final ItemStack itemStack) { + return GT_Values.V[mTier]; + } + + @Override + public final double getDurabilityForDisplay(final ItemStack stack) { + return 1.0D - (this.getCharge(stack) / this.getMaxCharge(stack)); + } + + @Override + public boolean showDurabilityBar(final ItemStack stack) { + return true; + } + + @SuppressWarnings("unchecked") + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(""); + String aEuInfo = StatCollector.translateToLocal("GTPP.info.euInfo"); + String aTier = StatCollector.translateToLocal("GTPP.machines.tier"); + String aInputLimit = StatCollector.translateToLocal("GTPP.info.inputLimit"); + String aCurrentPower = StatCollector.translateToLocal("GTPP.info.currentPower"); + String aEU = StatCollector.translateToLocal("GTPP.info.eu"); + String aEUT = aEU+"/t"; + + list.add(EnumChatFormatting.GOLD + aEuInfo + EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GRAY + aTier+": [" + EnumChatFormatting.YELLOW + this.getTier(stack) + + EnumChatFormatting.GRAY + "] "+aInputLimit+": [" + EnumChatFormatting.YELLOW + + this.getTransferLimit(stack) + EnumChatFormatting.GRAY + aEUT); + list.add(EnumChatFormatting.GRAY + aCurrentPower +": [" + EnumChatFormatting.YELLOW + (long) this.getCharge(stack) + + EnumChatFormatting.GRAY + aEU +"] [" + EnumChatFormatting.YELLOW + + MathUtils.findPercentage(this.getCharge(stack), this.getMaxCharge(stack)) + EnumChatFormatting.GRAY + + "%]"); + super.addInformation(stack, aPlayer, list, bool); + } + + @Override + public final double charge(final ItemStack stack, final double amount, final int tier, final boolean ignoreTransferLimit, + final boolean simulate) { + /*if (!simulate) { + ElectricItem.manager.charge(stack, amount, tier, true, simulate); + }*/ + + return ElectricItem.manager.charge(stack, amount, tier, true, simulate); + } + + @Override + public final double discharge(final ItemStack stack, final double amount, final int tier, + final boolean ignoreTransferLimit, final boolean externally, final boolean simulate) { + /*if (!simulate) { + ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); + }*/ + + return ElectricItem.manager.discharge(stack, amount, tier, ignoreTransferLimit, externally, simulate); + } + + @Override + public final double getCharge(final ItemStack stack) { + return ElectricItem.manager.getCharge(stack); + } + + @Override + public final boolean canUse(final ItemStack stack, final double amount) { + return ElectricItem.manager.canUse(stack, amount); + } + + @Override + public final boolean use(final ItemStack stack, final double amount, final EntityLivingBase entity) { + return ElectricItem.manager.use(stack, amount, entity); + } + + @Override + public final void chargeFromArmor(final ItemStack stack, final EntityLivingBase entity) { + ElectricItem.manager.chargeFromArmor(stack, entity); + } + + @Override + public String getToolTip(final ItemStack stack) { + //return ElectricItem.manager.getToolTip(stack); + return null; + } + + @Override + public final BaubleType getBaubleType(final ItemStack arg0) { + return mType; + } + +} diff --git a/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java b/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java new file mode 100644 index 0000000000..aa89ff1627 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/bauble/MonsterKillerBaseBauble.java @@ -0,0 +1,175 @@ +package gtPlusPlus.core.item.bauble; + +import java.util.List; + +import baubles.api.BaubleType; +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.enums.GT_Values; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.minecraft.AABB; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.math.MathUtils; +import gtPlusPlus.core.util.minecraft.EntityUtils; +import gtPlusPlus.core.util.minecraft.PlayerUtils; +import ic2.api.item.ElectricItem; +import net.minecraft.creativetab.CreativeTabs; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.Item; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.StatCollector; +import net.minecraft.world.World; + +public class MonsterKillerBaseBauble extends ElectricBaseBauble { + + private final Class[] mTargets; + + public MonsterKillerBaseBauble(Class[] aMonsterBaseClassArray, String aMonsterTypeName, int aPowerTier) { + super(BaubleType.AMULET, aPowerTier, GT_Values.V[aPowerTier] * 20 * 300, + "GTPP.MonsterKiller." + aMonsterTypeName + ".name"); + mTargets = aMonsterBaseClassArray; + } + + @SideOnly(Side.CLIENT) + @Override + public void getSubItems(Item item, CreativeTabs par2CreativeTabs, List itemList) { + ItemStack itemStack = new ItemStack(this, 1); + ItemStack charged; + if (this.getEmptyItem(itemStack) == this) { + charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, 0.0D, Integer.MAX_VALUE, true, false); + itemList.add(charged); + } + if (this.getChargedItem(itemStack) == this) { + charged = new ItemStack(this, 1); + ElectricItem.manager.charge(charged, Double.POSITIVE_INFINITY, Integer.MAX_VALUE, true, false); + itemList.add(charged); + } + + } + + @Override + public void onUpdate(final ItemStack itemStack, final World worldObj, final Entity player, final int p_77663_4_, + final boolean p_77663_5_) { + super.onUpdate(itemStack, worldObj, player, p_77663_4_, p_77663_5_); + } + + @Override + public boolean canProvideEnergy(final ItemStack itemStack) { + double aItemCharge = ElectricItem.manager.getCharge(itemStack); + return aItemCharge > 0; + } + + @Override + public String getItemStackDisplayName(final ItemStack p_77653_1_) { + return (EnumChatFormatting.WHITE + super.getItemStackDisplayName(p_77653_1_) + EnumChatFormatting.GRAY); + } + + @Override + public boolean showDurabilityBar(final ItemStack stack) { + return true; + } + + @SuppressWarnings("unchecked") + @Override + public void addInformation(final ItemStack stack, final EntityPlayer aPlayer, final List list, final boolean bool) { + list.add(""); + String aString1 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.1"); + String aString2 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.2"); + String aString3 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.3"); + String aString4 = StatCollector.translateToLocal("GTPP.monsterkiller.tooltip.4"); + String aEU = StatCollector.translateToLocal("GTPP.info.eu"); + String aEUT = aEU + "/t"; + + list.add(EnumChatFormatting.GREEN + aString1 + EnumChatFormatting.GRAY); + list.add(EnumChatFormatting.GREEN + aString2 + " " + (int) getTransferLimit(stack) + aEUT + " " + aString3 + + EnumChatFormatting.GRAY); + list.add(""); + list.add("" + EnumChatFormatting.GREEN + aString4 + " " + EnumChatFormatting.GRAY); + for (Class cz : mTargets) { + list.add("- " + EnumChatFormatting.DARK_GREEN + cz.getSimpleName().replace("Entity", "") + EnumChatFormatting.GRAY); + } + + super.addInformation(stack, aPlayer, list, bool); + } + + @Override + public boolean canEquip(final ItemStack arg0, final EntityLivingBase arg1) { + return true; + } + + @Override + public boolean canUnequip(final ItemStack arg0, final EntityLivingBase arg1) { + return true; + } + + @Override + public void onEquipped(final ItemStack arg0, final EntityLivingBase arg1) { + + } + + @Override + public void onUnequipped(final ItemStack arg0, final EntityLivingBase arg1) { + + } + + @Override // TODO + public void onWornTick(final ItemStack aBaubleStack, final EntityLivingBase aPlayerEntity) { + if (aPlayerEntity == null) { + return; + } + EntityPlayer aPlayer = (EntityPlayer) aPlayerEntity; + if (!aPlayer.worldObj.isRemote) { + if (this.getCharge(aBaubleStack) >= getTransferLimit(aBaubleStack)) { + AABB aPlayerBox = new AABB(aPlayerEntity, 5, 5, 5); + if (this.mTargets != null && this.mTargets.length > 0) { + for (Class clazz : mTargets) { + AutoMap<?> aEnts = EntityUtils.getEntitiesWithinBoundingBox(clazz, aPlayerBox); + if (aEnts.isEmpty()) { + continue; + } else { + EntityLiving aClosest = null; + double aEntityDistance = Short.MIN_VALUE; + for (Object ent : aEnts) { + if (!EntityLiving.class.isInstance(ent)) { + continue; + } else { + double aCurEntDis = EntityUtils.getDistance(aPlayerEntity, (Entity) ent); + if (aEntityDistance == Short.MIN_VALUE || aCurEntDis < aEntityDistance) { + aEntityDistance = aCurEntDis; + aClosest = (EntityLiving) ent; + } + } + } + if (aClosest != null) { + float aEntHealth = aClosest.getHealth(); + float aEntMaxHealth = aClosest.getMaxHealth(); + double aEntHealthPerc = MathUtils.findPercentage(aEntHealth, aEntMaxHealth); + long aEuUsage = (long) (aEntHealthPerc * 50 * aEntMaxHealth); + if (this.discharge(aBaubleStack, aEuUsage, mTier, true, false, false) > 0) { + aClosest.setDead(); + PlayerUtils.messagePlayer(aPlayer, "Removed 1x "+aClosest.getCommandSenderName()); + break; + } + } else { + continue; + } + } + } + } + } else { + return; + } + } + } + + @Override + public String getTextureNameForBauble() { + return CORE.MODID + ":" + "baubles/itemAmulet"; + } + +} diff --git a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java index 02afada849..ec1d51b502 100644 --- a/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java +++ b/src/Java/gtPlusPlus/core/item/chemistry/GenericChem.java @@ -2,8 +2,11 @@ package gtPlusPlus.core.item.chemistry; import gregtech.api.enums.TextureSet; import gtPlusPlus.api.objects.minecraft.ItemPackage; +import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.MaterialGenerator; +import gtPlusPlus.core.material.MaterialStack; +import gtPlusPlus.core.material.NONMATERIAL; import gtPlusPlus.core.material.state.MaterialState; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.FluidUtils; @@ -18,9 +21,28 @@ public class GenericChem extends ItemPackage { * Materials */ - public static final Material BAKELITE = new Material("Bakelite", MaterialState.SOLID, TextureSet.SET_DULL, new short[]{90, 140, 140}, 120, 240, 23, 24, true, "", 0);//Not a GT Inherited Material - public static final Material NYLON = new Material("Nylon", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{45, 45, 45}, 300, 600, 44, 48, true, "", 0);//Not a GT Inherited Material - public static final Material TEFLON = new Material("Teflon", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{75, 45, 75}, 300, 600, 44, 48, true, "", 0);//Not a GT Inherited Material + public static final Material BAKELITE = new Material("Bakelite", MaterialState.SOLID, TextureSet.SET_DULL, new short[]{90, 140, 140}, 120, 240, 23, 24, true, null, 0);//Not a GT Inherited Material + public static final Material NYLON = new Material("Nylon", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{45, 45, 45}, 300, 600, 44, 48, true, null, 0);//Not a GT Inherited Material + + //Refined PTFE + public static final Material TEFLON = new Material( + "Teflon", + MaterialState.SOLID, + TextureSet.SET_SHINY, + new short[] { 75, 45, 75 }, + 330, 640, + -1, -1, + false, + null, + 0, + new MaterialStack[] { + new MaterialStack(NONMATERIAL.PTFE, 75), + new MaterialStack(NONMATERIAL.PLASTIC, 15), + new MaterialStack(ELEMENT.getInstance().CARBON, 5), + new MaterialStack(ELEMENT.getInstance().SODIUM, 5) + });// Not a GT + // Inherited + // Material //public static final Material HYPOGEN = new Material("Hypogen", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 120, 75}, 12255, 19377, 240, 251, true, "Hy⚶", 0);//Not a GT Inherited Material //public static final Material HYPOGEN = new Material("Hypogen", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 120, 75}, 12255, 19377, 240, 251, true, "Hy⚶", 0);//Not a GT Inherited Material diff --git a/src/Java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java b/src/Java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java new file mode 100644 index 0000000000..9fd7bf7020 --- /dev/null +++ b/src/Java/gtPlusPlus/core/item/wearable/armour/hazmat/ArmourHazmat.java @@ -0,0 +1,117 @@ +package gtPlusPlus.core.item.wearable.armour.hazmat; + +import java.util.List; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gtPlusPlus.core.item.wearable.armour.ArmourLoader; +import gtPlusPlus.core.item.wearable.armour.base.BaseArmourHelm; +import gtPlusPlus.core.lib.CORE; +import net.minecraft.client.renderer.texture.IIconRegister; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.item.EntityItem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.EnumRarity; +import net.minecraft.item.ItemStack; +import net.minecraft.util.DamageSource; +import net.minecraft.util.IIcon; +import net.minecraft.world.World; + +public class ArmourHazmat extends BaseArmourHelm { + + public IIcon iconHelm; + + public ArmourHazmat() { + super(ArmourLoader.TinFoilArmour, 0); + } + + @SideOnly(Side.CLIENT) + public void registerIcons(IIconRegister ir) { + this.iconHelm = ir.registerIcon(CORE.MODID + ":itemHatTinFoil"); + } + + @Override + public int getRenderIndex() { + return 0; + } + + @SideOnly(Side.CLIENT) + public IIcon getIconFromDamage(int par1) { + return this.iconHelm; + } + + public String getArmorTexture(ItemStack stack, Entity entity, int slot, String type) { + return CORE.MODID + ":textures/models/TinFoil.png"; + } + + public EnumRarity getRarity(ItemStack itemstack) { + return EnumRarity.rare; + } + + public boolean getIsRepairable(ItemStack par1ItemStack, ItemStack par2ItemStack) { + return false; + } + + @Override + public int getArmorDisplay(EntityPlayer player, ItemStack armor, int slot) { + return super.getArmorDisplay(player, armor, slot); + } + + @Override + public void damageArmor(EntityLivingBase entity, ItemStack stack, DamageSource source, int damage, int slot) { + + } + + @SuppressWarnings({ "unchecked" }) + @Override + public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List aList, boolean p_77624_4_) { + aList.add("DoomSquirter's protection against cosmic radiation!"); + aList.add("General paranoia makes the wearer unable to collect xp"); + aList.add("Movement speed is also reduced, to keep you safe"); + aList.add("This hat may also have other strange powers"); + } + + @Override + public ArmorProperties getProperties(EntityLivingBase player, ItemStack armor, DamageSource source, double damage, + int slot) { + return new ArmorProperties(0, 0, 0); + } + + @Override + public boolean isDamageable() { + return false; + } + + @Override + public boolean itemInteractionForEntity(ItemStack p_111207_1_, EntityPlayer p_111207_2_, + EntityLivingBase p_111207_3_) { + return super.itemInteractionForEntity(p_111207_1_, p_111207_2_, p_111207_3_); + } + + @Override + public void onUpdate(ItemStack aStack, World aWorld, Entity aEntity, int p_77663_4_, boolean p_77663_5_) { + super.onUpdate(aStack, aWorld, aEntity, p_77663_4_, p_77663_5_); + } + + @Override + public boolean onEntityItemUpdate(EntityItem entityItem) { + return super.onEntityItemUpdate(entityItem); + } + + @Override + public void onArmorTick(World world, EntityPlayer player, ItemStack itemStack) { + if (itemStack != null && player != null && world != null && !world.isRemote) { + if (player instanceof EntityPlayer) { + + } + } + super.onArmorTick(world, player, itemStack); + } + + @Override + public boolean showDurabilityBar(ItemStack stack) { + return false; + } + +} diff --git a/src/Java/gtPlusPlus/core/material/ALLOY.java b/src/Java/gtPlusPlus/core/material/ALLOY.java index 4edd36c51f..d2639a220f 100644 --- a/src/Java/gtPlusPlus/core/material/ALLOY.java +++ b/src/Java/gtPlusPlus/core/material/ALLOY.java @@ -190,7 +190,7 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().ALUMINIUM, 20), new MaterialStack(NICHROME, 10) }); - + public static final Material NITINOL_60 = new Material( "Nitinol 60", //Material Name MaterialState.SOLID, //State @@ -474,7 +474,7 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().CARBON, 50), new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 50) }); - + public static final Material TUNGSTEN_TITANIUM_CARBIDE = new Material( "Tungsten Titanium Carbide", //Material Name MaterialState.SOLID, //State @@ -549,7 +549,7 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().NIOBIUM, 50), new MaterialStack(ELEMENT.getInstance().CARBON, 50) }); - + public static final Material ARCANITE = new Material( "Arcanite", //Material Name MaterialState.SOLID, //State @@ -680,7 +680,7 @@ public final class ALLOY { new MaterialStack(TRINIUM_NAQUADAH, 9), new MaterialStack(ELEMENT.getInstance().CARBON, 1) }); - + public static final Material TRINIUM_REINFORCED_STEEL = new Material( "Arceus Alloy 2B", //Material Name MaterialState.SOLID, //State @@ -697,8 +697,8 @@ public final class ALLOY { new MaterialStack(ALLOY.TUNGSTENSTEEL, 20), new MaterialStack(ALLOY.OSMIRIDIUM, 10) }); - - + + /* * Witchery Material @@ -719,12 +719,12 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().THAUMIUM, 30), new MaterialStack(ELEMENT.getInstance().IRON, 35) }); - - + + /* * Top Tier Alloys */ - + //0lafe Compound public static final Material LAFIUM = new Material( "Lafium Compound", //Material Name @@ -768,12 +768,12 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().TITANIUM, 12), new MaterialStack(ALLOY.OSMIRIDIUM, 6) }); - + //Piky Alloy public static final Material PIKYONIUM = new Material( "Pikyonium 64B", //Material Name MaterialState.SOLID, //State - new short[]{52, 103, 186, 0}, //Material Colour + new short[]{52, 103, 186, 0}, //Material Colour 7850, //Melting Point in C 11765, //Boiling Point in C -1, @@ -787,10 +787,10 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().CERIUM, 6), new MaterialStack(ELEMENT.getInstance().ANTIMONY, 4), new MaterialStack(ELEMENT.getInstance().PLATINUM, 4), - new MaterialStack(ELEMENT.getInstance().YTTRIUM, 2), + new MaterialStack(ELEMENT.getInstance().YTTERBIUM, 2), new MaterialStack(ALLOY.TUNGSTENSTEEL, 8) }); - + //Piky Alloy public static final Material ABYSSAL = new Material( "Abyssal Alloy", //Material Name @@ -812,7 +812,7 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().RADON, 2), new MaterialStack(ELEMENT.getInstance().GERMANIUM, 2), }); - + //Titansteel public static final Material TITANSTEEL = new Material( "Titansteel", //Material Name @@ -830,8 +830,8 @@ public final class ALLOY { new MaterialStack(ELEMENT.getInstance().TERRA, 1), new MaterialStack(ELEMENT.getInstance().PERDITIO, 1), }); - - + + public static final Material OCTIRON = new Material( "Octiron", //Material Name MaterialState.SOLID, //State @@ -849,7 +849,62 @@ public final class ALLOY { new MaterialStack(STEEL_BLACK, 10), new MaterialStack(ELEMENT.getInstance().THAUMIUM, 25) }); + + + + public static final Material BLACK_TITANIUM = new Material( + "Black Titanium", //Material Name + MaterialState.SOLID, //State + null, //Material Colour + Materials.Titanium.mMeltingPoint*4, //Melting Point in C + Materials.Titanium.mMeltingPoint*16, + -1, + -1, + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().TITANIUM, 55), + new MaterialStack(ELEMENT.getInstance().LANTHANUM, 12), + new MaterialStack(ELEMENT.getInstance().TUNGSTEN, 8), + new MaterialStack(ELEMENT.getInstance().COBALT, 6), + new MaterialStack(ELEMENT.getInstance().MANGANESE, 4), + new MaterialStack(ELEMENT.getInstance().PHOSPHORUS, 4), + new MaterialStack(ELEMENT.getInstance().PALLADIUM, 4), + new MaterialStack(ELEMENT.getInstance().NIOBIUM, 2), + new MaterialStack(ELEMENT.getInstance().ARGON, 5) + }); + public static final Material BABBIT_ALLOY = new Material( + "Babbit Alloy", //Material Name + MaterialState.SOLID, //State + null, //Material Colour + 268, //Melting Point in C + 589, + -1, + -1, + true, //Uses Blast furnace? + //Material Stacks with Percentage of required elements. + new MaterialStack[]{ + new MaterialStack(ELEMENT.getInstance().TIN, 10), + new MaterialStack(ELEMENT.getInstance().LEAD, 72), + new MaterialStack(ELEMENT.getInstance().ANTIMONY, 16), + new MaterialStack(ELEMENT.getInstance().ARSENIC, 2) + }); + + + + + + + + + + + + + + + //Quantum public static final Material QUANTUM = new Material( "Quantum", //Material Name diff --git a/src/Java/gtPlusPlus/core/material/ELEMENT.java b/src/Java/gtPlusPlus/core/material/ELEMENT.java index 62e1163a39..e972992391 100644 --- a/src/Java/gtPlusPlus/core/material/ELEMENT.java +++ b/src/Java/gtPlusPlus/core/material/ELEMENT.java @@ -11,7 +11,7 @@ import gtPlusPlus.core.util.minecraft.MaterialUtils; public final class ELEMENT { - public static final String[] NAMES = new String[]{"Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminum", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Cesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; + public static final String[] NAMES = new String[]{"Hydrogen", "Helium", "Lithium", "Beryllium", "Boron", "Carbon", "Nitrogen", "Oxygen", "Fluorine", "Neon", "Sodium", "Magnesium", "Aluminium", "Silicon", "Phosphorus", "Sulfur", "Chlorine", "Argon", "Potassium", "Calcium", "Scandium", "Titanium", "Vanadium", "Chromium", "Manganese", "Iron", "Cobalt", "Nickel", "Copper", "Zinc", "Gallium", "Germanium", "Arsenic", "Selenium", "Bromine", "Krypton", "Rubidium", "Strontium", "Yttrium", "Zirconium", "Niobium", "Molybdenum", "Technetium", "Ruthenium", "Rhodium", "Palladium", "Silver", "Cadmium", "Indium", "Tin", "Antimony", "Tellurium", "Iodine", "Xenon", "Caesium", "Barium", "Lanthanum", "Cerium", "Praseodymium", "Neodymium", "Promethium", "Samarium", "Europium", "Gadolinium", "Terbium", "Dysprosium", "Holmium", "Erbium", "Thulium", "Ytterbium", "Lutetium", "Hafnium", "Tantalum", "Tungsten", "Rhenium", "Osmium", "Iridium", "Platinum", "Gold", "Mercury", "Thallium", "Lead", "Bismuth", "Polonium", "Astatine", "Radon", "Francium", "Radium", "Actinium", "Thorium", "Protactinium", "Uranium", "Neptunium", "Plutonium", "Americium", "Curium", "Berkelium", "Californium", "Einsteinium", "Fermium", "Mendelevium", "Nobelium", "Lawrencium", "Rutherfordium", "Dubnium", "Seaborgium", "Bohrium", "Hassium", "Meitnerium", "Darmstadtium", "Roentgenium", "Copernicium", "Nihonium", "Flerovium", "Moscovium", "Livermorium", "Tennessine", "Oganesson"}; //First 50 Elements public final Material HYDROGEN = MaterialUtils.generateMaterialFromGtENUM(Materials.Hydrogen); @@ -68,7 +68,7 @@ public final class ELEMENT { public final Material TELLURIUM = new Material("Tellurium", MaterialState.SOLID, new short[]{210, 210, 210}, 449, 989, 52, 76, false, "Te", 0);//Not a GT Inherited Material public final Material IODINE = new Material("Iodine", MaterialState.SOLID, TextureSet.SET_SHINY, new short[]{96, 96, 96}, 114, 184, 53, 74, false, "I", 0);//Not a GT Inherited Material public final Material XENON = new Material("Xenon", MaterialState.GAS, new short[]{255, 255, 255}, -111, -108, 54, 77, false, "Xe", 0);//Not a GT Inherited Material - public final Material CESIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Caesium); + public final Material CAESIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Caesium); public final Material BARIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Barium); public final Material LANTHANUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Lanthanum); public final Material CERIUM = MaterialUtils.generateMaterialFromGtENUM(Materials.Cerium); @@ -212,7 +212,15 @@ public final class ELEMENT { public static final Material ASTRAL_TITANIUM = new Material("Astral Titanium", MaterialState.SOLID, TextureSets.REFINED.get(), new short[] {220, 160, 240, 2}, INSTANCE.TITANIUM.getMeltingPointC()+7500, INSTANCE.TITANIUM.getBoilingPointC()+7500, 145, 133, true, "✧◇✧", 0);//Not a GT Inherited Material public static final Material CHRONOMATIC_GLASS = new Material("Chromatic Glass", MaterialState.SOLID, new short[]{255, 255, 255, 3}, 9200, 17550, 40, 51, false, "⌘☯𓍰 𓍱 𓍲 𓍳 𓍴 𓍵 𓍶 𓍷 𓍸 ☯⌘ ", 0);//Not a GT Inherited Material public static final Material ADVANCED_NITINOL = new Material("Advanced Nitinol", MaterialState.SOLID, TextureSets.ENRICHED.get(), ALLOY.NITINOL_60.getRGB(), 8400, 14377, 40, 51, true, "⚷⚙⚷ Ni4Ti6", 0);//Not a GT Inherited Material - public static final Material HYPOGEN = new Material("Hypogen", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 120, 75}, 12255, 19377, 240, 251, true, "Hy⚶", 0);//Not a GT Inherited Material + public static final Material HYPOGEN = new Material("Hypogen", MaterialState.SOLID, TextureSets.NUCLEAR.get(), new short[]{220, 120, 75, 2}, 12255, 19377, 240, 251, true, "Hy⚶", 0);//Not a GT Inherited Material + + + //Runescape materials + public static final Material BLACK_METAL = new Material("Black Metal", MaterialState.SOLID, TextureSet.SET_METALLIC, new short[] {5, 5, 5}, 2350, 4650, 24, 17, false, "҈", 0, new MaterialStack[]{new MaterialStack(getInstance().LEAD, 15), new MaterialStack(getInstance().TUNGSTEN, 25), new MaterialStack(getInstance().CARBON, 60)});//Not a GT Inherited Material + public static final Material WHITE_METAL = new Material("White Metal", MaterialState.SOLID, TextureSet.SET_METALLIC, new short[] {255, 255, 255}, 4560, 7580, 35, 41, false, "҉", 0, new MaterialStack[]{new MaterialStack(getInstance().COPPER, 5), new MaterialStack(getInstance().ANTIMONY, 10), new MaterialStack(getInstance().PLATINUM, 10), new MaterialStack(getInstance().TIN, 75)});//Not a GT Inherited Material + public static final Material GRANITE = new Material("Ancient Granite", MaterialState.SOLID, TextureSet.SET_SAND, new short[] {107, 107, 107}, 500, 2000, 16, 12, false, "«»", 0, false);//Not a GT Inherited Material + public static final Material RUNITE = new Material("Runite", MaterialState.SOLID, TextureSet.SET_FINE, new short[] {60, 200, 190}, 6750, 11550, 73, 87, true, "§", 0);//Not a GT Inherited Material + public static final Material DRAGON_METAL = new Material("Dragonblood", MaterialState.SOLID, TextureSet.SET_SHINY, new short[] {220, 40, 20, 2}, 10160, 17850, 96, 105, true, "۞", 0);//Not a GT Inherited Material } diff --git a/src/Java/gtPlusPlus/core/material/Material.java b/src/Java/gtPlusPlus/core/material/Material.java index 58a7f68afe..8fb3c5fc3b 100644 --- a/src/Java/gtPlusPlus/core/material/Material.java +++ b/src/Java/gtPlusPlus/core/material/Material.java @@ -141,7 +141,7 @@ public class Material { this (materialName, defaultState, set, durability, rgba, meltingPoint, boilingPoint, protons, neutrons, blastFurnace, chemicalSymbol, radiationLevel, true, true, inputs); } - public Material(final String materialName, final MaterialState defaultState, final TextureSet set, final long durability, short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, final String chemicalSymbol, final int radiationLevel, boolean generateCells, boolean generateFluid, final MaterialStack... inputs){ + public Material(final String materialName, final MaterialState defaultState, final TextureSet set, final long durability, short[] rgba, final int meltingPoint, final int boilingPoint, final long protons, final long neutrons, final boolean blastFurnace, String chemicalSymbol, final int radiationLevel, boolean generateCells, boolean generateFluid, final MaterialStack... inputs){ if (mMaterialMap.add(this)) { @@ -442,6 +442,11 @@ public class Material { //Makes a Fancy Chemical Tooltip + + if (chemicalSymbol == null) { + chemicalSymbol = ""; + } + this.vChemicalSymbol = chemicalSymbol; if (this.vMaterialInput != null){ this.vChemicalFormula = this.getToolTip(chemicalSymbol, OrePrefixes.dust.mMaterialAmount / M, true); diff --git a/src/Java/gtPlusPlus/core/material/NONMATERIAL.java b/src/Java/gtPlusPlus/core/material/NONMATERIAL.java index 4da34ae16c..7ab72d50bc 100644 --- a/src/Java/gtPlusPlus/core/material/NONMATERIAL.java +++ b/src/Java/gtPlusPlus/core/material/NONMATERIAL.java @@ -27,7 +27,11 @@ public class NONMATERIAL { //Wrought Iron public static final Material WROUGHT_IRON = MaterialUtils.generateMaterialFromGtENUM(Materials.WroughtIron); - + //PTFE + public static final Material PTFE = MaterialUtils.generateMaterialFromGtENUM(MaterialUtils.getMaterial("Polytetrafluoroethylene", "Plastic")); + + //Plastic + public static final Material PLASTIC = MaterialUtils.generateMaterialFromGtENUM(MaterialUtils.getMaterial("Plastic", "Rubber")); static { diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java index a4dc366aee..68f7bdd762 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_GREGTECH.java @@ -2127,6 +2127,21 @@ public class RECIPES_GREGTECH { private static void sifterRecipes() { + // Rare Earth Processing + GT_Values.RA.addSifterRecipe(ItemUtils.getItemStackOfAmountFromOreDict("dustRareEarth", 1), + new ItemStack[] { + ELEMENT.getInstance().YTTRIUM.getSmallDust(1), + ELEMENT.getInstance().NEODYMIUM.getSmallDust(1), + ELEMENT.getInstance().LANTHANUM.getSmallDust(1), + ELEMENT.getInstance().CERIUM.getSmallDust(1), + ELEMENT.getInstance().CADMIUM.getSmallDust(1), + ELEMENT.getInstance().CAESIUM.getSmallDust(1), + ELEMENT.getInstance().YTTERBIUM.getTinyDust(1), + ELEMENT.getInstance().SAMARIUM.getTinyDust(1), + ELEMENT.getInstance().GADOLINIUM.getTinyDust(1) + }, + new int[] { 2000, 2000, 2000, 2000, 2000, 2000, 1000, 1000, 1000 }, 20 * 30, 500); + // Zirconium GT_Values.RA.addSifterRecipe(ItemUtils.getItemStackOfAmountFromOreDict("crushedPurifiedIlmenite", 1), new ItemStack[] { ItemUtils.getItemStackOfAmountFromOreDict("dustIron", 1), diff --git a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java index 54d9994edc..c26b01d0f7 100644 --- a/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java +++ b/src/Java/gtPlusPlus/core/recipe/RECIPES_Machines.java @@ -702,26 +702,26 @@ public class RECIPES_Machines { RECIPE_IndustrialMultiTankController); } - ItemStack mSemiFluidgen = ItemUtils.simpleMetaStack("IC2:blockGenerator:7", 7, 1); //Semi-Fluid Generators - GT_ModHandler.addCraftingRecipe(GregtechItemList.Generator_SemiFluid_LV.get(1L, new Object[0]), CI.bitsd, - new Object[] { "PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_LV, Character.valueOf('P'), - ItemList.Electric_Piston_LV, Character.valueOf('E'), ItemList.Electric_Motor_LV, - Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Basic), Character.valueOf('W'), - mSemiFluidgen, Character.valueOf('G'), - OrePrefixes.gearGt.get(Materials.Steel) }); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Generator_SemiFluid_MV.get(1L, new Object[0]), CI.bitsd, - new Object[] { "PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_MV, Character.valueOf('P'), - ItemList.Electric_Piston_MV, Character.valueOf('E'), ItemList.Electric_Motor_MV, - Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Good), Character.valueOf('W'), - mSemiFluidgen, Character.valueOf('G'), - OrePrefixes.gearGt.get(Materials.Aluminium) }); - GT_ModHandler.addCraftingRecipe(GregtechItemList.Generator_SemiFluid_HV.get(1L, new Object[0]), CI.bitsd, - new Object[] { "PCP", "EME", "GWG", Character.valueOf('M'), ItemList.Hull_HV, Character.valueOf('P'), - ItemList.Electric_Piston_HV, Character.valueOf('E'), ItemList.Electric_Motor_HV, - Character.valueOf('C'), OrePrefixes.circuit.get(Materials.Advanced), Character.valueOf('W'), - mSemiFluidgen, Character.valueOf('G'), - OrePrefixes.gearGt.get(Materials.StainlessSteel) }); + ItemStack mSemiFluidgen = ItemUtils.getItemStackFromFQRN("IC2:blockGenerator:7", 1); + mSemiFluidgen.setItemDamage(7); + //ItemUtils.simpleMetaStack("IC2:blockGenerator:7", 7, 1); + ItemStack[] aSemifluids = new ItemStack[] {mSemiFluidgen, GregtechItemList.Generator_SemiFluid_LV.get(1), GregtechItemList.Generator_SemiFluid_MV.get(1), GregtechItemList.Generator_SemiFluid_HV.get(1)}; + for (int o=1;o<4;o++) { + CORE.RA.addSixSlotAssemblingRecipe( + new ItemStack[] { + aSemifluids[o-1], + CI.getElectricPiston(o, GTNH ? 4 : 2), + CI.getElectricMotor(o, GTNH ? 2 : 1), + CI.getTieredComponent(OrePrefixes.circuit, o, GTNH ? 4 : 2), + CI.getPlate(o, GTNH ? 8 : 4), + CI.getGear(o-1, GTNH ? 4 : 2) + }, + CI.getAlternativeTieredFluid(o, 144 * 4), + aSemifluids[o], + 20 * 30, + (int) GT_Values.V[o]); + } if (CORE.ConfigSwitches.enableMultiblock_AlloyBlastSmelter){ //Industrial Blast Smelter @@ -849,15 +849,15 @@ public class RECIPES_Machines { if (CORE.ConfigSwitches.enableMachine_SimpleWasher){ ItemStack plateWrought = ItemUtils.getItemStackOfAmountFromOreDict("plateWroughtIron", 1); ItemStack washerPipe; + + if (CORE.ConfigSwitches.enableCustom_Pipes){ washerPipe = ItemUtils.getItemStackOfAmountFromOreDict("pipeLargeClay", 1); RecipeUtils.addShapedGregtechRecipe( plateWrought, CI.electricPump_LV, plateWrought, plateWrought, washerPipe, plateWrought, plateWrought, CI.machineCasing_ULV, plateWrought, - GregtechItemList.SimpleDustWasher.get(1)); - } - else { + GregtechItemList.SimpleDustWasher_ULV.get(1)); } //Add Recipe washerPipe = ItemUtils.getItemStackOfAmountFromOreDict("pipeLargeCopper", 1); @@ -865,7 +865,69 @@ public class RECIPES_Machines { plateWrought, CI.electricPump_LV, plateWrought, plateWrought, washerPipe, plateWrought, plateWrought, CI.machineCasing_ULV, plateWrought, - GregtechItemList.SimpleDustWasher.get(1)); + GregtechItemList.SimpleDustWasher_ULV.get(1)); + + int aSimpleWasherTier = 2; + int aSlot = 0; + ItemStack[][] aInputsForSimpleWashers = new ItemStack[4][6]; + + aInputsForSimpleWashers[0] = new ItemStack[] { + CI.getTieredMachineHull(2), + CI.getTieredComponent(OrePrefixes.screw, 2, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.plate, 1, GTNH ? 8 : 4), + CI.getTieredComponent(OrePrefixes.rod, 2, GTNH ? 4 : 2), + CI.getTieredComponent(OrePrefixes.circuit, 2, GTNH ? 3 : 1), + + }; + aInputsForSimpleWashers[1] = new ItemStack[] { + CI.getTieredMachineHull(4), + CI.getTieredComponent(OrePrefixes.screw, 4, GTNH ? 24 : 12), + CI.getTieredComponent(OrePrefixes.plate, 3, GTNH ? 12 : 6), + CI.getTieredComponent(OrePrefixes.rod, 4, GTNH ? 6 : 3), + CI.getTieredComponent(OrePrefixes.circuit, 4, GTNH ? 4 : 2), + + }; + aInputsForSimpleWashers[2] = new ItemStack[] { + CI.getTieredMachineHull(6), + CI.getTieredComponent(OrePrefixes.screw, 6, GTNH ? 48 : 24), + CI.getTieredComponent(OrePrefixes.plate, 5, GTNH ? 16 : 8), + CI.getTieredComponent(OrePrefixes.rod, 6, GTNH ? 8 : 4), + CI.getTieredComponent(OrePrefixes.circuit, 6, GTNH ? 6 : 3), + + }; + aInputsForSimpleWashers[3] = new ItemStack[] { + CI.getTieredMachineHull(8), + CI.getTieredComponent(OrePrefixes.screw, 8, GTNH ? 64 : 32), + CI.getTieredComponent(OrePrefixes.plate, 7, GTNH ? 32 : 16), + CI.getTieredComponent(OrePrefixes.rod, 8, GTNH ? 10 : 5), + CI.getTieredComponent(OrePrefixes.circuit, 8, GTNH ? 8 : 4), + + }; + + + + + + + ItemStack[] aSimpleWashers = new ItemStack[] {GregtechItemList.SimpleDustWasher_MV.get(1), GregtechItemList.SimpleDustWasher_EV.get(1), GregtechItemList.SimpleDustWasher_LuV.get(1), GregtechItemList.SimpleDustWasher_UV.get(1)}; + for (int i=0;i<4;i++) { + + CORE.RA.addSixSlotAssemblingRecipe( + aInputsForSimpleWashers[aSlot], + CI.getTieredFluid(aSimpleWasherTier, 144 * aSimpleWasherTier), + aSimpleWashers[aSlot], + 20 * 15 * aSimpleWasherTier, + (int) GT_Values.V[aSimpleWasherTier]); + + aSimpleWasherTier += 2; + aSlot++; + } + + + + + + } if (CORE.ConfigSwitches.enableMachine_Pollution && CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK){ diff --git a/src/Java/gtPlusPlus/core/recipe/common/CI.java b/src/Java/gtPlusPlus/core/recipe/common/CI.java index ba592bcb65..ca334fe0d3 100644 --- a/src/Java/gtPlusPlus/core/recipe/common/CI.java +++ b/src/Java/gtPlusPlus/core/recipe/common/CI.java @@ -369,6 +369,7 @@ public class CI { return Materials._NULL; } + @Deprecated public static String getTieredComponent(OrePrefixes type, int tier){ Object material = getMaterialFromTier(tier); if (material != null){ @@ -769,6 +770,10 @@ public class CI { ItemStack aTempStack = null; + if (aPrefix == OrePrefixes.rod) { + aPrefix = OrePrefixes.stick; + } + if (aPrefix == OrePrefixes.gear || aPrefix == OrePrefixes.gearGt) { m = aMaster[0][aTier]; } diff --git a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java index bb7004350d..c3670ef959 100644 --- a/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java +++ b/src/Java/gtPlusPlus/core/tileentities/ModTileEntities.java @@ -7,6 +7,7 @@ import gtPlusPlus.core.block.general.BlockSuperLight.TileEntitySuperLight; import gtPlusPlus.core.block.machine.Machine_SuperJukebox.TileEntitySuperJukebox; import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.tileentities.general.*; +import gtPlusPlus.core.tileentities.general.redstone.TileEntityRedstoneHandler; import gtPlusPlus.core.tileentities.machines.*; import gtPlusPlus.plugin.villagers.tile.TileEntityGenericSpawner; diff --git a/src/Java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java b/src/Java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java new file mode 100644 index 0000000000..eda0c65e46 --- /dev/null +++ b/src/Java/gtPlusPlus/core/tileentities/general/redstone/TileEntityRedstoneHandler.java @@ -0,0 +1,468 @@ +package gtPlusPlus.core.tileentities.general.redstone; + +import cpw.mods.fml.common.registry.GameRegistry; +import gtPlusPlus.api.interfaces.IToolable; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.minecraft.BlockPos; +import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.EntityUtils; +import net.minecraft.block.Block; +import net.minecraft.init.Blocks; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.EnumSkyBlock; +import net.minecraft.world.IBlockAccess; + +public abstract class TileEntityRedstoneHandler extends TileEntity implements IToolable { + + private final int mTileType; + private BlockPos mTilePos; + private boolean mRequiresUpdate = false; + private Long mStartTime; + private Byte mRedstoneLevel; + + public boolean mLightMode = false; + public float mLightValue = 0; + + /** + * Sets the Redstone Handler Type. + * @param aTileType - A type of the handler designated by an int. 0 = receiver, 1 = emitter, 2 = both, anything else = nothing. + */ + public TileEntityRedstoneHandler(int aTileType) { + mTileType = aTileType; + registerTileEntity(); + } + + private void registerTileEntity() { + if (!EntityUtils.isTileEntityRegistered(getTileEntityClass(), getTileEntityNameForRegistration())) { + GameRegistry.registerTileEntity(getTileEntityClass(), getTileEntityNameForRegistration()); + } + } + + protected abstract Class<? extends TileEntity> getTileEntityClass(); + + protected abstract String getTileEntityNameForRegistration(); + + public Block getBlock() { + return mTilePos != null ? mTilePos.getBlockAtPos() : Blocks.redstone_block; + } + + public final boolean isLight() { + return mLightMode; + } + + public final float getLightBrightness() { + if (!isLight()) { + return 0; + } + else { + return mLightValue; + } + } + + @Override + public void readFromNBT(NBTTagCompound aNBT) { + mStartTime = aNBT.getLong("mStartTime"); + mInvName = aNBT.getString("mInvName"); + mLightValue = aNBT.getFloat("mLightValue"); + mLightMode = aNBT.getBoolean("mLightMode"); + mRedstoneLevel = aNBT.getByte("mRedstoneLevel"); + super.readFromNBT(aNBT); + } + + @Override + public void writeToNBT(NBTTagCompound aNBT) { + aNBT.setInteger("mTileType", mTileType); + aNBT.setLong("mStartTime", mStartTime); + aNBT.setString("mInvName", mInvName); + aNBT.setFloat("mLightValue", getLightBrightness()); + aNBT.setBoolean("mLightMode", isLight()); + aNBT.setByte("mRedstoneLevel", mRedstoneLevel); + super.writeToNBT(aNBT); + } + + + private boolean mHasUpdatedRecently = false; + + private final boolean init() { + if (mTilePos == null) { + try { + mTilePos = new BlockPos(this); + } catch (Throwable t) { + return false; + } + } + if (mStartTime == null) { + try { + mStartTime = System.currentTimeMillis(); + } catch (Throwable t) { + return false; + } + } + return true; + } + private Long mLastUpdate; + private String mInvName = ""; + + @Override + public void updateEntity() { + //Handle init + if (!init()) { + return; + } + if (mRequiresUpdate || mLastUpdate == null) { + mRequiresUpdate = false; + mHasUpdatedRecently = true; + mLastUpdate = System.currentTimeMillis(); + if (mTilePos.world.getBlockLightValue(xCoord, yCoord, zCoord) != getLightBrightness()/0.0625f) { + mTilePos.getBlockAtPos().setLightLevel(getLightBrightness()/0.0625f); + mTilePos.world.setLightValue(EnumSkyBlock.Block, xCoord, yCoord, zCoord, (int) (getLightBrightness()/0.0625f)); + mTilePos.world.updateLightByType(EnumSkyBlock.Block, xCoord, yCoord, zCoord); + Logger.INFO("Updating Light"); + } + mTilePos.world.scheduleBlockUpdate(xCoord, yCoord, zCoord, mTilePos.getBlockAtPos(), 1); + markDirty(); + } + if (Utils.getMillisSince(mLastUpdate, System.currentTimeMillis()) >= 5000) { + if (mHasUpdatedRecently) { + mHasUpdatedRecently = false; + this.markForUpdate(); + } + } + + if (Utils.getMillisSince(mStartTime, System.currentTimeMillis()) % 50 == 0) { + + } + + + + super.updateEntity(); + } + + public final void markForUpdate() { + mRequiresUpdate = true; + } + + public final boolean hasUpdatedRecently() { + return mHasUpdatedRecently; + } + + @Override + public int getBlockMetadata() { + return super.getBlockMetadata(); + } + + @Override + public void markDirty() { + super.markDirty(); + } + + @Override + public boolean canUpdate() { + return true; + } + + public void setRedstoneState(boolean aRedstoneActive) { + + } + + public void setCurrentTextureArray(IIcon[] aTextures) { + + } + + /** + * Used to see if one of the blocks next to you or your block is getting power from a neighboring block. Used by + * items like TNT or Doors so they don't have redstone going straight into them. Args: x, y, z + */ + public boolean isGettingIndirectlyPowered() { + if (mTilePos == null) { + return false; + } + return mTilePos.world.isBlockIndirectlyGettingPowered(xCoord, yCoord, zCoord); + } + + public int getStrongestIndirectPower() { + if (mTilePos == null) { + return 0; + } + return mTilePos.world.getStrongestIndirectPower(xCoord, yCoord, zCoord); + } + + /** + * Gets the power level from a certain block face. Args: x, y, z, direction + */ + public int getIndirectPowerForSide(int aSide) { + if (mTilePos == null || aSide <0 || aSide > 5) { + return 0; + } + return mTilePos.world.getIndirectPowerLevelTo(xCoord, yCoord, zCoord, aSide); + } + + /** + * Returns the highest redstone signal strength powering the given block. Args: X, Y, Z. + */ + public int getBlockPowerInput() { + if (mTilePos == null) { + return 0; + } + return mTilePos.world.getBlockPowerInput(xCoord, yCoord, zCoord); + } + + /** + * Determine if this block can make a redstone connection on the side provided, + * Useful to control which sides are inputs and outputs for redstone wires. + * + * Side: + * -1: UP + * 0: NORTH + * 1: EAST + * 2: SOUTH + * 3: WEST + * + * @param world The current world + * @param x X Position + * @param y Y Position + * @param z Z Position + * @param side The side that is trying to make the connection + * @return True to make the connection + */ + public boolean canConnectRedstone(IBlockAccess world, int x, int y, int z, int side) { + if (mTilePos == null) { + return false; + } + return canAcceptRedstoneSignal() || canSupplyRedstoneSignal(); + } + + /** + * Called to determine whether to allow the a block to handle its own indirect power rather than using the default rules. + * @param world The world + * @param x The x position of this block instance + * @param y The y position of this block instance + * @param z The z position of this block instance + * @param side The INPUT side of the block to be powered - ie the opposite of this block's output side + * @return Whether Block#isProvidingWeakPower should be called when determining indirect power + */ + public boolean shouldCheckWeakPower(IBlockAccess world, int x, int y, int z, int side) { + if (mTilePos == null) { + return false; + } + return getBlock().isNormalCube(); + } + + /** + * If this block should be notified of weak changes. + * Weak changes are changes 1 block away through a solid block. + * Similar to comparators. + * + * @param world The current world + * @param x X Position + * @param y Y position + * @param z Z position + * @param side The side to check + * @return true To be notified of changes + */ + public boolean getWeakChanges(IBlockAccess world, int x, int y, int z) { + if (mTilePos == null) { + return false; + } + return false; + } + + + /** + * Override this to change the level of redstone output. + * @return + */ + public int getRedstoneLevel() { + if (mTilePos == null || mRedstoneLevel == null) { + return 0; + } + else { + if (canSupplyRedstoneSignal()) { + if (this.hasUpdatedRecently()) { + int aInputPower = getInputPowerLevel(); + mRedstoneLevel = (byte) ((aInputPower >= 0 && aInputPower <= 127) ? aInputPower : 0); + } + return mRedstoneLevel; + } + } + return 0; + } + + + public boolean providesWeakPower() { + return isProvidingPower(); + } + + public boolean providesStrongPower() { + return isProvidingPower(); + } + + + /** + * Returns the amount of week power this block is providing to a side. + * @param world + * @param x + * @param y + * @param z + * @param side + * @return + */ + public int isProvidingWeakPower(IBlockAccess world, int x, int y, int z, int side) { + if (!providesWeakPower()) { + return 0; + } + return getOutputPowerLevel(); + } + /** + * Returns the amount of strong power this block is providing to a side. + * @param world + * @param x + * @param y + * @param z + * @param side + * @return + */ + public int isProvidingStrongPower(IBlockAccess world, int x, int y, int z, int side) { + if (!providesStrongPower()) { + return 0; + } + return getOutputPowerLevel(); + } + + + + + + + + /* + * Alk's Simplified Redstone Handling functions (Fuck redstone) + */ + + /** + * + * @return - Does this Block supply redstone signal at all? + */ + public final boolean isPowered() { + return canAcceptRedstoneSignal() && getInputPowerLevel() > 0; + } + + /** + * + * @return - Can this Block provide redstone signal at all? + */ + public final boolean isProvidingPower() { + return canSupplyRedstoneSignal() && getOutputPowerLevel() > 0; + } + + /** + * + * @return - (0-15) Redstone Output signal level + */ + public final int getOutputPowerLevel() { + return getRedstoneLevel(); + } + + /** + * + * @return (0-15) Redstone Input Signal level + */ + public final int getInputPowerLevel() { + return getBlockPowerInput(); + } + + /** + * + * @return - Does this Tile Entity support outputting redstone? + */ + public final boolean canSupplyRedstoneSignal() { + return mTileType == 1 || mTileType == 2; + } + + /** + * + * @return - Does this Tile Entity support inputting redstone? + */ + public final boolean canAcceptRedstoneSignal() { + return mTileType == 0 || mTileType == 2; + } + + + @Override + public boolean isScrewdriverable() { + return false; + } + + + @Override + public boolean onScrewdriverLMB() { + return false; + } + + + @Override + public boolean onScrewdriverRMB() { + return false; + } + + + @Override + public boolean isWrenchable() { + return false; + } + + + @Override + public boolean onWrenchLMB() { + return false; + } + + + @Override + public boolean onWrenchRMB() { + return false; + } + + + @Override + public boolean isMalletable() { + return false; + } + + + @Override + public boolean onMalletLMB() { + return false; + } + + + @Override + public boolean onMalletRMB() { + return false; + } + + + public void setCustomName(String displayName) { + this.mInvName = displayName; + } + + public String getCustomName() { + return this.mInvName; + } + + public String getInventoryName() { + return this.hasCustomInventoryName() ? this.mInvName : "container.redstone.generic"; + } + + public boolean hasCustomInventoryName() { + return (this.mInvName != null) && !this.mInvName.equals(""); + } + + + + + + +} diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java index 18954f12b6..6bb4c932dc 100644 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityAdvPooCollector.java @@ -1,6 +1,5 @@ package gtPlusPlus.core.tileentities.machines; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.core.item.chemistry.AgriculturalChem; import gtPlusPlus.core.util.math.MathUtils; @@ -15,7 +14,6 @@ import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.passive.IAnimals; import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; @@ -132,17 +130,17 @@ public class TileEntityAdvPooCollector extends TileEntityBaseFluidCollector { } @Override - public Item itemToSpawnInWorldIfTankIsFull() { + public ItemStack itemToSpawnInWorldIfTankIsFull() { int a = MathUtils.randInt(0, 75); - Item aItem = null; + ItemStack aItem = null; if (a <= 30) { - aItem = AgriculturalChem.dustDirt; + aItem = ItemUtils.getSimpleStack(AgriculturalChem.dustDirt); } else if (a <= 40) { - aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustManureByproducts", 1).getItem(); + aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustManureByproducts", 1); } else if (a <= 55) { - aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallManureByproducts", 1).getItem(); + aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallManureByproducts", 1); } return aItem; } diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java index 78b8f74799..cdae4cf829 100644 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityBaseFluidCollector.java @@ -2,7 +2,6 @@ package gtPlusPlus.core.tileentities.machines; import java.util.List; -import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; import gtPlusPlus.api.objects.minecraft.BTF_FluidTank; import gtPlusPlus.api.objects.minecraft.BlockPos; @@ -11,7 +10,6 @@ import gtPlusPlus.core.util.math.MathUtils; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.ItemUtils; import net.minecraft.entity.item.EntityItem; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; import net.minecraft.network.NetworkManager; @@ -208,9 +206,11 @@ public abstract class TileEntityBaseFluidCollector extends TileEntityBase implem this.tank.fill(FluidUtils.getFluidStack(fluidToProvide(), aFluidAmount), true); } else { - ItemStack aDirtStack = ItemUtils.getSimpleStack(itemToSpawnInWorldIfTankIsFull()); - if (aDirtStack != null) - if (!this.mInventory.addItemStack(aDirtStack)) { + ItemStack aDirtStack = ItemUtils.getSimpleStack(itemToSpawnInWorldIfTankIsFull(), 1); + if (!ItemUtils.checkForInvalidItems(aDirtStack)) { + return; + } + if (!this.mInventory.addItemStack(aDirtStack)) { EntityItem entity = new EntityItem(worldObj, xCoord, yCoord+1.5, zCoord, aDirtStack); worldObj.spawnEntityInWorld(entity); } @@ -230,7 +230,7 @@ public abstract class TileEntityBaseFluidCollector extends TileEntityBase implem public abstract Fluid fluidToProvide(); - public abstract Item itemToSpawnInWorldIfTankIsFull(); + public abstract ItemStack itemToSpawnInWorldIfTankIsFull(); diff --git a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java index f6570c6cc6..25348a31f8 100644 --- a/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java +++ b/src/Java/gtPlusPlus/core/tileentities/machines/TileEntityPooCollector.java @@ -12,7 +12,6 @@ import net.minecraft.entity.passive.EntityHorse; import net.minecraft.entity.passive.EntityMooshroom; import net.minecraft.entity.passive.EntitySheep; import net.minecraft.entity.passive.IAnimals; -import net.minecraft.item.Item; import net.minecraft.item.ItemStack; import net.minecraftforge.common.util.ForgeDirection; import net.minecraftforge.fluids.Fluid; @@ -53,7 +52,11 @@ public class TileEntityPooCollector extends TileEntityBaseFluidCollector { } else { return false; + } + if (!ItemUtils.checkForInvalidItems(aPoop)) { + return false; } + //Add poop to world //Logger.INFO("Adding animal waste for "+aPooMaker.getCommandSenderName()); @@ -123,17 +126,17 @@ public class TileEntityPooCollector extends TileEntityBaseFluidCollector { } @Override - public Item itemToSpawnInWorldIfTankIsFull() { + public ItemStack itemToSpawnInWorldIfTankIsFull() { int a = MathUtils.randInt(0, 100); - Item aItem = null; + ItemStack aItem = null; if (a <= 30) { - aItem = AgriculturalChem.dustDirt; + aItem = ItemUtils.getSimpleStack(AgriculturalChem.dustDirt); } else if (a <= 40) { - aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallManureByproducts", 1).getItem(); + aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustSmallManureByproducts", 1); } else if (a <= 55) { - aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyManureByproducts", 1).getItem(); + aItem = ItemUtils.getItemStackOfAmountFromOreDict("dustTinyManureByproducts", 1); } return aItem; } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java index 839cb164cb..8c5a9f6581 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/EntityUtils.java @@ -1,24 +1,30 @@ package gtPlusPlus.core.util.minecraft; +import java.lang.reflect.Field; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Method; +import java.util.List; +import java.util.Map; import cpw.mods.fml.common.registry.EntityRegistry; - +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.api.objects.minecraft.AABB; +import gtPlusPlus.api.objects.minecraft.BlockPos; +import gtPlusPlus.core.util.reflect.ReflectionUtils; +import ic2.core.IC2Potion; +import ic2.core.item.armor.ItemArmorHazmat; import net.minecraft.block.Block; -import net.minecraft.entity.*; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLiving; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.EnumCreatureType; import net.minecraft.entity.player.EntityPlayer; import net.minecraft.util.DamageSource; import net.minecraft.util.MathHelper; import net.minecraft.world.World; import net.minecraft.world.biome.BiomeGenBase; -import gregtech.api.util.GT_Utility; - -import gtPlusPlus.api.objects.minecraft.BlockPos; -import ic2.core.IC2Potion; -import ic2.core.item.armor.ItemArmorHazmat; - public class EntityUtils { public static void setEntityOnFire(final Entity entity, final int length){ @@ -125,5 +131,60 @@ public class EntityUtils { public static void doDamage(Entity entity, DamageSource dmg, int i) { entity.attackEntityFrom(dmg, i); } + + public static boolean isTileEntityRegistered(Class aTileClass, String aTileName) { + Field aRegistry = ReflectionUtils.getField(ReflectionUtils.getClass("net.minecraft.tileentity.TileEntity"), "nameToClassMap"); + Field aRegistry2 = ReflectionUtils.getField(ReflectionUtils.getClass("net.minecraft.tileentity.TileEntity"), "classToNameMap"); + try { + Object o = aRegistry.get(null); + if (o != null) { + Map nameToClassMap = (Map) o; + if (!nameToClassMap.containsKey(aTileName)) { + o = aRegistry2.get(null); + if (o != null) { + Map classToNameMap = (Map) o; + if (!classToNameMap.containsKey(aTileClass)) { + return false; + } + else { + return true; + } + } + } + else { + return true; + } + } + } catch (IllegalArgumentException | IllegalAccessException e) { + e.printStackTrace(); + } + return false; + } + + public static double getDistance(Entity p1, Entity p2) { + return Math.sqrt( Math.pow(p1.posX - p2.posX, 2) + Math.pow(p1.posY - p2.posY, 2) + Math.pow(p1.posZ - p2.posZ, 2)); + } + + public static AutoMap<Entity> getEntitiesWithinBoundingBoxExcluding(Entity aExclusion, AABB aBoundingBox){ + + if (aExclusion == null) { + return new AutoMap<Entity>(); + } + else { + List<Entity> aEntities = aBoundingBox.world().getEntitiesWithinAABBExcludingEntity(aExclusion, aBoundingBox.get()); + return new AutoMap<Entity>(aEntities); + } + } + + public static AutoMap<Entity> getEntitiesWithinBoundingBox(Class aEntityType, AABB aBoundingBox){ + + if (aEntityType == null) { + return new AutoMap<Entity>(); + } + else { + List<Entity> aEntities = aBoundingBox.world().getEntitiesWithinAABB(aEntityType, aBoundingBox.get()); + return new AutoMap<Entity>(aEntities); + } + } } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java new file mode 100644 index 0000000000..c529f60ba1 --- /dev/null +++ b/src/Java/gtPlusPlus/core/util/minecraft/HazmatUtils.java @@ -0,0 +1,349 @@ +package gtPlusPlus.core.util.minecraft; + +import static gregtech.api.GregTech_API.sBioHazmatList; +import static gregtech.api.GregTech_API.sElectroHazmatList; +import static gregtech.api.GregTech_API.sFrostHazmatList; +import static gregtech.api.GregTech_API.sGasHazmatList; +import static gregtech.api.GregTech_API.sHeatHazmatList; +import static gregtech.api.GregTech_API.sRadioHazmatList; + +import java.util.Collections; +import java.util.HashMap; + +import cpw.mods.fml.common.eventhandler.SubscribeEvent; +import gregtech.api.objects.GT_HashSet; +import gregtech.api.objects.GT_ItemStack; +import gregtech.api.util.GT_ModHandler; +import gtPlusPlus.GTplusplus; +import gtPlusPlus.GTplusplus.INIT_PHASE; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.api.objects.data.AutoMap; +import gtPlusPlus.core.util.Utils; +import ic2.core.item.armor.ItemArmorHazmat; +import ic2.core.item.armor.ItemArmorNanoSuit; +import ic2.core.item.armor.ItemArmorQuantumSuit; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.item.ItemStack; +import net.minecraft.util.EnumChatFormatting; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; + +public class HazmatUtils { + + public static final GT_HashSet<GT_ItemStack> sHazmatList = new GT_HashSet<GT_ItemStack>(); + + private static final HashMap<String, AutoMap<String>> mToolTips = new HashMap<String, AutoMap<String>>(); + + private static boolean mInit = false; + private static HazmatUtils mInstance; + + public static void init() { + if (mInit) { + return; + } + + mInstance = new HazmatUtils(); + + sHazmatList.add(GT_ModHandler.getIC2Item("hazmatHelmet", 1L, 32767)); + sHazmatList.add(GT_ModHandler.getIC2Item("hazmatChestplate", 1L, 32767)); + sHazmatList.add(GT_ModHandler.getIC2Item("hazmatLeggings", 1L, 32767)); + sHazmatList.add(GT_ModHandler.getIC2Item("hazmatBoots", 1L, 32767)); + + // Make Nano a hazmat suit + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoHelmet:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoChestplate:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoLegs:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorNanoBoots:27", 1)); + + Logger.INFO("[Hazmat] Registered Nano as hazmat gear."); + + // Make Quantum a hazmat suit + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumHelmet:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumChestplate:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumLegs:27", 1)); + addProtection(ItemUtils.getItemStackFromFQRN("IC2:itemArmorQuantumBoots:27", 1)); + Logger.INFO("[Hazmat] Registered Quantum as hazmat gear."); + + Utils.registerEvent(mInstance); + Logger.INFO("[Hazmat] Registered Tooltip handler for hazmat gear."); + mInit = true; + + } + + private final static String mToolTipText = "Provides protection from:"; + + @SubscribeEvent + public void onItemTooltip(ItemTooltipEvent event) { + //Logger.INFO("Ticking Hazmat handler"); + if (GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.STARTED + && GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.SERVER_START) { + //Logger.INFO("[Hazmat] Bad Phase : " + GTplusplus.CURRENT_LOAD_PHASE); + return; + } + if (event.itemStack == null || isVanillaHazmatPiece(event.itemStack)) { + //Logger.INFO("[Hazmat] Invalid Itemstack or vanilla hazmat"); + return; + } else { + ItemStack aStackTemp = event.itemStack; + GT_ItemStack aStack = new GT_ItemStack(aStackTemp); + if (isNanoArmourPiece(aStackTemp) || isQuantumArmourPiece(aStackTemp)) { + event.toolTip.add(EnumChatFormatting.DARK_PURPLE+"Provides full hazmat protection."); + } + else { + //Logger.INFO("[Hazmat] Finding Tooltip Data"); + String[] aTooltips = getTooltips(aStack); + if (aTooltips == null || aTooltips.length == 0) { + //Logger.INFO("[Hazmat] No Info!"); + return; + } else { + //Logger.INFO("[Hazmat] Found Tooltips!"); + if (providesProtection(aStackTemp)) { + event.toolTip.add(EnumChatFormatting.LIGHT_PURPLE+"Provides full hazmat protection."); + } else { + event.toolTip.add(mToolTipText); + for (String r : aTooltips) { + event.toolTip.add(" - " + r); + } + } + } + } + } + } + + /** + * Static function to replace + * {@link #ic2.core.item.armor.ItemArmorHazmat.hasCompleteHazmat(EntityLivingBase)}. + * Because IC2 doesn't let us register things ourself, anything registered via + * GT/GT++ will return true. + * + * @param living - Entity Wearing Armour + * @return - Does {@link EntityLivingBase} have a full hazmat suit on? + */ + public static boolean hasCompleteHazmat(EntityLivingBase living) { + // Entity is Null, cannot have Hazmat. + if (living == null || living.isDead) { + return false; + } else { + + // Map All Player Armour slots + AutoMap<ItemStack> aEquipment = new AutoMap<ItemStack>(); + for (int i = 1; i < 5; ++i) { + ItemStack stack = living.getEquipmentInSlot(i); + + // Item is Null, cannot have full suit + if (stack == null) { + return false; + } else { + aEquipment.put(stack); + } + } + + // Compare Equipment to all items mapped for full hazmat. + for (ItemStack aSlotStack : aEquipment) { + if (!isHazmatPiece(aSlotStack)) { + return false; + } + } + + // We are in some kind of full hazmat, huzzah! + return true; + } + } + + /** + * Is this item vanilla IC2 hazmat? + * + * @param aArmour - The Armour to provide protection. + * @return + */ + public static boolean isVanillaHazmatPiece(ItemStack aArmour) { + return aArmour != null ? aArmour.getItem() instanceof ItemArmorHazmat : false; + } + + /** + * Is this item vanilla IC2 Nanosuit? + * + * @param aArmour - The Armour to provide protection. + * @return + */ + public static boolean isNanoArmourPiece(ItemStack aArmour) { + return aArmour != null ? aArmour.getItem() instanceof ItemArmorNanoSuit : false; + } + + /** + * Is this item vanilla IC2 Quantum? + * + * @param aArmour - The Armour to provide protection. + * @return + */ + public static boolean isQuantumArmourPiece(ItemStack aArmour) { + return aArmour != null ? aArmour.getItem() instanceof ItemArmorQuantumSuit : false; + } + + /** + * Is this item a registered piece of full hazmat? (Provides all 6 protections) + * + * @param aStack - The Armour to provide protection. + * @return + */ + public static boolean isHazmatPiece(ItemStack aStack) { + return isVanillaHazmatPiece(aStack) || providesProtection(aStack); + } + + /** + * Registers the {@link ItemStack} to all types of protection. Provides full + * hazmat protection. Frost, Fire, Bio, Gas, Radioaton & Electricity. + * + * @param aStack - The Armour to provide protection. + * @return - Did we register this ItemStack properly? + */ + public static boolean addProtection(ItemStack aVanStack) { + Logger.INFO("[Hazmat] Registering " + aVanStack.getDisplayName() + " for full Hazmat protection."); + GT_ItemStack aStack = getGtStackFromVanilla(aVanStack); + AutoMap<Boolean> aAdded = new AutoMap<Boolean>(); + aAdded.put(addProtection_Frost(aStack)); + aAdded.put(addProtection_Fire(aStack)); + aAdded.put(addProtection_Biohazard(aStack)); + aAdded.put(addProtection_Gas(aStack)); + aAdded.put(addProtection_Radiation(aStack)); + aAdded.put(addProtection_Electricty(aStack)); + for (boolean b : aAdded) { + if (!b) { + return false; + } + } + Logger.INFO("[Hazmat] Protection added for all 6 damage types, registering to master Hazmat list."); + sHazmatList.add(aStack); + return true; + } + + public static boolean addProtection_Frost(GT_ItemStack aStack) { + registerTooltip(aStack, EnumChatFormatting.AQUA + "Frost"); + return addProtection_Generic(sFrostHazmatList, aStack); + } + + public static boolean addProtection_Fire(GT_ItemStack aStack) { + registerTooltip(aStack, EnumChatFormatting.DARK_RED + "Heat"); + return addProtection_Generic(sHeatHazmatList, aStack); + } + + public static boolean addProtection_Biohazard(GT_ItemStack aStack) { + registerTooltip(aStack, EnumChatFormatting.GREEN + "Biohazards"); + return addProtection_Generic(sBioHazmatList, aStack); + } + + public static boolean addProtection_Gas(GT_ItemStack aStack) { + registerTooltip(aStack, EnumChatFormatting.WHITE + "Gas"); + return addProtection_Generic(sGasHazmatList, aStack); + } + + public static boolean addProtection_Radiation(GT_ItemStack aStack) { + registerTooltip(aStack, EnumChatFormatting.DARK_GREEN + "Radiation"); + return addProtection_Generic(sRadioHazmatList, aStack); + } + + public static boolean addProtection_Electricty(GT_ItemStack aStack) { + registerTooltip(aStack, EnumChatFormatting.YELLOW + "Electricity"); + return addProtection_Generic(sElectroHazmatList, aStack); + } + + private static boolean addProtection_Generic(GT_HashSet<GT_ItemStack> aSet, GT_ItemStack aStack) { + int aMapSize = aSet.size(); + aSet.add(aStack); + return aMapSize < aSet.size(); + } + + /** + * Does this item provide hazmat protection? (Protection against Frost, Heat, + * Bio, Gas, Rads, Elec) An item may return false even if it protects against + * all six damage types. This is because it's not actually registered as hazmat + * correct. + * + * @param aStack - The item to check for protection + * @return + */ + public static boolean providesProtection(ItemStack aStack) { + return providesProtetion_Generic(sHazmatList, aStack); + } + + public static boolean providesProtetion_Frost(ItemStack aStack) { + return providesProtetion_Generic(sFrostHazmatList, aStack); + } + + public static boolean providesProtetion_Fire(ItemStack aStack) { + return providesProtetion_Generic(sHeatHazmatList, aStack); + } + + public static boolean providesProtetion_Biohazard(ItemStack aStack) { + return providesProtetion_Generic(sBioHazmatList, aStack); + } + + public static boolean providesProtetion_Gas(ItemStack aStack) { + return providesProtetion_Generic(sGasHazmatList, aStack); + } + + public static boolean providesProtetion_Radiation(ItemStack aStack) { + return providesProtetion_Generic(sRadioHazmatList, aStack); + } + + public static boolean providesProtetion_Electricity(ItemStack aStack) { + return providesProtetion_Generic(sElectroHazmatList, aStack); + } + + private static boolean providesProtetion_Generic(GT_HashSet aSet, ItemStack aStack) { + if (isVanillaHazmatPiece(aStack)) { + return true; + } + return aSet.getMap().containsKey(aStack); + } + + private static String[] getTooltips(GT_ItemStack aStack) { + String aKey = convertGtItemstackToStringData(aStack); + AutoMap<String> aTempTooltipData = mToolTips.get(aKey); + if (aTempTooltipData == null) { + //Logger.INFO("[Hazmat] Item was not mapped for TTs - "+aKey); + return new String[] {}; + } else { + //Logger.INFO("[Hazmat] Item was mapped for TTs"); + Collections.sort(aTempTooltipData); + //Logger.INFO("[Hazmat] Sorted TTs"); + return aTempTooltipData.toArray(); + } + } + + private static void registerTooltip(GT_ItemStack aStack, String aTooltip) { + String aKey = convertGtItemstackToStringData(aStack); + Logger.INFO("[Hazmat] Mapping " + aTooltip + " for " + aKey); + AutoMap<String> aTempTooltipData = mToolTips.get(aKey); + if (aTempTooltipData == null) { + Logger.INFO("No data mapped yet, creating."); + aTempTooltipData = new AutoMap<String>(); + } + aTempTooltipData.add(aTooltip); + mToolTips.put(convertGtItemstackToStringData(aStack), aTempTooltipData); + } + + public static ItemStack getStackFromGtStack(GT_ItemStack aGtStack) { + return ItemUtils.simpleMetaStack(aGtStack.mItem, aGtStack.mMetaData, aGtStack.mStackSize); + } + + public static GT_ItemStack getGtStackFromVanilla(ItemStack aStack) { + return new GT_ItemStack(aStack); + } + + private static String convertGtItemstackToStringData(GT_ItemStack aStack) { + if (aStack == null) { + return "NULL"; + } else { + return aStack.mItem.getUnlocalizedName() + "." + aStack.mMetaData + "." + aStack.mStackSize; + } + } + + private static String convertGtItemstackToStringDataIgnoreDamage(GT_ItemStack aStack) { + if (aStack == null) { + return "NULL"; + } else { + return aStack.mItem.getUnlocalizedName() + "." + aStack.mStackSize; + } + } + +} diff --git a/src/Java/gtPlusPlus/core/util/minecraft/InventoryUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/InventoryUtils.java index 0d4394d773..8f12d20494 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/InventoryUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/InventoryUtils.java @@ -7,54 +7,52 @@ import net.minecraft.entity.item.EntityItem; import net.minecraft.inventory.IInventory; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; import net.minecraft.world.World; public class InventoryUtils { private final static Random mRandom = new Random(); - public static void dropInventoryItems(World world, int x, int y, int z, Block block){ - Object tileentity = world.getTileEntity(x, y, z); - - if (tileentity != null) - { - for (int i1 = 0; i1 < ((IInventory) tileentity).getSizeInventory(); ++i1) - { - ItemStack itemstack = ((IInventory) tileentity).getStackInSlot(i1); - - if (itemstack != null) - { - float f = mRandom.nextFloat() * 0.8F + 0.1F; - float f1 = mRandom.nextFloat() * 0.8F + 0.1F; - EntityItem entityitem; - - for (float f2 = mRandom.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; world.spawnEntityInWorld(entityitem)) - { - int j1 = mRandom.nextInt(21) + 10; - - if (j1 > itemstack.stackSize) - { - j1 = itemstack.stackSize; - } - - itemstack.stackSize -= j1; - entityitem = new EntityItem(world, x + f, y + f1, z + f2, new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); - float f3 = 0.05F; - entityitem.motionX = (float)mRandom.nextGaussian() * f3; - entityitem.motionY = (float)mRandom.nextGaussian() * f3 + 0.2F; - entityitem.motionZ = (float)mRandom.nextGaussian() * f3; - - if (itemstack.hasTagCompound()) - { - entityitem.getEntityItem().setTagCompound((NBTTagCompound)itemstack.getTagCompound().copy()); - } - } - } - } - - world.func_147453_f(x, y, z, block); - } - + public static void dropInventoryItems(World world, int x, int y, int z, Block block) { + TileEntity tileentity = world.getTileEntity(x, y, z); + + if (tileentity != null && tileentity instanceof IInventory + && ((IInventory) tileentity).getSizeInventory() > 0) { + for (int i1 = 0; i1 < ((IInventory) tileentity).getSizeInventory(); ++i1) { + ItemStack itemstack = ((IInventory) tileentity).getStackInSlot(i1); + + if (itemstack != null) { + float f = mRandom.nextFloat() * 0.8F + 0.1F; + float f1 = mRandom.nextFloat() * 0.8F + 0.1F; + EntityItem entityitem; + + for (float f2 = mRandom.nextFloat() * 0.8F + 0.1F; itemstack.stackSize > 0; world.spawnEntityInWorld(entityitem)) { + int j1 = mRandom.nextInt(21) + 10; + + if (j1 > itemstack.stackSize) { + j1 = itemstack.stackSize; + } + + itemstack.stackSize -= j1; + entityitem = new EntityItem(world, x + f, y + f1, z + f2, + new ItemStack(itemstack.getItem(), j1, itemstack.getItemDamage())); + float f3 = 0.05F; + entityitem.motionX = (float) mRandom.nextGaussian() * f3; + entityitem.motionY = (float) mRandom.nextGaussian() * f3 + 0.2F; + entityitem.motionZ = (float) mRandom.nextGaussian() * f3; + + if (itemstack.hasTagCompound()) { + entityitem.getEntityItem() + .setTagCompound((NBTTagCompound) itemstack.getTagCompound().copy()); + } + } + } + } + + world.func_147453_f(x, y, z, block); + } + } } diff --git a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java index d32ff4e160..ae799baa2b 100644 --- a/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java +++ b/src/Java/gtPlusPlus/core/util/minecraft/ItemUtils.java @@ -13,6 +13,7 @@ import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_OreDictUnificator; import gregtech.api.util.GT_Utility; +import gregtech.common.items.GT_MetaGenerated_Tool_01; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.api.objects.minecraft.BlockPos; @@ -29,6 +30,8 @@ import gtPlusPlus.core.lib.LoadedMods; import gtPlusPlus.core.material.Material; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.reflect.ReflectionUtils; +import gtPlusPlus.xmod.gregtech.api.items.Gregtech_MetaTool; +import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import gtPlusPlus.xmod.gregtech.loaders.RecipeGen_DustGeneration; import net.minecraft.block.Block; import net.minecraft.init.Items; @@ -1113,5 +1116,67 @@ public class ItemUtils { } return aDisplay; } + + public static boolean isItemGregtechTool(ItemStack aStack) { + if (aStack == null) { + return false; + } + final Item mItem = aStack.getItem(); + final Item aSkookum = ItemUtils.getItemFromFQRN("miscutils:gt.plusplus.metatool.01"); + final Class aSkookClass = aSkookum.getClass(); + if (aSkookClass.isInstance(mItem) || mItem instanceof GT_MetaGenerated_Tool_01 || mItem instanceof MetaGeneratedGregtechTools || mItem instanceof Gregtech_MetaTool || mItem == aSkookum) { + return true; + } + return false; + } + + public static boolean isToolWrench(ItemStack aWrench) { + if (isItemGregtechTool(aWrench) && (aWrench.getItemDamage() == 16 || aWrench.getItemDamage() == 120 || aWrench.getItemDamage() == 122 || aWrench.getItemDamage() == 124 || aWrench.getItemDamage() == 7734)) { + return true; + } + return false; + } + + public static boolean isToolMallet(ItemStack aMallet) { + if (isItemGregtechTool(aMallet) && (aMallet.getItemDamage() == 14)) { + return true; + } + return false; + } + + public static boolean isToolScrewdriver(ItemStack aScrewdriver) { + if (isItemGregtechTool(aScrewdriver) && (aScrewdriver.getItemDamage() == 22 || aScrewdriver.getItemDamage() == 150)) { + return true; + } + return false; + } + + public static boolean isToolCrowbar(ItemStack aCrowbar) { + if (isItemGregtechTool(aCrowbar) && (aCrowbar.getItemDamage() == 20)) { + return true; + } + return false; + } + + public static boolean isToolWirecutters(ItemStack aWirecutters) { + if (isItemGregtechTool(aWirecutters) && (aWirecutters.getItemDamage() == 26)) { + return true; + } + return false; + } + + public static boolean isToolHammer(ItemStack aHammer) { + if (isItemGregtechTool(aHammer) && (aHammer.getItemDamage() == 12 || aHammer.getItemDamage() == 7734)) { + return true; + } + return false; + } + + public static boolean isToolSolderingIron(ItemStack aSoldering) { + if (isItemGregtechTool(aSoldering) && (aSoldering.getItemDamage() == 160)) { + return true; + } + return false; + } } diff --git a/src/Java/gtPlusPlus/core/util/reflect/ProxyFinder.java b/src/Java/gtPlusPlus/core/util/reflect/ProxyFinder.java index d22fafb37b..aaa9b2fae7 100644 --- a/src/Java/gtPlusPlus/core/util/reflect/ProxyFinder.java +++ b/src/Java/gtPlusPlus/core/util/reflect/ProxyFinder.java @@ -20,7 +20,7 @@ public class ProxyFinder { } } catch (final NoClassDefFoundError err) { - //its server side + //its client side return null; } break; diff --git a/src/Java/gtPlusPlus/everglades/gen/gt/WorldGen_Ores.java b/src/Java/gtPlusPlus/everglades/gen/gt/WorldGen_Ores.java index 978deb1d25..0715f86e01 100644 --- a/src/Java/gtPlusPlus/everglades/gen/gt/WorldGen_Ores.java +++ b/src/Java/gtPlusPlus/everglades/gen/gt/WorldGen_Ores.java @@ -2,288 +2,77 @@ package gtPlusPlus.everglades.gen.gt; import java.util.Hashtable; -import net.minecraft.block.Block; - -import gregtech.api.enums.Materials; - -import gtPlusPlus.api.objects.data.Pair; import gtPlusPlus.core.material.ELEMENT; -import gtPlusPlus.core.material.Material; import gtPlusPlus.core.material.ORES; import gtPlusPlus.core.material.nuclear.FLUORIDES; -import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.everglades.object.BoxedQuad; public class WorldGen_Ores { - - /** - * Set Ore Types on by one. - */ - public static volatile Pair<Block, Integer> Geikielite; // MgTiO3 - public static volatile Pair<Block, Integer> Zimbabweite; // (Na,K)2PbAs4(Nb,Ta,Ti)4O18 - public static volatile Pair<Block, Integer> Titanite; // CaTiSiO5 - public static volatile Pair<Block, Integer> Zirconolite; // CaZrTi2O7 - public static volatile Pair<Block, Integer> Crocoite; // PbCrO4 - public static volatile Pair<Block, Integer> Nichromite; // (Ni,Co,Fe)(Cr,Fe,Al)2O4 - public static volatile Pair<Block, Integer> Yttriaite; // Y2O3 - public static volatile Pair<Block, Integer> Samarskite_Y; // (YFe3+Fe2+U,Th,Ca)2(Nb,Ta)2O8 - public static volatile Pair<Block, Integer> Samarskite_Yb; // (YbFe3+)2(Nb,Ta)2O8 - public static volatile Pair<Block, Integer> Zircon; // ZrSiO4 - public static volatile Pair<Block, Integer> Gadolinite_Ce; // (Ce2,La,Nd,Y)2FeBe2Si1O14 - public static volatile Pair<Block, Integer> Gadolinite_Y; // (Ce,La,Nd,Y2)2FeBe2Si4O9 - public static volatile Pair<Block, Integer> Lepersonnite; // Ca(Gd,Dy)2(UO2)24(SiO4)4(CO3)8(OH)24·48H2O - public static volatile Pair<Block, Integer> Xenotime; // YPO4 - public static volatile Pair<Block, Integer> Yttrialite; // Y2Th2Si2O7 - public static volatile Pair<Block, Integer> Yttrocerite; // CaF5YCe - public static volatile Pair<Block, Integer> Polycrase; // YCaCeUThTi2Nb2Ta2O6 - public static volatile Pair<Block, Integer> Zircophyllite; // (K,Na)3(Mn,Fe)7(Zr,Ti,Nb)2Si8O24(OH,F)7 - public static volatile Pair<Block, Integer> Zirkelite; // (Ca,Th,Ce)Zr(Ti,Nb)2O7 - public static volatile Pair<Block, Integer> Lanthanite_La; // (La)2(CO3)3·8(H2O). - public static volatile Pair<Block, Integer> Lanthanite_Ce; // (Ce)2(CO3)3·8(H2O). - public static volatile Pair<Block, Integer> Lanthanite_Nd; // (Nd)2(CO3)3·8(H2O). - public static volatile Pair<Block, Integer> Hibonite; // ((Ca,Ce)(Al,Ti,Mg)12O19) - public static volatile Pair<Block, Integer> Cerite; // (Ce,La,Ca)9(Mg,Fe+3)(SiO4)6(SiO3OH)(OH)3 - public static volatile Pair<Block, Integer> Agardite_Y; // (YCa)Cu5(As2O4)3(OH)6·3H2O - public static volatile Pair<Block, Integer> Agardite_Cd; // (CdCa)Cu7(AsO2)4(O2H)5·3H2O - public static volatile Pair<Block, Integer> Agardite_La; // (LaCa)Cu5(AsO6)2(OH)4·3H2O - public static volatile Pair<Block, Integer> Agardite_Nd; // (NdCa)Cu6(As3O3)2(O2H)6·3H2O - public static volatile Pair<Block, Integer> Fluorcaphite; // (Ca,Sr,Ce,Na)5(PO4)3F - public static volatile Pair<Block, Integer> Florencite; // SmAl3(PO4)2(OH)6 - public static volatile Pair<Block, Integer> Cryolite; // Na3AlF6 - //public static volatile Pair<Block, Integer> Pyroxene; // - - - - - public static WorldGen_GT_Ore_Layer BaseVein = new WorldGen_GT_Ore_Layer( - "veinA", - 20, 40, - 1, - 8, - 128, - ELEMENT.getInstance().IRON, - ELEMENT.getInstance().IRON, - ELEMENT.getInstance().IRON, + public static WorldGen_GT_Ore_Layer BaseVein = new WorldGen_GT_Ore_Layer("veinA", 20, 40, 1, 1, 128, + ELEMENT.getInstance().IRON, ELEMENT.getInstance().IRON, ELEMENT.getInstance().IRON, ELEMENT.getInstance().IRON); - - - + /** * Custom ore Veins */ - - public static WorldGen_GT_Ore_Layer Vein1 = new WorldGen_GT_Ore_Layer( - "vein1", - 0, 60, - 30, - 16, - 16, - ORES.AGARDITE_CD, - ORES.AGARDITE_LA, - ORES.DEMICHELEITE_BR, - ORES.IRARSITE); - - public static WorldGen_GT_Ore_Layer Vein2 = new WorldGen_GT_Ore_Layer( - "vein2", - 0, 60, - 30, - 16, - 16, - ORES.AGARDITE_ND, - ORES.AGARDITE_Y, - ORES.KASHINITE, - ORES.CERITE); - public static WorldGen_GT_Ore_Layer Vein3 = new WorldGen_GT_Ore_Layer( - "vein3", - 0, 60, - 30, - 16, - 32, - ORES.CERITE, - ORES.NICHROMITE, - ORES.XENOTIME, - ORES.HIBONITE); + public static WorldGen_GT_Ore_Layer Vein1 = new WorldGen_GT_Ore_Layer("vein1", 0, 60, 30, 2, 16, ORES.AGARDITE_CD, + ORES.AGARDITE_LA, ORES.DEMICHELEITE_BR, ORES.IRARSITE); + + public static WorldGen_GT_Ore_Layer Vein2 = new WorldGen_GT_Ore_Layer("vein2", 0, 60, 30, 2, 16, ORES.AGARDITE_ND, + ORES.AGARDITE_Y, ORES.KASHINITE, ORES.CERITE); - public static WorldGen_GT_Ore_Layer Vein4 = new WorldGen_GT_Ore_Layer( - "vein4", - 0, 60, - 40, - 16, - 32, - ORES.GEIKIELITE, - ORES.CRYOLITE, - ORES.GADOLINITE_CE, - ORES.AGARDITE_ND); - - - - public static WorldGen_GT_Ore_Layer Vein5 = new WorldGen_GT_Ore_Layer( - "vein5", - 30, 128, - 20, - 8, - 48, - ORES.HIBONITE, - ORES.YTTRIALITE, - ORES.ZIRCONILITE, - ORES.CERITE); - public static WorldGen_GT_Ore_Layer Vein6 = new WorldGen_GT_Ore_Layer( - "vein6", - 0, 40, - 20, - 8, - 48, - ORES.XENOTIME, - ORES.ZIRKELITE, - ORES.CROCROITE, - ORES.IRARSITE); - public static WorldGen_GT_Ore_Layer Vein7 = new WorldGen_GT_Ore_Layer( - "vein7", - 40, 128, - 20, - 8, - 48, - ORES.HONEAITE, - ORES.MIESSIITE, - ORES.SAMARSKITE_Y, - ORES.SAMARSKITE_YB); - public static WorldGen_GT_Ore_Layer Vein8 = new WorldGen_GT_Ore_Layer( - "vein8", - 0, 40, - 20, - 8, - 48, - ORES.TITANITE, - ORES.ZIMBABWEITE, - ORES.ZIRCON, - ORES.FLORENCITE); - - - + public static WorldGen_GT_Ore_Layer Vein3 = new WorldGen_GT_Ore_Layer("vein3", 0, 60, 30, 3, 32, ORES.CERITE, + ORES.NICHROMITE, ORES.XENOTIME, ORES.HIBONITE); + + public static WorldGen_GT_Ore_Layer Vein4 = new WorldGen_GT_Ore_Layer("vein4", 0, 60, 40, 3, 32, ORES.GEIKIELITE, + ORES.CRYOLITE, ORES.GADOLINITE_CE, ORES.AGARDITE_ND); + + public static WorldGen_GT_Ore_Layer Vein5 = new WorldGen_GT_Ore_Layer("vein5", 30, 128, 20, 2, 48, ORES.HIBONITE, + ORES.YTTRIALITE, ORES.ZIRCONILITE, ORES.CERITE); + public static WorldGen_GT_Ore_Layer Vein6 = new WorldGen_GT_Ore_Layer("vein6", 0, 40, 20, 2, 48, ORES.XENOTIME, + ORES.ZIRKELITE, ORES.CROCROITE, ORES.IRARSITE); + public static WorldGen_GT_Ore_Layer Vein7 = new WorldGen_GT_Ore_Layer("vein7", 40, 128, 20, 2, 48, ORES.HONEAITE, + ORES.MIESSIITE, ORES.SAMARSKITE_Y, ORES.SAMARSKITE_YB); + public static WorldGen_GT_Ore_Layer Vein8 = new WorldGen_GT_Ore_Layer("vein8", 0, 40, 20, 2, 48, ORES.TITANITE, + ORES.ZIMBABWEITE, ORES.ZIRCON, ORES.FLORENCITE); + + public static WorldGen_GT_Ore_Layer Vein9 = new WorldGen_GT_Ore_Layer("vein9", 10, 30, 20, 1, 48, + ORES.LANTHANITE_CE, FLUORIDES.FLUORITE, ORES.LAFOSSAITE, ORES.FLORENCITE); + public static WorldGen_GT_Ore_Layer Vein10 = new WorldGen_GT_Ore_Layer("vein10", 20, 50, 20, 2, 32, ORES.GEIKIELITE, + ORES.YTTROCERITE, ORES.LANTHANITE_LA, ORES.RADIOBARITE); + public static WorldGen_GT_Ore_Layer Vein11 = new WorldGen_GT_Ore_Layer("vein11", 30, 70, 20, 1, 48, + FLUORIDES.FLUORITE, ORES.KASHINITE, ORES.ZIRCON, ORES.CRYOLITE); + public static WorldGen_GT_Ore_Layer Vein12 = new WorldGen_GT_Ore_Layer("vein12", 40, 80, 20, 3, 32, ORES.CERITE, + ORES.ALBURNITE, ORES.MIESSIITE, ORES.HIBONITE); - public static WorldGen_GT_Ore_Layer Vein9 = new WorldGen_GT_Ore_Layer( - "vein9", - 10, 30, - 20, - 4, - 48, - ORES.LANTHANITE_CE, - FLUORIDES.FLUORITE, - ORES.LAFOSSAITE, - ORES.FLORENCITE); - public static WorldGen_GT_Ore_Layer Vein10 = new WorldGen_GT_Ore_Layer( - "vein10", - 20, 50, - 20, - 8, - 32, - ORES.GEIKIELITE, - ORES.YTTROCERITE, - ORES.LANTHANITE_LA, - ORES.RADIOBARITE); - public static WorldGen_GT_Ore_Layer Vein11 = new WorldGen_GT_Ore_Layer( - "vein11", - 30, 70, - 20, - 5, - 48, - FLUORIDES.FLUORITE, - ORES.KASHINITE, - ORES.ZIRCON, - ORES.CRYOLITE); - public static WorldGen_GT_Ore_Layer Vein12 = new WorldGen_GT_Ore_Layer( - "vein12", - 40, 80, - 20, - 8, - 32, - ORES.CERITE, - ORES.ALBURNITE, - ORES.MIESSIITE, - ORES.HIBONITE); - /** * Best Rarest Veins 2017 */ - - public static WorldGen_GT_Ore_Layer Vein13 = new WorldGen_GT_Ore_Layer( - "vein13", - 5, 15, - 5, - 5, - 16, - ORES.CRYOLITE, - ORES.RADIOBARITE, - ORES.HONEAITE, - ORES.FLORENCITE); - public static WorldGen_GT_Ore_Layer Vein14 = new WorldGen_GT_Ore_Layer( - "vein14", - 10, 20, - 8, - 3, - 16, - ORES.DEMICHELEITE_BR, - ORES.PERROUDITE, - ORES.IRARSITE, - ORES.RADIOBARITE); + public static WorldGen_GT_Ore_Layer Vein13 = new WorldGen_GT_Ore_Layer("vein13", 5, 15, 5, 1, 16, ORES.CRYOLITE, + ORES.RADIOBARITE, ORES.HONEAITE, ORES.FLORENCITE); + + public static WorldGen_GT_Ore_Layer Vein14 = new WorldGen_GT_Ore_Layer("vein14", 10, 20, 8, 2, 16, + ORES.DEMICHELEITE_BR, ORES.PERROUDITE, ORES.IRARSITE, ORES.RADIOBARITE); - public static WorldGen_GT_Ore_Layer Vein15 = new WorldGen_GT_Ore_Layer( - "vein15", - 5, 25, - 5, - 6, - 24, - ORES.FLUORCAPHITE, - ORES.LAFOSSAITE, - ORES.GADOLINITE_CE, - ORES.GADOLINITE_Y); + public static WorldGen_GT_Ore_Layer Vein15 = new WorldGen_GT_Ore_Layer("vein15", 5, 25, 5, 3, 24, ORES.FLUORCAPHITE, + ORES.LAFOSSAITE, ORES.GADOLINITE_CE, ORES.GADOLINITE_Y); + + public static WorldGen_GT_Ore_Layer Vein16 = new WorldGen_GT_Ore_Layer("vein16", 0, 25, 4, 2, 32, ORES.YTTROCERITE, + ORES.LEPERSONNITE, ORES.LAUTARITE, FLUORIDES.FLUORITE); + + public static WorldGen_GT_Ore_Layer Vein17 = new WorldGen_GT_Ore_Layer("vein17", 10, 35, 4, 1, 32, ORES.FLORENCITE, + ORES.LAUTARITE, ORES.SAMARSKITE_YB, ORES.POLYCRASE); + public static WorldGen_GT_Ore_Layer Vein18 = new WorldGen_GT_Ore_Layer("vein18", 15, 40, 4, 1, 48, + ORES.GADOLINITE_CE, ORES.GADOLINITE_Y, ORES.AGARDITE_LA, ORES.AGARDITE_CD); - public static WorldGen_GT_Ore_Layer Vein16 = new WorldGen_GT_Ore_Layer( - "vein16", - 0, 25, - 4, - 6, - 32, - ORES.YTTROCERITE, - ORES.LEPERSONNITE, - ORES.LAUTARITE, - FLUORIDES.FLUORITE); - - public static WorldGen_GT_Ore_Layer Vein17 = new WorldGen_GT_Ore_Layer( - "vein17", - 10, 35, - 4, - 5, - 32, - ORES.FLORENCITE, - ORES.LAUTARITE, - ORES.SAMARSKITE_YB, - ORES.POLYCRASE); - public static WorldGen_GT_Ore_Layer Vein18 = new WorldGen_GT_Ore_Layer( - "vein18", - 15, 40, - 4, - 4, - 48, - ORES.GADOLINITE_CE, - ORES.GADOLINITE_Y, - ORES.AGARDITE_LA, - ORES.AGARDITE_CD); - - - - public static Hashtable<Long, WorldGen_GT_Ore_Layer> validOreveins = new Hashtable<Long, WorldGen_GT_Ore_Layer>( 1024); - - public static volatile BoxedQuad<Integer, Integer, Integer, Integer> OreVein1 = new BoxedQuad(null, null, null, null); - static long ID = 0; - public static void generateValidOreVeins(){ + + public static void generateValidOreVeins() { validOreveins.put(ID++, BaseVein); validOreveins.put(ID++, Vein1); validOreveins.put(ID++, Vein2); @@ -304,5 +93,5 @@ public class WorldGen_Ores { validOreveins.put(ID++, Vein17); validOreveins.put(ID++, Vein18); } - + } diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_IC2_Hazmat.java b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_IC2_Hazmat.java new file mode 100644 index 0000000000..4bb7ef7d46 --- /dev/null +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/ClassTransformer_IC2_Hazmat.java @@ -0,0 +1,132 @@ +package gtPlusPlus.preloader.asm.transformers; + +import static org.objectweb.asm.Opcodes.*; + +import org.apache.logging.log4j.Level; +import org.objectweb.asm.ClassReader; +import org.objectweb.asm.ClassVisitor; +import org.objectweb.asm.ClassWriter; +import org.objectweb.asm.Label; +import org.objectweb.asm.MethodVisitor; + +import cpw.mods.fml.relauncher.FMLRelaunchLog; +import gtPlusPlus.core.util.minecraft.HazmatUtils; +import net.minecraft.entity.EntityLivingBase; + +public class ClassTransformer_IC2_Hazmat { + + private final boolean isValid; + private final ClassReader reader; + private final ClassWriter writer; + private final String className; + + public boolean hasCompleteHazmat(EntityLivingBase living) { + return HazmatUtils.hasCompleteHazmat(living); + } + + public ClassTransformer_IC2_Hazmat(byte[] basicClass, String aClassName) { + className = aClassName; + ClassReader aTempReader = null; + ClassWriter aTempWriter = null; + + FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Attempting to patch in mode " + className + "."); + + aTempReader = new ClassReader(basicClass); + aTempWriter = new ClassWriter(aTempReader, ClassWriter.COMPUTE_FRAMES); + aTempReader.accept(new localClassVisitor(aTempWriter, className), 0); + + if (aTempReader != null && aTempWriter != null) { + isValid = true; + } else { + isValid = false; + } + + FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Valid patch? " + isValid + "."); + reader = aTempReader; + writer = aTempWriter; + + if (reader != null && writer != null) { + FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Attempting Method Injection."); + injectMethod("hasCompleteHazmat"); + } + + } + + public boolean isValidTransformer() { + return isValid; + } + + public ClassReader getReader() { + return reader; + } + + public ClassWriter getWriter() { + return writer; + } + + public boolean injectMethod(String aMethodName) { + MethodVisitor mv; + boolean didInject = false; + ClassWriter cw = getWriter(); + + boolean isObf; + try { + isObf = Class.forName("net.minecraft.entity.EntityLivingBase") == null; + } catch (ClassNotFoundException e) { + isObf = true; + } + String aEntityLivingBase = "net/minecraft/entity/EntityLivingBase"; + if (isObf) { + aEntityLivingBase = "sv"; + } + + + FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Injecting " + aMethodName + "."); + if (aMethodName.equals("hasCompleteHazmat")) { + mv = cw.visitMethod(ACC_PUBLIC, "hasCompleteHazmat", "(L"+aEntityLivingBase+";)Z", null, null); + mv.visitCode(); + Label l0 = new Label(); + mv.visitLabel(l0); + mv.visitLineNumber(23, l0); + mv.visitVarInsn(ALOAD, 1); + mv.visitMethodInsn(INVOKESTATIC, "gtPlusPlus/core/util/minecraft/HazmatUtils", "hasCompleteHazmat", "(L"+aEntityLivingBase+";)Z", false); + mv.visitInsn(IRETURN); + Label l1 = new Label(); + mv.visitLabel(l1); + mv.visitLocalVariable("this", "Lic2/core/item/armor/ItemArmorHazmat;", null, l0, l1, 0); + mv.visitLocalVariable("living", "L"+aEntityLivingBase+";", null, l0, l1, 1); + mv.visitMaxs(1, 2); + mv.visitEnd(); + } + FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Method injection complete."); + return didInject; + } + + public final class localClassVisitor extends ClassVisitor { + + String aClassName; + + public localClassVisitor(ClassVisitor cv, String aName) { + super(ASM5, cv); + aClassName = aName; + } + + @Override + public MethodVisitor visitMethod(int access, String name, String desc, String signature, String[] exceptions) { + MethodVisitor methodVisitor; + + if (name.equals("hasCompleteHazmat")) { + methodVisitor = null; + } else { + methodVisitor = super.visitMethod(access, name, desc, signature, exceptions); + } + + if (methodVisitor == null) { + FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, + "Found method " + name + ", removing."); + } + return methodVisitor; + } + } + +} diff --git a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java index 81302a59d4..3f5897d590 100644 --- a/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java +++ b/src/Java/gtPlusPlus/preloader/asm/transformers/Preloader_Transformer_Handler.java @@ -201,6 +201,12 @@ public class Preloader_Transformer_Handler implements IClassTransformer { return new ClassTransformer_IC2_GetHarvestTool(basicClass, obfuscated, transformedName).getWriter().toByteArray(); } } + //Fix IC2 Hazmat + + if (transformedName.equals("ic2.core.item.armor.ItemArmorHazmat")) { + FMLRelaunchLog.log("[GT++ ASM] IC2 Hazmat Patch", Level.INFO, "Transforming %s", transformedName); + return new ClassTransformer_IC2_Hazmat(basicClass, transformedName).getWriter().toByteArray(); + } //Fix Thaumcraft Shit //Patching ItemWispEssence to allow invalid item handling diff --git a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java index 6edc47badf..169683d251 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/HANDLER_GT.java @@ -32,6 +32,7 @@ import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.fluid.GregtechFluidHandler; import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; import gtPlusPlus.xmod.gregtech.loaders.*; +import gtPlusPlus.xmod.gregtech.recipes.RecipesToRemove; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechConduits; import gtPlusPlus.xmod.gregtech.registration.gregtech.GregtechNitroDieselFix; import net.minecraft.item.Item; @@ -93,6 +94,10 @@ public class HANDLER_GT { if (CORE.ConfigSwitches.enableSkookumChoochers){ new ProcessingToolHeadChoocher().run(); } + new ProcessingAngelGrinder().run(); + new ProcessingElectricSnips().run(); + new ProcessingElectricButcherKnife().run(); + new ProcessingElectricLighter().run(); if (CORE.ConfigSwitches.enableNitroFix){ GregtechNitroDieselFix.run(); @@ -110,6 +115,7 @@ public class HANDLER_GT { public static void onLoadComplete(FMLLoadCompleteEvent event) { removeCrudeTurbineRotors(); cleanAssemblyLineRecipeMap(); + RecipesToRemove.go(); } private static int removeCrudeTurbineRotors() { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java index 83abe22568..9b300b1ced 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechItemList.java @@ -423,7 +423,11 @@ public enum GregtechItemList implements GregtechItemContainer { //Basically is an automatic Cauldron - SimpleDustWasher, + SimpleDustWasher_ULV, + SimpleDustWasher_MV, + SimpleDustWasher_EV, + SimpleDustWasher_LuV, + SimpleDustWasher_UV, //Solar Tower Reflector Solar_Tower_Reflector, @@ -530,6 +534,11 @@ public enum GregtechItemList implements GregtechItemContainer { //Block that enables uplink to a superconductor network SuperConductorInputNode, + + //Heat Pipes + HeatPipe_Tier_1, + HeatPipe_Tier_2, + HeatPipe_Tier_3, //Chemical Dehydrators for nuclear fuels diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java index 5db505aa05..b17b4a26ff 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechOrePrefixes.java @@ -54,6 +54,10 @@ public enum GregtechOrePrefixes { type2("16x Wires", "16x ", " Wire", true, true, false, false, false, false, true, false, false, false, 0, M * 8, 64, -1), toolSkookumChoocher("Skookum Choocher", "", " Skookum Choocher", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. + toolAngleGrinder("Angle Grinder", "", "Angle Grinder", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. + toolElectricSnips("Electric Snips", "", "Electric Snips", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. + toolElectricLighter("Electric Lighter", "", "Electric Lighter", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. + toolElectricButcherKnife("Electric Butcher Knife", "", "Electric Butcher Knife", true, true, false, false, false, false, true, true, false, false, B[6], M * 6, 16, 37), // consisting out of 6 Ingots. @@ -61,7 +65,7 @@ public enum GregtechOrePrefixes { battery("Reusable Batteries", "", "", false, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Introduced by Calclavia circuit("Circuits", "", "", true, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Introduced by Calclavia chipset("Chipsets", "", "", true, true, false, false, false, false, false, false, false, false, 0, -1, 64, -1), // Introduced by Buildcraft - computer("Computers", "", "", true, true, false, false, true, false, false, false, false, false, 0, -1, 64, -1); // A whole Computer. "computerMaster" = ComputerCube + computer("Computers", "", "", true, true, false, false, true, false, false, false, false, false, 0, -1, 64, -1),; // A whole Computer. "computerMaster" = ComputerCube public static volatile int VERSION = 508; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java index a6b5e78473..105023065c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/enums/GregtechToolDictNames.java @@ -2,6 +2,6 @@ package gtPlusPlus.xmod.gregtech.api.enums; public enum GregtechToolDictNames { - craftingToolSkookumChoocher, craftingToolHandPump; + craftingToolSkookumChoocher, craftingToolHandPump, craftingToolAngleGrinder, craftingToolElectricSnips, craftingToolElectricLighter, craftingToolElectricButcherKnife; }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/power/CONTAINER_BasicTank.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/power/CONTAINER_BasicTank.java new file mode 100644 index 0000000000..9a58e74ec4 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/power/CONTAINER_BasicTank.java @@ -0,0 +1,69 @@ +package gtPlusPlus.xmod.gregtech.api.gui.power; + +import cpw.mods.fml.relauncher.Side; +import cpw.mods.fml.relauncher.SideOnly; +import gregtech.api.gui.GT_ContainerMetaTile_Machine; +import gregtech.api.gui.GT_Slot_Output; +import gregtech.api.gui.GT_Slot_Render; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_BasicTank; + +import java.util.Iterator; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.inventory.ICrafting; +import net.minecraft.inventory.Slot; + +public class CONTAINER_BasicTank extends GT_ContainerMetaTile_Machine { + public int mContent = 0; + + public CONTAINER_BasicTank(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity) { + super(aInventoryPlayer, aTileEntity); + } + + public void addSlots(InventoryPlayer aInventoryPlayer) { + this.addSlotToContainer(new Slot(this.mTileEntity, 0, 80, 17)); + this.addSlotToContainer(new GT_Slot_Output(this.mTileEntity, 1, 80, 53)); + this.addSlotToContainer(new GT_Slot_Render(this.mTileEntity, 2, 59, 42)); + } + + public void detectAndSendChanges() { + super.detectAndSendChanges(); + if (!this.mTileEntity.isClientSide() && this.mTileEntity.getMetaTileEntity() != null) { + if (((GTPP_MTE_BasicTank) this.mTileEntity.getMetaTileEntity()).mFluid != null) { + this.mContent = ((GTPP_MTE_BasicTank) this.mTileEntity.getMetaTileEntity()).mFluid.amount; + } else { + this.mContent = 0; + } + + Iterator var2 = this.crafters.iterator(); + + while (var2.hasNext()) { + ICrafting var1 = (ICrafting) var2.next(); + var1.sendProgressBarUpdate(this, 100, this.mContent & ''); + var1.sendProgressBarUpdate(this, 101, this.mContent >>> 16); + } + + } + } + + @SideOnly(Side.CLIENT) + public void updateProgressBar(int par1, int par2) { + super.updateProgressBar(par1, par2); + switch (par1) { + case 100 : + this.mContent = this.mContent & -65536 | par2; + break; + case 101 : + this.mContent = this.mContent & '' | par2 << 16; + } + + } + + public int getSlotCount() { + return 2; + } + + public int getShiftClickSlotCount() { + return 1; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/gui/power/GUI_BasicTank.java b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/power/GUI_BasicTank.java new file mode 100644 index 0000000000..a03aac346b --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/gui/power/GUI_BasicTank.java @@ -0,0 +1,36 @@ +package gtPlusPlus.xmod.gregtech.api.gui.power; + +import gregtech.api.gui.GT_GUIContainerMetaTile_Machine; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Utility; +import net.minecraft.entity.player.InventoryPlayer; +import net.minecraft.util.StatCollector; + +public class GUI_BasicTank extends GT_GUIContainerMetaTile_Machine { + private final String mName; + + public GUI_BasicTank(InventoryPlayer aInventoryPlayer, IGregTechTileEntity aTileEntity, String aName) { + super(new CONTAINER_BasicTank(aInventoryPlayer, aTileEntity), "gregtech:textures/gui/BasicTank.png"); + this.mName = aName; + } + + protected void drawGuiContainerForegroundLayer(int par1, int par2) { + this.fontRendererObj.drawString(StatCollector.translateToLocal("container.inventory"), 8, this.ySize - 96 + 2, + 4210752); + this.fontRendererObj.drawString(this.mName, 8, 6, 4210752); + if (this.mContainer != null) { + this.fontRendererObj.drawString("Liquid Amount", 10, 20, 16448255); + this.fontRendererObj.drawString( + GT_Utility.parseNumberToString(((CONTAINER_BasicTank) this.mContainer).mContent), 10, 30, + 16448255); + } + + } + + protected void drawGuiContainerBackgroundLayer(float par1, int par2, int par3) { + super.drawGuiContainerBackgroundLayer(par1, par2, par3); + int x = (this.width - this.xSize) / 2; + int y = (this.height - this.ySize) / 2; + this.drawTexturedModalRect(x, y, 0, 0, this.xSize, this.ySize); + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatEntity.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatEntity.java new file mode 100644 index 0000000000..824bb258d8 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatEntity.java @@ -0,0 +1,26 @@ +package gtPlusPlus.xmod.gregtech.api.interfaces; + +import ic2.api.energy.tile.IHeatSource; +import net.minecraftforge.common.util.ForgeDirection; + +public interface IHeatEntity extends IHeatSource, IHeatSink { + + public int getHeatBuffer(); + + public void setHeatBuffer(int HeatBuffer); + + public void addtoHeatBuffer(int heat); + + public int getTransmitHeat(); + + public int fillHeatBuffer(int maxAmount); + + public int getMaxHeatEmittedPerTick(); + + public void updateHeatEntity(); + + public int maxrequestHeatTick(ForgeDirection directionFrom); + + public int requestHeat(ForgeDirection directionFrom, int requestheat); + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatSink.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatSink.java new file mode 100644 index 0000000000..80adcf0d51 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IHeatSink.java @@ -0,0 +1,13 @@ +package gtPlusPlus.xmod.gregtech.api.interfaces; + +import net.minecraftforge.common.util.ForgeDirection; + +public interface IHeatSink { + + + int maxHeatInPerTick(ForgeDirection var1); + + int addHeat(ForgeDirection var1, int var2); + + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IMetaTileEntityHeatPipe.java b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IMetaTileEntityHeatPipe.java new file mode 100644 index 0000000000..770f249648 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/interfaces/IMetaTileEntityHeatPipe.java @@ -0,0 +1,14 @@ +package gtPlusPlus.xmod.gregtech.api.interfaces; + +import java.util.ArrayList; + +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import net.minecraft.tileentity.TileEntity; + +public interface IMetaTileEntityHeatPipe extends IMetaTileEntity { + + + long transferHeat(byte var1, long var2, long var4, ArrayList<TileEntity> var6); + + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java new file mode 100644 index 0000000000..1ce7fc49d3 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicLosslessGenerator.java @@ -0,0 +1,313 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.GT_Utility; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; +import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import java.util.Collection; +import java.util.Iterator; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public abstract class GTPP_MTE_BasicLosslessGenerator extends GTPP_MTE_BasicTank { + public GTPP_MTE_BasicLosslessGenerator(int aID, String aName, String aNameRegional, int aTier, String aDescription, + ITexture... aTextures) { + super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); + } + + public GTPP_MTE_BasicLosslessGenerator(int aID, String aName, String aNameRegional, int aTier, + String[] aDescription, ITexture... aTextures) { + super(aID, aName, aNameRegional, aTier, 3, aDescription, aTextures); + } + + public GTPP_MTE_BasicLosslessGenerator(String aName, int aTier, String aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + public GTPP_MTE_BasicLosslessGenerator(String aName, int aTier, String[] aDescription, ITexture[][][] aTextures) { + super(aName, aTier, 3, aDescription, aTextures); + } + + public ITexture[][][] getTextureSet(ITexture[] aTextures) { + ITexture[][][] rTextures = new ITexture[10][17][]; + + for (byte i = -1; i < 16; ++i) { + rTextures[0][i + 1] = this.getFront(i); + rTextures[1][i + 1] = this.getBack(i); + rTextures[2][i + 1] = this.getBottom(i); + rTextures[3][i + 1] = this.getTop(i); + rTextures[4][i + 1] = this.getSides(i); + rTextures[5][i + 1] = this.getFrontActive(i); + rTextures[6][i + 1] = this.getBackActive(i); + rTextures[7][i + 1] = this.getBottomActive(i); + rTextures[8][i + 1] = this.getTopActive(i); + rTextures[9][i + 1] = this.getSidesActive(i); + } + + return rTextures; + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aFacing, byte aColorIndex, + boolean aActive, boolean aRedstone) { + return this.mTextures[(aActive ? 5 : 0) + (aSide == aFacing + ? 0 + : (aSide == GT_Utility.getOppositeSide(aFacing) + ? 1 + : (aSide == 0 ? 2 : (aSide == 1 ? 3 : 4))))][aColorIndex + 1]; + } + + public String[] getDescription() { + String[] desc = new String[this.mDescriptionArray.length + 1]; + System.arraycopy(this.mDescriptionArray, 0, desc, 0, this.mDescriptionArray.length); + desc[this.mDescriptionArray.length] = "Fuel Efficiency: " + this.getEfficiency() + "%"; + return desc; + } + + public boolean onRightclick(IGregTechTileEntity aBaseMetaTileEntity, EntityPlayer aPlayer) { + Logger.WARNING("Right Clicked"); + if (aBaseMetaTileEntity.isClientSide()) { + return true; + } else { + aBaseMetaTileEntity.openGUI(aPlayer); + return true; + } + } + + public ITexture[] getFront(byte aColor) { + return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getBack(byte aColor) { + return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getBottom(byte aColor) { + return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getTop(byte aColor) { + return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getSides(byte aColor) { + return new ITexture[]{BlockIcons.MACHINE_CASINGS[this.mTier][aColor + 1]}; + } + + public ITexture[] getFrontActive(byte aColor) { + return this.getFront(aColor); + } + + public ITexture[] getBackActive(byte aColor) { + return this.getBack(aColor); + } + + public ITexture[] getBottomActive(byte aColor) { + return this.getBottom(aColor); + } + + public ITexture[] getTopActive(byte aColor) { + return this.getTop(aColor); + } + + public ITexture[] getSidesActive(byte aColor) { + return this.getSides(aColor); + } + + public boolean isFacingValid(byte aSide) { + return aSide > 1; + } + + public boolean isSimpleMachine() { + return false; + } + + public boolean isValidSlot(int aIndex) { + return aIndex < 2; + } + + public boolean isEnetOutput() { + return true; + } + + public boolean isOutputFacing(byte aSide) { + return true; + } + + public boolean isAccessAllowed(EntityPlayer aPlayer) { + return true; + } + + public long maxEUOutput() { + return this.getBaseMetaTileEntity().isAllowedToWork() ? GT_Values.V[this.mTier] : 0L; + } + + public long maxEUStore() { + return Math.max(this.getEUVar(), GT_Values.V[this.mTier] * 40L + this.getMinimumStoredEU()); + } + + public boolean doesFillContainers() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + public boolean doesEmptyContainers() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + public boolean canTankBeFilled() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + public boolean canTankBeEmptied() { + return this.getBaseMetaTileEntity().isAllowedToWork(); + } + + public boolean displaysItemStack() { + return true; + } + + public boolean displaysStackSize() { + return false; + } + + public boolean isFluidInputAllowed(FluidStack aFluid) { + int aVal = this.getFuelValue(aFluid); + Logger.WARNING("Fuel Value: "+aVal); + return aVal > 0; + } + + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide() && aBaseMetaTileEntity.isAllowedToWork() && aTick % 10L == 0L) { + int tFuelValue; + if (this.mFluid == null) { + if (aBaseMetaTileEntity.getUniversalEnergyStored() < this.maxEUOutput() + this.getMinimumStoredEU()) { + this.mInventory[this.getStackDisplaySlot()] = null; + } else { + if (this.mInventory[this.getStackDisplaySlot()] == null) { + this.mInventory[this.getStackDisplaySlot()] = new ItemStack(Blocks.fire, 1); + } + + this.mInventory[this.getStackDisplaySlot()].setStackDisplayName("Generating: " + + (aBaseMetaTileEntity.getUniversalEnergyStored() - this.getMinimumStoredEU()) + " EU"); + } + } else { + tFuelValue = this.getFuelValue(this.mFluid); + int tConsumed = this.consumedFluidPerOperation(this.mFluid); + if (tFuelValue > 0 && tConsumed > 0 && this.mFluid.amount > tConsumed) { + long tFluidAmountToUse = Math.min((long) (this.mFluid.amount / tConsumed), + (this.maxEUStore() - aBaseMetaTileEntity.getUniversalEnergyStored()) / (long) tFuelValue); + if (tFluidAmountToUse > 0L && aBaseMetaTileEntity + .increaseStoredEnergyUnits(tFluidAmountToUse * (long) tFuelValue, true)) { + PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution()); + this.mFluid.amount = (int) ((long) this.mFluid.amount - tFluidAmountToUse * (long) tConsumed); + } + } + } + + if (this.mInventory[this.getInputSlot()] != null + && aBaseMetaTileEntity.getUniversalEnergyStored() < this.maxEUOutput() * 20L + + this.getMinimumStoredEU() + && GT_Utility.getFluidForFilledItem(this.mInventory[this.getInputSlot()], true) == null) { + tFuelValue = this.getFuelValue(this.mInventory[this.getInputSlot()]); + if (tFuelValue > 0) { + ItemStack tEmptyContainer = this.getEmptyContainer(this.mInventory[this.getInputSlot()]); + if (aBaseMetaTileEntity.addStackToSlot(this.getOutputSlot(), tEmptyContainer)) { + aBaseMetaTileEntity.increaseStoredEnergyUnits((long) tFuelValue, true); + aBaseMetaTileEntity.decrStackSize(this.getInputSlot(), 1); + PollutionUtils.addPollution(this.getBaseMetaTileEntity(), 10 * this.getPollution()); + } + } + } + } + + if (aBaseMetaTileEntity.isServerSide()) { + Logger.WARNING("Ticking Servside"); + aBaseMetaTileEntity.setActive(aBaseMetaTileEntity.isAllowedToWork() && aBaseMetaTileEntity + .getUniversalEnergyStored() >= this.maxEUOutput() + this.getMinimumStoredEU()); + } + + } + + public abstract int getPollution(); + + public abstract GT_Recipe_Map getRecipes(); + + public abstract int getEfficiency(); + + public int consumedFluidPerOperation(FluidStack aLiquid) { + return 1; + } + + public int getFuelValue(FluidStack aLiquid) { + if (aLiquid != null && this.getRecipes() != null) { + Collection<GT_Recipe> tRecipeList = this.getRecipes().mRecipeList; + Logger.WARNING("Fuels: "+tRecipeList.size()); + if (tRecipeList != null) { + Iterator var4 = tRecipeList.iterator(); + + while (var4.hasNext()) { + GT_Recipe tFuel = (GT_Recipe) var4.next(); + FluidStack tLiquid; + if ((tLiquid = GT_Utility.getFluidForFilledItem(tFuel.getRepresentativeInput(0), true)) != null + && aLiquid.isFluidEqual(tLiquid)) { + Logger.WARNING("Fuel Ok"); + return (int) ((long) tFuel.mSpecialValue * (long) this.getEfficiency() + * (long) this.consumedFluidPerOperation(tLiquid) / 100L); + } + if ((tLiquid = tFuel.getRepresentativeFluidInput(0)) != null + && aLiquid.isFluidEqual(tLiquid)) { + Logger.WARNING("Fuel Ok"); + return (int) ((long) tFuel.mSpecialValue * (long) this.getEfficiency() + * (long) this.consumedFluidPerOperation(tLiquid) / 100L); + } + } + } + + return 0; + } else { + return 0; + } + } + + public int getFuelValue(ItemStack aStack) { + if (!GT_Utility.isStackInvalid(aStack) && this.getRecipes() != null) { + Logger.WARNING("Fuel Item OK"); + GT_Recipe tFuel = this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, + (FluidStack[]) null, new ItemStack[]{aStack}); + return tFuel != null ? (int) ((long) tFuel.mSpecialValue * 1000L * (long) this.getEfficiency() / 100L) : 0; + } else { + return 0; + } + } + + public ItemStack getEmptyContainer(ItemStack aStack) { + if (!GT_Utility.isStackInvalid(aStack) && this.getRecipes() != null) { + GT_Recipe tFuel = this.getRecipes().findRecipe(this.getBaseMetaTileEntity(), false, Long.MAX_VALUE, + (FluidStack[]) null, new ItemStack[]{aStack}); + return tFuel != null + ? GT_Utility.copy(new Object[]{tFuel.getOutput(0)}) + : GT_Utility.getContainerItem(aStack, true); + } else { + return null; + } + } + + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return super.allowPutStack(aBaseMetaTileEntity, aIndex, aSide, aStack) && (this.getFuelValue(aStack) > 0 + || this.getFuelValue(GT_Utility.getFluidForFilledItem(aStack, true)) > 0); + } + + public int getCapacity() { + return 16000; + } + + public int getTankPressure() { + return -100; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java index 03c8fadad4..9c6840e33c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/custom/power/GTPP_MTE_BasicTank.java @@ -6,6 +6,8 @@ import gregtech.api.gui.GT_GUIContainer_BasicTank; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.util.GT_Utility; +import gtPlusPlus.xmod.gregtech.api.gui.power.CONTAINER_BasicTank; +import gtPlusPlus.xmod.gregtech.api.gui.power.GUI_BasicTank; import net.minecraft.entity.player.InventoryPlayer; import net.minecraft.item.ItemStack; import net.minecraft.nbt.NBTTagCompound; @@ -115,12 +117,12 @@ public abstract class GTPP_MTE_BasicTank extends GTPP_MTE_TieredMachineBlock { @Override public Object getServerGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_Container_BasicTank(aPlayerInventory, aBaseMetaTileEntity); + return new CONTAINER_BasicTank(aPlayerInventory, aBaseMetaTileEntity); } @Override public Object getClientGUI(int aID, InventoryPlayer aPlayerInventory, IGregTechTileEntity aBaseMetaTileEntity) { - return new GT_GUIContainer_BasicTank(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); + return new GUI_BasicTank(aPlayerInventory, aBaseMetaTileEntity, getLocalName()); } @Override diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java new file mode 100644 index 0000000000..68ec0ba0c9 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaPipeEntity_Heat.java @@ -0,0 +1,532 @@ +package gtPlusPlus.xmod.gregtech.api.metatileentity.implementations; + +import java.util.ArrayList; +import java.util.Arrays; + +import gregtech.GT_Mod; +import gregtech.api.enums.Dyes; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.Textures.BlockIcons; +import gregtech.api.interfaces.ITexture; +import gregtech.api.interfaces.metatileentity.IMetaTileEntity; +import gregtech.api.interfaces.tileentity.IEnergyConnected; +import gregtech.api.interfaces.tileentity.IGregTechTileEntity; +import gregtech.api.metatileentity.BaseMetaPipeEntity; +import gregtech.api.metatileentity.MetaPipeEntity; +import gregtech.api.objects.GT_RenderedTexture; +import gregtech.api.util.GT_Utility; +import gregtech.common.GT_Client; +import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.gregtech.api.interfaces.IHeatEntity; +import gtPlusPlus.xmod.gregtech.api.interfaces.IMetaTileEntityHeatPipe; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; +import ic2.api.energy.tile.IEnergySink; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.AxisAlignedBB; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class GT_MetaPipeEntity_Heat extends MetaPipeEntity implements IMetaTileEntityHeatPipe, IHeatEntity { + + public final Materials mMaterial; + public final long mHeatLossPerMeter, mAmperage, mMaxTemp; + public final boolean mInsulated, mCanShock; + public long mTransferredAmperage = 0, mTransferredAmperageLast20 = 0, mTransferredVoltageLast20 = 0; + public short mOverheat; + + private boolean mCheckConnections; + public byte mDisableInput; + + public GT_MetaPipeEntity_Heat(int aID, String aName, String aNameRegional, Materials aMaterial, long aMaxTemp) { + super(aID, aName, aNameRegional, 0); + mMaterial = aMaterial; + mAmperage = 1; + mMaxTemp = aMaxTemp; + mInsulated = false; + mCanShock = true; + mHeatLossPerMeter = aMaxTemp/1000; + } + + public GT_MetaPipeEntity_Heat(String aName, Materials aMaterial, long aMaxTemp) { + super(aName, 0); + mMaterial = aMaterial; + mAmperage = 1; + mMaxTemp = aMaxTemp; + mInsulated = false; + mCanShock = true; + mHeatLossPerMeter = aMaxTemp/1000; + } + + + @Override + public IMetaTileEntity newMetaEntity(IGregTechTileEntity aTileEntity) { + return new GT_MetaPipeEntity_Heat(mName, mMaterial, mMaxTemp); + } + + @Override + public void onEntityCollidedWithBlock(World aWorld, int aX, int aY, int aZ, Entity aEntity) { + if (mCanShock && (((BaseMetaPipeEntity) getBaseMetaTileEntity()).mConnections & -128) == 0 && aEntity instanceof EntityLivingBase) + GT_Utility.applyHeatDamage((EntityLivingBase) aEntity, mTransferredVoltageLast20); + } + + @Override + public AxisAlignedBB getCollisionBoundingBoxFromPool(World aWorld, int aX, int aY, int aZ) { + if (!mCanShock) return super.getCollisionBoundingBoxFromPool(aWorld, aX, aY, aZ); + return AxisAlignedBB.getBoundingBox(aX + 0.125D, aY + 0.125D, aZ + 0.125D, aX + 0.875D, aY + 0.875D, aZ + 0.875D); + } + + @Override + public boolean isSimpleMachine() { + return true; + } + + @Override + public boolean isFacingValid(byte aFacing) { + return false; + } + + @Override + public boolean isValidSlot(int aIndex) { + return true; + } + + @Override + public final boolean renderInside(byte aSide) { + return false; + } + + @Override + public int getProgresstime() { + return (int) mTransferredAmperage * 64; + } + + @Override + public int maxProgresstime() { + return (int) mAmperage * 64; + } + + @Override + public long injectEnergyUnits(byte aSide, long aVoltage, long aAmperage) { + if (!getBaseMetaTileEntity().getCoverBehaviorAtSide(aSide).letsEnergyIn(aSide, getBaseMetaTileEntity().getCoverIDAtSide(aSide), getBaseMetaTileEntity().getCoverDataAtSide(aSide), getBaseMetaTileEntity())) + return 0; + return transferHeat(aSide, aVoltage, aAmperage, new ArrayList<TileEntity>(Arrays.asList((TileEntity) getBaseMetaTileEntity()))); + } + + @Override + public long transferHeat(byte aSide, long aVoltage, long aAmperage, ArrayList<TileEntity> aAlreadyPassedTileEntityList) { + if (!this.isConnectedAtSide(aSide) && aSide != 6) { + return 0L; + } else { + long rUsedAmperes = 0L; + aVoltage -= this.mHeatLossPerMeter; + if (aVoltage > 0L) { + for (byte i = 0; i < 6 && aAmperage > rUsedAmperes; ++i) { + if (i != aSide && this.isConnectedAtSide(i) + && this.getBaseMetaTileEntity().getCoverBehaviorAtSide(i).letsEnergyOut(i, + this.getBaseMetaTileEntity().getCoverIDAtSide(i), + this.getBaseMetaTileEntity().getCoverDataAtSide(i), this.getBaseMetaTileEntity())) { + TileEntity tTileEntity = this.getBaseMetaTileEntity().getTileEntityAtSide(i); + if (!aAlreadyPassedTileEntityList.contains(tTileEntity)) { + aAlreadyPassedTileEntityList.add(tTileEntity); + if (tTileEntity instanceof IEnergyConnected) { + if (this.getBaseMetaTileEntity().getColorization() >= 0) { + byte tColor = ((IEnergyConnected) tTileEntity).getColorization(); + if (tColor >= 0 && tColor != this.getBaseMetaTileEntity().getColorization()) { + continue; + } + } + + if (tTileEntity instanceof IGregTechTileEntity + && ((IGregTechTileEntity) tTileEntity) + .getMetaTileEntity() instanceof IMetaTileEntityHeatPipe + && ((IGregTechTileEntity) tTileEntity) + .getCoverBehaviorAtSide(GT_Utility.getOppositeSide(i)) + .letsEnergyIn(GT_Utility.getOppositeSide(i), + ((IGregTechTileEntity) tTileEntity) + .getCoverIDAtSide(GT_Utility.getOppositeSide(i)), + ((IGregTechTileEntity) tTileEntity) + .getCoverDataAtSide(GT_Utility.getOppositeSide(i)), + (IGregTechTileEntity) tTileEntity)) { + if (((IGregTechTileEntity) tTileEntity).getTimer() > 50L) { + rUsedAmperes += ((IMetaTileEntityHeatPipe) ((IGregTechTileEntity) tTileEntity) + .getMetaTileEntity()).transferHeat(GT_Utility.getOppositeSide(i), + aVoltage, aAmperage - rUsedAmperes, + aAlreadyPassedTileEntityList); + } + } else { + rUsedAmperes += ((IEnergyConnected) tTileEntity).injectEnergyUnits( + GT_Utility.getOppositeSide(i), aVoltage, aAmperage - rUsedAmperes); + } + } else { + ForgeDirection tDirection; + + if (tTileEntity instanceof IEnergySink) { + tDirection = ForgeDirection.getOrientation(i).getOpposite(); + if (((IEnergySink) tTileEntity) + .acceptsEnergyFrom((TileEntity) this.getBaseMetaTileEntity(), tDirection) + && ((IEnergySink) tTileEntity).getDemandedEnergy() > 0.0D + && ((IEnergySink) tTileEntity).injectEnergy(tDirection, (double) aVoltage, + (double) aVoltage) < (double) aVoltage) { + ++rUsedAmperes; + } + } + } + } + } + } + } + + this.mTransferredAmperage += rUsedAmperes; + this.mTransferredVoltageLast20 = Math.max(this.mTransferredVoltageLast20, aVoltage); + this.mTransferredAmperageLast20 = Math.max(this.mTransferredAmperageLast20, this.mTransferredAmperage); + if (aVoltage <= this.mMaxTemp && this.mTransferredAmperage <= this.mAmperage) { + return rUsedAmperes; + } else { + if (this.mOverheat > GT_Mod.gregtechproxy.mWireHeatingTicks * 100) { + //this.getBaseMetaTileEntity().setToFire(); + } else { + this.mOverheat = (short) (this.mOverheat + 100); + } + + return aAmperage; + } + } + } + + @Override + public void onPostTick(IGregTechTileEntity aBaseMetaTileEntity, long aTick) { + if (aBaseMetaTileEntity.isServerSide()) { + this.mTransferredAmperage = 0L; + if (this.mOverheat > 0) { + --this.mOverheat; + } + + if (aTick % 20L == 0L) { + this.mTransferredVoltageLast20 = 0L; + this.mTransferredAmperageLast20 = 0L; + + for (byte tSide = 0; tSide < 6; ++tSide) { + IGregTechTileEntity tBaseMetaTileEntity = aBaseMetaTileEntity.getIGregTechTileEntityAtSide(tSide); + byte uSide = GT_Utility.getOppositeSide(tSide); + if ((this.mCheckConnections || this.isConnectedAtSide(tSide) + || aBaseMetaTileEntity.getCoverBehaviorAtSide(tSide).alwaysLookConnected(tSide, + aBaseMetaTileEntity.getCoverIDAtSide(tSide), + aBaseMetaTileEntity.getCoverDataAtSide(tSide), aBaseMetaTileEntity) + || tBaseMetaTileEntity != null && tBaseMetaTileEntity.getCoverBehaviorAtSide(uSide) + .alwaysLookConnected(uSide, tBaseMetaTileEntity.getCoverIDAtSide(uSide), + tBaseMetaTileEntity.getCoverDataAtSide(uSide), tBaseMetaTileEntity)) + && this.connect(tSide) == 0) { + this.disconnect(tSide); + } + } + + if (isGT6Pipes()) { + this.mCheckConnections = false; + } + } + } else if (aBaseMetaTileEntity.isClientSide() && GT_Client.changeDetected == 4) { + aBaseMetaTileEntity.issueTextureUpdate(); + } + + } + + @Override + public boolean allowPullStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; + } + + @Override + public boolean allowPutStack(IGregTechTileEntity aBaseMetaTileEntity, int aIndex, byte aSide, ItemStack aStack) { + return false; + } + + @Override + public String[] getDescription() { + return new String[]{ + "Max Voltage: " + EnumChatFormatting.GOLD + mMaxTemp + "C" + EnumChatFormatting.GRAY, + "Loss: " + EnumChatFormatting.RED + mHeatLossPerMeter + EnumChatFormatting.GRAY + " HU per meter", + CORE.GT_Tooltip + }; + } + + @Override + public float getThickNess() { + return 1; + } + + @Override + public void saveNBTData(NBTTagCompound aNBT) { + aNBT.setInteger("HeatBuffer", this.HeatBuffer); + } + + @Override + public void loadNBTData(NBTTagCompound aNBT) { + this.HeatBuffer = aNBT.getInteger("HeatBuffer"); + } + + + + + + + + + + + + + + protected int transmitHeat; + protected int maxHeatEmitpeerTick; + protected int HeatBuffer; + + + + + public byte getTileEntityBaseType() { + return 4; + } + + public ITexture[] getTexture(IGregTechTileEntity aBaseMetaTileEntity, byte aSide, byte aConnections, + byte aColorIndex, boolean aConnected, boolean aRedstone) { + float tThickNess = this.getThickNess(); + if (this.mDisableInput == 0) { + return new ITexture[]{(ITexture) (aConnected + ? getBaseTexture(tThickNess, 1, this.mMaterial, aColorIndex) + : new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, this.mMaterial.mRGBa)))}; + } else { + byte tMask = 0; + byte[][] sRestrictionArray = new byte[][]{{2, 3, 5, 4}, {2, 3, 4, 5}, {1, 0, 4, 5}, {1, 0, 4, 5}, + {1, 0, 2, 3}, {1, 0, 2, 3}}; + if (aSide >= 0 && aSide < 6) { + for (byte i = 0; i < 4; ++i) { + if (this.isInputDisabledAtSide(sRestrictionArray[aSide][i])) { + tMask = (byte) (tMask | 1 << i); + } + } + } + + return new ITexture[]{ + (ITexture) (aConnected + ? getBaseTexture(tThickNess, 1, this.mMaterial, aColorIndex) + : new GT_RenderedTexture(this.mMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, this.mMaterial.mRGBa))), + getRestrictorTexture(tMask)}; + } + } + + protected static final ITexture getBaseTexture(float aThickNess, int aPipeAmount, Materials aMaterial, + byte aColorIndex) { + if (aPipeAmount >= 9) { + return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeNonuple.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } else if (aPipeAmount >= 4) { + return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeQuadruple.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } else if (aThickNess < 0.124F) { + return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipe.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } else if (aThickNess < 0.374F) { + return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeTiny.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } else if (aThickNess < 0.499F) { + return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeSmall.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } else if (aThickNess < 0.749F) { + return new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeMedium.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } else { + return aThickNess < 0.874F + ? new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeLarge.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)) + : new GT_RenderedTexture(aMaterial.mIconSet.mTextures[OrePrefixes.pipeHuge.mTextureIndex], + Dyes.getModulation(aColorIndex, aMaterial.mRGBa)); + } + } + + protected static final ITexture getRestrictorTexture(byte aMask) { + switch (aMask) { + case 1 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UP); + case 2 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DOWN); + case 3 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UD); + case 4 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_LEFT); + case 5 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UL); + case 6 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DL); + case 7 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NR); + case 8 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_RIGHT); + case 9 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_UR); + case 10 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_DR); + case 11 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NL); + case 12 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_LR); + case 13 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_ND); + case 14 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR_NU); + case 15 : + return new GT_RenderedTexture(BlockIcons.PIPE_RESTRICTOR); + default : + return null; + } + } + + + public final boolean isGT6Pipes() { + return StaticFields59.mGT6StylePipes; + } + + public void updateHeatEntity() { + int amount = this.getMaxHeatEmittedPerTick() - this.HeatBuffer; + if (amount > 0) { + this.addtoHeatBuffer(this.fillHeatBuffer(amount)); + } + } + + public boolean facingMatchesDirection(ForgeDirection direction) { + return true; + } + + public int maxrequestHeatTick(ForgeDirection directionFrom) { + return this.getMaxHeatEmittedPerTick(); + } + + public int requestHeat(ForgeDirection directionFrom, int requestheat) { + if (this.facingMatchesDirection(directionFrom)) { + int heatbuffertemp = this.getHeatBuffer(); + if (this.getHeatBuffer() >= requestheat) { + this.setHeatBuffer(this.getHeatBuffer() - requestheat); + this.transmitHeat = requestheat; + return requestheat; + } else { + this.transmitHeat = heatbuffertemp; + this.setHeatBuffer(0); + return heatbuffertemp; + } + } else { + return 0; + } + } + + + public int getHeatBuffer() { + return this.HeatBuffer; + } + + public void setHeatBuffer(int HeatBuffer) { + this.HeatBuffer = HeatBuffer; + } + + public void addtoHeatBuffer(int heat) { + this.setHeatBuffer(this.getHeatBuffer() + heat); + } + + + public int fillHeatBuffer(int maxAmount) { + return maxAmount >= this.getMaxHeatEmittedPerTick() ? this.getMaxHeatEmittedPerTick() : maxAmount; + } + + public int getMaxHeatEmittedPerTick() { + return (int) (this.mMaxTemp/1000); + } + + + public boolean onWrenchRightClick(byte aSide, byte aWrenchingSide, EntityPlayer aPlayer, float aX, float aY, + float aZ) { + if (isGT6Pipes()) { + byte tSide = GT_Utility.determineWrenchingSide(aSide, aX, aY, aZ); + byte tMask = (byte) (1 << tSide); + if (aPlayer.isSneaking()) { + if (this.isInputDisabledAtSide(tSide)) { + this.mDisableInput = (byte) (this.mDisableInput & ~tMask); + GT_Utility.sendChatToPlayer(aPlayer, this.trans("212", "Input enabled")); + if (!this.isConnectedAtSide(tSide)) { + this.connect(tSide); + } + } else { + this.mDisableInput |= tMask; + GT_Utility.sendChatToPlayer(aPlayer, this.trans("213", "Input disabled")); + } + } else if (!this.isConnectedAtSide(tSide)) { + if (this.connect(tSide) > 0) { + GT_Utility.sendChatToPlayer(aPlayer, this.trans("214", "Connected")); + } + } else { + this.disconnect(tSide); + GT_Utility.sendChatToPlayer(aPlayer, this.trans("215", "Disconnected")); + } + + return true; + } else { + return false; + } + } + + public boolean isInputDisabledAtSide(int aSide) { + return (this.mDisableInput & 1 << aSide) != 0; + } + + + + + @Override + public int maxHeatInPerTick(ForgeDirection var1) { + return (int) (this.mMaxTemp/500); + } + + @Override + public int addHeat(ForgeDirection var1, int var2) { + + + + /*ForgeDirection dir = ForgeDirection.getOrientation(this.getFacing()); + TileEntity te = this.getBaseMetaTileEntity().getWorld().getTileEntity(this.xCoord + dir.offsetX, this.yCoord + dir.offsetY, + this.zCoord + dir.offsetZ); + if (te instanceof IHeatSource) { + int heatbandwith = ((IHeatSource) te).maxrequestHeatTick(dir.getOpposite()); + double freeEUstorage = (double) this.maxEUStorage - this.EUstorage; + if (freeEUstorage >= this.productionpeerheat * (double) heatbandwith) { + this.receivedheat = ((IHeatSource) te).requestHeat(dir.getOpposite(), heatbandwith); + if (this.receivedheat != 0) { + this.production = (double) this.receivedheat * this.productionpeerheat; + this.EUstorage += this.production; + return true; + } + } + } + + this.production = 0.0D; + this.receivedheat = 0;*/ + + + return 0; + } + + @Override + public int getTransmitHeat() { + return this.transmitHeat; + } + + + + + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java index 5ce74588fa..8c0c47bea2 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_Hatch_Muffler_Adv.java @@ -6,7 +6,6 @@ import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Config; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.util.minecraft.gregtech.PollutionUtils; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; import gtPlusPlus.xmod.gregtech.common.StaticFields59; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; import net.minecraft.entity.player.EntityPlayer; @@ -24,7 +23,7 @@ public class GT_MetaTileEntity_Hatch_Muffler_Adv extends GT_MetaTileEntity_Hatch super.onConfigLoad(aConfig); if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK || CORE.GTNH) { try { - Integer a1 = (int) Meta_GT_Proxy.getFieldFromGregtechProxy(false, "mPollutionSmogLimit"); + Integer a1 = (int) StaticFields59.getFieldFromGregtechProxy(false, "mPollutionSmogLimit"); if (a1 != null && a1 > 0) { mPollutionSmogLimit = a1; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java index 5e41af86af..d6906c7b67 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GT_MetaTileEntity_SuperBus_Input.java @@ -187,7 +187,7 @@ public class GT_MetaTileEntity_SuperBus_Input extends GT_MetaTileEntity_Hatch_In if (s.startsWith(" ")) { s = s.substring(1); } - superString += (s+"\r\n"); + superString += (s+", "); } PlayerUtils.messagePlayer(aPlayer, superString); } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java index f6056af87a..929dee22e4 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/GregtechMetaPipeEntityFluid.java @@ -15,7 +15,7 @@ import gregtech.api.objects.GT_RenderedTexture; import gtPlusPlus.core.lib.CORE; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; -import gtPlusPlus.xmod.gregtech.common.Meta_GT_Proxy; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { @@ -23,7 +23,7 @@ public class GregtechMetaPipeEntityFluid extends GT_MetaPipeEntity_Fluid { public static final boolean mGt6Pipe; static { - Boolean aGt6 = (Boolean) Meta_GT_Proxy.getFieldFromGregtechProxy(false, "gt6Pipe"); + Boolean aGt6 = (Boolean) StaticFields59.getFieldFromGregtechProxy(false, "gt6Pipe"); if (aGt6 != null) { mGt6Pipe = aGt6; } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java index d188202324..516f78038d 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/api/metatileentity/implementations/base/GregtechMeta_MultiBlockBase.java @@ -273,7 +273,7 @@ GT_MetaTileEntity_MultiBlockBase { public final static String TAG_HIDE_HATCHES = "TAG_HIDE_HATCHES"; public final static String TAG_HIDE_POLLUTION = "TAG_HIDE_POLLUTION"; public final static String TAG_HIDE_MACHINE_TYPE = "TAG_HIDE_MACHINE_TYPE"; - + @Override public final String[] getDescription() { /*if (aCachedToolTip != null) { @@ -291,13 +291,13 @@ GT_MetaTileEntity_MultiBlockBase { aCachedToolTip = null; } }*/ - + String aRequiresMuffler = "1x Muffler Hatch"; String aRequiresCoreModule = "1x Core Module"; String aRequiresMaint = "1x Maintanence Hatch"; - + String[] x = getTooltip(); - + //Filter List, toggle switches, rebuild map without flags boolean showHatches = true; boolean showMachineType = true; @@ -323,8 +323,8 @@ GT_MetaTileEntity_MultiBlockBase { for (int ee = 0; ee < x.length; ee++) { x[ee] = aTempMap.get(ee); } - - + + //Assemble ordered map for misc tooltips AutoMap<String> aOrderedMap = new AutoMap<String>(); if (showHatches) { @@ -338,15 +338,15 @@ GT_MetaTileEntity_MultiBlockBase { if (showMachineType) { aOrderedMap.put(getMachineTooltip()); } - + if (showPollution) { aOrderedMap.put(getPollutionTooltip()); } - - - - - + + + + + //Add Stock Tooltip to bottom of list String[] z; z = new String[aOrderedMap.size()]; @@ -476,62 +476,6 @@ GT_MetaTileEntity_MultiBlockBase { } return true; } - - private int boostOutput(int aAmount) { - if (aAmount <= 0) { - return 10000; - } - if (aAmount <= 250) { - aAmount += MathUtils.randInt(Math.max(aAmount/2, 1), aAmount*2); - } - else if (aAmount <= 500) { - aAmount += MathUtils.randInt(Math.max(aAmount/2, 1), aAmount*2); - } - else if (aAmount <= 750) { - aAmount += MathUtils.randInt(Math.max(aAmount/2, 1), aAmount*2); - } - else if (aAmount <= 1000) { - aAmount = (aAmount*2); - } - else if (aAmount <= 1500) { - aAmount = (aAmount*2); - } - else if (aAmount <= 2000) { - aAmount = (int) (aAmount*1.5); - } - else if (aAmount <= 3000) { - aAmount = (int) (aAmount*1.5); - } - else if (aAmount <= 4000) { - aAmount = (int) (aAmount*1.2); - } - else if (aAmount <= 5000) { - aAmount = (int) (aAmount*1.2); - } - else if (aAmount <= 7000) { - aAmount = (int) (aAmount*1.2); - } - else if (aAmount <= 9000) { - aAmount = (int) (aAmount*1.1); - } - return Math.min(10000, aAmount); - } - - public GT_Recipe generateAdditionalOutputForRecipe(GT_Recipe aRecipe) { - AutoMap<Integer> aNewChances = new AutoMap<Integer>(); - for (int chance : aRecipe.mChances) { - aNewChances.put(boostOutput(chance)); - } - GT_Recipe aClone = aRecipe.copy(); - int[] aTemp = new int[aNewChances.size()]; - int slot = 0; - for (int g : aNewChances) { - aTemp[slot] = g; - slot++; - } - aClone.mChances = aTemp; - return aClone; - } /** * A Static {@link Method} object which holds the current status of logging. @@ -539,23 +483,16 @@ GT_MetaTileEntity_MultiBlockBase { public static Method aLogger = null; public void log(String s) { + boolean isDebugLogging = CORE.DEBUG; boolean reset = true; - - if (!isDebugLogging) { - return; - } - + if (aLogger == null || reset) { if (isDebugLogging) { - try { - aLogger = Logger.class.getMethod("INFO", String.class); - } catch (NoSuchMethodException | SecurityException e) {} + aLogger = ReflectionUtils.getMethod(Logger.class, "INFO", String.class); } else { - try { - aLogger = Logger.class.getMethod("MACHINE_INFO", String.class); - } catch (NoSuchMethodException | SecurityException e) {} + aLogger = ReflectionUtils.getMethod(Logger.class, "MACHINE_INFO", String.class); } } try { @@ -606,38 +543,195 @@ GT_MetaTileEntity_MultiBlockBase { ItemStack[] aItemInputs, FluidStack[] aFluidInputs, int aMaxParallelRecipes, int aEUPercent, int aSpeedBonusPercent, int aOutputChanceRoll, GT_Recipe aRecipe) { + // Based on the Processing Array. A bit overkill, but very flexible. + + if (this.doesMachineBoostOutput()) { + log("Boosting."); + return checkRecipeBoostedOutputs(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, aRecipe); + } + + + //Control Core to control the Multiblocks behaviour. + int aControlCoreTier = getControlCoreTier(); + + //If no core, return false; + if (aControlCoreTier > 0) { + log("Control core found."); + } + + + // Reset outputs and progress stats + this.mEUt = 0; + this.mMaxProgresstime = 0; + this.mOutputItems = new ItemStack[]{}; + this.mOutputFluids = new FluidStack[]{}; + long tVoltage = getMaxInputVoltage(); byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); + log("Running checkRecipeGeneric(0)"); + + //Check to see if Voltage Tier > Control Core Tier + if (tTier > aControlCoreTier) { + log("Control core found is lower tier than power tier. OK"); + tTier = (byte) aControlCoreTier; + } + GT_Recipe tRecipe = aRecipe != null ? aRecipe : findRecipe( getBaseMetaTileEntity(), mLastRecipe, false, gregtech.api.enums.GT_Values.V[tTier], aFluidInputs, aItemInputs); + log("Running checkRecipeGeneric(1)"); + // Remember last recipe - an optimization for findRecipe() + this.mLastRecipe = tRecipe; + if (tRecipe == null) { log("BAD RETURN - 1"); return false; } - - //Boost output if machine implements this strategy - if (doesMachineBoostOutput()) { - return checkRecipeBoostedOutputs(aItemInputs, aFluidInputs, aMaxParallelRecipes, aEUPercent, aSpeedBonusPercent, aOutputChanceRoll, tRecipe); - } - else { - return checkRecipeGeneric(tRecipe, aSpeedBonusPercent, aOutputChanceRoll); + + if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { + log("BAD RETURN - 2"); + return false; } - + + // EU discount + float tRecipeEUt = (tRecipe.mEUt * aEUPercent) / 100.0f; + float tTotalEUt = 0.0f; + + int parallelRecipes = 0; + + log("parallelRecipes: "+parallelRecipes); + log("aMaxParallelRecipes: "+aMaxParallelRecipes); + log("tTotalEUt: "+tTotalEUt); + log("tVoltage: "+tVoltage); + log("tRecipeEUt: "+tRecipeEUt); + // Count recipes to do in parallel, consuming input items and fluids and considering input voltage limits + for (; parallelRecipes < aMaxParallelRecipes && tTotalEUt < (tVoltage - tRecipeEUt); parallelRecipes++) { + if (!tRecipe.isRecipeInputEqual(true, aFluidInputs, aItemInputs)) { + log("Broke at "+parallelRecipes+"."); + break; + } + log("Bumped EU from "+tTotalEUt+" to "+(tTotalEUt+tRecipeEUt)+"."); + tTotalEUt += tRecipeEUt; + } + + if (parallelRecipes == 0) { + log("BAD RETURN - 3"); + return false; + } + + // -- Try not to fail after this point - inputs have already been consumed! -- + + + // Convert speed bonus to duration multiplier + // e.g. 100% speed bonus = 200% speed = 100%/200% = 50% recipe duration. + aSpeedBonusPercent = Math.max(-99, aSpeedBonusPercent); + float tTimeFactor = 100.0f / (100.0f + aSpeedBonusPercent); + this.mMaxProgresstime = (int)(tRecipe.mDuration * tTimeFactor); + + this.mEUt = (int)Math.ceil(tTotalEUt); + + this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); + this.mEfficiencyIncrease = 10000; + + // Overclock + if (this.mEUt <= 16) { + this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); + this.mMaxProgresstime = (this.mMaxProgresstime / (1 << tTier - 1)); + } else { + while (this.mEUt <= gregtech.api.enums.GT_Values.V[(tTier - 1)]) { + this.mEUt *= 4; + this.mMaxProgresstime /= 2; + } + } + + if (this.mEUt > 0) { + this.mEUt = (-this.mEUt); + } + + this.mMaxProgresstime = Math.max(1, this.mMaxProgresstime); + + // Collect fluid outputs + FluidStack[] tOutputFluids = new FluidStack[tRecipe.mFluidOutputs.length]; + for (int h = 0; h < tRecipe.mFluidOutputs.length; h++) { + if (tRecipe.getFluidOutput(h) != null) { + tOutputFluids[h] = tRecipe.getFluidOutput(h).copy(); + tOutputFluids[h].amount *= parallelRecipes; + } + } + + // Collect output item types + ItemStack[] tOutputItems = new ItemStack[tRecipe.mOutputs.length]; + for (int h = 0; h < tRecipe.mOutputs.length; h++) { + if (tRecipe.getOutput(h) != null) { + tOutputItems[h] = tRecipe.getOutput(h).copy(); + tOutputItems[h].stackSize = 0; + } + } + + // Set output item stack sizes (taking output chance into account) + for (int f = 0; f < tOutputItems.length; f++) { + if (tRecipe.mOutputs[f] != null && tOutputItems[f] != null) { + for (int g = 0; g < parallelRecipes; g++) { + if (getBaseMetaTileEntity().getRandomNumber(aOutputChanceRoll) < tRecipe.getOutputChance(f)) + tOutputItems[f].stackSize += tRecipe.mOutputs[f].stackSize; + } + } + } + + tOutputItems = removeNulls(tOutputItems); + + // Sanitize item stack size, splitting any stacks greater than max stack size + List<ItemStack> splitStacks = new ArrayList<ItemStack>(); + for (ItemStack tItem : tOutputItems) { + while (tItem.getMaxStackSize() < tItem.stackSize) { + ItemStack tmp = tItem.copy(); + tmp.stackSize = tmp.getMaxStackSize(); + tItem.stackSize = tItem.stackSize - tItem.getMaxStackSize(); + splitStacks.add(tmp); + } + } + + if (splitStacks.size() > 0) { + ItemStack[] tmp = new ItemStack[splitStacks.size()]; + tmp = splitStacks.toArray(tmp); + tOutputItems = ArrayUtils.addAll(tOutputItems, tmp); + } + + // Strip empty stacks + List<ItemStack> tSList = new ArrayList<ItemStack>(); + for (ItemStack tS : tOutputItems) { + if (tS.stackSize > 0) tSList.add(tS); + } + tOutputItems = tSList.toArray(new ItemStack[tSList.size()]); + + // Commit outputs + this.mOutputItems = tOutputItems; + this.mOutputFluids = tOutputFluids; + updateSlots(); + + // Play sounds (GT++ addition - GT multiblocks play no sounds) + startProcess(); + + log("GOOD RETURN - 1"); + return true; } - + + + + + /* * Here we handle recipe boosting, which grants additional output %'s to recipes that do not have 100%. */ - + private boolean mHasBoostedCurrentRecipe = false; private GT_Recipe mBoostedRecipe = null; private ItemStack[] mInputVerificationForBoosting = null; - + /** * Does this machine boost it's output? * @return - if true, gives additional % to output chances. @@ -646,6 +740,65 @@ GT_MetaTileEntity_MultiBlockBase { return false; } + + + private int boostOutput(int aAmount) { + if (aAmount <= 0) { + return 10000; + } + if (aAmount <= 250) { + aAmount += MathUtils.randInt(Math.max(aAmount/2, 1), aAmount*2); + } + else if (aAmount <= 500) { + aAmount += MathUtils.randInt(Math.max(aAmount/2, 1), aAmount*2); + } + else if (aAmount <= 750) { + aAmount += MathUtils.randInt(Math.max(aAmount/2, 1), aAmount*2); + } + else if (aAmount <= 1000) { + aAmount = (aAmount*2); + } + else if (aAmount <= 1500) { + aAmount = (aAmount*2); + } + else if (aAmount <= 2000) { + aAmount = (int) (aAmount*1.5); + } + else if (aAmount <= 3000) { + aAmount = (int) (aAmount*1.5); + } + else if (aAmount <= 4000) { + aAmount = (int) (aAmount*1.2); + } + else if (aAmount <= 5000) { + aAmount = (int) (aAmount*1.2); + } + else if (aAmount <= 7000) { + aAmount = (int) (aAmount*1.2); + } + else if (aAmount <= 9000) { + aAmount = (int) (aAmount*1.1); + } + return Math.min(10000, aAmount); + } + + public GT_Recipe generateAdditionalOutputForRecipe(GT_Recipe aRecipe) { + AutoMap<Integer> aNewChances = new AutoMap<Integer>(); + for (int chance : aRecipe.mChances) { + aNewChances.put(boostOutput(chance)); + } + GT_Recipe aClone = aRecipe.copy(); + int[] aTemp = new int[aNewChances.size()]; + int slot = 0; + for (int g : aNewChances) { + aTemp[slot] = g; + slot++; + } + aClone.mChances = aTemp; + return aClone; + } + + /** * Processes recipes but provides a bonus to the output % of items if they are < 100%. * @@ -708,6 +861,11 @@ GT_MetaTileEntity_MultiBlockBase { mHasBoostedCurrentRecipe = true; tRecipe = mBoostedRecipe; } + //Bad boost + else { + mBoostedRecipe = null; + mHasBoostedCurrentRecipe = false; + } } } //We have changed inputs, so we should generate a new boosted recipe @@ -718,6 +876,11 @@ GT_MetaTileEntity_MultiBlockBase { mHasBoostedCurrentRecipe = true; tRecipe = mBoostedRecipe; } + //Bad boost + else { + mBoostedRecipe = null; + mHasBoostedCurrentRecipe = false; + } } //Bad modify, let's just use the original recipe. @@ -734,67 +897,6 @@ GT_MetaTileEntity_MultiBlockBase { log("BAD RETURN - 1"); return false; } - - // -- Try not to fail after this point - inputs have already been consumed! -- - return checkRecipeGeneric(tRecipe, aSpeedBonusPercent, aOutputChanceRoll); - } - - - /** - * Directly processes a recipe from a non-generic recipe handler - * @param aRecipe - A pre-modified GT_Recipe - * @return - Did we process? - */ - public boolean checkRecipeGeneric(GT_Recipe tRecipe, int rSpeedBonus, int aMaxOutputChance) { - // Based on the Processing Array. A bit overkill, but very flexible. - - if (tRecipe == null) { - return false; - } - - - ItemStack[] aItemInputs = tRecipe.mInputs; - FluidStack[] aFluidInputs = tRecipe.mFluidInputs; - int aMaxParallelRecipes = getMaxParallelRecipes(); - int aEUPercent = this.getEuDiscountForParallelism(); - int aSpeedBonusPercent = rSpeedBonus; - int aOutputChanceRoll = aMaxOutputChance; - - - - //Control Core to control the Multiblocks behaviour. - int aControlCoreTier = getControlCoreTier(); - - //If no core, return false; - if (aControlCoreTier == 0 && requireControlCores) { - log("No control core found."); - return false; - } - - // Reset outputs and progress stats - this.mEUt = 0; - this.mMaxProgresstime = 0; - this.mOutputItems = new ItemStack[]{}; - this.mOutputFluids = new FluidStack[]{}; - - long tVoltage = getMaxInputVoltage(); - byte tTier = (byte) Math.max(1, GT_Utility.getTier(tVoltage)); - log("Running checkRecipeGeneric(0)"); - - //Check to see if Voltage Tier > Control Core Tier - if (tTier > aControlCoreTier && requireControlCores) { - log("Control core found is lower tier than power tier."); - return false; - } - - log("Running checkRecipeGeneric(1)"); - // Remember last recipe - an optimization for findRecipe() - this.mLastRecipe = tRecipe; - - if (tRecipe == null) { - log("BAD RETURN - 1"); - return false; - } if (!this.canBufferOutputs(tRecipe, aMaxParallelRecipes)) { log("BAD RETURN - 2"); @@ -841,11 +943,6 @@ GT_MetaTileEntity_MultiBlockBase { this.mEfficiency = (10000 - (getIdealStatus() - getRepairStatus()) * 1000); this.mEfficiencyIncrease = 10000; - - //Only Overclock as high as the control circuit. - byte tTierOld = tTier; - tTier = getControlCoreTier() > 0 ? (byte) aControlCoreTier : tTierOld; - // Overclock if (this.mEUt <= 16) { this.mEUt = (this.mEUt * (1 << tTier - 1) * (1 << tTier - 1)); @@ -929,40 +1026,30 @@ GT_MetaTileEntity_MultiBlockBase { return true; } - public GT_Recipe reduceRecipeTimeByPercentage(final GT_Recipe tRecipe, - final float percentage) { - int cloneTime = 0; - GT_Recipe baseRecipe; - GT_Recipe cloneRecipe = null; - baseRecipe = tRecipe.copy(); - if ((baseRecipe != null) && ((cloneRecipe != baseRecipe) || (cloneRecipe == null))) { - cloneRecipe = baseRecipe.copy(); - log("Setting Recipe"); - } - if ((baseRecipe != null) && ((cloneTime != baseRecipe.mDuration) || (cloneTime == 0))) { - cloneTime = baseRecipe.mDuration; - log("Setting Time"); - } - if ((cloneRecipe != null) && cloneRecipe.mDuration > 0) { - final int originalTime = cloneRecipe.mDuration; - final int tempTime = MathUtils.findPercentageOfInt(cloneRecipe.mDuration, - (100 - percentage)); - cloneRecipe.mDuration = tempTime; - if (cloneRecipe.mDuration < originalTime) { - log("Generated recipe with a smaller time. | " - + originalTime + " | " + cloneRecipe.mDuration + " |"); - return cloneRecipe; - } else { - log("Did not generate recipe with a smaller time. | " - + originalTime + " | " + cloneRecipe.mDuration + " |"); - return tRecipe; - } - } - log("Error generating recipe, returning null."); - return null; - } + + + + + + + + + + + + + + + + + + + + + + public boolean isMachineRunning() { boolean aRunning = this.getBaseMetaTileEntity().isActive(); @@ -1156,13 +1243,13 @@ GT_MetaTileEntity_MultiBlockBase { } public int getControlCoreTier() { - + //Always return best tier if config is off. /*boolean aCoresConfig = gtPlusPlus.core.lib.CORE.ConfigSwitches.requireControlCores; if (!aCoresConfig) { return 10; }*/ - + if (mControlCoreBus.isEmpty()) { log("No Control Core Modules Found."); return 0; @@ -1202,9 +1289,9 @@ GT_MetaTileEntity_MultiBlockBase { log("Tried to add a secondary control core module."); return false; } - + GT_MetaTileEntity_Hatch_ControlCore Module = (GT_MetaTileEntity_Hatch_ControlCore) aMetaTileEntity; - + if (Module != null) { if (Module.setOwner(aTileEntity)) { log("Adding control core module."); @@ -1493,12 +1580,12 @@ GT_MetaTileEntity_MultiBlockBase { @SuppressWarnings("rawtypes") public boolean isThisHatchMultiDynamo(Object aMetaTileEntity){ Class mDynamoClass; - mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); - if (mDynamoClass != null){ - if (mDynamoClass.isInstance(aMetaTileEntity)){ - return true; - } + mDynamoClass = ReflectionUtils.getClass("com.github.technus.tectech.thing.metaTileEntity.hatch.GT_MetaTileEntity_Hatch_DynamoMulti"); + if (mDynamoClass != null){ + if (mDynamoClass.isInstance(aMetaTileEntity)){ + return true; } + } return false; } @@ -1530,7 +1617,7 @@ GT_MetaTileEntity_MultiBlockBase { return ""; } } - + private static Method calculatePollutionReduction; public int calculatePollutionReductionForHatch(GT_MetaTileEntity_Hatch_Muffler i , int g) { if (calculatePollutionReduction == null) { @@ -1784,17 +1871,17 @@ GT_MetaTileEntity_MultiBlockBase { } public abstract boolean checkMultiblock(IGregTechTileEntity aBaseMetaTileEntity, ItemStack aStack); - - + + public boolean isValidBlockForStructure(IGregTechTileEntity aBaseMetaTileEntity, int aCasingID, boolean canBeHatch, Block aFoundBlock, int aFoundMeta, Block aExpectedBlock, int aExpectedMeta) { boolean isHatch = false; if (aBaseMetaTileEntity != null) { - + if (aCasingID < 64) { aCasingID = TAE.GTPP_INDEX(aCasingID); } - + isHatch = this.addToMachineList(aBaseMetaTileEntity, aCasingID); if (isHatch) { return true; diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java index 6b4bab9e26..7505c2a808 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/Meta_GT_Proxy.java @@ -5,7 +5,6 @@ import static gtPlusPlus.xmod.gregtech.common.covers.GTPP_Cover_Overflow.mOverfl import java.lang.reflect.Constructor; import java.lang.reflect.InvocationTargetException; import java.util.ArrayList; -import java.util.Collection; import java.util.HashMap; import java.util.LinkedHashMap; import java.util.List; @@ -16,7 +15,6 @@ import java.util.TimerTask; import cpw.mods.fml.common.registry.GameRegistry; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; -import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.GT_Values; import gregtech.api.enums.Materials; @@ -24,11 +22,8 @@ import gregtech.api.interfaces.tileentity.IGregTechTileEntity; import gregtech.api.metatileentity.BaseMetaTileEntity; import gregtech.api.util.GT_LanguageManager; import gregtech.api.util.GT_Log; -import gregtech.api.util.GT_Recipe; -import gregtech.api.util.GT_Recipe.GT_Recipe_Map; import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT; -import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; import gregtech.common.GT_Proxy; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.api.objects.data.AutoMap; @@ -39,11 +34,8 @@ import gtPlusPlus.core.lib.CORE; import gtPlusPlus.core.material.ELEMENT; import gtPlusPlus.core.util.minecraft.FluidUtils; import gtPlusPlus.core.util.minecraft.MaterialUtils; -import gtPlusPlus.core.util.reflect.ProxyFinder; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.metatileentity.BaseCustomTileEntity; import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.BaseCustomPower_MTE; -import gtPlusPlus.xmod.gregtech.loaders.misc.AssLineAchievements; import net.minecraft.block.Block; import net.minecraft.client.renderer.texture.IIconRegister; import net.minecraft.entity.player.EntityPlayer; @@ -98,6 +90,9 @@ public class Meta_GT_Proxy { GT_Log.out.println("GT++ Mod: Fatal Error ocurred while initializing TileEntities, crashing Minecraft."); throw new RuntimeException(""); } + + //Gotta set it here so that we don't try call gregtech too early. + StaticFields59.mGT6StylePipes = (boolean) StaticFields59.getFieldFromGregtechProxy(true, "gt6Pipe"); GT_Log.out.println("GT++ Mod: Registering the BaseMetaTileEntity."); GameRegistry.registerTileEntity(tBaseMetaTileEntity.getClass(), "BaseMetaTileEntity_GTPP"); @@ -375,37 +370,13 @@ public class Meta_GT_Proxy { } - private static GT_Proxy[] mProxies = new GT_Proxy[2]; + static GT_Proxy[] mProxies = new GT_Proxy[2]; + /** + * @deprecated Use {@link StaticFields59#getFieldFromGregtechProxy(boolean,String)} instead + */ public static Object getFieldFromGregtechProxy(boolean client, String fieldName) { - Object proxyGT; - - if (mProxies[0] != null && client) { - proxyGT = mProxies[0]; - } else if (mProxies[1] != null && !client) { - proxyGT = mProxies[1]; - } else { - try { - proxyGT = (client ? ProxyFinder.getClientProxy(GT_Mod.instance) - : ProxyFinder.getServerProxy(GT_Mod.instance)); - } catch (final ReflectiveOperationException e1) { - proxyGT = null; - Logger.INFO("Failed to obtain instance of GT " + (client ? "Client" : "Server") + " proxy."); - } - if (mProxies[0] == null && client) { - mProxies[0] = (GT_Proxy) proxyGT; - } else if (mProxies[1] == null && !client) { - mProxies[1] = (GT_Proxy) proxyGT; - } - } - - if (proxyGT != null && proxyGT instanceof GT_Proxy) { - try { - return ReflectionUtils.getField(proxyGT.getClass(), fieldName).get(proxyGT); - } catch (IllegalArgumentException | IllegalAccessException e) { - } - } - return null; + return StaticFields59.getFieldFromGregtechProxy(client, fieldName); } public void setCustomGregtechTooltip(String aNbtTagName, FormattedTooltipString aData) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java index 1604cc5acd..2a3fd5e77c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/StaticFields59.java @@ -9,6 +9,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; +import gregtech.GT_Mod; import gregtech.api.GregTech_API; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; @@ -18,14 +19,19 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Muffl import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_TieredMachineBlock; import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe.GT_Recipe_Map; +import gregtech.common.GT_Proxy; import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.core.util.reflect.ProxyFinder; import gtPlusPlus.core.util.reflect.ReflectionUtils; import net.minecraft.block.Block; import net.minecraft.item.ItemStack; public class StaticFields59 { + + public static boolean mGT6StylePipes; + public static final Field mGtBlockCasings5; public static final Field mPreventableComponents; public static final Field mDisabledItems; @@ -45,6 +51,7 @@ public class StaticFields59 { static { Logger.INFO("[SH] Creating Static Helper for various fields which require reflective access."); + mGtBlockCasings5 = getField(GregTech_API.class, "sBlockCasings5"); Logger.INFO("[SH] Got Field: sBlockCasings5"); mPreventableComponents = getField(OrePrefixes.class, "mPreventableComponents"); @@ -176,5 +183,36 @@ public class StaticFields59 { return null; } + public static Object getFieldFromGregtechProxy(boolean client, String fieldName) { + Object proxyGT; + + if (Meta_GT_Proxy.mProxies[0] != null && client) { + proxyGT = Meta_GT_Proxy.mProxies[0]; + } else if (Meta_GT_Proxy.mProxies[1] != null && !client) { + proxyGT = Meta_GT_Proxy.mProxies[1]; + } else { + try { + proxyGT = (client ? ProxyFinder.getClientProxy(GT_Mod.instance) + : ProxyFinder.getServerProxy(GT_Mod.instance)); + } catch (final ReflectiveOperationException e1) { + proxyGT = null; + Logger.INFO("Failed to obtain instance of GT " + (client ? "Client" : "Server") + " proxy."); + } + if (Meta_GT_Proxy.mProxies[0] == null && client) { + Meta_GT_Proxy.mProxies[0] = (GT_Proxy) proxyGT; + } else if (Meta_GT_Proxy.mProxies[1] == null && !client) { + Meta_GT_Proxy.mProxies[1] = (GT_Proxy) proxyGT; + } + } + + if (proxyGT != null && proxyGT instanceof GT_Proxy) { + try { + return ReflectionUtils.getField(proxyGT.getClass(), fieldName).get(proxyGT); + } catch (IllegalArgumentException | IllegalAccessException e) { + } + } + return null; + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java index cf6e484ff5..4fde2d6916 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesCentrifugeMultiblock.java @@ -1,16 +1,14 @@ package gtPlusPlus.xmod.gregtech.common.blocks.textures; -import net.minecraft.tileentity.TileEntity; -import net.minecraft.util.IIcon; -import net.minecraft.world.IBlockAccess; - import gregtech.api.enums.Textures; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; - import gtPlusPlus.xmod.gregtech.common.blocks.GregtechMetaCasingBlocks; import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock.CustomIcon; import gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing.GregtechMetaTileEntity_IndustrialCentrifuge; +import net.minecraft.tileentity.TileEntity; +import net.minecraft.util.IIcon; +import net.minecraft.world.IBlockAccess; public class TexturesCentrifugeMultiblock { @@ -92,103 +90,55 @@ public class TexturesCentrifugeMultiblock { TileEntity tTileEntity; IMetaTileEntity tMetaTileEntity; if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[0].getIcon(); - } - return this.CENTRIFUGE[0].getIcon(); + return getIconByIndex(tMetaTileEntity, 0); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[3].getIcon(); - } - return this.CENTRIFUGE[3].getIcon(); + return getIconByIndex(tMetaTileEntity, 3); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 3 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[6].getIcon(); - } - return this.CENTRIFUGE[6].getIcon(); + return getIconByIndex(tMetaTileEntity, 6); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[1].getIcon(); - } - return this.CENTRIFUGE[1].getIcon(); + return getIconByIndex(tMetaTileEntity, 1); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[7].getIcon(); - } - return this.CENTRIFUGE[7].getIcon(); + return getIconByIndex(tMetaTileEntity, 7); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[8].getIcon(); - } - return this.CENTRIFUGE[8].getIcon(); + return getIconByIndex(tMetaTileEntity, 8); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[5].getIcon(); - } - return this.CENTRIFUGE[5].getIcon(); + return getIconByIndex(tMetaTileEntity, 5); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord + (aSide == 2 ? 1 : -1), yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[2].getIcon(); - } - return this.CENTRIFUGE[2].getIcon(); + return getIconByIndex(tMetaTileEntity, 2); } } else if ((aSide == 4) || (aSide == 5)) { TileEntity tTileEntity; Object tMetaTileEntity; if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[0].getIcon(); - } - return this.CENTRIFUGE[0].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 0); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[3].getIcon(); - } - return this.CENTRIFUGE[3].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 3); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 4 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[6].getIcon(); - } - return this.CENTRIFUGE[6].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 6); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[1].getIcon(); - } - return this.CENTRIFUGE[1].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 1); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[7].getIcon(); - } - return this.CENTRIFUGE[7].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 7); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord + 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[8].getIcon(); - } - return this.CENTRIFUGE[8].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 8); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[5].getIcon(); - } - return this.CENTRIFUGE[5].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 5); } if ((null != (tTileEntity = aWorld.getTileEntity(xCoord, yCoord - 1, zCoord + (aSide == 5 ? 1 : -1)))) && ((tTileEntity instanceof IGregTechTileEntity)) && (((IGregTechTileEntity) tTileEntity).getFrontFacing() == aSide) && (null != (tMetaTileEntity = ((IGregTechTileEntity) tTileEntity).getMetaTileEntity())) && ((tMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge))) { - if (isUsingAnimatedTexture(tTileEntity)) { - return this.CENTRIFUGE_ACTIVE[2].getIcon(); - } - return this.CENTRIFUGE[2].getIcon(); + return getIconByIndex((IMetaTileEntity) tMetaTileEntity, 2); } } return TexturesGtBlock.Casing_Material_Centrifuge.getIcon(); @@ -440,15 +390,33 @@ public class TexturesCentrifugeMultiblock { return Textures.BlockIcons.CONNECTED_HULLS[(tStartIndex + 7)].getIcon(); } - public boolean isUsingAnimatedTexture(TileEntity tTileEntity) { - IGregTechTileEntity aTile; - if (tTileEntity instanceof IGregTechTileEntity) { - aTile = (IGregTechTileEntity) tTileEntity; - if (aTile instanceof GregtechMetaTileEntity_IndustrialCentrifuge) { - return ((GregtechMetaTileEntity_IndustrialCentrifuge) aTile).usingAnimations(); - } - } + public boolean isCentrifugeRunning(IMetaTileEntity aTile) { + if (aTile == null) { + return false; + } + else { + return aTile.getBaseMetaTileEntity().isActive(); + } + + + } + + public boolean isUsingAnimatedTexture(IMetaTileEntity aMetaTileEntity) { + if (aMetaTileEntity != null) { + if (aMetaTileEntity instanceof GregtechMetaTileEntity_IndustrialCentrifuge) { + return ((GregtechMetaTileEntity_IndustrialCentrifuge) aMetaTileEntity).usingAnimations(); + } + } return false; } + public IIcon getIconByIndex(IMetaTileEntity aMetaTileEntity, int aIndex) { + if (isUsingAnimatedTexture(aMetaTileEntity)) { + if (isCentrifugeRunning(aMetaTileEntity)) { + return this.CENTRIFUGE_ACTIVE[aIndex].getIcon(); + } + } + return this.CENTRIFUGE[aIndex].getIcon(); + } + } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java index ca795e40d1..ee104eaca3 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/blocks/textures/TexturesGtTools.java @@ -13,6 +13,10 @@ import gtPlusPlus.core.lib.CORE; public final class TexturesGtTools { public final static CustomIcon SKOOKUM_CHOOCHER = new CustomIcon("iconsets/SKOOKUMCHOOCHER"); + public final static CustomIcon ANGLE_GRINDER = new CustomIcon("iconsets/ANGLE_GRINDER"); + public final static CustomIcon ELECTRIC_SNIPS = new CustomIcon("iconsets/ELECTRIC_SNIPS"); + public final static CustomIcon ELECTRIC_LIGHTER = new CustomIcon("iconsets/ELECTRIC_LIGHTER"); + public final static CustomIcon ELECTRIC_BUTCHER_KNIFE = new CustomIcon("iconsets/ELECTRIC_BUTCHER_KNIFE"); diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java index d228fdc04a..dbae4fe194 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/MetaGeneratedGregtechTools.java @@ -1,47 +1,68 @@ package gtPlusPlus.xmod.gregtech.common.items; -import java.util.ArrayList; -import java.util.Iterator; -import java.util.concurrent.ConcurrentHashMap; - import gregtech.api.GregTech_API; -import gregtech.api.enums.GT_Values; import gregtech.api.enums.TC_Aspects; import gregtech.api.enums.ToolDictNames; -import gregtech.api.interfaces.IItemBehaviour; -import gregtech.api.items.GT_MetaBase_Item; import gregtech.api.items.GT_MetaGenerated_Tool; -import gregtech.api.util.GT_Log; -import gtPlusPlus.api.objects.Logger; -import gtPlusPlus.core.util.reflect.ReflectionUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechToolDictNames; +import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_AngelGrinder; import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_Choocher; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.item.ItemStack; -import net.minecraft.world.World; -import net.minecraftforge.fluids.FluidStack; +import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_ElectricButcherKnife; +import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_ElectricLighter; +import gtPlusPlus.xmod.gregtech.common.tools.TOOL_Gregtech_ElectricSnips; public class MetaGeneratedGregtechTools extends GT_MetaGenerated_Tool { + public static final short ELECTRIC_LIGHTER = 7534; + public static final short ELECTRIC_BUTCHER_KNIFE = 7634; public static final short SKOOKUM_CHOOCHER = 7734; + public static final short ANGLE_GRINDER = 7834; + public static final short ELECTRIC_SNIPS = 7934; public static GT_MetaGenerated_Tool INSTANCE; public MetaGeneratedGregtechTools() { super("plusplus.metatool.01"); INSTANCE = this; - //Skookum Choocher - GregTech_API.registerTool( - this.addTool( - SKOOKUM_CHOOCHER, "Skookum Choocher", - "Can Really Chooch. Does a Skookum job at Hammering and Wrenching stuff.", - new TOOL_Gregtech_Choocher(), - new Object[]{GregtechToolDictNames.craftingToolSkookumChoocher, - ToolDictNames.craftingToolHardHammer, - ToolDictNames.craftingToolWrench, - new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), - new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), - new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L)}), + // Skookum Choocher + GregTech_API.registerTool(this.addTool(SKOOKUM_CHOOCHER, "Skookum Choocher", + "Can Really Chooch. Does a Skookum job at Hammering and Wrenching stuff.", new TOOL_Gregtech_Choocher(), + new Object[] { GregtechToolDictNames.craftingToolSkookumChoocher, ToolDictNames.craftingToolHardHammer, + ToolDictNames.craftingToolWrench, new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) }), GregTech_API.sWrenchList); - } + + // Electric File + this.addTool(ANGLE_GRINDER, "Angle Grinder", "Hand-held electric filing device", + new TOOL_Gregtech_AngelGrinder(), + new Object[] { GregtechToolDictNames.craftingToolAngleGrinder, ToolDictNames.craftingToolFile, + new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) }); + + // Electric Wire Cutter + this.addTool(ELECTRIC_SNIPS, "Automatic Snips", "Hand-held electric wire cutter", + new TOOL_Gregtech_ElectricSnips(), + new Object[] { GregtechToolDictNames.craftingToolElectricSnips, ToolDictNames.craftingToolWireCutter, + new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) }); + + // Electric Lighter + this.addTool(ELECTRIC_LIGHTER, "Pyromatic 9k", "Electric Fire!", + new TOOL_Gregtech_ElectricLighter(), + new Object[] { GregtechToolDictNames.craftingToolElectricLighter, + new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) }); + + // Electric Butcher Knife + this.addTool(ELECTRIC_BUTCHER_KNIFE, "Meat-o-matic", "Electric butcher knife", + new TOOL_Gregtech_ElectricButcherKnife(), + new Object[] { GregtechToolDictNames.craftingToolElectricButcherKnife, ToolDictNames.craftingToolKnife, + new TC_Aspects.TC_AspectStack(TC_Aspects.INSTRUMENTUM, 1L), + new TC_Aspects.TC_AspectStack(TC_Aspects.FABRICO, 2L), + new TC_Aspects.TC_AspectStack(TC_Aspects.ORDO, 2L) }); + } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java new file mode 100644 index 0000000000..278b556733 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Electric_Lighter.java @@ -0,0 +1,143 @@ +package gtPlusPlus.xmod.gregtech.common.items.behaviours; + +import java.util.List; + +import codechicken.lib.math.MathHelper; +import gregtech.api.GregTech_API; +import gregtech.api.items.GT_MetaBase_Item; +import gregtech.api.util.GT_LanguageManager; +import gregtech.api.util.GT_Utility; +import gregtech.api.util.GT_Utility.ItemNBT; +import gregtech.common.items.behaviors.Behaviour_None; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.xmod.gregtech.common.helpers.ChargingHelper; +import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; +import ic2.api.item.IElectricItemManager; +import net.minecraft.entity.Entity; +import net.minecraft.entity.monster.EntityCreeper; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.init.Blocks; +import net.minecraft.item.ItemStack; +import net.minecraft.nbt.NBTTagCompound; +import net.minecraft.world.World; +import net.minecraftforge.common.util.ForgeDirection; + +public class Behaviour_Electric_Lighter extends Behaviour_None { + + private final ItemStack mLighter; + + private final long mFuelAmount; + + private final String mTooltip = GT_LanguageManager.addStringLocalization("gt.behaviour.lighter.tooltip", + "Can light things on Fire"); + private final String mTooltipUses = GT_LanguageManager.addStringLocalization("gt.behaviour.lighter.uses", + "Remaining Uses:"); + private final String mTooltipUnstackable = GT_LanguageManager.addStringLocalization("gt.behaviour.unstackable", + "Not usable when stacked!"); + + public Behaviour_Electric_Lighter(ItemStack aFullLighter, long aFuelAmount) { + this.mLighter = aFullLighter; + this.mFuelAmount = aFuelAmount; + } + + public boolean onLeftClickEntity(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, Entity aEntity) { + if (!aPlayer.worldObj.isRemote && aStack.stackSize == 1) { + boolean rOutput = false; + if (aEntity instanceof EntityCreeper) { + if (this.prepare(aStack) || aPlayer.capabilities.isCreativeMode) { + GT_Utility.sendSoundToPlayers(aPlayer.worldObj, (String) GregTech_API.sSoundList.get(6), 1.0F, 1.0F, + MathHelper.floor_double(aEntity.posX), MathHelper.floor_double(aEntity.posY), + MathHelper.floor_double(aEntity.posZ)); + ((EntityCreeper) aEntity).func_146079_cb(); + rOutput = true; + } + } + return rOutput; + } else { + return false; + } + } + + public boolean onItemUse(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, + int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + return false; + } + + public boolean onItemUseFirst(GT_MetaBase_Item aItem, ItemStack aStack, EntityPlayer aPlayer, World aWorld, int aX, + int aY, int aZ, int aSide, float hitX, float hitY, float hitZ) { + if (!aWorld.isRemote && aStack.stackSize == 1) { + Logger.WARNING("Preparing Lighter a"); + boolean rOutput = false; + ForgeDirection tDirection = ForgeDirection.getOrientation(aSide); + aX += tDirection.offsetX; + aY += tDirection.offsetY; + aZ += tDirection.offsetZ; + if (GT_Utility.isBlockAir(aWorld, aX, aY, aZ) && aPlayer.canPlayerEdit(aX, aY, aZ, aSide, aStack)) { + Logger.WARNING("Preparing Lighter b"); + if (this.prepare(aStack) || aPlayer.capabilities.isCreativeMode) { + Logger.WARNING("Preparing Lighter c"); + GT_Utility.sendSoundToPlayers(aWorld, (String) GregTech_API.sSoundList.get(6), 1.0F, 1.0F, aX, aY, + aZ); + aWorld.setBlock(aX, aY, aZ, Blocks.fire); + rOutput = true; + // ItemNBT.setLighterFuel(aStack, tFuelAmount); + return rOutput; + } + } + } + Logger.WARNING("Preparing Lighter z"); + return false; + } + + private boolean prepare(ItemStack aStack) { + if (aStack != null) { + Logger.WARNING("Preparing Lighter 1"); + if (aStack.getItem() instanceof MetaGeneratedGregtechTools) { + Logger.WARNING("Preparing Lighter 2"); + if (ChargingHelper.isItemValid(aStack)) { + Logger.WARNING("Preparing Lighter 3"); + if (aStack.getItem() instanceof IElectricItemManager) { + Logger.WARNING("Preparing Lighter 4"); + IElectricItemManager aItemElec = (IElectricItemManager) aStack.getItem(); + double aCharge = aItemElec.getCharge(aStack); + long aEuCost = 4096 * 2; + if (aCharge >= aEuCost) { + Logger.WARNING("Preparing Lighter 5"); + aItemElec.discharge(aStack, aEuCost, 3, true, true, false); + return true; + } + } + } + } + } + Logger.WARNING("Preparing Lighter 0"); + return false; + } + + private void useUp(ItemStack aStack) { + + } + + public List<String> getAdditionalToolTips(GT_MetaBase_Item aItem, List<String> aList, ItemStack aStack) { + aList.add(this.mTooltip); + int aUses = 0; + + if (aStack != null) { + if (aStack.getItem() instanceof MetaGeneratedGregtechTools) { + if (ChargingHelper.isItemValid(aStack)) { + if (aStack.getItem() instanceof IElectricItemManager) { + IElectricItemManager aItemElec = (IElectricItemManager) aStack.getItem(); + double aCharge = aItemElec.getCharge(aStack); + long aEuCost = 4096 * 2; + aUses = (int) (aCharge / aEuCost); + } + } + } + } + + NBTTagCompound tNBT = aStack.getTagCompound(); + aList.add(this.mTooltipUses + " " + aUses); + aList.add(this.mTooltipUnstackable); + return aList; + } +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Grinder.java b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Grinder.java new file mode 100644 index 0000000000..9012bb8cd8 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/items/behaviours/Behaviour_Grinder.java @@ -0,0 +1,94 @@ +package gtPlusPlus.xmod.gregtech.common.items.behaviours; + +import java.util.List; + +import gregtech.api.enums.SubTag; +import gregtech.api.interfaces.IItemBehaviour; +import gregtech.api.items.GT_MetaBase_Item; +import net.minecraft.dispenser.IBlockSource; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.entity.projectile.EntityArrow; +import net.minecraft.item.ItemStack; +import net.minecraft.world.World; + +public class Behaviour_Grinder implements IItemBehaviour<GT_MetaBase_Item> { + + @Override + public boolean onLeftClickEntity(GT_MetaBase_Item var1, ItemStack var2, EntityPlayer var3, Entity var4) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean onItemUse(GT_MetaBase_Item var1, ItemStack var2, EntityPlayer var3, World var4, int var5, int var6, + int var7, int var8, float var9, float var10, float var11) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean onItemUseFirst(GT_MetaBase_Item var1, ItemStack var2, EntityPlayer var3, World var4, int var5, + int var6, int var7, int var8, float var9, float var10, float var11) { + // TODO Auto-generated method stub + return false; + } + + @Override + public ItemStack onItemRightClick(GT_MetaBase_Item var1, ItemStack var2, World var3, EntityPlayer var4) { + // TODO Auto-generated method stub + return null; + } + + @Override + public List<String> getAdditionalToolTips(GT_MetaBase_Item var1, List<String> var2, ItemStack var3) { + // TODO Auto-generated method stub + return null; + } + + @Override + public void onUpdate(GT_MetaBase_Item var1, ItemStack var2, World var3, Entity var4, int var5, boolean var6) { + // TODO Auto-generated method stub + + } + + @Override + public boolean isItemStackUsable(GT_MetaBase_Item var1, ItemStack var2) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean canDispense(GT_MetaBase_Item var1, IBlockSource var2, ItemStack var3) { + // TODO Auto-generated method stub + return false; + } + + @Override + public ItemStack onDispense(GT_MetaBase_Item var1, IBlockSource var2, ItemStack var3) { + // TODO Auto-generated method stub + return null; + } + + @Override + public boolean hasProjectile(GT_MetaBase_Item var1, SubTag var2, ItemStack var3) { + // TODO Auto-generated method stub + return false; + } + + @Override + public EntityArrow getProjectile(GT_MetaBase_Item var1, SubTag var2, ItemStack var3, World var4, double var5, + double var7, double var9) { + // TODO Auto-generated method stub + return null; + } + + @Override + public EntityArrow getProjectile(GT_MetaBase_Item var1, SubTag var2, ItemStack var3, World var4, + EntityLivingBase var5, float var6) { + // TODO Auto-generated method stub + return null; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java index 45a73f9e35..ef3e06086e 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/generators/GT_MetaTileEntity_SemiFluidGenerator.java @@ -18,9 +18,11 @@ import gregtech.api.util.GT_ModHandler; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; import gregtech.api.util.Recipe_GT.Gregtech_Recipe_Map; +import gtPlusPlus.api.objects.Logger; import gtPlusPlus.core.lib.CORE; +import gtPlusPlus.xmod.gregtech.api.metatileentity.custom.power.GTPP_MTE_BasicLosslessGenerator; -public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_BasicGenerator{ +public class GT_MetaTileEntity_SemiFluidGenerator extends GTPP_MTE_BasicLosslessGenerator{ public static final int BASE_POLLUTION = 2; public int mEfficiency; @@ -48,7 +50,7 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public int getCapacity() { - return 8000; + return 4000 * this.mTier; } public void onConfigLoad() { @@ -63,6 +65,7 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public GT_Recipe.GT_Recipe_Map getRecipes() { + //Logger.INFO("Fuel Count: "+Gregtech_Recipe_Map.sSemiFluidLiquidFuels.mRecipeList.size()); return Gregtech_Recipe_Map.sSemiFluidLiquidFuels; } @@ -91,12 +94,15 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public int getFuelValue(ItemStack aStack) { - if ((GT_Utility.isStackInvalid(aStack)) || (getRecipes() == null)) + if ((GT_Utility.isStackInvalid(aStack)) || (getRecipes() == null)) { + Logger.INFO("Bad Fuel?"); return 0; + } int rValue = Math.max(GT_ModHandler.getFuelCanValue(aStack) * 6 / 5, super.getFuelValue(aStack)); if (ItemList.Fuel_Can_Plastic_Filled.isStackEqual(aStack, false, true)) { rValue = Math.max(rValue, GameRegistry.getFuelValue(aStack) * 3); } + Logger.INFO("Good Fuel: "+rValue); return rValue; } @@ -110,7 +116,7 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public ITexture[] getBack(byte aColor) { return new ITexture[] { super.getBack(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK) }; + new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP) }; } @Override @@ -122,13 +128,13 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public ITexture[] getTop(byte aColor) { return new ITexture[] { super.getTop(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP) }; + new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE) }; } @Override public ITexture[] getSides(byte aColor) { return new ITexture[] { super.getSides(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE) }; + new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP) }; } @Override @@ -141,7 +147,7 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public ITexture[] getBackActive(byte aColor) { return new ITexture[] { super.getBackActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_BACK_ACTIVE) }; + new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE) }; } @Override @@ -153,13 +159,13 @@ public class GT_MetaTileEntity_SemiFluidGenerator extends GT_MetaTileEntity_Basi @Override public ITexture[] getTopActive(byte aColor) { return new ITexture[] { super.getTopActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE) }; + new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE) }; } @Override public ITexture[] getSidesActive(byte aColor) { return new ITexture[] { super.getSidesActive(aColor)[0], - new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_SIDE_ACTIVE) }; + new GT_RenderedTexture(Textures.BlockIcons.DIESEL_GENERATOR_TOP_ACTIVE) }; } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_BasicWasher.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_BasicWasher.java index 81f594bc7e..c07fa2e927 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_BasicWasher.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/basic/GregtechMetaTileEntity_BasicWasher.java @@ -1,7 +1,5 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.basic; -import net.minecraft.item.ItemStack; - import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; @@ -10,8 +8,7 @@ import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_BasicMachin import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.Recipe_GT; - -import gtPlusPlus.core.lib.CORE; +import net.minecraft.item.ItemStack; import net.minecraftforge.fluids.FluidStack; public class GregtechMetaTileEntity_BasicWasher extends GT_MetaTileEntity_BasicMachine { @@ -67,7 +64,7 @@ public class GregtechMetaTileEntity_BasicWasher extends GT_MetaTileEntity_BasicM @Override public int getCapacity() { - return 8000; + return 8000 * Math.max(1, this.mTier); } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java index e3c05a8388..3f3a276f0c 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialCentrifuge.java @@ -1,13 +1,10 @@ package gtPlusPlus.xmod.gregtech.common.tileentities.machines.multi.processing; -import gregtech.api.GregTech_API; import gregtech.api.enums.TAE; import gregtech.api.enums.Textures; import gregtech.api.interfaces.ITexture; import gregtech.api.interfaces.metatileentity.IMetaTileEntity; import gregtech.api.interfaces.tileentity.IGregTechTileEntity; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch; -import gregtech.api.metatileentity.implementations.GT_MetaTileEntity_Hatch_Maintenance; import gregtech.api.objects.GT_RenderedTexture; import gregtech.api.util.GT_Recipe; import gregtech.api.util.GT_Utility; @@ -27,7 +24,7 @@ import net.minecraftforge.common.util.ForgeDirection; public class GregtechMetaTileEntity_IndustrialCentrifuge extends GregtechMeta_MultiBlockBase { - private boolean mIsAnimated = true; + private boolean mIsAnimated; private static ITexture frontFace; private static ITexture frontFaceActive; private static CustomIcon GT9_5_Active = new CustomIcon("iconsets/LARGECENTRIFUGE_ACTIVE5"); @@ -38,10 +35,12 @@ extends GregtechMeta_MultiBlockBase { super(aID, aName, aNameRegional); frontFaceActive = new GT_RenderedTexture(GT9_5_Active); frontFace = new GT_RenderedTexture(GT9_5); + mIsAnimated = true; } public GregtechMetaTileEntity_IndustrialCentrifuge(final String aName) { super(aName); + mIsAnimated = true; } @Override @@ -59,6 +58,7 @@ extends GregtechMeta_MultiBlockBase { return new String[]{ "Controller Block for the Industrial Centrifuge", "125% faster than using single block machines of the same voltage", + "Disable animations with a screwdriver", "Only uses 90% of the eu/t normally required", "Processes six items per voltage tier", "Size: 3x3x3 (Hollow)", @@ -179,13 +179,14 @@ extends GregtechMeta_MultiBlockBase { @Override public void onModeChangeByScrewdriver(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { - this.mIsAnimated = Utils.invertBoolean(mIsAnimated); + this.mIsAnimated = !mIsAnimated; + Logger.INFO("Is Centrifuge animated "+this.mIsAnimated); if (this.mIsAnimated) { - PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture."); + PlayerUtils.messagePlayer(aPlayer, "Using Animated Turbine Texture. "); } else { - PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture."); - } + PlayerUtils.messagePlayer(aPlayer, "Using Static Turbine Texture. "); + } } @Override @@ -196,12 +197,18 @@ extends GregtechMeta_MultiBlockBase { @Override public void loadNBTData(NBTTagCompound aNBT) { - super.loadNBTData(aNBT); - mIsAnimated = aNBT.getBoolean("mIsAnimated"); + super.loadNBTData(aNBT); + if (aNBT.hasKey("mIsAnimated")) { + mIsAnimated = aNBT.getBoolean("mIsAnimated"); + } + else { + mIsAnimated = true; + } } public boolean usingAnimations() { - return mIsAnimated; + //Logger.INFO("Is animated? "+this.mIsAnimated); + return this.mIsAnimated; } private ITexture getFrontFacingTurbineTexture(boolean isActive) { diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java index 61cfbcc5c7..7c57f799d7 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/machines/multi/processing/GregtechMetaTileEntity_IndustrialSifter.java @@ -170,7 +170,7 @@ extends GregtechMeta_MultiBlockBase { } else { - if (!isValidBlockForStructure(tTileEntity, TAE.GTPP_INDEX(21), false, aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j), ModBlocks.blockCasings2Misc, 5)) { + if (!isValidBlockForStructure(tTileEntity, TAE.GTPP_INDEX(21), true, aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j), ModBlocks.blockCasings2Misc, 5)) { log("Sifter Casing(s) Missing from one of the "+sHeight+" layers inner 3x3."); log("Instead, found "+aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j).getLocalizedName()); return false; @@ -181,16 +181,9 @@ extends GregtechMeta_MultiBlockBase { else { //Dealt with inner 5x5, now deal with the exterior. //Deal with all 4 sides (Sifter walls) - boolean checkController = false; - if (((xDir + i) != 0) || (((zDir + j) != 0) && (h == 0))) {//no controller - checkController = true; - } - else { - checkController = false; - } - if (!this.addToMachineList(tTileEntity, TAE.GTPP_INDEX(21))) { + boolean checkController = false; if (!checkController){ - if (!isValidBlockForStructure(null, TAE.GTPP_INDEX(21), false, aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j), ModBlocks.blockCasings2Misc, 5)) { + if (!isValidBlockForStructure(tTileEntity, TAE.GTPP_INDEX(21), true, aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j), (int) aBaseMetaTileEntity.getMetaIDOffset(xDir + i, h, zDir + j), ModBlocks.blockCasings2Misc, 5)) { if ((tTileEntity instanceof GregtechMetaTileEntity_IndustrialSifter) || (aBaseMetaTileEntity.getBlockOffset(xDir + i, h, zDir + j) == GregTech_API.sBlockMachines)){ if (h != 0){ log("Found a secondary controller at the wrong Y level."); @@ -205,10 +198,7 @@ extends GregtechMeta_MultiBlockBase { } } tAmount++; - } - else { - tAmount++; - } + } } } diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java index b77529220f..86d02eae9a 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tileentities/storage/GregtechMetaEnergyBuffer.java @@ -26,10 +26,7 @@ import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtBlock; public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { - /* - * public GregtechMetaEnergyBuffer() { super.this - * setCreativeTab(GregTech_API.TAB_GREGTECH); } - */ + private byte aCurrentOutputAmperage = 4; public GregtechMetaEnergyBuffer(final int aID, final String aName, final String aNameRegional, final int aTier, final String aDescription, final int aSlotCount) { super(aID, aName, aNameRegional, aTier, aSlotCount, aDescription); @@ -41,7 +38,7 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { @Override public String[] getDescription() { - return new String[] {this.mDescription, "Accepts/Outputs 4Amp",}; + return new String[] {this.mDescription, "Defaults 4A In/Out", "Change output Amperage with a screwdriver", "Now Portable!"}; } @Override @@ -200,12 +197,12 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { @Override public long maxAmperesIn() { - return 4; + return aCurrentOutputAmperage; } @Override public long maxAmperesOut() { - return 4; + return aCurrentOutputAmperage; } @Override public int rechargerSlotStartIndex() {return 0;} @Override public int dechargerSlotStartIndex() {return 0;} @@ -216,13 +213,25 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { @Override public boolean isAccessAllowed(final EntityPlayer aPlayer) {return true;} @Override - public void saveNBTData(final NBTTagCompound aNBT) { - // + public void saveNBTData(final NBTTagCompound aNBT) { + aNBT.setByte("aCurrentOutputAmperage", aCurrentOutputAmperage); + if (CORE.NBT_PERSISTENCY_PATCH_APPLIED) { + long aEU = this.getBaseMetaTileEntity().getStoredEU(); + if (aEU > 0){ + aNBT.setLong("aStoredEU", aEU); + if (aNBT.hasKey("aStoredEU")) { + Logger.WARNING("Set aStoredEU to NBT."); + } + } + } } @Override - public void loadNBTData(final NBTTagCompound aNBT) { - // + public void loadNBTData(final NBTTagCompound aNBT) { + aCurrentOutputAmperage = aNBT.getByte("aCurrentOutputAmperage"); + if (aNBT.hasKey("aStoredEU")) { + this.setEUVar(aNBT.getLong("aStoredEU")); + } } @Override @@ -244,6 +253,7 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { final double c = ((double) tempStorage / this.maxEUStore()) * 100; final double roundOff = Math.round(c * 100.00) / 100.00; PlayerUtils.messagePlayer(playerIn, "Energy: " + GT_Utility.formatNumbers(tempStorage) + " EU at "+V[this.mTier]+"v ("+roundOff+"%)"); + PlayerUtils.messagePlayer(playerIn, "Amperage: " + GT_Utility.formatNumbers(maxAmperesIn())+"A"); } //Utils.LOG_WARNING("Begin Show Energy"); @@ -373,6 +383,35 @@ public class GregtechMetaEnergyBuffer extends GregtechMetaTileEntity { @Override public boolean isItemValidForSlot(final int p_94041_1_, final ItemStack p_94041_2_) { return false; + } + + @Override + public void setItemNBT(NBTTagCompound aNBT) { + if (CORE.NBT_PERSISTENCY_PATCH_APPLIED) { + aNBT.setByte("aCurrentOutputAmperage", aCurrentOutputAmperage); + long aEU = this.getBaseMetaTileEntity().getStoredEU(); + if (aEU > 0){ + aNBT.setLong("aStoredEU", aEU); + if (aNBT.hasKey("aStoredEU")) { + Logger.WARNING("Set aStoredEU to NBT."); + } + } + } } + @Override + public void onScrewdriverRightClick(byte aSide, EntityPlayer aPlayer, float aX, float aY, float aZ) { + byte aTest = (byte) (aCurrentOutputAmperage + 1); + if (aTest > 16 || aTest <= 0 ) { + aTest = 1; + } + aCurrentOutputAmperage = aTest; + PlayerUtils.messagePlayer(aPlayer, "Now handling "+aCurrentOutputAmperage+" Amps."); + } + + + + + + }
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java new file mode 100644 index 0000000000..905164802c --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_AngelGrinder.java @@ -0,0 +1,199 @@ +package gtPlusPlus.xmod.gregtech.common.tools; + +import java.util.Arrays; +import java.util.List; + +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.Textures.ItemIcons; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.common.items.behaviors.Behaviour_None; +import gregtech.common.tools.GT_Tool; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; +import gtPlusPlus.xmod.gregtech.common.items.behaviours.Behaviour_Choocher; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraftforge.event.world.BlockEvent; + +public class TOOL_Gregtech_AngelGrinder +extends GT_Tool { + + public static final List<String> mEffectiveList = Arrays.asList(new String[]{EntityIronGolem.class.getName(), "EntityTowerGuardian"}); + + + @Override + public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) { + String tName = aEntity.getClass().getName(); + tName = tName.substring(tName.lastIndexOf(".") + 1); + return (mEffectiveList.contains(tName)) || (tName.contains("Golem")) ? aOriginalDamage * 2.0F : aOriginalDamage; + } + + @Override + public int getToolDamagePerBlockBreak() { + return 50; + } + + @Override + public int getToolDamagePerDropConversion() { + return 100; + } + + @Override + public int getToolDamagePerContainerCraft() { + return 400; + } + + @Override + public int getToolDamagePerEntityAttack() { + return 100; + } + + @Override + public int getBaseQuality() { + return 0; + } + + @Override + public float getBaseDamage() { + return 8.0F; + } + + @Override + public float getSpeedMultiplier() { + return 2F; + } + + @Override + public float getMaxDurabilityMultiplier() { + return 1.8F; + } + + @Override + public String getCraftingSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(1)); + } + + @Override + public String getEntityHitSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(2)); + } + + @Override + public String getBreakingSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(0)); + } + + @Override + public String getMiningSound() { + return null; + } + + @Override + public boolean canBlock() { + return false; + } + + public boolean isWrench(){ + return false; + } + + @Override + public boolean isCrowbar() { + return false; + } + + @Override + public boolean isWeapon() { + return true; + } + + @Override + public boolean isMinableBlock(final Block aBlock, final byte aMetaData) { + final String tTool = aBlock.getHarvestTool(aMetaData); + return (tTool != null) && (tTool.equals("sword") || tTool.equals("file")); + } + + + @Override + public int convertBlockDrops(final List<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { + int rConversions = 0; + /*GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{new ItemStack(aBlock, 1, aMetaData)}); + if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) { + for (final ItemStack tDrop : aDrops) { + tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{tDrop})}); + if (tRecipe != null) { + final ItemStack tHammeringOutput = tRecipe.getOutput(0); + if (tHammeringOutput != null) { + rConversions += tDrop.stackSize; + tDrop.stackSize *= tHammeringOutput.stackSize; + tHammeringOutput.stackSize = tDrop.stackSize; + GT_Utility.setStack(tDrop, tHammeringOutput); + } + } + } + } else { + aDrops.clear(); + aDrops.add(tRecipe.getOutput(0)); + rConversions++; + }*/ + return rConversions; + } + + @Override + public ItemStack getBrokenItem(final ItemStack aStack) { + return null; + } + + public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { + return (IIconContainer) (aIsToolHead + ? TexturesGtTools.ANGLE_GRINDER + : ItemIcons.POWER_UNIT_HV); + } + + public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { + return !aIsToolHead + ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa + : Materials.TungstenSteel.mRGBa; + } + + + + + @Override + public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) { + super.onToolCrafted(aStack, aPlayer); + aPlayer.triggerAchievement(AchievementList.buildSword); + try { + GT_Mod.achievements.issueAchievement(aPlayer, "tools"); + GT_Mod.achievements.issueAchievement(aPlayer, "unitool"); + } catch (final Exception e) { + } + } + + @Override + public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) { + return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Ground out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); + } + + @Override + public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) { + aItem.addItemBehavior(aID, new Behaviour_None()); + } + + @Override + public boolean isGrafter() { + return false; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java new file mode 100644 index 0000000000..ff4be9dd93 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricButcherKnife.java @@ -0,0 +1,197 @@ +package gtPlusPlus.xmod.gregtech.common.tools; + +import java.util.Arrays; +import java.util.List; + +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.Textures.ItemIcons; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.common.items.behaviors.Behaviour_None; +import gregtech.common.tools.GT_Tool; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraftforge.event.world.BlockEvent; + +public class TOOL_Gregtech_ElectricButcherKnife +extends GT_Tool { + + public static final List<String> mEffectiveList = Arrays.asList(new String[]{EntityIronGolem.class.getName(), "EntityTowerGuardian"}); + + + @Override + public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) { + String tName = aEntity.getClass().getName(); + tName = tName.substring(tName.lastIndexOf(".") + 1); + return (mEffectiveList.contains(tName)) || (tName.contains("Golem")) ? aOriginalDamage * 2.0F : aOriginalDamage; + } + + @Override + public int getToolDamagePerBlockBreak() { + return 50; + } + + @Override + public int getToolDamagePerDropConversion() { + return 100; + } + + @Override + public int getToolDamagePerContainerCraft() { + return 400; + } + + @Override + public int getToolDamagePerEntityAttack() { + return 100; + } + + @Override + public int getBaseQuality() { + return 0; + } + + @Override + public float getBaseDamage() { + return 8.0F; + } + + @Override + public float getSpeedMultiplier() { + return 2F; + } + + @Override + public float getMaxDurabilityMultiplier() { + return 1.8F; + } + + @Override + public String getCraftingSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(1)); + } + + @Override + public String getEntityHitSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(2)); + } + + @Override + public String getBreakingSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(0)); + } + + @Override + public String getMiningSound() { + return null; + } + + @Override + public boolean canBlock() { + return false; + } + + public boolean isWrench(){ + return false; + } + + @Override + public boolean isCrowbar() { + return false; + } + + @Override + public boolean isWeapon() { + return true; + } + + @Override + public boolean isMinableBlock(final Block aBlock, final byte aMetaData) { + final String tTool = aBlock.getHarvestTool(aMetaData); + return (tTool != null) && (tTool.equals("sword") || tTool.equals("file")); + } + + + @Override + public int convertBlockDrops(final List<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { + int rConversions = 0; + /*GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{new ItemStack(aBlock, 1, aMetaData)}); + if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) { + for (final ItemStack tDrop : aDrops) { + tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{tDrop})}); + if (tRecipe != null) { + final ItemStack tHammeringOutput = tRecipe.getOutput(0); + if (tHammeringOutput != null) { + rConversions += tDrop.stackSize; + tDrop.stackSize *= tHammeringOutput.stackSize; + tHammeringOutput.stackSize = tDrop.stackSize; + GT_Utility.setStack(tDrop, tHammeringOutput); + } + } + } + } else { + aDrops.clear(); + aDrops.add(tRecipe.getOutput(0)); + rConversions++; + }*/ + return rConversions; + } + + @Override + public ItemStack getBrokenItem(final ItemStack aStack) { + return null; + } + + public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { + return (IIconContainer) (aIsToolHead + ? TexturesGtTools.ELECTRIC_BUTCHER_KNIFE + : ItemIcons.POWER_UNIT_HV); + } + + public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { + return aIsToolHead + ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa + : Materials.RedSteel.mRGBa; + } + + + + + @Override + public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) { + super.onToolCrafted(aStack, aPlayer); + aPlayer.triggerAchievement(AchievementList.buildSword); + try { + GT_Mod.achievements.issueAchievement(aPlayer, "tools"); + GT_Mod.achievements.issueAchievement(aPlayer, "unitool"); + } catch (final Exception e) { + } + } + + @Override + public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) { + return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Sliced out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); + } + + @Override + public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) { + aItem.addItemBehavior(aID, new Behaviour_None()); + } + + @Override + public boolean isGrafter() { + return false; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java new file mode 100644 index 0000000000..cf6f33cc36 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricLighter.java @@ -0,0 +1,198 @@ +package gtPlusPlus.xmod.gregtech.common.tools; + +import java.util.Arrays; +import java.util.List; + +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.Textures.ItemIcons; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.common.items.behaviors.Behaviour_None; +import gregtech.common.tools.GT_Tool; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; +import gtPlusPlus.xmod.gregtech.common.items.behaviours.Behaviour_Electric_Lighter; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraftforge.event.world.BlockEvent; + +public class TOOL_Gregtech_ElectricLighter +extends GT_Tool { + + public static final List<String> mEffectiveList = Arrays.asList(new String[]{EntityIronGolem.class.getName(), "EntityTowerGuardian"}); + + + @Override + public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) { + String tName = aEntity.getClass().getName(); + tName = tName.substring(tName.lastIndexOf(".") + 1); + return (mEffectiveList.contains(tName)) || (tName.contains("Golem")) ? aOriginalDamage * 2.0F : aOriginalDamage; + } + + @Override + public int getToolDamagePerBlockBreak() { + return 50; + } + + @Override + public int getToolDamagePerDropConversion() { + return 100; + } + + @Override + public int getToolDamagePerContainerCraft() { + return 400; + } + + @Override + public int getToolDamagePerEntityAttack() { + return 100; + } + + @Override + public int getBaseQuality() { + return 0; + } + + @Override + public float getBaseDamage() { + return 8.0F; + } + + @Override + public float getSpeedMultiplier() { + return 2F; + } + + @Override + public float getMaxDurabilityMultiplier() { + return 1.8F; + } + + @Override + public String getCraftingSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(1)); + } + + @Override + public String getEntityHitSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(2)); + } + + @Override + public String getBreakingSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(0)); + } + + @Override + public String getMiningSound() { + return null; + } + + @Override + public boolean canBlock() { + return false; + } + + public boolean isWrench(){ + return false; + } + + @Override + public boolean isCrowbar() { + return false; + } + + @Override + public boolean isWeapon() { + return true; + } + + @Override + public boolean isMinableBlock(final Block aBlock, final byte aMetaData) { + final String tTool = aBlock.getHarvestTool(aMetaData); + return (tTool != null) && (tTool.equals("sword") || tTool.equals("file")); + } + + + @Override + public int convertBlockDrops(final List<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { + int rConversions = 0; + /*GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{new ItemStack(aBlock, 1, aMetaData)}); + if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) { + for (final ItemStack tDrop : aDrops) { + tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{tDrop})}); + if (tRecipe != null) { + final ItemStack tHammeringOutput = tRecipe.getOutput(0); + if (tHammeringOutput != null) { + rConversions += tDrop.stackSize; + tDrop.stackSize *= tHammeringOutput.stackSize; + tHammeringOutput.stackSize = tDrop.stackSize; + GT_Utility.setStack(tDrop, tHammeringOutput); + } + } + } + } else { + aDrops.clear(); + aDrops.add(tRecipe.getOutput(0)); + rConversions++; + }*/ + return rConversions; + } + + @Override + public ItemStack getBrokenItem(final ItemStack aStack) { + return null; + } + + public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { + return (IIconContainer) (aIsToolHead + ? TexturesGtTools.ELECTRIC_LIGHTER + : ItemIcons.POWER_UNIT_HV); + } + + public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { + return !aIsToolHead + ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa + : Materials.Silver.mRGBa; + } + + + + + @Override + public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) { + super.onToolCrafted(aStack, aPlayer); + aPlayer.triggerAchievement(AchievementList.buildSword); + try { + GT_Mod.achievements.issueAchievement(aPlayer, "tools"); + GT_Mod.achievements.issueAchievement(aPlayer, "unitool"); + } catch (final Exception e) { + } + } + + @Override + public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) { + return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Ground out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); + } + + @Override + public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) { + aItem.addItemBehavior(aID, new Behaviour_Electric_Lighter(null, 32000)); + } + + @Override + public boolean isGrafter() { + return false; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java new file mode 100644 index 0000000000..bc0c821478 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/common/tools/TOOL_Gregtech_ElectricSnips.java @@ -0,0 +1,197 @@ +package gtPlusPlus.xmod.gregtech.common.tools; + +import java.util.Arrays; +import java.util.List; + +import gregtech.GT_Mod; +import gregtech.api.GregTech_API; +import gregtech.api.enums.Materials; +import gregtech.api.enums.Textures.ItemIcons; +import gregtech.api.interfaces.IIconContainer; +import gregtech.api.items.GT_MetaGenerated_Tool; +import gregtech.common.items.behaviors.Behaviour_None; +import gregtech.common.tools.GT_Tool; +import gtPlusPlus.xmod.gregtech.common.blocks.textures.TexturesGtTools; +import net.minecraft.block.Block; +import net.minecraft.entity.Entity; +import net.minecraft.entity.EntityLivingBase; +import net.minecraft.entity.monster.EntityIronGolem; +import net.minecraft.entity.player.EntityPlayer; +import net.minecraft.item.ItemStack; +import net.minecraft.stats.AchievementList; +import net.minecraft.util.ChatComponentText; +import net.minecraft.util.EnumChatFormatting; +import net.minecraft.util.IChatComponent; +import net.minecraftforge.event.world.BlockEvent; + +public class TOOL_Gregtech_ElectricSnips +extends GT_Tool { + + public static final List<String> mEffectiveList = Arrays.asList(new String[]{EntityIronGolem.class.getName(), "EntityTowerGuardian"}); + + + @Override + public float getNormalDamageAgainstEntity(final float aOriginalDamage, final Entity aEntity, final ItemStack aStack, final EntityPlayer aPlayer) { + String tName = aEntity.getClass().getName(); + tName = tName.substring(tName.lastIndexOf(".") + 1); + return (mEffectiveList.contains(tName)) || (tName.contains("Golem")) ? aOriginalDamage * 2.0F : aOriginalDamage; + } + + @Override + public int getToolDamagePerBlockBreak() { + return 50; + } + + @Override + public int getToolDamagePerDropConversion() { + return 100; + } + + @Override + public int getToolDamagePerContainerCraft() { + return 400; + } + + @Override + public int getToolDamagePerEntityAttack() { + return 100; + } + + @Override + public int getBaseQuality() { + return 0; + } + + @Override + public float getBaseDamage() { + return 4.0F; + } + + @Override + public float getSpeedMultiplier() { + return 1F; + } + + @Override + public float getMaxDurabilityMultiplier() { + return 1.4F; + } + + @Override + public String getCraftingSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(1)); + } + + @Override + public String getEntityHitSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(2)); + } + + @Override + public String getBreakingSound() { + return GregTech_API.sSoundList.get(Integer.valueOf(0)); + } + + @Override + public String getMiningSound() { + return null; + } + + @Override + public boolean canBlock() { + return false; + } + + public boolean isWrench(){ + return false; + } + + @Override + public boolean isCrowbar() { + return false; + } + + @Override + public boolean isWeapon() { + return true; + } + + @Override + public boolean isMinableBlock(final Block aBlock, final byte aMetaData) { + final String tTool = aBlock.getHarvestTool(aMetaData); + return (tTool != null) && (tTool.equals("sword") || tTool.equals("cutter")); + } + + + @Override + public int convertBlockDrops(final List<ItemStack> aDrops, final ItemStack aStack, final EntityPlayer aPlayer, final Block aBlock, final int aX, final int aY, final int aZ, final byte aMetaData, final int aFortune, final boolean aSilkTouch, final BlockEvent.HarvestDropsEvent aEvent) { + int rConversions = 0; + /*GT_Recipe tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{new ItemStack(aBlock, 1, aMetaData)}); + if ((tRecipe == null) || (aBlock.hasTileEntity(aMetaData))) { + for (final ItemStack tDrop : aDrops) { + tRecipe = GT_Recipe.GT_Recipe_Map.sHammerRecipes.findRecipe(null, true, 2147483647L, null, new ItemStack[]{GT_Utility.copyAmount(1L, new Object[]{tDrop})}); + if (tRecipe != null) { + final ItemStack tHammeringOutput = tRecipe.getOutput(0); + if (tHammeringOutput != null) { + rConversions += tDrop.stackSize; + tDrop.stackSize *= tHammeringOutput.stackSize; + tHammeringOutput.stackSize = tDrop.stackSize; + GT_Utility.setStack(tDrop, tHammeringOutput); + } + } + } + } else { + aDrops.clear(); + aDrops.add(tRecipe.getOutput(0)); + rConversions++; + }*/ + return rConversions; + } + + @Override + public ItemStack getBrokenItem(final ItemStack aStack) { + return null; + } + + public IIconContainer getIcon(boolean aIsToolHead, ItemStack aStack) { + return (IIconContainer) (aIsToolHead + ? TexturesGtTools.ELECTRIC_SNIPS + : ItemIcons.POWER_UNIT_MV); + } + + public short[] getRGBa(boolean aIsToolHead, ItemStack aStack) { + return !aIsToolHead + ? GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa + : GT_MetaGenerated_Tool.getPrimaryMaterial(aStack).mRGBa; + } + + + + + @Override + public void onToolCrafted(final ItemStack aStack, final EntityPlayer aPlayer) { + super.onToolCrafted(aStack, aPlayer); + aPlayer.triggerAchievement(AchievementList.buildSword); + try { + GT_Mod.achievements.issueAchievement(aPlayer, "tools"); + GT_Mod.achievements.issueAchievement(aPlayer, "unitool"); + } catch (final Exception e) { + } + } + + @Override + public IChatComponent getDeathMessage(final EntityLivingBase aPlayer, final EntityLivingBase aEntity) { + return new ChatComponentText(EnumChatFormatting.RED + aEntity.getCommandSenderName() + EnumChatFormatting.WHITE + " has been Snipped out of existence by " + EnumChatFormatting.GREEN + aPlayer.getCommandSenderName() + EnumChatFormatting.WHITE); + } + + @Override + public void onStatsAddedToTool(final GT_MetaGenerated_Tool aItem, final int aID) { + aItem.addItemBehavior(aID, new Behaviour_None()); + } + + @Override + public boolean isGrafter() { + return false; + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingAngelGrinder.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingAngelGrinder.java new file mode 100644 index 0000000000..1d20b56551 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingAngelGrinder.java @@ -0,0 +1,139 @@ + +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_ModHandler.RecipeBits; +import gregtech.api.util.GT_OreDictUnificator; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; +import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegistrator; +import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; +import net.minecraft.item.ItemStack; + +public class ProcessingAngelGrinder implements Interface_OreRecipeRegistrator, Runnable { + public ProcessingAngelGrinder() { + GregtechOrePrefixes.toolAngleGrinder.add(this); + } + + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint)) { + if (aMaterial != Materials.Rubber) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) + && (!aMaterial.contains(SubTag.NO_SMASHING))) { + GT_ModHandler.addCraftingRecipe( + MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(16, 1, aMaterial, aMaterial, null), + GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, + new Object[] { "IhI", "III", " I ", Character.valueOf('I'), + OrePrefixes.ingot.get(aMaterial) }); + } + } + } + } + + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { + // TODO Auto-generated method stub + + } + + public void materialsLoops() { + final Materials[] i = Materials.values(); + final int size = i.length; + Logger.MATERIALS("Materials to attempt tool gen. with: " + size); + int used = 0; + Materials aMaterial = null; + for (int r = 0; r < size; r++) { + aMaterial = i[r]; + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint) && (aMaterial != Materials.Rubber) + && (aMaterial != Materials._NULL)) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) + && (!aMaterial.contains(SubTag.NO_SMASHING)) && (!aMaterial.contains(SubTag.TRANSPARENT)) + && (!aMaterial.contains(SubTag.FLAMMABLE)) && (!aMaterial.contains(SubTag.MAGICAL)) + && (!aMaterial.contains(SubTag.NO_SMELTING))) { + Logger.MATERIALS("Generating Angle Grinder from "+MaterialUtils.getMaterialName(aMaterial)); + // Input 1 + + + final ItemStack plate = GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L); + final ItemStack longrod = GT_OreDictUnificator.get(OrePrefixes.stickLong, aMaterial, 1L); + + if ((null != plate && longrod != null)) { + addRecipe(aMaterial, 1600000L, 3, ItemList.Battery_RE_HV_Lithium.get(1)); + addRecipe(aMaterial, 1200000L, 3, ItemList.Battery_RE_HV_Cadmium.get(1)); + addRecipe(aMaterial, 800000L, 3, ItemList.Battery_RE_HV_Sodium.get(1)); + used++; + } else { + Logger.MATERIALS("Unable to generate Angle Grinder from "+MaterialUtils.getMaterialName(aMaterial)+", Plate or Long Rod may be invalid. Invalid | Plate? "+(plate == null) +" | Rod? "+(longrod == null)+" |"); + } + // GT_ModHandler.addCraftingRecipe(, + // GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | + // GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"P H", "PIP", " I ", + // Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial), + // Character.valueOf('P'), OrePrefixes.plate.get(aMaterial), + // Character.valueOf('H'), OrePrefixes.toolHeadHammer.get(aMaterial)}); + } else { + Logger.MATERIALS("Unable to generate Angle Grinder from "+MaterialUtils.getMaterialName(aMaterial)); + } + } else { + Logger.MATERIALS("Unable to generate Angle Grinder from "+MaterialUtils.getMaterialName(aMaterial)); + } + + } + + Logger.INFO("Materials used for tool gen: " + used); + } + + @Override + public void run() { + Logger.INFO("Generating Angle Grinders for all valid GT Materials."); + this.materialsLoops(); + } + + public boolean addRecipe(Materials aMaterial, long aBatteryStorage, int aVoltageTier, ItemStack aBattery) { + + ItemStack aOutputStack = MetaGeneratedGregtechTools.INSTANCE.getToolWithStats( + MetaGeneratedGregtechTools.ANGLE_GRINDER, + 1, + aMaterial, + Materials.Titanium, + new long[]{aBatteryStorage, GT_Values.V[aVoltageTier], 3L, -1L}); + + + + long aDura = MetaGeneratedGregtechTools.getToolMaxDamage(aOutputStack); + if (aDura <= 32000) { + Logger.MATERIALS("Unable to generate Angle Grinder from "+MaterialUtils.getMaterialName(aMaterial)+", Durability: "+aDura); + return false; + } + + return GT_ModHandler.addCraftingRecipe( + aOutputStack, + RecipeBits.DISMANTLEABLE | RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | RecipeBits.BUFFERED, + new Object[]{ + "SXL", + "GMG", + "PBP", + 'X', ItemList.Component_Grinder_Tungsten.get(1), + 'M', CI.getElectricMotor(aVoltageTier, 1), + 'S', OrePrefixes.screw.get(Materials.Titanium), + 'L', OrePrefixes.stickLong.get(aMaterial), + 'P', OrePrefixes.plate.get(aMaterial), + 'G', ELEMENT.STANDALONE.BLACK_METAL.getGear(1), + 'B', aBattery + }); + + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricButcherKnife.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricButcherKnife.java new file mode 100644 index 0000000000..e8f9f5129c --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricButcherKnife.java @@ -0,0 +1,143 @@ + +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_ModHandler.RecipeBits; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.common.items.GT_MetaGenerated_Tool_01; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; +import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegistrator; +import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; +import net.minecraft.item.ItemStack; + +public class ProcessingElectricButcherKnife implements Interface_OreRecipeRegistrator, Runnable { + public ProcessingElectricButcherKnife() { + GregtechOrePrefixes.toolElectricButcherKnife.add(this); + } + + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint)) { + if (aMaterial != Materials.Rubber) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) + && (!aMaterial.contains(SubTag.NO_SMASHING))) { + GT_ModHandler.addCraftingRecipe( + MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(16, 1, aMaterial, aMaterial, null), + GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, + new Object[] { "IhI", "III", " I ", Character.valueOf('I'), + OrePrefixes.ingot.get(aMaterial) }); + } + } + } + } + + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { + // TODO Auto-generated method stub + + } + + public void materialsLoops() { + final Materials[] i = Materials.values(); + final int size = i.length; + Logger.MATERIALS("Materials to attempt tool gen. with: " + size); + int used = 0; + Materials aMaterial = null; + for (int r = 0; r < size; r++) { + aMaterial = i[r]; + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint) && (aMaterial != Materials.Rubber) + && (aMaterial != Materials._NULL)) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) + && (!aMaterial.contains(SubTag.NO_SMASHING)) && (!aMaterial.contains(SubTag.TRANSPARENT)) + && (!aMaterial.contains(SubTag.FLAMMABLE)) && (!aMaterial.contains(SubTag.MAGICAL)) + && (!aMaterial.contains(SubTag.NO_SMELTING))) { + Logger.MATERIALS("Generating Electric Butcher Knife from "+MaterialUtils.getMaterialName(aMaterial)); + // Input 1 + + + final ItemStack plate = GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L); + + if ((null != plate)) { + addRecipe(aMaterial, 1600000L, 3, ItemList.Battery_RE_HV_Lithium.get(1)); + addRecipe(aMaterial, 1200000L, 3, ItemList.Battery_RE_HV_Cadmium.get(1)); + addRecipe(aMaterial, 800000L, 3, ItemList.Battery_RE_HV_Sodium.get(1)); + used++; + } else { + Logger.MATERIALS("Unable to generate Electric Butcher Knife from "+MaterialUtils.getMaterialName(aMaterial)+", Plate or Long Rod may be invalid. Invalid | Plate? "+(plate == null) +" | Rod? "+" |"); + } + // GT_ModHandler.addCraftingRecipe(, + // GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | + // GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"P H", "PIP", " I ", + // Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial), + // Character.valueOf('P'), OrePrefixes.plate.get(aMaterial), + // Character.valueOf('H'), OrePrefixes.toolHeadHammer.get(aMaterial)}); + } else { + Logger.MATERIALS("Unable to generate Electric Butcher Knife from "+MaterialUtils.getMaterialName(aMaterial)); + } + } else { + Logger.MATERIALS("Unable to generate Electric Butcher Knife from "+MaterialUtils.getMaterialName(aMaterial)); + } + + } + + Logger.INFO("Materials used for tool gen: " + used); + } + + @Override + public void run() { + Logger.INFO("Generating Electric Butcher Knifes for all valid GT Materials."); + this.materialsLoops(); + } + + public boolean addRecipe(Materials aMaterial, long aBatteryStorage, int aVoltageTier, ItemStack aBattery) { + + ItemStack aOutputStack = MetaGeneratedGregtechTools.INSTANCE.getToolWithStats( + MetaGeneratedGregtechTools.ELECTRIC_BUTCHER_KNIFE, + 1, + aMaterial, + Materials.Titanium, + new long[]{aBatteryStorage, GT_Values.V[aVoltageTier], 3L, -1L}); + + ItemStack aInputCutter = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.BUTCHERYKNIFE, + 1, + aMaterial, + aMaterial, + null); + + long aDura = MetaGeneratedGregtechTools.getToolMaxDamage(aOutputStack); + if (aDura <= 32000) { + Logger.MATERIALS("Unable to generate Electric Butcher Knife from "+MaterialUtils.getMaterialName(aMaterial)+", Durability: "+aDura); + return false; + } + + return GT_ModHandler.addCraftingRecipe( + aOutputStack, + RecipeBits.DISMANTLEABLE | RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | RecipeBits.BUFFERED, + new Object[]{ + "SXS", + "GMG", + "PBP", + 'X', aInputCutter, + 'M', CI.getElectricMotor(aVoltageTier, 1), + 'S', OrePrefixes.wireFine.get(Materials.Electrum), + 'P', OrePrefixes.plate.get(aMaterial), + 'G', ELEMENT.STANDALONE.WHITE_METAL.getGear(1), + 'B', aBattery + }); + + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricLighter.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricLighter.java new file mode 100644 index 0000000000..f3dc546191 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricLighter.java @@ -0,0 +1,143 @@ + +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_ModHandler.RecipeBits; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.common.items.GT_MetaGenerated_Tool_01; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; +import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegistrator; +import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; +import net.minecraft.item.ItemStack; + +public class ProcessingElectricLighter implements Interface_OreRecipeRegistrator, Runnable { + public ProcessingElectricLighter() { + GregtechOrePrefixes.toolElectricLighter.add(this); + } + + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint)) { + if (aMaterial != Materials.Rubber) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) + && (!aMaterial.contains(SubTag.NO_SMASHING))) { + GT_ModHandler.addCraftingRecipe( + MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(16, 1, aMaterial, aMaterial, null), + GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, + new Object[] { "IhI", "III", " I ", Character.valueOf('I'), + OrePrefixes.ingot.get(aMaterial) }); + } + } + } + } + + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { + // TODO Auto-generated method stub + + } + + public void materialsLoops() { + final Materials[] i = Materials.values(); + final int size = i.length; + Logger.MATERIALS("Materials to attempt tool gen. with: " + size); + int used = 0; + Materials aMaterial = null; + for (int r = 0; r < size; r++) { + aMaterial = i[r]; + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint) && (aMaterial != Materials.Rubber) + && (aMaterial != Materials._NULL)) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) + && (!aMaterial.contains(SubTag.NO_SMASHING)) && (!aMaterial.contains(SubTag.TRANSPARENT)) + && (!aMaterial.contains(SubTag.FLAMMABLE)) && (!aMaterial.contains(SubTag.MAGICAL)) + && (!aMaterial.contains(SubTag.NO_SMELTING))) { + Logger.MATERIALS("Generating Electric Lighter from "+MaterialUtils.getMaterialName(aMaterial)); + // Input 1 + + + final ItemStack plate = GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L); + + if ((null != plate)) { + addRecipe(aMaterial, 1600000L, 3, ItemList.Battery_RE_HV_Lithium.get(1)); + addRecipe(aMaterial, 1200000L, 3, ItemList.Battery_RE_HV_Cadmium.get(1)); + addRecipe(aMaterial, 800000L, 3, ItemList.Battery_RE_HV_Sodium.get(1)); + used++; + } else { + Logger.MATERIALS("Unable to generate Electric Lighter from "+MaterialUtils.getMaterialName(aMaterial)+", Plate or Long Rod may be invalid. Invalid | Plate? "+(plate == null) +" | Rod? "+" |"); + } + // GT_ModHandler.addCraftingRecipe(, + // GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | + // GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"P H", "PIP", " I ", + // Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial), + // Character.valueOf('P'), OrePrefixes.plate.get(aMaterial), + // Character.valueOf('H'), OrePrefixes.toolHeadHammer.get(aMaterial)}); + } else { + Logger.MATERIALS("Unable to generate Electric Lighter from "+MaterialUtils.getMaterialName(aMaterial)); + } + } else { + Logger.MATERIALS("Unable to generate Electric Lighter from "+MaterialUtils.getMaterialName(aMaterial)); + } + + } + + Logger.INFO("Materials used for tool gen: " + used); + } + + @Override + public void run() { + Logger.INFO("Generating Electric Lighters for all valid GT Materials."); + this.materialsLoops(); + } + + public boolean addRecipe(Materials aMaterial, long aBatteryStorage, int aVoltageTier, ItemStack aBattery) { + + ItemStack aOutputStack = MetaGeneratedGregtechTools.INSTANCE.getToolWithStats( + MetaGeneratedGregtechTools.ELECTRIC_LIGHTER, + 1, + aMaterial, + Materials.Titanium, + new long[]{aBatteryStorage, GT_Values.V[aVoltageTier], 3L, -1L}); + + ItemStack aInputCutter = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.SOLDERING_IRON_LV, + 1, + aMaterial, + aMaterial, + null); + + long aDura = MetaGeneratedGregtechTools.getToolMaxDamage(aOutputStack); + if (aDura <= 32000) { + Logger.MATERIALS("Unable to generate Electric Lighter from "+MaterialUtils.getMaterialName(aMaterial)+", Durability: "+aDura); + return false; + } + + return GT_ModHandler.addCraftingRecipe( + aOutputStack, + RecipeBits.DISMANTLEABLE | RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | RecipeBits.BUFFERED, + new Object[]{ + "SXS", + "GMG", + "PBP", + 'X', aInputCutter, + 'M', CI.getSensor(aVoltageTier, 1), + 'S', OrePrefixes.wireGt04.get(Materials.Gold), + 'P', OrePrefixes.plate.get(aMaterial), + 'G', ELEMENT.STANDALONE.RUNITE.getPlate(1), + 'B', aBattery + }); + + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricSnips.java b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricSnips.java new file mode 100644 index 0000000000..9285dbc63d --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/loaders/ProcessingElectricSnips.java @@ -0,0 +1,143 @@ + +package gtPlusPlus.xmod.gregtech.loaders; + +import gregtech.api.enums.GT_Values; +import gregtech.api.enums.ItemList; +import gregtech.api.enums.Materials; +import gregtech.api.enums.OrePrefixes; +import gregtech.api.enums.SubTag; +import gregtech.api.util.GT_ModHandler; +import gregtech.api.util.GT_ModHandler.RecipeBits; +import gregtech.api.util.GT_OreDictUnificator; +import gregtech.common.items.GT_MetaGenerated_Tool_01; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.recipe.common.CI; +import gtPlusPlus.core.util.minecraft.MaterialUtils; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; +import gtPlusPlus.xmod.gregtech.api.interfaces.internal.Interface_OreRecipeRegistrator; +import gtPlusPlus.xmod.gregtech.common.items.MetaGeneratedGregtechTools; +import net.minecraft.item.ItemStack; + +public class ProcessingElectricSnips implements Interface_OreRecipeRegistrator, Runnable { + public ProcessingElectricSnips() { + GregtechOrePrefixes.toolElectricSnips.add(this); + } + + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint)) { + if (aMaterial != Materials.Rubber) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) + && (!aMaterial.contains(SubTag.NO_SMASHING))) { + GT_ModHandler.addCraftingRecipe( + MetaGeneratedGregtechTools.INSTANCE.getToolWithStats(16, 1, aMaterial, aMaterial, null), + GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | GT_ModHandler.RecipeBits.BUFFERED, + new Object[] { "IhI", "III", " I ", Character.valueOf('I'), + OrePrefixes.ingot.get(aMaterial) }); + } + } + } + } + + @Override + public void registerOre(final GregtechOrePrefixes aPrefix, final GT_Materials aMaterial, final String aOreDictName, + final String aModName, final ItemStack aStack) { + // TODO Auto-generated method stub + + } + + public void materialsLoops() { + final Materials[] i = Materials.values(); + final int size = i.length; + Logger.MATERIALS("Materials to attempt tool gen. with: " + size); + int used = 0; + Materials aMaterial = null; + for (int r = 0; r < size; r++) { + aMaterial = i[r]; + if ((aMaterial != Materials.Stone) && (aMaterial != Materials.Flint) && (aMaterial != Materials.Rubber) + && (aMaterial != Materials._NULL)) { + if ((!aMaterial.contains(SubTag.WOOD)) && (!aMaterial.contains(SubTag.BOUNCY)) + && (!aMaterial.contains(SubTag.NO_SMASHING)) && (!aMaterial.contains(SubTag.TRANSPARENT)) + && (!aMaterial.contains(SubTag.FLAMMABLE)) && (!aMaterial.contains(SubTag.MAGICAL)) + && (!aMaterial.contains(SubTag.NO_SMELTING))) { + Logger.MATERIALS("Generating Electric Snips from "+MaterialUtils.getMaterialName(aMaterial)); + // Input 1 + + + final ItemStack plate = GT_OreDictUnificator.get(OrePrefixes.plate, aMaterial, 1L); + + if ((null != plate)) { + addRecipe(aMaterial, 1600000L, 3, ItemList.Battery_RE_HV_Lithium.get(1)); + addRecipe(aMaterial, 1200000L, 3, ItemList.Battery_RE_HV_Cadmium.get(1)); + addRecipe(aMaterial, 800000L, 3, ItemList.Battery_RE_HV_Sodium.get(1)); + used++; + } else { + Logger.MATERIALS("Unable to generate Electric Snips from "+MaterialUtils.getMaterialName(aMaterial)+", Plate or Long Rod may be invalid. Invalid | Plate? "+(plate == null) +" | Rod? "+" |"); + } + // GT_ModHandler.addCraftingRecipe(, + // GT_ModHandler.RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | + // GT_ModHandler.RecipeBits.BUFFERED, new Object[]{"P H", "PIP", " I ", + // Character.valueOf('I'), OrePrefixes.ingot.get(aMaterial), + // Character.valueOf('P'), OrePrefixes.plate.get(aMaterial), + // Character.valueOf('H'), OrePrefixes.toolHeadHammer.get(aMaterial)}); + } else { + Logger.MATERIALS("Unable to generate Electric Snips from "+MaterialUtils.getMaterialName(aMaterial)); + } + } else { + Logger.MATERIALS("Unable to generate Electric Snips from "+MaterialUtils.getMaterialName(aMaterial)); + } + + } + + Logger.INFO("Materials used for tool gen: " + used); + } + + @Override + public void run() { + Logger.INFO("Generating Electric Snipss for all valid GT Materials."); + this.materialsLoops(); + } + + public boolean addRecipe(Materials aMaterial, long aBatteryStorage, int aVoltageTier, ItemStack aBattery) { + + ItemStack aOutputStack = MetaGeneratedGregtechTools.INSTANCE.getToolWithStats( + MetaGeneratedGregtechTools.ELECTRIC_SNIPS, + 1, + aMaterial, + Materials.Titanium, + new long[]{aBatteryStorage, GT_Values.V[aVoltageTier], 3L, -1L}); + + ItemStack aInputCutter = GT_MetaGenerated_Tool_01.INSTANCE.getToolWithStats( + GT_MetaGenerated_Tool_01.WIRECUTTER, + 1, + aMaterial, + aMaterial, + null); + + long aDura = MetaGeneratedGregtechTools.getToolMaxDamage(aOutputStack); + if (aDura <= 32000) { + Logger.MATERIALS("Unable to generate Electric Snips from "+MaterialUtils.getMaterialName(aMaterial)+", Durability: "+aDura); + return false; + } + + return GT_ModHandler.addCraftingRecipe( + aOutputStack, + RecipeBits.DISMANTLEABLE | RecipeBits.DO_NOT_CHECK_FOR_COLLISIONS | RecipeBits.BUFFERED, + new Object[]{ + "SXS", + "GMG", + "PBP", + 'X', aInputCutter, + 'M', CI.getElectricMotor(aVoltageTier, 1), + 'S', OrePrefixes.wireFine.get(Materials.Electrum), + 'P', OrePrefixes.plate.get(aMaterial), + 'G', ELEMENT.STANDALONE.WHITE_METAL.getGear(1), + 'B', aBattery + }); + + } + +}
\ No newline at end of file diff --git a/src/Java/gtPlusPlus/xmod/gregtech/recipes/RecipesToRemove.java b/src/Java/gtPlusPlus/xmod/gregtech/recipes/RecipesToRemove.java new file mode 100644 index 0000000000..06373c9e1d --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/gregtech/recipes/RecipesToRemove.java @@ -0,0 +1,46 @@ +package gtPlusPlus.xmod.gregtech.recipes; + +import gregtech.api.enums.Materials; +import gregtech.api.util.GT_Recipe; +import gregtech.api.util.Recipe_GT; +import gtPlusPlus.api.objects.Logger; +import gtPlusPlus.core.material.ELEMENT; +import gtPlusPlus.core.util.minecraft.ItemUtils; +import net.minecraft.item.ItemStack; +import net.minecraftforge.fluids.FluidStack; + +public class RecipesToRemove { + + public static void go() { + + Logger.INFO("Processing Gregtech recipe maps, removing recipes to suit GT++."); + + //Remove Rare Earth Centrifuging + //1 Rare Earth Dust - 25% chance for small piles of: neodymium, yttrium, lanthanum, cerium, cadmium, and caesium + //Replaced by advanced sifting recipe. + GT_Recipe aRareEarthCentrifuging = GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.findRecipe(null, false, 20, new FluidStack[] {}, new ItemStack[] {ItemUtils.getItemStackOfAmountFromOreDict("dustRareEarth", 1)}); + if (aRareEarthCentrifuging != null && aRareEarthCentrifuging.mEnabled) { + aRareEarthCentrifuging.mEnabled = false; + aRareEarthCentrifuging.mHidden = true; + GT_Recipe.GT_Recipe_Map.sCentrifugeRecipes.mRecipeList.remove(aRareEarthCentrifuging); + Recipe_GT.GT_Recipe_Map_LargeCentrifuge.sMultiblockCentrifugeRecipes.mRecipeList.remove(aRareEarthCentrifuging); + Recipe_GT.GT_Recipe_Map_LargeCentrifuge.sMultiblockCentrifugeRecipes_GT.mRecipeList.remove(aRareEarthCentrifuging); + Logger.INFO("Removed vanilla GT Rare Earth processing."); + //Set the Chemical Symbol for Rare Earth now that we are giving it custom outputs + //Best not to set this unless the original recipe is removed. + Materials.RareEarth.mChemicalFormula = "(" + +ELEMENT.getInstance().YTTRIUM.vChemicalSymbol + +ELEMENT.getInstance().NEODYMIUM.vChemicalSymbol + +ELEMENT.getInstance().LANTHANUM.vChemicalSymbol + +ELEMENT.getInstance().CERIUM.vChemicalSymbol + +ELEMENT.getInstance().CADMIUM.vChemicalSymbol + +ELEMENT.getInstance().CAESIUM.vChemicalSymbol + +ELEMENT.getInstance().YTTERBIUM.vChemicalSymbol + +ELEMENT.getInstance().SAMARIUM.vChemicalSymbol + +ELEMENT.getInstance().GADOLINIUM.vChemicalSymbol+ + ")"; + } + + } + +} diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java index 94104ab0d5..38589eaac1 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechConduits.java @@ -18,9 +18,12 @@ import gtPlusPlus.core.material.*; import gtPlusPlus.core.recipe.common.CI; import gtPlusPlus.core.util.Utils; import gtPlusPlus.core.util.minecraft.*; +import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.enums.GregtechOrePrefixes.GT_Materials; +import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GT_MetaPipeEntity_Heat; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GregtechMetaPipeEntityFluid; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.GregtechMetaPipeEntity_Cable; +import gtPlusPlus.xmod.gregtech.common.tileentities.generators.GregtechMetaTileEntityGeothermalGenerator; import net.minecraft.item.ItemStack; import net.minecraftforge.oredict.OreDictionary; @@ -94,7 +97,16 @@ public class GregtechConduits { Logger.INFO("Failed during Hexadecuple pipe generation. [Ecx]"); e.printStackTrace(); } - } + } + + + //Generate Heat Pipes + GregtechItemList.HeatPipe_Tier_1.set(new GT_MetaPipeEntity_Heat(31021, "gtpp.pipe.heat.basic.01", "Lead Heat Pipe (500C)", Materials.Lead, 500).getStackForm(1L)); + GregtechItemList.HeatPipe_Tier_2.set(new GT_MetaPipeEntity_Heat(31022, "gtpp.pipe.heat.basic.02", "Iron Heat Pipe (500C)", Materials.Iron, 500).getStackForm(1L)); + GregtechItemList.HeatPipe_Tier_3.set(new GT_MetaPipeEntity_Heat(31023, "gtpp.pipe.heat.basic.03", "Silver Heat Pipe (1500C)", Materials.Silver, 1500).getStackForm(1L)); + + + } private static void generateFluidMultiPipes(Constructor<GT_MetaPipeEntity_Fluid> aClazz, Materials aMaterial, String name, String displayName, int startID, int baseCapacity, int heatCapacity, boolean gasProof){ diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java index d04f71e235..a69c91e93b 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechHiAmpTransformer.java @@ -2,16 +2,16 @@ package gtPlusPlus.xmod.gregtech.registration.gregtech; import static gtPlusPlus.core.lib.CORE.GTNH; -import net.minecraft.item.ItemStack; - import gregtech.api.enums.ItemList; import gregtech.api.enums.Materials; import gregtech.api.enums.OrePrefixes; import gregtech.api.util.GT_ModHandler; import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; +import gtPlusPlus.core.util.minecraft.ItemUtils; import gtPlusPlus.xmod.gregtech.api.enums.GregtechItemList; import gtPlusPlus.xmod.gregtech.api.metatileentity.implementations.base.GregtechMetaTransformerHiAmp; +import gtPlusPlus.xmod.gregtech.common.StaticFields59; +import net.minecraft.item.ItemStack; public class GregtechHiAmpTransformer { @@ -54,21 +54,18 @@ public class GregtechHiAmpTransformer { ItemStack mItem_1; ItemStack mItem_2; ItemStack mItem_3; - try { - mItem_1 = Utils.getValueOfItemList("Casing_Coil_TungstenSteel", ItemList.Circuit_Elite).get(1); - } catch (Throwable t){ - mItem_1 = ItemList.Circuit_Elite.get(1); - } - try { - mItem_2 = Utils.getValueOfItemList("Casing_Coil_Naquadah", ItemList.Circuit_Master).get(1); - } catch (Throwable t){ - mItem_2 = ItemList.Circuit_Master.get(1); - } - try { - mItem_3 = Utils.getValueOfItemList("Casing_Coil_NaquadahAlloy", ItemList.Circuit_Ultimate).get(1); - } catch (Throwable t){ - mItem_3 = ItemList.Circuit_Ultimate.get(1); - } + + if (CORE.MAIN_GREGTECH_5U_EXPERIMENTAL_FORK) { + mItem_1 = ItemUtils.simpleMetaStack(ItemUtils.getSimpleStack(StaticFields59.getBlockCasings5()).getItem(), 3, 1); + mItem_2 = ItemUtils.simpleMetaStack(ItemUtils.getSimpleStack(StaticFields59.getBlockCasings5()).getItem(), 4, 1); + mItem_3 = ItemUtils.simpleMetaStack(ItemUtils.getSimpleStack(StaticFields59.getBlockCasings5()).getItem(), 5, 1); + } + else { + mItem_1 = ItemList.Circuit_Elite.get(1); + mItem_2 = ItemList.Circuit_Master.get(1); + mItem_3 = ItemList.Circuit_Ultimate.get(1); + } + if(!GTNH){ GT_ModHandler.addCraftingRecipe(GregtechItemList.Transformer_HA_LV_ULV.get(1L, new Object[0]), bitsd, new Object[] { " BB", "CM ", " BB", Character.valueOf('M'), ItemList.Hull_ULV, Character.valueOf('C'), diff --git a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java index 25b8e73d37..deb31c8c95 100644 --- a/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java +++ b/src/Java/gtPlusPlus/xmod/gregtech/registration/gregtech/GregtechSimpleWasher.java @@ -20,8 +20,22 @@ public class GregtechSimpleWasher { generateDirtyDustRecipes(); generateDirtyCrushedRecipes(); // Register the Simple Washer Entity. - GregtechItemList.SimpleDustWasher - .set(new GregtechMetaTileEntity_BasicWasher(767, "simplewasher.01.tier.00", "Simple Washer", 0) + GregtechItemList.SimpleDustWasher_ULV + .set(new GregtechMetaTileEntity_BasicWasher(767, "simplewasher.01.tier.01", "Simple Washer I", 0) + .getStackForm(1L)); + + //People want them in higher tiers apparently + GregtechItemList.SimpleDustWasher_MV + .set(new GregtechMetaTileEntity_BasicWasher(31017, "simplewasher.01.tier.02", "Simple Washer II", 2) + .getStackForm(1L)); + GregtechItemList.SimpleDustWasher_EV + .set(new GregtechMetaTileEntity_BasicWasher(31018, "simplewasher.01.tier.03", "Simple Washer III", 4) + .getStackForm(1L)); + GregtechItemList.SimpleDustWasher_LuV + .set(new GregtechMetaTileEntity_BasicWasher(31019, "simplewasher.01.tier.04", "Simple Washer IV", 6) + .getStackForm(1L)); + GregtechItemList.SimpleDustWasher_UV + .set(new GregtechMetaTileEntity_BasicWasher(31020, "simplewasher.01.tier.05", "Simple Washer V", 8) .getStackForm(1L)); } } diff --git a/src/Java/gtPlusPlus/xmod/ic2/item/reactor/IC2_FuelRod_Base.java b/src/Java/gtPlusPlus/xmod/ic2/item/reactor/IC2_FuelRod_Base.java new file mode 100644 index 0000000000..01151024c4 --- /dev/null +++ b/src/Java/gtPlusPlus/xmod/ic2/item/reactor/IC2_FuelRod_Base.java @@ -0,0 +1,52 @@ +package gtPlusPlus.xmod.ic2.item.reactor; + +import ic2.api.reactor.IReactor; +import ic2.api.reactor.IReactorComponent; +import net.minecraft.item.ItemStack; + +public class IC2_FuelRod_Base implements IReactorComponent { + + @Override + public void processChamber(IReactor var1, ItemStack var2, int var3, int var4, boolean var5) { + // TODO Auto-generated method stub + + } + + @Override + public boolean acceptUraniumPulse(IReactor var1, ItemStack var2, ItemStack var3, int var4, int var5, int var6, + int var7, boolean var8) { + // TODO Auto-generated method stub + return false; + } + + @Override + public boolean canStoreHeat(IReactor var1, ItemStack var2, int var3, int var4) { + // TODO Auto-generated method stub + return false; + } + + @Override + public int getMaxHeat(IReactor var1, ItemStack var2, int var3, int var4) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int getCurrentHeat(IReactor var1, ItemStack var2, int var3, int var4) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int alterHeat(IReactor var1, ItemStack var2, int var3, int var4, int var5) { + // TODO Auto-generated method stub + return 0; + } + + @Override + public float influenceExplosion(IReactor var1, ItemStack var2) { + // TODO Auto-generated method stub + return 0; + } + +} diff --git a/src/resources/assets/gregtech/lang/en_US.lang b/src/resources/assets/gregtech/lang/en_US.lang index ffbb3d8a7a..caf4f636fb 100644 --- a/src/resources/assets/gregtech/lang/en_US.lang +++ b/src/resources/assets/gregtech/lang/en_US.lang @@ -46,7 +46,12 @@ GTPP.nanohealer.tooltip.4=WILL NOT PREVENT DEATH GTPP.nanohealer.tooltip.5=Shift+RMB to toggle notifications GTPP.nanohealer.hidden=Hiding Info? - +//10/4/19 +//Tooltips for the Mob Killing Baubles +GTPP.monsterkiller.tooltip.1=Worn as an Amulet within Baubles +GTPP.monsterkiller.tooltip.2=Drains +GTPP.monsterkiller.tooltip.3=per each kill +GTPP.monsterkiller.tooltip.4=Target Type: diff --git a/src/resources/assets/miscutils/lang/en_US.lang b/src/resources/assets/miscutils/lang/en_US.lang index e1102d708e..9ce7e83082 100644 --- a/src/resources/assets/miscutils/lang/en_US.lang +++ b/src/resources/assets/miscutils/lang/en_US.lang @@ -2609,7 +2609,7 @@ item.particle.ion.Antimony.name=Antimony Ion item.particle.ion.Tellurium.name=Tellurium Ion item.particle.ion.Iodine.name=Iodine Ion item.particle.ion.Xenon.name=Xenon Ion -item.particle.ion.Cesium.name=Cesium Ion +item.particle.ion.Cesium.name=Caesium Ion item.particle.ion.Barium.name=Barium Ion item.particle.ion.Lanthanum.name=Lanthanum Ion item.particle.ion.Cerium.name=Cerium Ion @@ -2770,4 +2770,105 @@ item.itemNuggetTeflon.name=Teflon Nugget item.itemPlateTeflon.name=Teflon Plate item.itemPlateDoubleTeflon.name=Double Teflon Plate item.itemCellTeflon.name=Teflon Cell -tile.Block of Teflon.name=Block of Teflon
\ No newline at end of file +tile.Block of Teflon.name=Block of Teflon + +//Added 17/4/19 +//Spelling Corrections +item.particle.ion.Aluminium.name=Aluminium Ion +item.particle.ion.Caesium.name=Caesium Ion + +item.GTPP.MonsterKiller.Enderman.name=Enderman Killer +item.GTPP.MonsterKiller.Spider.name=Spider Killer +item.GTPP.MonsterKiller.Skeleton.name=Skeleton Killer +item.GTPP.MonsterKiller.Creeper.name=Creeper Killer +item.GTPP.MonsterKiller.Zombie.name=Zombie Killer +item.GTPP.MonsterKiller.Hellish.name=Nether Mob Killer + +item.itemIngotRunite.name=Runite Ingot +item.itemDustRunite.name=Runite Dust +item.itemDustTinyRunite.name=Tiny Pile of Runite Dust +item.itemDustSmallRunite.name=Small Pile of Runite Dust +item.itemNuggetRunite.name=Runite Nugget +item.itemPlateRunite.name=Runite Plate +item.itemPlateDoubleRunite.name=Double Runite Plate +item.itemCellRunite.name=Runite Cell +tile.Block of Runite.name=Block of Runite + +item.itemIngotDragonblood.name=Dragonblood Ingot +item.itemDustDragonblood.name=Dragonblood Dust +item.itemDustTinyDragonblood.name=Tiny Pile of Dragonblood Dust +item.itemDustSmallDragonblood.name=Small Pile of Dragonblood Dust +item.itemNuggetDragonblood.name=Dragonblood Nugget +item.itemPlateDragonblood.name=Dragonblood Plate +item.itemPlateDoubleDragonblood.name=Double Dragonblood Plate +item.itemCellDragonblood.name=Dragonblood Cell +tile.Block of Dragonblood.name=Block of Dragonblood + +item.itemIngotBlackTitanium.name=Black Titanium Ingot +item.itemDustBlackTitanium.name=Black Titanium Dust +item.itemDustTinyBlackTitanium.name=Tiny Pile of Black Titanium Dust +item.itemDustSmallBlackTitanium.name=Small Pile of Black Titanium Dust +item.itemNuggetBlackTitanium.name=Black Titanium Nugget +item.itemPlateBlackTitanium.name=Black Titanium Plate +item.itemPlateDoubleBlackTitanium.name=Double Black Titanium Plate +item.itemCellBlackTitanium.name=Black Titanium Cell +tile.Block of Black Titanium.name=Block of Black Titanium + +item.itemIngotAncientGranite.name=Ancient Granite Ingot +item.itemHotIngotAncientGranite.name=Hot Ancient Granite Ingot +item.itemDustAncientGranite.name=Ancient Granite Dust +item.itemDustTinyAncientGranite.name=Tiny Pile of Ancient Granite Dust +item.itemDustSmallAncientGranite.name=Small Pile of Ancient Granite Dust +item.itemNuggetAncientGranite.name=Ancient Granite Nugget +item.itemPlateAncientGranite.name=Ancient Granite Plate +item.itemPlateDoubleAncientGranite.name=Double Ancient Granite Plate +tile.Block of Ancient Granite.name=Block of Ancient Granite + +item.itemIngotBabbitAlloy.name=Babbit Alloy Ingot +item.itemHotIngotBabbitAlloy.name=Hot Babbit Alloy Ingot +item.itemDustBabbitAlloy.name=Babbit Alloy Dust +item.itemDustTinyBabbitAlloy.name=Tiny Pile of Babbit Alloy Dust +item.itemDustSmallBabbitAlloy.name=Small Pile of Babbit Alloy Dust +item.itemNuggetBabbitAlloy.name=Babbit Alloy Nugget +item.itemPlateBabbitAlloy.name=Babbit Alloy Plate +item.itemPlateDoubleBabbitAlloy.name=Double Babbit Alloy Plate +item.itemCellBabbitAlloy.name=Babbit Alloy Cell +tile.Block of Babbit Alloy.name=Block of Babbit Alloy + +item.itemIngotBlackMetal.name=Black Metal Ingot +item.itemHotIngotBlackMetal.name=Hot Black Metal Ingot +item.itemDustBlackMetal.name=Black Metal Dust +item.itemDustTinyBlackMetal.name=Tiny Pile of Black Metal Dust +item.itemDustSmallBlackMetal.name=Small Pile of Black Metal Dust +item.itemNuggetBlackMetal.name=Black Metal Nugget +item.itemPlateBlackMetal.name=Black Metal Plate +item.itemPlateDoubleBlackMetal.name=Double Black Metal Plate +item.itemBoltBlackMetal.name=Black Metal Bolt +item.itemRodBlackMetal.name=Black Metal Rod +item.itemRodLongBlackMetal.name=Long Black Metal Rod +item.itemRingBlackMetal.name=Black Metal Ring +item.itemScrewBlackMetal.name=Black Metal Screw +item.itemRotorBlackMetal.name=Black Metal Rotor +item.itemGearBlackMetal.name=Black Metal Gear +item.itemCellBlackMetal.name=Black Metal Cell +tile.Block of Black Metal.name=Block of Black Metal +tile.Black Metal Frame Box.name=Black Metal Frame Box + +item.itemIngotWhiteMetal.name=White Metal Ingot +item.itemHotIngotWhiteMetal.name=Hot White Metal Ingot +item.itemDustWhiteMetal.name=White Metal Dust +item.itemDustTinyWhiteMetal.name=Tiny Pile of White Metal Dust +item.itemDustSmallWhiteMetal.name=Small Pile of White Metal Dust +item.itemNuggetWhiteMetal.name=White Metal Nugget +item.itemPlateWhiteMetal.name=White Metal Plate +item.itemPlateDoubleWhiteMetal.name=Double White Metal Plate +item.itemBoltWhiteMetal.name=White Metal Bolt +item.itemRodWhiteMetal.name=White Metal Rod +item.itemRodLongWhiteMetal.name=Long White Metal Rod +item.itemRingWhiteMetal.name=White Metal Ring +item.itemScrewWhiteMetal.name=White Metal Screw +item.itemRotorWhiteMetal.name=White Metal Rotor +item.itemGearWhiteMetal.name=White Metal Gear +item.itemCellWhiteMetal.name=White Metal Cell +tile.Block of White Metal.name=Block of White Metal +tile.White Metal Frame Box.name=White Metal Frame Box
\ No newline at end of file diff --git a/src/resources/assets/miscutils/textures/blocks/redstone/redstone_meter/top.png b/src/resources/assets/miscutils/textures/blocks/redstone/redstone_meter/top.png Binary files differnew file mode 100644 index 0000000000..ba45c43891 --- /dev/null +++ b/src/resources/assets/miscutils/textures/blocks/redstone/redstone_meter/top.png diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ANGLE_GRINDER.png b/src/resources/assets/miscutils/textures/items/iconsets/ANGLE_GRINDER.png Binary files differnew file mode 100644 index 0000000000..3030cbe6aa --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/iconsets/ANGLE_GRINDER.png diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ANGLE_GRINDER_OVERLAY.png b/src/resources/assets/miscutils/textures/items/iconsets/ANGLE_GRINDER_OVERLAY.png Binary files differnew file mode 100644 index 0000000000..d83a131004 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/iconsets/ANGLE_GRINDER_OVERLAY.png diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_BUTCHER_KNIFE.png b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_BUTCHER_KNIFE.png Binary files differnew file mode 100644 index 0000000000..5114f2c9a8 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_BUTCHER_KNIFE.png diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_BUTCHER_KNIFE_OVERLAY.png b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_BUTCHER_KNIFE_OVERLAY.png Binary files differnew file mode 100644 index 0000000000..d83a131004 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_BUTCHER_KNIFE_OVERLAY.png diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_LIGHTER.png b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_LIGHTER.png Binary files differnew file mode 100644 index 0000000000..1c6257f336 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_LIGHTER.png diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_LIGHTER_OVERLAY.png b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_LIGHTER_OVERLAY.png Binary files differnew file mode 100644 index 0000000000..1c91860461 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_LIGHTER_OVERLAY.png diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_SNIPS.png b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_SNIPS.png Binary files differnew file mode 100644 index 0000000000..8ccd7f3c1a --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_SNIPS.png diff --git a/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_SNIPS_OVERLAY.png b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_SNIPS_OVERLAY.png Binary files differnew file mode 100644 index 0000000000..d83a131004 --- /dev/null +++ b/src/resources/assets/miscutils/textures/items/iconsets/ELECTRIC_SNIPS_OVERLAY.png |