mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 06:24:43 +00:00
Made some more public fields either private or final.
This commit is contained in:
1 parent
756c58d5cb
commit
75032ebf9c
32 files changed
+355
-331
No files matched your search
@@ -8,9 +8,9 @@ import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
|
||||
public class FluidEvent extends Event
|
||||
{
|
||||
public final FluidStack fluid;
|
||||
public final World world;
|
||||
public final BlockPos pos;
|
||||
private final FluidStack fluid;
|
||||
private final World world;
|
||||
private final BlockPos pos;
|
||||
|
||||
public FluidEvent(FluidStack fluid, World world, BlockPos pos)
|
||||
{
|
||||
@@ -19,6 +19,21 @@ public class FluidEvent extends Event
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
public FluidStack getFluid()
|
||||
{
|
||||
return fluid;
|
||||
}
|
||||
|
||||
public World getWorld()
|
||||
{
|
||||
return world;
|
||||
}
|
||||
|
||||
public BlockPos getPos()
|
||||
{
|
||||
return pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Mods should fire this event when they move fluids around.
|
||||
*
|
||||
@@ -38,8 +53,8 @@ public class FluidEvent extends Event
|
||||
*/
|
||||
public static class FluidFillingEvent extends FluidEvent
|
||||
{
|
||||
public final IFluidTank tank;
|
||||
public final int amount;
|
||||
private final IFluidTank tank;
|
||||
private final int amount;
|
||||
|
||||
public FluidFillingEvent(FluidStack fluid, World world, BlockPos pos, IFluidTank tank, int amount)
|
||||
{
|
||||
@@ -47,6 +62,16 @@ public class FluidEvent extends Event
|
||||
this.tank = tank;
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public IFluidTank getTank()
|
||||
{
|
||||
return tank;
|
||||
}
|
||||
|
||||
public int getAmount()
|
||||
{
|
||||
return amount;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -56,8 +81,8 @@ public class FluidEvent extends Event
|
||||
*/
|
||||
public static class FluidDrainingEvent extends FluidEvent
|
||||
{
|
||||
public final IFluidTank tank;
|
||||
public final int amount;
|
||||
private final IFluidTank tank;
|
||||
private final int amount;
|
||||
|
||||
public FluidDrainingEvent(FluidStack fluid, World world, BlockPos pos, IFluidTank tank, int amount)
|
||||
{
|
||||
@@ -65,6 +90,16 @@ public class FluidEvent extends Event
|
||||
this.amount = amount;
|
||||
this.tank = tank;
|
||||
}
|
||||
|
||||
public IFluidTank getTank()
|
||||
{
|
||||
return tank;
|
||||
}
|
||||
|
||||
public int getAmount()
|
||||
{
|
||||
return amount;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,9 +36,9 @@ import java.util.List;
|
||||
public class UniversalBucket extends Item implements IFluidContainerItem
|
||||
{
|
||||
|
||||
public final int capacity; // how much the bucket holds
|
||||
public final ItemStack empty; // empty item to return and recognize when filling
|
||||
public final boolean nbtSensitive;
|
||||
private final int capacity; // how much the bucket holds
|
||||
private final ItemStack empty; // empty item to return and recognize when filling
|
||||
private final boolean nbtSensitive;
|
||||
|
||||
public UniversalBucket()
|
||||
{
|
||||
@@ -68,7 +68,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem
|
||||
for (Fluid fluid : FluidRegistry.getRegisteredFluids().values())
|
||||
{
|
||||
// add all fluids that the bucket can be filled with
|
||||
FluidStack fs = new FluidStack(fluid, capacity);
|
||||
FluidStack fs = new FluidStack(fluid, getCapacity());
|
||||
ItemStack stack = new ItemStack(this);
|
||||
if (fill(stack, fs, true) == fs.amount)
|
||||
{
|
||||
@@ -83,9 +83,9 @@ public class UniversalBucket extends Item implements IFluidContainerItem
|
||||
FluidStack fluidStack = getFluid(stack);
|
||||
if (fluidStack == null)
|
||||
{
|
||||
if(empty != null)
|
||||
if(getEmpty() != null)
|
||||
{
|
||||
return empty.getDisplayName();
|
||||
return getEmpty().getDisplayName();
|
||||
}
|
||||
return super.getItemStackDisplayName(stack);
|
||||
}
|
||||
@@ -132,7 +132,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem
|
||||
player.addStat(StatList.func_188057_b(this));
|
||||
|
||||
itemstack.stackSize--;
|
||||
ItemStack emptyStack = empty != null ? empty.copy() : new ItemStack(this);
|
||||
ItemStack emptyStack = getEmpty() != null ? getEmpty().copy() : new ItemStack(this);
|
||||
|
||||
// check whether we replace the item or add the empty one to the inventory
|
||||
if (itemstack.stackSize <= 0)
|
||||
@@ -210,8 +210,8 @@ public class UniversalBucket extends Item implements IFluidContainerItem
|
||||
|
||||
// not for us to handle
|
||||
if (event.getEmptyBucket() == null ||
|
||||
!event.getEmptyBucket().isItemEqual(empty) ||
|
||||
(nbtSensitive && ItemStack.areItemStackTagsEqual(event.getEmptyBucket(), empty)))
|
||||
!event.getEmptyBucket().isItemEqual(getEmpty()) ||
|
||||
(isNbtSensitive() && ItemStack.areItemStackTagsEqual(event.getEmptyBucket(), getEmpty())))
|
||||
{
|
||||
return;
|
||||
}
|
||||
@@ -233,7 +233,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem
|
||||
{
|
||||
FluidStack drained = fluidBlock.drain(world, pos, false);
|
||||
// check if it fits exactly
|
||||
if (drained != null && drained.amount == capacity)
|
||||
if (drained != null && drained.amount == getCapacity())
|
||||
{
|
||||
// check if the container accepts it
|
||||
ItemStack filledBucket = new ItemStack(this);
|
||||
@@ -262,7 +262,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem
|
||||
public static ItemStack getFilledBucket(UniversalBucket item, Fluid fluid)
|
||||
{
|
||||
ItemStack stack = new ItemStack(item);
|
||||
item.fill(stack, new FluidStack(fluid, item.capacity), true);
|
||||
item.fill(stack, new FluidStack(fluid, item.getCapacity()), true);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@@ -277,7 +277,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem
|
||||
@Override
|
||||
public int getCapacity(ItemStack container)
|
||||
{
|
||||
return capacity;
|
||||
return getCapacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -290,7 +290,7 @@ public class UniversalBucket extends Item implements IFluidContainerItem
|
||||
}
|
||||
|
||||
// can only fill exact capacity
|
||||
if (resource == null || resource.amount != capacity)
|
||||
if (resource == null || resource.amount != getCapacity())
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
@@ -310,14 +310,14 @@ public class UniversalBucket extends Item implements IFluidContainerItem
|
||||
resource.writeToNBT(tag);
|
||||
container.setTagCompound(tag);
|
||||
}
|
||||
return capacity;
|
||||
return getCapacity();
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidStack drain(ItemStack container, int maxDrain, boolean doDrain)
|
||||
{
|
||||
// can only drain everything at once
|
||||
if (maxDrain < capacity)
|
||||
if (maxDrain < getCapacity())
|
||||
{
|
||||
return null;
|
||||
}
|
||||
@@ -325,11 +325,11 @@ public class UniversalBucket extends Item implements IFluidContainerItem
|
||||
FluidStack fluidStack = getFluid(container);
|
||||
if (doDrain && fluidStack != null)
|
||||
{
|
||||
if(empty != null)
|
||||
if(getEmpty() != null)
|
||||
{
|
||||
container.setItem(empty.getItem());
|
||||
container.setTagCompound(empty.getTagCompound());
|
||||
container.setItemDamage(empty.getItemDamage());
|
||||
container.setItem(getEmpty().getItem());
|
||||
container.setTagCompound(getEmpty().getTagCompound());
|
||||
container.setItemDamage(getEmpty().getItemDamage());
|
||||
}
|
||||
else {
|
||||
container.stackSize = 0;
|
||||
@@ -338,4 +338,19 @@ public class UniversalBucket extends Item implements IFluidContainerItem
|
||||
|
||||
return fluidStack;
|
||||
}
|
||||
|
||||
public int getCapacity()
|
||||
{
|
||||
return capacity;
|
||||
}
|
||||
|
||||
public ItemStack getEmpty()
|
||||
{
|
||||
return empty;
|
||||
}
|
||||
|
||||
public boolean isNbtSensitive()
|
||||
{
|
||||
return nbtSensitive;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user