use of micdoodle8.mods.galacticraft.core.items.ItemBucketGC in project Galacticraft by micdoodle8.
the class MarsModule method preInit.
@Override
public void preInit(FMLPreInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(new EventHandlerMars());
if (!FluidRegistry.isFluidRegistered("bacterialsludge")) {
ResourceLocation stillIcon = new ResourceLocation(GalacticraftPlanets.TEXTURE_PREFIX + "blocks/fluids/sludge_still");
ResourceLocation flowingIcon = new ResourceLocation(GalacticraftPlanets.TEXTURE_PREFIX + "blocks/fluids/sludge_flow");
sludgeGC = new Fluid("bacterialsludge", stillIcon, flowingIcon).setDensity(800).setViscosity(1500);
FluidRegistry.registerFluid(sludgeGC);
} else {
GCLog.info("Galacticraft sludge is not default, issues may occur.");
}
sludge = FluidRegistry.getFluid("bacterialsludge");
if (sludge.getBlock() == null) {
MarsBlocks.blockSludge = new BlockSludge("sludge");
((BlockSludge) MarsBlocks.blockSludge).setQuantaPerBlock(3);
MarsBlocks.registerBlock(MarsBlocks.blockSludge, ItemBlockDesc.class);
sludge.setBlock(MarsBlocks.blockSludge);
} else {
MarsBlocks.blockSludge = sludge.getBlock();
}
if (MarsBlocks.blockSludge != null) {
MarsItems.bucketSludge = new ItemBucketGC(MarsBlocks.blockSludge).setUnlocalizedName("bucket_sludge");
MarsItems.registerItem(MarsItems.bucketSludge);
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("bacterialsludge", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(MarsItems.bucketSludge), new ItemStack(Items.bucket));
}
EventHandlerGC.bucketList.put(MarsBlocks.blockSludge, MarsItems.bucketSludge);
MarsBlocks.initBlocks();
MarsItems.initItems();
}
use of micdoodle8.mods.galacticraft.core.items.ItemBucketGC in project Galacticraft by micdoodle8.
the class VenusModule method preInit.
@Override
public void preInit(FMLPreInitializationEvent event) {
MinecraftForge.EVENT_BUS.register(new EventHandlerVenus());
if (!FluidRegistry.isFluidRegistered("sulphuricacid")) {
ResourceLocation stillIcon = new ResourceLocation(GalacticraftPlanets.TEXTURE_PREFIX + "blocks/fluids/sulphuric_acid_still");
ResourceLocation flowingIcon = new ResourceLocation(GalacticraftPlanets.TEXTURE_PREFIX + "blocks/fluids/sulphuric_acid_flow");
sulphuricAcidGC = new Fluid("sulphuricacid", stillIcon, flowingIcon).setDensity(6229).setViscosity(1400);
FluidRegistry.registerFluid(sulphuricAcidGC);
} else {
GCLog.info("Galacticraft sulphuric acid is not default, issues may occur.");
}
sulphuricAcid = FluidRegistry.getFluid("sulphuricacid");
if (sulphuricAcid.getBlock() == null) {
VenusBlocks.sulphuricAcid = new BlockSulphuricAcid("sulphuric_acid");
((BlockSulphuricAcid) VenusBlocks.sulphuricAcid).setQuantaPerBlock(5);
VenusBlocks.registerBlock(VenusBlocks.sulphuricAcid, ItemBlockDesc.class);
sulphuricAcid.setBlock(VenusBlocks.sulphuricAcid);
} else {
VenusBlocks.sulphuricAcid = sulphuricAcid.getBlock();
}
if (VenusBlocks.sulphuricAcid != null) {
VenusItems.bucketSulphuricAcid = new ItemBucketGC(VenusBlocks.sulphuricAcid).setUnlocalizedName("bucket_sulphuric_acid");
VenusItems.registerItem(VenusItems.bucketSulphuricAcid);
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack("sulphuricacid", FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(VenusItems.bucketSulphuricAcid), new ItemStack(Items.bucket));
}
EventHandlerGC.bucketList.put(VenusBlocks.sulphuricAcid, VenusItems.bucketSulphuricAcid);
VenusBlocks.initBlocks();
VenusItems.initItems();
}
use of micdoodle8.mods.galacticraft.core.items.ItemBucketGC in project Galacticraft by micdoodle8.
the class GCFluids method registerDispenserBehaviours.
public static void registerDispenserBehaviours() {
IBehaviorDispenseItem ibehaviordispenseitem = new BehaviorDefaultDispenseItem() {
private final BehaviorDefaultDispenseItem dispenseBehavior = new BehaviorDefaultDispenseItem();
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
ItemBucketGC itembucket = (ItemBucketGC) stack.getItem();
BlockPos blockpos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()));
if (itembucket.tryPlaceContainedLiquid(source.getWorld(), blockpos)) {
stack.setItem(Items.bucket);
stack.stackSize = 1;
return stack;
} else {
return this.dispenseBehavior.dispense(source, stack);
}
}
};
if (GCItems.bucketFuel != null) {
BlockDispenser.dispenseBehaviorRegistry.putObject(GCItems.bucketFuel, ibehaviordispenseitem);
}
if (GCItems.bucketOil != null) {
BlockDispenser.dispenseBehaviorRegistry.putObject(GCItems.bucketOil, ibehaviordispenseitem);
}
if (GalacticraftCore.isPlanetsLoaded) {
if (MarsItems.bucketSludge != null) {
BlockDispenser.dispenseBehaviorRegistry.putObject(MarsItems.bucketSludge, ibehaviordispenseitem);
}
if (VenusItems.bucketSulphuricAcid != null) {
BlockDispenser.dispenseBehaviorRegistry.putObject(VenusItems.bucketSulphuricAcid, ibehaviordispenseitem);
}
}
// The following code is for other objects, not liquids, but it's convenient to keep it all together
BlockDispenser.dispenseBehaviorRegistry.putObject(GCItems.meteorChunk, new BehaviorProjectileDispense() {
@Override
protected IProjectile getProjectileEntity(World worldIn, IPosition position) {
return new EntityMeteorChunk(worldIn);
}
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
World world = source.getWorld();
IPosition position = BlockDispenser.getDispensePosition(source);
EnumFacing enumfacing = BlockDispenser.getFacing(source.getBlockMetadata());
EntityMeteorChunk meteor = new EntityMeteorChunk(world);
meteor.setPosition(position.getX(), position.getY(), position.getZ());
meteor.setThrowableHeading((double) enumfacing.getFrontOffsetX(), (double) ((float) enumfacing.getFrontOffsetY() + 0.1F), (double) enumfacing.getFrontOffsetZ(), 1.0F, this.func_82498_a());
if (stack.getItemDamage() > 0) {
meteor.setFire(20);
meteor.isHot = true;
}
meteor.canBePickedUp = 1;
world.spawnEntityInWorld((Entity) meteor);
stack.splitStack(1);
return stack;
}
});
BlockDispenser.dispenseBehaviorRegistry.putObject(GCItems.rocketTier1, new BehaviorDefaultDispenseItem() {
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
World world = source.getWorld();
BlockPos pos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()), 2);
IBlockState iblockstate = world.getBlockState(pos);
boolean rocketPlaced = false;
if (iblockstate.getBlock() == GCBlocks.landingPadFull && GCBlocks.landingPadFull.getMetaFromState(iblockstate) == 0) {
float centerX = pos.getX() + 0.5F;
float centerY = pos.getY() + 0.4F;
float centerZ = pos.getZ() + 0.5F;
rocketPlaced = ItemTier1Rocket.placeRocketOnPad(stack, world, world.getTileEntity(pos), centerX, centerY, centerZ);
}
if (rocketPlaced) {
stack.splitStack(1);
}
return stack;
}
});
if (GalacticraftCore.isPlanetsLoaded) {
BlockDispenser.dispenseBehaviorRegistry.putObject(MarsItems.rocketMars, new BehaviorDefaultDispenseItem() {
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
World world = source.getWorld();
BlockPos pos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()), 2);
IBlockState iblockstate = world.getBlockState(pos);
boolean rocketPlaced = false;
if (iblockstate.getBlock() == GCBlocks.landingPadFull && GCBlocks.landingPadFull.getMetaFromState(iblockstate) == 0) {
float centerX = pos.getX() + 0.5F;
float centerY = pos.getY() + 0.4F;
float centerZ = pos.getZ() + 0.5F;
rocketPlaced = ItemTier2Rocket.placeRocketOnPad(stack, world, world.getTileEntity(pos), centerX, centerY, centerZ);
}
if (rocketPlaced) {
stack.splitStack(1);
}
return stack;
}
});
BlockDispenser.dispenseBehaviorRegistry.putObject(AsteroidsItems.tier3Rocket, new BehaviorDefaultDispenseItem() {
@Override
public ItemStack dispenseStack(IBlockSource source, ItemStack stack) {
World world = source.getWorld();
BlockPos pos = source.getBlockPos().offset(BlockDispenser.getFacing(source.getBlockMetadata()), 2);
IBlockState iblockstate = world.getBlockState(pos);
boolean rocketPlaced = false;
if (iblockstate.getBlock() == GCBlocks.landingPadFull && GCBlocks.landingPadFull.getMetaFromState(iblockstate) == 0) {
float centerX = pos.getX() + 0.5F;
float centerY = pos.getY() + 0.4F;
float centerZ = pos.getZ() + 0.5F;
rocketPlaced = ItemTier3Rocket.placeRocketOnPad(stack, world, world.getTileEntity(pos), centerX, centerY, centerZ);
}
if (rocketPlaced) {
stack.splitStack(1);
}
return stack;
}
});
}
}
use of micdoodle8.mods.galacticraft.core.items.ItemBucketGC in project Galacticraft by micdoodle8.
the class GCFluids method registerOilandFuel.
public static void registerOilandFuel() {
// NOTE: the way this operates will depend on the order in which different mods initialize (normally alphabetical order)
// Galacticraft can handle things OK if another mod registers oil or fuel first. The other mod may not be so happy if GC registers oil or fuel first.
String oilID = ConfigManagerCore.useOldOilFluidID ? "oilgc" : "oil";
String fuelID = ConfigManagerCore.useOldFuelFluidID ? "fuelgc" : "fuel";
// Oil:
if (!FluidRegistry.isFluidRegistered(oilID)) {
ResourceLocation flowingOil = new ResourceLocation(Constants.TEXTURE_PREFIX + "blocks/fluids/oil_flow");
ResourceLocation stillOil = new ResourceLocation(Constants.TEXTURE_PREFIX + "blocks/fluids/oil_still");
Fluid gcFluidOil = new Fluid(oilID, stillOil, flowingOil).setDensity(800).setViscosity(1500);
FluidRegistry.registerFluid(gcFluidOil);
} else {
GCLog.info("Galacticraft oil is not default, issues may occur.");
}
fluidOil = FluidRegistry.getFluid(oilID);
if (fluidOil.getBlock() == null) {
GCBlocks.registerOil();
fluidOil.setBlock(GCBlocks.crudeOil);
} else {
GCBlocks.crudeOil = fluidOil.getBlock();
}
if (GCBlocks.crudeOil != null && Item.itemRegistry.getObject(new ResourceLocation("buildcraftenergy:items/bucketOil")) == null) {
GCItems.bucketOil = new ItemBucketGC(GCBlocks.crudeOil);
GCItems.bucketOil.setUnlocalizedName("bucket_oil");
GCItems.registerItem(GCItems.bucketOil);
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack(oilID, FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(GCItems.bucketOil), new ItemStack(Items.bucket));
}
EventHandlerGC.bucketList.put(GCBlocks.crudeOil, GCItems.bucketOil);
// Fuel:
if (!FluidRegistry.isFluidRegistered(fuelID)) {
ResourceLocation flowingFuel = new ResourceLocation(Constants.TEXTURE_PREFIX + "blocks/fluids/fuel_flow");
ResourceLocation stillFuel = new ResourceLocation(Constants.TEXTURE_PREFIX + "blocks/fluids/fuel_still");
Fluid gcFluidFuel = new Fluid(fuelID, stillFuel, flowingFuel).setDensity(400).setViscosity(900);
FluidRegistry.registerFluid(gcFluidFuel);
} else {
GCLog.info("Galacticraft fuel is not default, issues may occur.");
}
fluidFuel = FluidRegistry.getFluid(fuelID);
if (fluidFuel.getBlock() == null) {
GCBlocks.registerFuel();
GCFluids.fluidFuel.setBlock(GCBlocks.fuel);
} else {
GCBlocks.fuel = fluidFuel.getBlock();
}
if (GCBlocks.fuel != null && Item.itemRegistry.getObject(new ResourceLocation("buildcraftenergy:items/bucketFuel")) == null) {
GCItems.bucketFuel = new ItemBucketGC(GCBlocks.fuel);
GCItems.bucketFuel.setUnlocalizedName("bucket_fuel");
GCItems.registerItem(GCItems.bucketFuel);
FluidContainerRegistry.registerFluidContainer(FluidRegistry.getFluidStack(fuelID, FluidContainerRegistry.BUCKET_VOLUME), new ItemStack(GCItems.bucketFuel), new ItemStack(Items.bucket));
}
EventHandlerGC.bucketList.put(GCBlocks.fuel, GCItems.bucketFuel);
}
Aggregations