use of net.minecraftforge.fluids.UniversalBucket in project RFTools by McJty.
the class SensorTileEntity method checkFluid.
private boolean checkFluid(BlockPos newpos) {
IBlockState state = getWorld().getBlockState(newpos);
ItemStack matcher = inventoryHelper.getStackInSlot(0);
Block block = state.getBlock();
if (matcher.isEmpty()) {
if (block instanceof BlockLiquid || block instanceof IFluidBlock) {
return !block.isAir(state, getWorld(), newpos);
}
return false;
}
ItemStack stack = block.getItem(getWorld(), newpos, state);
Item matcherItem = matcher.getItem();
FluidStack matcherFluidStack = null;
// }
if (matcherItem instanceof ItemBucket || matcherItem instanceof UniversalBucket) {
matcherFluidStack = new FluidBucketWrapper(matcher).getFluid();
return checkFluid(block, matcherFluidStack, state, newpos);
}
return false;
}
use of net.minecraftforge.fluids.UniversalBucket in project ImmersiveEngineering by BluSunrize.
the class RecipeShapelessIngredient method getRemainingItems.
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
NonNullList<ItemStack> remains = super.getRemainingItems(inv);
for (int i = 0; i < remains.size(); i++) {
ItemStack s = inv.getStackInSlot(i);
ItemStack remain = remains.get(i);
if (toolDamageSlot >= 0 && toolDamageSlot < getIngredients().size()) {
ItemStack tool = ItemStack.EMPTY;
if (remain.isEmpty() && !s.isEmpty() && getIngredients().get(toolDamageSlot).apply(s))
tool = s.copy();
else if (!remain.isEmpty() && getIngredients().get(toolDamageSlot).apply(remain))
tool = remain;
if (!tool.isEmpty() && tool.isItemStackDamageable()) {
tool.setItemDamage(tool.getItemDamage() + 1);
if (tool.getItemDamage() > tool.getMaxDamage())
tool = ItemStack.EMPTY;
remains.set(i, tool);
}
}
if (!s.isEmpty() && remain.isEmpty() && s.getItem() instanceof UniversalBucket) {
ItemStack empty = ((UniversalBucket) s.getItem()).getEmpty();
if (!empty.isEmpty())
remains.set(i, empty.copy());
}
}
return remains;
}
use of net.minecraftforge.fluids.UniversalBucket in project MinecraftForge by MinecraftForge.
the class ForgeModContainer method preInit.
@Subscribe
public void preInit(FMLPreInitializationEvent evt) {
CapabilityItemHandler.register();
CapabilityFluidHandler.register();
CapabilityAnimation.register();
CapabilityEnergy.register();
MinecraftForge.EVENT_BUS.register(MinecraftForge.INTERNAL_HANDLER);
ForgeChunkManager.captureConfig(evt.getModConfigurationDirectory());
MinecraftForge.EVENT_BUS.register(this);
if (!ForgeModContainer.disableVersionCheck) {
ForgeVersion.startVersionCheck();
}
// Add and register the forge universal bucket, if it's enabled
if (FluidRegistry.isUniversalBucketEnabled()) {
universalBucket = new UniversalBucket();
universalBucket.setUnlocalizedName("forge.bucketFilled");
GameRegistry.register(universalBucket.setRegistryName(ForgeVersion.MOD_ID, "bucketFilled"));
MinecraftForge.EVENT_BUS.register(universalBucket);
}
}
use of net.minecraftforge.fluids.UniversalBucket in project Wizardry by TeamWizardry.
the class RecipeShapelessFluid method getRemainingItems.
@Override
public NonNullList<ItemStack> getRemainingItems(InventoryCrafting inv) {
NonNullList<ItemStack> remains = super.getRemainingItems(inv);
for (int i = 0; i < remains.size(); i++) {
ItemStack stack = inv.getStackInSlot(i);
ItemStack remain = remains.get(i);
if (!stack.isEmpty() && remain.isEmpty() && stack.getItem() instanceof UniversalBucket) {
ItemStack empty = ((UniversalBucket) stack.getItem()).getEmpty();
if (!empty.isEmpty())
remains.set(i, empty.copy());
}
}
return remains;
}
Aggregations