diff options
| author | Connor-Colenso <52056774+Connor-Colenso@users.noreply.github.com> | 2023-09-04 03:05:22 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-09-04 03:05:22 +0100 |
| commit | 76719d65a90d98e228a914774d3b11ed9f01ac8e (patch) | |
| tree | ce0d35f954e441e9cc4aa95aa347073728e6f4ee /src/main/java/gtPlusPlus/core/fluids | |
| parent | 0393b582eb3edcb5c575330804b6747577a55e27 (diff) | |
| download | GT5-Unofficial-76719d65a90d98e228a914774d3b11ed9f01ac8e.tar.gz GT5-Unofficial-76719d65a90d98e228a914774d3b11ed9f01ac8e.tar.bz2 GT5-Unofficial-76719d65a90d98e228a914774d3b11ed9f01ac8e.zip | |
Clean-up v2 (#729)
* Remove test items from NEI with no texture
* Add number formatting to hand pumps
* Remove heavy plates (no recipes & completely unused).
* Remove helium generator (no texture, no recipe)
* Remove fire pit and fire starter (no use, no recipe, no textures)
* Remove giant chicken and associated unused stuff, has no texture and is unobtainable. Used to be relevant but isn't anymore.
* Remove villagers with silly trades like 1 motor + 1 hull = 1 hull. Why?
* Remove trade bench, no recipe, missing textures. Unused.
* Remove farm processors, no texture, no recipe. Unused.
* Remove MAX tier components, these exist in GT now, have no recipe here and are unused.
* Hide untextured light block from NEI
* Update buildscript
* Remove unused backpacks, no recipe and contains dupe bugs. Bad.
* Remove eatotronic, universal toolbox and magic tool bag. All 3 are missing textures and uncraftable.
* Remove eatotronic, universal toolbox and magic tool bag. All 3 are missing textures and uncraftable. part 2
* Remove dragon catcher (what?), no texture, no recipe, unused.
* Remove empty item, does nothing, has no recipe, no idea why it is here.
* Empty item v2 removal
* Revert "Empty item v2 removal"
This reverts commit 75bcd3ccfaf55bbfe2c12b2e4167d5c37636030d.
* Revert "Remove empty item, does nothing, has no recipe, no idea why it is here."
This reverts commit e41a9f484392776331c58530ab1faa5ef978ef36.
* Remove debug square. No recipe, unused.
* Number formatting overflow covers
* Remove JVM garbage collection block. Unused, no recipe.
* Remove nanotubes, no recipe for them. Unused.
* Remove "git" item, doesn't seem to work. Has no recipe.
* Remove uncraftable food with awful textures.
* Remove "bat king" mob, unused content. Does not spawn.
* Remove uncraftable doors with bad textures. Unused content.
* Remove uncraftable, unlocalised redstone stuff that crashes game when placed.
* Remove weird spawner item. No recipe, does not exist in world.
* Remove sunnarium bit, no recipe, no usage.
* Remove unused modularity table and some misc uncraftable, unused items.
* Remove Interconnecting Storage Crate, no recipe, unused.
* Delete worse debug power gen, this already exists as part of GT. Unneeded duplication.
* Delete unused placeholder circuit
* Delete uncraftable generator hatches.
* Spotless
* Remove XP tank thing, unused and uncraftable.
* Remove null item, this fluid registry only seemed to register one null fluid. All others exist?
* Remove EU -> RF battery. Unused in GTNH.
* Remove some shelf nonsense, why is this in this mod?
* Remove some weird random tools. These have no realistic usage in GTNH.
* Remove firemaker. Useless in GTNH.
* Removed helium blob. Deprecated item, not used anymore, uncraftable.
* spotlessApply (#730)
Co-authored-by: GitHub GTNH Actions <>
* Stop modulators generating unused blocks with no textures
* Remove more unused untextured casings
* Remove more unused untextured casings
* Remove more unused untextured casings
* Remove more unused untextured casings
* Remove more unused untextured casings
* Remove some weird methods and uncraftable mining parts, probably part of deprecated multiblock.
* spotlessApply (#732)
Co-authored-by: GitHub GTNH Actions <>
* Remove gem shards, unused.
* Remove unused atoms
* Remove unused gum
* Remove unused elements/materials
* Bye bye
* Remove some unused reflection stuff
* Remove control cores, obsolete now.
* Remove mob killing thing with no texture and no recipe.
* Remove uncraftable covers
* Remove pizza gloves
* Net and rope removal, unused
* Remove force crop
* Removal of some old event stuff
* Remove unused nuclear chem items
* Remove player safe, mostly because of the horrible event code that was intercepting every block break. I can't see any real usage of this via discord.
* Remove Force material and associated other nonsense. Also remove some nuclear chem stuff.
* Remove force for realsies
* Skookum Chooker purge.
* Remove some enderio compat, these plates/dusts are added via GT5 anyway now. This is obsolete.
* spotlessApply (#733)
Co-authored-by: GitHub GTNH Actions <>
* Unused textures
* Bump dep
* Revert "Remove force for realsies"
This reverts commit 0d288912a99f9dabce56d2a2623d4d3510f4804e.
* Revert "Remove Force material and associated other nonsense. Also remove some nuclear chem stuff."
This reverts commit 3455e6e916defe1f2aef923be6f9696a6cf3095b.
* Remove nuclear items that are unused
* spotlessApply (#734)
Co-authored-by: GitHub GTNH Actions <>
---------
Co-authored-by: GTNH-Colen <54497873+GTNH-Colen@users.noreply.github.com>
Co-authored-by: Connor Colenso <colen@CONNORSPC>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Diffstat (limited to 'src/main/java/gtPlusPlus/core/fluids')
3 files changed, 0 insertions, 611 deletions
diff --git a/src/main/java/gtPlusPlus/core/fluids/FluidFactory.java b/src/main/java/gtPlusPlus/core/fluids/FluidFactory.java deleted file mode 100644 index 121c217130..0000000000 --- a/src/main/java/gtPlusPlus/core/fluids/FluidFactory.java +++ /dev/null @@ -1,206 +0,0 @@ -package gtPlusPlus.core.fluids; - -import java.util.LinkedHashMap; -import java.util.Map; - -import net.minecraft.block.Block; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemStack; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; -import net.minecraftforge.event.entity.player.FillBucketEvent; -import net.minecraftforge.fluids.Fluid; -import net.minecraftforge.fluids.FluidContainerRegistry; -import net.minecraftforge.fluids.FluidRegistry; - -import cpw.mods.fml.common.eventhandler.Event.Result; -import cpw.mods.fml.common.eventhandler.SubscribeEvent; -import cpw.mods.fml.common.registry.GameRegistry; -import gtPlusPlus.GTplusplus; -import gtPlusPlus.GTplusplus.INIT_PHASE; -import gtPlusPlus.api.objects.GregtechException; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.item.base.itemblock.FluidItemBlock; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.Utils; -import gtPlusPlus.core.util.minecraft.FluidUtils; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class FluidFactory { - - public static final Map<String, Fluid> mNameToFluidMap = new LinkedHashMap<String, Fluid>(); - public static final Map<String, ItemStack> mNameToBucketMap = new LinkedHashMap<String, ItemStack>(); - public static final Map<String, Block> mNameToBlockMap = new LinkedHashMap<String, Block>(); - public static final Map<String, Integer> mNameToMetaMap = new LinkedHashMap<String, Integer>(); - - public static final Map<Fluid, String> mFluidToNameMap = new LinkedHashMap<Fluid, String>(); - public static final Map<Fluid, ItemStack> mFluidToBucketMap = new LinkedHashMap<Fluid, ItemStack>(); - public static final Map<Fluid, Block> mFluidToBlockMap = new LinkedHashMap<Fluid, Block>(); - public static final Map<Fluid, Integer> mFluidToMetaMap = new LinkedHashMap<Fluid, Integer>(); - - public static final Map<ItemStack, Fluid> mBucketToFluidMap = new LinkedHashMap<ItemStack, Fluid>(); - public static final Map<ItemStack, String> mBucketToNameMap = new LinkedHashMap<ItemStack, String>(); - public static final Map<ItemStack, Block> mBucketToBlockMap = new LinkedHashMap<ItemStack, Block>(); - public static final Map<ItemStack, Integer> mBucketToMetaMap = new LinkedHashMap<ItemStack, Integer>(); - - public static final Map<Block, String> mBlockToNameMap = new LinkedHashMap<Block, String>(); - public static final Map<Block, Fluid> mBlockToFluidMap = new LinkedHashMap<Block, Fluid>(); - public static final Map<Block, ItemStack> mBlockToBucketMap = new LinkedHashMap<Block, ItemStack>(); - public static final Map<Block, Integer> mBlockToMetaMap = new LinkedHashMap<Block, Integer>(); - - public static final Map<Integer, String> mMetaToNameMap = new LinkedHashMap<Integer, String>(); - public static final Map<Integer, Fluid> mMetaToFluidMap = new LinkedHashMap<Integer, Fluid>(); - public static final Map<Integer, ItemStack> mMetaToBucketMap = new LinkedHashMap<Integer, ItemStack>(); - public static final Map<Integer, Block> mMetaToBlockMap = new LinkedHashMap<Integer, Block>(); - - // Special Colour Handling - public static final Map<Integer, Integer> mMetaToColourMap = new LinkedHashMap<Integer, Integer>(); - - public static Item mGenericBucket; - private static FluidPackage mErrorFluid; - private static AutoMap<FluidPackage> mGeneratedFluids = new AutoMap<FluidPackage>(); - - public static void preInit() {} - - public static void init() { - mGenericBucket = new ItemGenericFluidBucket(Blocks.air); - GameRegistry.registerItem(mGenericBucket, "gtpp.bucket.generic"); - for (FluidPackage y : mGeneratedFluids) { - if (!y.valid()) { - continue; - } - GameRegistry.registerBlock(y.mBlock, FluidItemBlock.class, "gtpp_" + y.mName); - FluidContainerRegistry.registerFluidContainer(y.get(), y.mBucket, new ItemStack(Items.bucket)); - } - Utils.registerEvent(BucketHandler.INSTANCE); - } - - public static void postInit() {} - - /** - * Generates a 'Water' type fluid. - * - * @param aID - The Fluid ID (Must be unique) - * @param aUnlocalName - Unlocalized Fluid Name - * @param aRGB - a {@link Short[]} containing the RGB of the FluidPackage. - * @return - A fully constructed & registered {@linkplain FluidPackage} - */ - public static FluidPackage generate(int aID, String aUnlocalName, short[] aRGB) { - return generate(aID, aUnlocalName, Short.MIN_VALUE, Short.MIN_VALUE, Short.MIN_VALUE, Short.MIN_VALUE, aRGB); - } - - /** - * Generate a {@link FluidPackage} from the data provided. This FluidPackage is automatically registered and handled - * internally. Pass in {@link Short}.MIN_VALUE for any of the Fluid Fields (Besides ID, Name or RGB) and it will - * default to water values. - * - * @param aID - The Fluid ID (Must be unique) - * @param aUnlocalName - Unlocalized Fluid Name - * @param luminosity - How bright is the fluid. - * @param density - completely arbitrary; negative density indicates that the fluid is lighter than air. - * Default value is approximately the real-life density of water in kg/m^3. - * @param temp - completely arbitrary; higher temperature indicates that the fluid is hotter than air. - * Default value is approximately the real-life room temperature of water in degrees Kelvin - * @param viscosity - completely arbitrary; negative values are not permissible. Default value is approximately - * the real-life density of water in m/s^2 (x10^-3). * Higher viscosity means that a fluid flows - * more slowly, like molasses. Lower viscosity means that a fluid flows more quickly, like - * helium. - * @param aRGB - a {@link Short[]} containing the RGB of the FluidPackage. - * @return - A fully constructed & registered {@linkplain FluidPackage} - */ - public static FluidPackage generate(int aID, String aUnlocalName, int luminosity, int density, int temp, - int viscosity, short[] aRGB) { - - FluidPackage aFluidToGenerate = null; - - // Check Load Phase for some Safety, only allow this to be called in Pre-Init. - if (GTplusplus.CURRENT_LOAD_PHASE != INIT_PHASE.PRE_INIT) { - try { - throw new GregtechException("Cannot generate Fluid Packages outside of Pre-Init!"); - } catch (GregtechException e) { - e.printStackTrace(); - CORE.crash("Cannot generate Fluid Packages outside of Pre-Init!"); - } - } - - Fluid aGenFluid = fluid(aUnlocalName, luminosity, density, temp, viscosity, aRGB); - Block aGenBlock = block(aGenFluid, aRGB); - ItemStack aGenBucket = bucket(aID); - - aFluidToGenerate = new FluidPackage(aID, aUnlocalName, aGenFluid, aGenBucket, aGenBlock); - - if (aFluidToGenerate != null && aFluidToGenerate.valid()) { - FluidRegistry.registerFluid(aFluidToGenerate.get()); - mGeneratedFluids.put(aFluidToGenerate); - } else { - // Handle Bad generation - if (mErrorFluid == null) { - mErrorFluid = new FluidPackage( - 0, - "", - FluidUtils.getWater(1).getFluid(), - ItemUtils.getSimpleStack(Items.water_bucket), - Blocks.water); - } - return mErrorFluid; - } - - return aFluidToGenerate; - } - - private static Fluid fluid(String aUnlocalName, int luminosity, int density, int temp, int viscosity, - short[] aRGB) { - return new FactoryFluid(aUnlocalName, luminosity, density, temp, viscosity, aRGB); - } - - private static ItemStack bucket(int aID) { - return ItemGenericFluidBucket.registerFluidForBucket(aID); - } - - private static Block block(Fluid aFluidForBlock, short[] aRGB) { - if (aFluidForBlock != null) { - FluidRegistry.registerFluid(aFluidForBlock); - return new BlockFluidBase(aFluidForBlock, aRGB); - } - return Blocks.dirt; - } - - /** - * Copyright © SpaceToad, 2011 http://www.mod-buildcraft.com BuildCraft is distributed under the terms of the - * Minecraft Mod Public License 1.0, or MMPL. Please check the contents of the license located in - * http://www.mod-buildcraft.com/MMPL-1.0.txt - * - * Modified version of the BC BucketHandler, except using ItemStacks > Items (Why?) - * - * @author Alkalus - */ - public static class BucketHandler { - - public static BucketHandler INSTANCE = new BucketHandler(); - - private BucketHandler() {} - - @SubscribeEvent - public void onBucketFill(FillBucketEvent event) { - ItemStack result = fillCustomBucket(event.world, event.target); - if (result == null) { - return; - } - event.result = result; - event.setResult(Result.ALLOW); - } - - private ItemStack fillCustomBucket(World world, MovingObjectPosition pos) { - Block block = world.getBlock(pos.blockX, pos.blockY, pos.blockZ); - ItemStack bucket = mBlockToBucketMap.get(block); - if (bucket != null && world.getBlockMetadata(pos.blockX, pos.blockY, pos.blockZ) == 0) { - world.setBlockToAir(pos.blockX, pos.blockY, pos.blockZ); - return ItemUtils.getSimpleStack(bucket, 1); - } else { - return null; - } - } - } -} diff --git a/src/main/java/gtPlusPlus/core/fluids/FluidPackage.java b/src/main/java/gtPlusPlus/core/fluids/FluidPackage.java deleted file mode 100644 index 10e54d794d..0000000000 --- a/src/main/java/gtPlusPlus/core/fluids/FluidPackage.java +++ /dev/null @@ -1,80 +0,0 @@ -package gtPlusPlus.core.fluids; - -import static gtPlusPlus.core.fluids.FluidFactory.mBlockToBucketMap; -import static gtPlusPlus.core.fluids.FluidFactory.mBlockToFluidMap; -import static gtPlusPlus.core.fluids.FluidFactory.mBlockToMetaMap; -import static gtPlusPlus.core.fluids.FluidFactory.mBlockToNameMap; -import static gtPlusPlus.core.fluids.FluidFactory.mBucketToBlockMap; -import static gtPlusPlus.core.fluids.FluidFactory.mBucketToFluidMap; -import static gtPlusPlus.core.fluids.FluidFactory.mBucketToMetaMap; -import static gtPlusPlus.core.fluids.FluidFactory.mBucketToNameMap; -import static gtPlusPlus.core.fluids.FluidFactory.mFluidToBlockMap; -import static gtPlusPlus.core.fluids.FluidFactory.mFluidToBucketMap; -import static gtPlusPlus.core.fluids.FluidFactory.mFluidToMetaMap; -import static gtPlusPlus.core.fluids.FluidFactory.mFluidToNameMap; -import static gtPlusPlus.core.fluids.FluidFactory.mMetaToBlockMap; -import static gtPlusPlus.core.fluids.FluidFactory.mMetaToBucketMap; -import static gtPlusPlus.core.fluids.FluidFactory.mMetaToColourMap; -import static gtPlusPlus.core.fluids.FluidFactory.mMetaToFluidMap; -import static gtPlusPlus.core.fluids.FluidFactory.mMetaToNameMap; -import static gtPlusPlus.core.fluids.FluidFactory.mNameToBlockMap; -import static gtPlusPlus.core.fluids.FluidFactory.mNameToBucketMap; -import static gtPlusPlus.core.fluids.FluidFactory.mNameToFluidMap; -import static gtPlusPlus.core.fluids.FluidFactory.mNameToMetaMap; - -import net.minecraft.block.Block; -import net.minecraft.item.ItemStack; -import net.minecraftforge.fluids.Fluid; - -public class FluidPackage { - - public final int mID; - public final String mName; - private final Fluid mFluid; - public final ItemStack mBucket; - public final Block mBlock; - - public FluidPackage(int aID, String aName, Fluid aFluid, ItemStack aBucket, Block aBlock) { - - mNameToFluidMap.put(aName, aFluid); - mNameToBucketMap.put(aName, aBucket); - mNameToBlockMap.put(aName, aBlock); - mNameToMetaMap.put(aName, aID); - - mFluidToNameMap.put(aFluid, aName); - mFluidToBucketMap.put(aFluid, aBucket); - mFluidToBlockMap.put(aFluid, aBlock); - mFluidToMetaMap.put(aFluid, aID); - - mBucketToFluidMap.put(aBucket, aFluid); - mBucketToNameMap.put(aBucket, aName); - mBucketToBlockMap.put(aBucket, aBlock); - mBucketToMetaMap.put(aBucket, aID); - - mBlockToNameMap.put(aBlock, aName); - mBlockToFluidMap.put(aBlock, aFluid); - mBlockToBucketMap.put(aBlock, aBucket); - mBlockToMetaMap.put(aBlock, aID); - - mMetaToNameMap.put(aID, aName); - mMetaToFluidMap.put(aID, aFluid); - mMetaToBucketMap.put(aID, aBucket); - mMetaToBlockMap.put(aID, aBlock); - - mMetaToColourMap.put(aID, aFluid.getColor()); - - mID = aID; - mName = aName; - mFluid = aFluid; - mBucket = aBucket; - mBlock = aBlock; - } - - public Fluid get() { - return mFluid; - } - - public boolean valid() { - return mName != null && mName.length() > 0 && mFluid != null && mBucket != null && mBlock != null; - } -} diff --git a/src/main/java/gtPlusPlus/core/fluids/ItemGenericFluidBucket.java b/src/main/java/gtPlusPlus/core/fluids/ItemGenericFluidBucket.java deleted file mode 100644 index 46e56d3f1d..0000000000 --- a/src/main/java/gtPlusPlus/core/fluids/ItemGenericFluidBucket.java +++ /dev/null @@ -1,325 +0,0 @@ -package gtPlusPlus.core.fluids; - -import static gregtech.api.enums.Mods.GTPlusPlus; - -import java.util.LinkedHashMap; -import java.util.List; -import java.util.Map; - -import net.minecraft.block.Block; -import net.minecraft.block.material.Material; -import net.minecraft.client.renderer.texture.IIconRegister; -import net.minecraft.creativetab.CreativeTabs; -import net.minecraft.entity.player.EntityPlayer; -import net.minecraft.init.Blocks; -import net.minecraft.init.Items; -import net.minecraft.item.Item; -import net.minecraft.item.ItemBucket; -import net.minecraft.item.ItemStack; -import net.minecraft.util.IIcon; -import net.minecraft.util.MovingObjectPosition; -import net.minecraft.world.World; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.event.entity.player.FillBucketEvent; - -import cpw.mods.fml.common.eventhandler.Event; -import gtPlusPlus.api.objects.GregtechException; -import gtPlusPlus.api.objects.data.AutoMap; -import gtPlusPlus.core.lib.CORE; -import gtPlusPlus.core.util.minecraft.ItemUtils; - -public class ItemGenericFluidBucket extends ItemBucket { - - private static IIcon mBaseBucketTexture; - private static IIcon mOverlayBucketTexture; - private static AutoMap<Block> mInternalFluidCache = new AutoMap<Block>(); - - public ItemGenericFluidBucket(Block aFluid) { - super(aFluid); - this.setContainerItem(Items.bucket); - this.maxStackSize = 1; - mInternalFluidCache.put(aFluid); - } - - public static ItemStack registerFluidForBucket(int aID) { - - if (FluidFactory.mMetaToBucketMap.containsKey(aID)) { - try { - // noinspection deprecation - throw new GregtechException( - aID + " is already registered! Unable to register fluid: " - + FluidFactory.mMetaToFluidMap.get(aID).getLocalizedName()); - } catch (GregtechException e) { - e.printStackTrace(); - // noinspection deprecation - CORE.crash( - aID + " is already registered! Unable to register fluid: " - + FluidFactory.mMetaToFluidMap.get(aID).getLocalizedName()); - } - } - mInternalFluidCache.put(FluidFactory.mMetaToBlockMap.get(aID)); - return ItemUtils.simpleMetaStack(FluidFactory.mGenericBucket, aID, 1); - } - - Map<Integer, IIcon> mIconCache = new LinkedHashMap<Integer, IIcon>(); - - /** - * Called whenever this item is equipped and the right mouse button is pressed. Args: itemStack, world, entityPlayer - */ - @Override - public ItemStack onItemRightClick(ItemStack aStack, World aWorld, EntityPlayer aPlayer) { - - Block isFull = FluidFactory.mMetaToBlockMap.get(aStack.getItemDamage()); - - boolean flag = isFull == Blocks.air; - MovingObjectPosition movingobjectposition = this.getMovingObjectPositionFromPlayer(aWorld, aPlayer, flag); - - if (movingobjectposition == null || isFull == null) { - return aStack; - } else { - FillBucketEvent event = new FillBucketEvent(aPlayer, aStack, aWorld, movingobjectposition); - if (MinecraftForge.EVENT_BUS.post(event)) { - return aStack; - } - - if (event.getResult() == Event.Result.ALLOW) { - if (aPlayer.capabilities.isCreativeMode) { - return aStack; - } - - if (--aStack.stackSize <= 0) { - return event.result; - } - - if (!aPlayer.inventory.addItemStackToInventory(event.result)) { - aPlayer.dropPlayerItemWithRandomChoice(event.result, false); - } - - return aStack; - } - if (movingobjectposition.typeOfHit == MovingObjectPosition.MovingObjectType.BLOCK) { - int i = movingobjectposition.blockX; - int j = movingobjectposition.blockY; - int k = movingobjectposition.blockZ; - - if (!aWorld.canMineBlock(aPlayer, i, j, k)) { - return aStack; - } - - if (flag) { - if (!aPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, aStack)) { - return aStack; - } - - Material material = aWorld.getBlock(i, j, k).getMaterial(); - int l = aWorld.getBlockMetadata(i, j, k); - - if (material == Material.water && l == 0) { - aWorld.setBlockToAir(i, j, k); - return this.func_150910_a(aStack, aPlayer, Items.water_bucket); - } - - if (material == Material.lava && l == 0) { - aWorld.setBlockToAir(i, j, k); - return this.func_150910_a(aStack, aPlayer, Items.lava_bucket); - } - } else { - if (isFull == Blocks.air) { - return new ItemStack(Items.bucket); - } - - if (movingobjectposition.sideHit == 0) { - --j; - } - - if (movingobjectposition.sideHit == 1) { - ++j; - } - - if (movingobjectposition.sideHit == 2) { - --k; - } - - if (movingobjectposition.sideHit == 3) { - ++k; - } - - if (movingobjectposition.sideHit == 4) { - --i; - } - - if (movingobjectposition.sideHit == 5) { - ++i; - } - - if (!aPlayer.canPlayerEdit(i, j, k, movingobjectposition.sideHit, aStack)) { - return aStack; - } - - if (this.tryPlaceContainedLiquid(isFull, aWorld, i, j, k) && !aPlayer.capabilities.isCreativeMode) { - return new ItemStack(Items.bucket); - } - } - } - - return aStack; - } - } - - private ItemStack func_150910_a(ItemStack p_150910_1_, EntityPlayer p_150910_2_, Item p_150910_3_) { - if (p_150910_2_.capabilities.isCreativeMode) { - return p_150910_1_; - } else if (--p_150910_1_.stackSize <= 0) { - return new ItemStack(p_150910_3_); - } else { - if (!p_150910_2_.inventory.addItemStackToInventory(new ItemStack(p_150910_3_))) { - p_150910_2_.dropPlayerItemWithRandomChoice(new ItemStack(p_150910_3_, 1, 0), false); - } - - return p_150910_1_; - } - } - - /** - * Attempts to place the liquid contained inside the bucket. - */ - public boolean tryPlaceContainedLiquid(Block isFull, World aWorld, int aX, int aY, int aZ) { - if (isFull == Blocks.air) { - return false; - } else { - Material material = aWorld.getBlock(aX, aY, aZ).getMaterial(); - boolean flag = !material.isSolid(); - - if (!aWorld.isAirBlock(aX, aY, aZ) && !flag) { - return false; - } else { - - if (!aWorld.isRemote && flag && !material.isLiquid()) { - aWorld.func_147480_a(aX, aY, aZ, true); - } - - aWorld.setBlock(aX, aY, aZ, isFull, 0, 3); - - return true; - } - } - } - - @Override - public IIcon getIconFromDamage(int aMeta) { - IIcon aTemp = mIconCache.get(aMeta); - return aTemp != null ? aTemp : super.getIconFromDamage(aMeta); - } - - @Override - public boolean getHasSubtypes() { - return mInternalFluidCache.size() > 0; - } - - @Override - public void getSubItems(Item item, CreativeTabs tab, List list) { - list.add(new ItemStack(item, 1, 0)); - for (Block f : mInternalFluidCache) { - Integer aMeta; - if (f != null) { - aMeta = FluidFactory.mBlockToMetaMap.get(f); - if (aMeta != null) { - list.add(new ItemStack(item, 1, aMeta)); - } - } - } - } - - @Override - public int getMaxDamage() { - return 512; - } - - @Override - public boolean isDamageable() { - return false; - } - - @Override - public void addInformation(ItemStack p_77624_1_, EntityPlayer p_77624_2_, List p_77624_3_, boolean p_77624_4_) { - // TODO Auto-generated method stub - super.addInformation(p_77624_1_, p_77624_2_, p_77624_3_, p_77624_4_); - } - - @Override - public int getItemEnchantability() { - return 0; - } - - @Override - public boolean isRepairable() { - return false; - } - - @Override - public IIcon getIcon(ItemStack stack, int renderPass, EntityPlayer player, ItemStack usingItem, int useRemaining) { - if (stack != null && renderPass == 1) { - return mOverlayBucketTexture; - } else { - return mBaseBucketTexture; - } - /* - * IIcon aTemp = mIconCache.get(stack.getItemDamage()); return aTemp != null ? aTemp : super.getIcon(stack, - * renderPass, player, usingItem, useRemaining); - */ - } - - @Override - public boolean isBookEnchantable(ItemStack stack, ItemStack book) { - return false; - } - - @Override - public int getMaxDamage(ItemStack stack) { - return 512; - } - - @Override - public boolean isDamaged(ItemStack stack) { - return false; - } - - @Override - public int getItemEnchantability(ItemStack stack) { - return 0; - } - - @Override - public IIcon getIconFromDamageForRenderPass(final int damage, final int pass) { - if (pass == 1) { - return mOverlayBucketTexture; - } else { - return mBaseBucketTexture; - } - } - - @Override - public void registerIcons(final IIconRegister i) { - mBaseBucketTexture = i.registerIcon("bucket_empty"); - mOverlayBucketTexture = i.registerIcon(GTPlusPlus.ID + ":bucket.generic.overlay"); - } - - @Override - public boolean tryPlaceContainedLiquid(World p_77875_1_, int p_77875_2_, int p_77875_3_, int p_77875_4_) { - return tryPlaceContainedLiquid(Blocks.air, p_77875_1_, p_77875_2_, p_77875_3_, p_77875_4_); - } - - @Override - public int getColorFromItemStack(ItemStack aStack, int aPass) { - if (aPass == 0) { - return super.getColorFromItemStack(aStack, aPass); - } else { - return FluidFactory.mMetaToColourMap.get(aStack.getItemDamage()); - } - } - - @Override - public boolean requiresMultipleRenderPasses() { - return true; - } -} |
