mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
Use universal buckets
This commit is contained in:
parent
f942810592
commit
1695f61a75
11 changed files with 33 additions and 289 deletions
|
@ -41,6 +41,7 @@ import de.ellpeck.actuallyadditions.mod.util.FakePlayerUtil;
|
|||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.Util;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.fml.common.Mod.EventHandler;
|
||||
import net.minecraftforge.fml.common.Mod.Instance;
|
||||
|
@ -59,6 +60,11 @@ public class ActuallyAdditions{
|
|||
@SidedProxy(clientSide = "de.ellpeck.actuallyadditions.mod.proxy.ClientProxy", serverSide = "de.ellpeck.actuallyadditions.mod.proxy.ServerProxy")
|
||||
public static IProxy proxy;
|
||||
|
||||
static{
|
||||
//For some reason, this has to be done here
|
||||
FluidRegistry.enableUniversalBucket();
|
||||
}
|
||||
|
||||
@EventHandler
|
||||
public void preInit(FMLPreInitializationEvent event){
|
||||
ModUtil.LOGGER.info("Starting PreInitialization Phase...");
|
||||
|
@ -117,9 +123,6 @@ public class ActuallyAdditions{
|
|||
|
||||
@EventHandler
|
||||
public void serverStarting(FMLServerStartingEvent event){
|
||||
Util.registerDispenserHandler(InitItems.itemBucketOil, new DispenserHandlerEmptyBucket());
|
||||
Util.registerDispenserHandler(InitItems.itemBucketCanolaOil, new DispenserHandlerEmptyBucket());
|
||||
Util.registerDispenserHandler(Items.BUCKET, new DispenserHandlerFillBucket());
|
||||
Util.registerDispenserHandler(InitItems.itemFertilizer, new DispenserHandlerFertilize());
|
||||
|
||||
WorldData.init(event.getServer());
|
||||
|
@ -128,12 +131,15 @@ public class ActuallyAdditions{
|
|||
@EventHandler
|
||||
public void missingMapping(FMLMissingMappingsEvent event){
|
||||
for(FMLMissingMappingsEvent.MissingMapping mapping : event.getAll()){
|
||||
if(mapping.name != null && mapping.name.toLowerCase(Locale.ROOT).startsWith(ModUtil.MOD_ID+":")){
|
||||
if(mapping.name.contains("paxel") || mapping.name.contains("itemSpecial") || mapping.name.contains("blockBookStand") || mapping.name.contains("Rarmor")){
|
||||
if(mapping.name != null){
|
||||
String name = mapping.name.toLowerCase(Locale.ROOT);
|
||||
if(name.startsWith(ModUtil.MOD_ID+":")){
|
||||
if(name.contains("paxel") || name.contains("itemspecial") || name.contains("blockbookstand") || name.contains("rarmor") || name.contains("bucket")){
|
||||
mapping.ignore();
|
||||
ModUtil.LOGGER.info("Missing Mapping "+mapping.name+" is getting ignored. This is intentional.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -39,11 +39,6 @@ public enum ConfigBoolValues{
|
|||
DO_SPIDER_DROPS("Spider Cobweb Drop", ConfigCategories.MOB_DROPS, true, "If Cobwebs should sometimes drop from Spiders"),
|
||||
DO_BAT_DROPS("Bat Wing Drop", ConfigCategories.MOB_DROPS, true, "If Wings should sometimes drop from Bats"),
|
||||
|
||||
PREVENT_OIL_OVERRIDE("Oil Fluid Override", ConfigCategories.FLUIDS, false, "If not registering Oil Fluids from Actually Additions if other Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
|
||||
PREVENT_CANOLA_OVERRIDE("Canola Oil Fluid Override", ConfigCategories.FLUIDS, false, "If not registering Canola Oil Fluids from Actually Additions if other Canola Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
|
||||
PREVENT_OIL_BLOCK_OVERRIDE("Oil Block Override", ConfigCategories.FLUIDS, false, "If not registering Oil Blocks from Actually Additions if other Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
|
||||
PREVENT_CANOLA_BLOCK_OVERRIDE("Canola Oil Block Override", ConfigCategories.FLUIDS, false, "If not registering Canola Oil Blocks from Actually Additions if other Canola Oil is already registered should be prevented"+ConfigurationHandler.ISSUES_WARNING),
|
||||
|
||||
CTRL_EXTRA_INFO("Advanced Info", ConfigCategories.OTHER, true, "Show Advanced Item Info when holding Control on every Item"),
|
||||
CTRL_INFO_FOR_EXTRA_INFO("Advanced Info Tooltips", ConfigCategories.OTHER, true, "Show the 'Press Control for more Info'-Text on Item Tooltips"),
|
||||
|
||||
|
|
|
@ -18,6 +18,9 @@ import net.minecraft.block.Block;
|
|||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.common.ForgeModContainer;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
import net.minecraftforge.fluids.UniversalBucket;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
|
@ -153,8 +156,6 @@ public class CreativeTab extends CreativeTabs{
|
|||
this.add(InitItems.itemWaterRemovalRing);
|
||||
|
||||
this.add(InitItems.itemPhantomConnector);
|
||||
this.add(InitItems.itemBucketCanolaOil);
|
||||
this.add(InitItems.itemBucketOil);
|
||||
|
||||
this.add(InitItems.itemWingsOfTheBats);
|
||||
|
||||
|
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* This file ("BucketFillEvent.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.event;
|
||||
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||
import de.ellpeck.actuallyadditions.mod.items.InitItems;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.event.entity.player.FillBucketEvent;
|
||||
import net.minecraftforge.fml.common.eventhandler.Event;
|
||||
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
|
||||
|
||||
public class BucketFillEvent{
|
||||
|
||||
@SubscribeEvent
|
||||
public void onBucketFilled(FillBucketEvent event){
|
||||
this.fillBucket(event, InitItems.itemBucketOil, InitFluids.blockOil);
|
||||
this.fillBucket(event, InitItems.itemBucketCanolaOil, InitFluids.blockCanolaOil);
|
||||
}
|
||||
|
||||
private void fillBucket(FillBucketEvent event, Item item, Block fluid){
|
||||
if(event.getTarget() != null && event.getTarget().getBlockPos() != null){
|
||||
Block block = PosUtil.getBlock(event.getTarget().getBlockPos(), event.getWorld());
|
||||
if(block == fluid){
|
||||
event.getWorld().setBlockToAir(event.getTarget().getBlockPos());
|
||||
event.setFilledBucket(new ItemStack(item));
|
||||
event.setResult(Event.Result.ALLOW);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -26,7 +26,6 @@ public class InitEvents{
|
|||
Util.registerEvent(new PlayerObtainEvents());
|
||||
Util.registerEvent(new LivingDropEvent());
|
||||
Util.registerEvent(new EntityLivingEvent());
|
||||
Util.registerEvent(new BucketFillEvent());
|
||||
Util.registerEvent(new LogoutEvent());
|
||||
Util.registerEvent(new WorldLoadingEvents());
|
||||
MinecraftForge.TERRAIN_GEN_BUS.register(new WorldDecorationEvent());
|
||||
|
|
|
@ -11,14 +11,14 @@
|
|||
package de.ellpeck.actuallyadditions.mod.fluids;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.blocks.base.BlockFluidFlowing;
|
||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
import net.minecraftforge.fluids.FluidRegistry;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
public class InitFluids{
|
||||
|
||||
public static Fluid fluidCanolaOil;
|
||||
|
@ -28,48 +28,22 @@ public class InitFluids{
|
|||
public static Block blockOil;
|
||||
|
||||
public static void init(){
|
||||
//Canola Fluid
|
||||
String canolaOil = "canolaoil";
|
||||
if(!FluidRegistry.isFluidRegistered(canolaOil) || ConfigBoolValues.PREVENT_CANOLA_OVERRIDE.isEnabled()){
|
||||
fluidCanolaOil = new FluidAA(canolaOil, "blockCanolaOil").setRarity(EnumRarity.UNCOMMON);
|
||||
FluidRegistry.registerFluid(fluidCanolaOil);
|
||||
}
|
||||
else{
|
||||
errorAlreadyRegistered("Canola Oil Fluid");
|
||||
}
|
||||
fluidCanolaOil = FluidRegistry.getFluid(canolaOil);
|
||||
fluidCanolaOil = registerFluid("canolaoil", "blockCanolaOil", EnumRarity.UNCOMMON);
|
||||
fluidOil = registerFluid("oil", "blockOil", EnumRarity.UNCOMMON);
|
||||
|
||||
//Canola Block
|
||||
if(fluidCanolaOil.getBlock() == null || ConfigBoolValues.PREVENT_CANOLA_BLOCK_OVERRIDE.isEnabled()){
|
||||
blockCanolaOil = new BlockFluidFlowing(fluidCanolaOil, Material.WATER, "blockCanolaOil");
|
||||
}
|
||||
else{
|
||||
errorAlreadyRegistered("Canola Oil Block");
|
||||
}
|
||||
blockCanolaOil = fluidCanolaOil.getBlock();
|
||||
|
||||
//Oil Fluid
|
||||
String oil = "oil";
|
||||
if(!FluidRegistry.isFluidRegistered(oil) || ConfigBoolValues.PREVENT_OIL_OVERRIDE.isEnabled()){
|
||||
fluidOil = new FluidAA(oil, "blockOil").setRarity(EnumRarity.UNCOMMON);
|
||||
FluidRegistry.registerFluid(fluidOil);
|
||||
}
|
||||
else{
|
||||
errorAlreadyRegistered("Oil Fluid");
|
||||
}
|
||||
fluidOil = FluidRegistry.getFluid(oil);
|
||||
|
||||
//Oil Block
|
||||
if(fluidOil.getBlock() == null || ConfigBoolValues.PREVENT_OIL_BLOCK_OVERRIDE.isEnabled()){
|
||||
blockOil = new BlockFluidFlowing(fluidOil, Material.WATER, "blockOil");
|
||||
}
|
||||
else{
|
||||
errorAlreadyRegistered("Oil Block");
|
||||
}
|
||||
blockOil = fluidOil.getBlock();
|
||||
blockCanolaOil = registerFluidBlock(fluidCanolaOil, Material.WATER, "blockCanolaOil");
|
||||
blockOil = registerFluidBlock(fluidOil, Material.WATER, "blockOil");
|
||||
}
|
||||
|
||||
public static void errorAlreadyRegistered(String str){
|
||||
ModUtil.LOGGER.warn(str+" from "+ModUtil.NAME+" is not getting used as it has already been registered by another Mod! If this causes Issues (which it shouldn't!), you can turn this off in the Config File!");
|
||||
private static Fluid registerFluid(String fluidName, String fluidTextureName, EnumRarity rarity){
|
||||
Fluid fluid = new FluidAA(fluidName.toLowerCase(Locale.ROOT), fluidTextureName).setRarity(rarity);
|
||||
FluidRegistry.registerFluid(fluid);
|
||||
FluidRegistry.addBucketForFluid(fluid);
|
||||
|
||||
return fluid;
|
||||
}
|
||||
|
||||
private static Block registerFluidBlock(Fluid fluid, Material material, String name){
|
||||
return new BlockFluidFlowing(fluid, material, name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,7 +28,6 @@ import net.minecraft.init.Items;
|
|||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fml.common.Loader;
|
||||
|
||||
public class InitItems{
|
||||
|
@ -90,8 +89,6 @@ public class InitItems{
|
|||
public static Item itemCoffeeSeed;
|
||||
|
||||
public static Item itemResonantRice;
|
||||
public static Item itemBucketOil;
|
||||
public static Item itemBucketCanolaOil;
|
||||
|
||||
public static Item itemPhantomConnector;
|
||||
|
||||
|
@ -252,10 +249,6 @@ public class InitItems{
|
|||
itemDrillUpgradeThreeByThree = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.THREE_BY_THREE, "itemDrillUpgradeThreeByThree");
|
||||
itemDrillUpgradeFiveByFive = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.FIVE_BY_FIVE, "itemDrillUpgradeFiveByFive");
|
||||
itemDrillUpgradeBlockPlacing = new ItemDrillUpgrade(ItemDrillUpgrade.UpgradeType.PLACER, "itemDrillUpgradeBlockPlacing");
|
||||
itemBucketOil = new ItemBucketAA(InitFluids.blockOil, "itemBucketOil");
|
||||
FluidContainerRegistry.registerFluidContainer(InitFluids.fluidOil, new ItemStack(itemBucketOil), FluidContainerRegistry.EMPTY_BUCKET);
|
||||
itemBucketCanolaOil = new ItemBucketAA(InitFluids.blockCanolaOil, "itemBucketCanolaOil");
|
||||
FluidContainerRegistry.registerFluidContainer(InitFluids.fluidCanolaOil, new ItemStack(itemBucketCanolaOil), FluidContainerRegistry.EMPTY_BUCKET);
|
||||
itemFertilizer = new ItemFertilizer("itemFertilizer");
|
||||
itemCoffee = new ItemCoffee("itemCoffee");
|
||||
itemPhantomConnector = new ItemPhantomConnector("itemPhantomConnector");
|
||||
|
|
|
@ -1,58 +0,0 @@
|
|||
/*
|
||||
* This file ("ItemBucketAA.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.items.base;
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ItemUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.ModUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.EnumRarity;
|
||||
import net.minecraft.item.ItemBucket;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
|
||||
public class ItemBucketAA extends ItemBucket{
|
||||
|
||||
private String name;
|
||||
|
||||
public ItemBucketAA(Block block, String unlocName){
|
||||
super(block);
|
||||
this.name = unlocName;
|
||||
this.setContainerItem(Items.BUCKET);
|
||||
|
||||
this.register();
|
||||
}
|
||||
|
||||
private void register(){
|
||||
ItemUtil.registerItem(this, this.getBaseName(), this.shouldAddCreative());
|
||||
|
||||
this.registerRendering();
|
||||
}
|
||||
|
||||
protected String getBaseName(){
|
||||
return this.name;
|
||||
}
|
||||
|
||||
public boolean shouldAddCreative(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void registerRendering(){
|
||||
ActuallyAdditions.proxy.addRenderRegister(new ItemStack(this), new ModelResourceLocation(this.getRegistryName(), "inventory"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumRarity getRarity(ItemStack stack){
|
||||
return EnumRarity.UNCOMMON;
|
||||
}
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
/*
|
||||
* This file ("DispenserHandlerEmptyBucket.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.misc;
|
||||
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.util.FakePlayerUtil;
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||
import net.minecraft.dispenser.IBlockSource;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemBucket;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
|
||||
public class DispenserHandlerEmptyBucket extends BehaviorDefaultDispenseItem{
|
||||
|
||||
@Override
|
||||
public ItemStack dispenseStack(IBlockSource source, ItemStack bucket){
|
||||
EnumFacing facing = BlockDispenser.getFacing(source.getBlockMetadata());
|
||||
int x = source.getBlockTileEntity().getPos().getX()+facing.getFrontOffsetX();
|
||||
int y = source.getBlockTileEntity().getPos().getY()+facing.getFrontOffsetY();
|
||||
int z = source.getBlockTileEntity().getPos().getZ()+facing.getFrontOffsetZ();
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
|
||||
if(source.getWorld().isAirBlock(pos) && !PosUtil.getMaterial(pos, source.getWorld()).isSolid() && ((ItemBucket)bucket.getItem()).tryPlaceContainedLiquid(FakePlayerUtil.getFakePlayer(source.getWorld()), source.getWorld(), pos)){
|
||||
return new ItemStack(Items.BUCKET);
|
||||
}
|
||||
|
||||
return new BehaviorDefaultDispenseItem().dispense(source, bucket);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,83 +0,0 @@
|
|||
/*
|
||||
* This file ("DispenserHandlerFillBucket.java") is part of the Actually Additions Mod for Minecraft.
|
||||
* It is created and owned by Ellpeck and distributed
|
||||
* under the Actually Additions License to be found at
|
||||
* http://ellpeck.de/actaddlicense/
|
||||
* View the source code at https://github.com/Ellpeck/ActuallyAdditions
|
||||
*
|
||||
* © 2016 Ellpeck
|
||||
*/
|
||||
|
||||
package de.ellpeck.actuallyadditions.mod.misc;
|
||||
|
||||
|
||||
import de.ellpeck.actuallyadditions.mod.util.PosUtil;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockDispenser;
|
||||
import net.minecraft.dispenser.BehaviorDefaultDispenseItem;
|
||||
import net.minecraft.dispenser.IBlockSource;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntityDispenser;
|
||||
import net.minecraft.util.EnumFacing;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraftforge.fluids.FluidContainerRegistry;
|
||||
import net.minecraftforge.fluids.IFluidBlock;
|
||||
|
||||
public class DispenserHandlerFillBucket extends BehaviorDefaultDispenseItem{
|
||||
|
||||
@Override
|
||||
public ItemStack dispenseStack(IBlockSource source, ItemStack emptyBucket){
|
||||
EnumFacing facing = BlockDispenser.getFacing(source.getBlockMetadata());
|
||||
int x = source.getBlockTileEntity().getPos().getX()+facing.getFrontOffsetX();
|
||||
int y = source.getBlockTileEntity().getPos().getY()+facing.getFrontOffsetY();
|
||||
int z = source.getBlockTileEntity().getPos().getZ()+facing.getFrontOffsetZ();
|
||||
|
||||
ItemStack filledBucket = this.tryFillBucket(source, x, y, z, emptyBucket);
|
||||
|
||||
//Bucket couldn't be filled
|
||||
if(filledBucket == null){
|
||||
return new BehaviorDefaultDispenseItem().dispense(source, emptyBucket);
|
||||
}
|
||||
|
||||
emptyBucket.stackSize--;
|
||||
//Only one bucket was there -> new bucket gets placed in slot
|
||||
if(emptyBucket.stackSize <= 0){
|
||||
emptyBucket = filledBucket.copy();
|
||||
}
|
||||
//Not enough space for the bucket in the inventory?
|
||||
else if(((TileEntityDispenser)source.getBlockTileEntity()).addItemStack(filledBucket.copy()) < 0){
|
||||
new BehaviorDefaultDispenseItem().dispense(source, filledBucket.copy());
|
||||
}
|
||||
//Filled Bucket or Empty Buckets because either they weren't filled or the full one was dispensed out because of missing space
|
||||
return emptyBucket;
|
||||
}
|
||||
|
||||
private ItemStack tryFillBucket(IBlockSource source, int x, int y, int z, ItemStack bucket){
|
||||
BlockPos pos = new BlockPos(x, y, z);
|
||||
Block block = PosUtil.getBlock(pos, source.getWorld());
|
||||
|
||||
if(block == Blocks.WATER || block == Blocks.FLOWING_WATER){
|
||||
if(PosUtil.getMetadata(pos, source.getWorld()) == 0){
|
||||
source.getWorld().setBlockToAir(pos);
|
||||
return new ItemStack(Items.WATER_BUCKET);
|
||||
}
|
||||
}
|
||||
else if(block == Blocks.LAVA || block == Blocks.FLOWING_LAVA){
|
||||
if(PosUtil.getMetadata(pos, source.getWorld()) == 0){
|
||||
source.getWorld().setBlockToAir(pos);
|
||||
return new ItemStack(Items.LAVA_BUCKET);
|
||||
}
|
||||
}
|
||||
else if(block instanceof IFluidBlock && ((IFluidBlock)block).canDrain(source.getWorld(), pos)){
|
||||
ItemStack stack = FluidContainerRegistry.fillFluidContainer(((IFluidBlock)block).drain(source.getWorld(), pos, false), bucket);
|
||||
if(stack != null){
|
||||
((IFluidBlock)block).drain(source.getWorld(), pos, true);
|
||||
return stack;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
|
@ -26,6 +26,7 @@ public class Util{
|
|||
|
||||
public static final Random RANDOM = new Random();
|
||||
public static final int WILDCARD = OreDictionary.WILDCARD_VALUE;
|
||||
public static final int BUCKET = 1000;
|
||||
|
||||
public static final EnumRarity CRYSTAL_RED_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID+"crystalRed", TextFormatting.DARK_RED, ModUtil.NAME+" Red Crystal");
|
||||
public static final EnumRarity CRYSTAL_BLUE_RARITY = EnumHelper.addRarity(ModUtil.MOD_ID+"crystalBlue", TextFormatting.DARK_BLUE, ModUtil.NAME+" Blue Crystal");
|
||||
|
|
Loading…
Reference in a new issue