Skip to content

Commit

Permalink
More Tinker integration
Browse files Browse the repository at this point in the history
  • Loading branch information
HenryLoenwind committed Dec 25, 2016
1 parent dae99fa commit b0be086
Show file tree
Hide file tree
Showing 5 changed files with 391 additions and 17 deletions.
12 changes: 12 additions & 0 deletions resources/assets/enderio/blockstates/fluids.json
Expand Up @@ -68,6 +68,18 @@
"soularium": {
"model": "forge:fluid",
"custom": { "fluid": "soularium" }
},
"glowstone": {
"model": "forge:fluid",
"custom": { "fluid": "glowstone" }
},
"redstone": {
"model": "forge:fluid",
"custom": { "fluid": "redstone" }
},
"ender": {
"model": "forge:fluid",
"custom": { "fluid": "ender" }
}
}
}
5 changes: 4 additions & 1 deletion resources/assets/enderio/lang/en_US.lang
Expand Up @@ -1531,7 +1531,7 @@ tile.blockInventoryChest_large.name=Large Inventory System Storage
tile.blockInventoryChest_huge.name=Huge Inventory System Storage
tile.blockInventoryChest_enormous.name=Enormous Inventory System Storage
tile.blockInventoryChest_warehouse.name=Inventory System Storage Warehouse
tile.blockInventoryChest_warehouse13.name= Inventory System Storage Extended Warehouse
tile.blockInventoryChest_warehouse13.name=Inventory System Storage Extended Warehouse

enderio.gui.permission.denied=Permission denied
enderio.wrench.permission.denied=Permission denied
Expand All @@ -1557,3 +1557,6 @@ fluid.conductiveiron=Molten Conductive Iron
fluid.pulsatingiron=Molten Pulsating Iron
fluid.darksteel=Molten Dark Steel
fluid.soularium=Molten Soularium
fluid.glowstone=Glowgas
fluid.redstone=Molten Redstone
fluid.ender=Liquidfied Ender Pearls
54 changes: 54 additions & 0 deletions src/main/java/crazypants/enderio/fluid/BlockFluidEio.java
Expand Up @@ -703,4 +703,58 @@ public Boolean isEntityInsideMaterial(IBlockAccess world, BlockPos blockpos, IBl

}

/////////////////////////////////////////////////////////////////////////
// Molten Glowstone
/////////////////////////////////////////////////////////////////////////

public static class MoltenGlowstone extends BlockFluidEio {

public MoltenGlowstone(Fluid fluid, Material material, int fogColor) { // 0xffbc5e
super(fluid, material, fogColor);
}

@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
if (entity instanceof EntityPlayer || (!world.isRemote && entity instanceof EntityLivingBase)) {
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.LEVITATION, 200, 0, true, true));
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.GLOWING, 2400, 0, true, true));
}
super.onEntityCollidedWithBlock(world, pos, state, entity);
}

@Override
public void init() {
super.init();
}

}

/////////////////////////////////////////////////////////////////////////
// Molten Redstone
/////////////////////////////////////////////////////////////////////////

public static class MoltenRedstone extends BlockFluidEio {

public MoltenRedstone(Fluid fluid, Material material, int fogColor) { // 0xff0000
super(fluid, material, fogColor);
}

@Override
public void onEntityCollidedWithBlock(World world, BlockPos pos, IBlockState state, Entity entity) {
if (entity instanceof EntityPlayer || (!world.isRemote && entity instanceof EntityLivingBase)) {
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.HASTE, 20 * 60, 0, true, true));
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.JUMP_BOOST, 20 * 60, 0, true, true));
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.SPEED, 20 * 60, 0, true, true));
((EntityLivingBase) entity).addPotionEffect(new PotionEffect(MobEffects.HUNGER, 20 * 60, 0, true, true));
}
super.onEntityCollidedWithBlock(world, pos, state, entity);
}

@Override
public void init() {
super.init();
}

}

}
158 changes: 158 additions & 0 deletions src/main/java/crazypants/enderio/integration/tic/AdditionalFluid.java
@@ -0,0 +1,158 @@
package crazypants.enderio.integration.tic;

import java.util.List;

import org.apache.commons.lang3.StringUtils;

import crazypants.enderio.material.PowderIngot;
import crazypants.util.Things;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.fluids.Fluid;
import net.minecraftforge.fluids.FluidRegistry;
import net.minecraftforge.fml.common.event.FMLInterModComms;
import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;

import static crazypants.enderio.ModObject.itemPowderIngot;

public class AdditionalFluid {

static void init(FMLPreInitializationEvent event) {
glowstone(event);
redstone(event);
ender(event);
}

static void init(FMLPostInitializationEvent event) {
ender(event);
}

public static void glowstone(FMLPreInitializationEvent event) {
Fluid f = new Fluid("glowstone", TicProxy.TEX_FLOWING, TicProxy.TEX_STILL) {
@Override
public int getColor() {
return 0xFF000000 | 0xffbc5e;
}
};
f.setDensity(-500);
f.setGaseous(true);
f.setLuminosity(15);
f.setTemperature(1500 + 273);
f.setViscosity(100);
if (FluidRegistry.registerFluid(f)) {
// HL: Disabled because I don't have a nice texture for it
// MoltenGlowstone block = new crazypants.enderio.fluid.BlockFluidEio.MoltenGlowstone(f, Material.WATER, 0xffbc5e);
// block.init();
// f.setBlock(block);
// if (!EnderIO.proxy.isDedicatedServer()) {
// EnderIO.fluids.registerFluidBlockRendering(f, f.getName());
// }
if (FluidRegistry.isUniversalBucketEnabled()) {
FluidRegistry.addBucketForFluid(f);
}

NBTTagCompound tag = new NBTTagCompound();
tag.setString("fluid", f.getName());
tag.setString("ore", StringUtils.capitalize("glowstone"));
tag.setBoolean("toolforge", true);
FMLInterModComms.sendMessage("tconstruct", "integrateSmeltery", tag);

// Note: We match the old TE amounts
TicProxy.registerSmelterySmelting(new ItemStack(Items.GLOWSTONE_DUST), f, 250);
TicProxy.registerSmelterySmelting(new ItemStack(Blocks.GLOWSTONE), f, 1000);
TicProxy.registerBasinCasting(new ItemStack(Blocks.GLOWSTONE), null, f, 1000);
}
}

public static void redstone(FMLPreInitializationEvent event) {
Fluid f = new Fluid("redstone", TicProxy.TEX_FLOWING, TicProxy.TEX_STILL) {
@Override
public int getColor() {
return 0xFF000000 | 0xff0000;
}
};
f.setDensity(1200);
f.setLuminosity(7);
f.setTemperature(1700 + 273);
f.setViscosity(1500);
if (FluidRegistry.registerFluid(f)) {
// HL: Disabled because I don't have a nice texture for it
// MoltenRedstone block = new crazypants.enderio.fluid.BlockFluidEio.MoltenRedstone(f, Material.WATER, 0xff0000);
// block.init();
// f.setBlock(block);
// if (!EnderIO.proxy.isDedicatedServer()) {
// EnderIO.fluids.registerFluidBlockRendering(f, f.getName());
// }
if (FluidRegistry.isUniversalBucketEnabled()) {
FluidRegistry.addBucketForFluid(f);
}

NBTTagCompound tag = new NBTTagCompound();
tag.setString("fluid", f.getName());
tag.setString("ore", StringUtils.capitalize("redstone"));
tag.setBoolean("toolforge", true);
FMLInterModComms.sendMessage("tconstruct", "integrateSmeltery", tag);

// Note: We match the old TE amounts
TicProxy.registerSmelterySmelting(new ItemStack(Items.REDSTONE), f, 100);
TicProxy.registerSmelterySmelting(new ItemStack(Blocks.REDSTONE_BLOCK), f, 900);
TicProxy.registerBasinCasting(new ItemStack(Blocks.REDSTONE_BLOCK), null, f, 900);
}
}

public static void ender(FMLPreInitializationEvent event) {
Fluid f = new Fluid("ender", TicProxy.TEX_FLOWING, TicProxy.TEX_STILL) {
@Override
public int getColor() {
return 0xFF000000 | 0x1b7b6b;
}
};
f.setDensity(4000);
f.setLuminosity(3);
f.setTemperature(1000 + 273);
f.setViscosity(3500);
if (FluidRegistry.registerFluid(f)) {
// HL: Disabled because I don't have a nice texture for it
// MoltenEnder block = new crazypants.enderio.fluid.BlockFluidEio.MoltenEnder(f, Material.WATER, 0x1b7b6b);
// block.init();
// f.setBlock(block);
// if (!EnderIO.proxy.isDedicatedServer()) {
// EnderIO.fluids.registerFluidBlockRendering(f, f.getName());
// }
if (FluidRegistry.isUniversalBucketEnabled()) {
FluidRegistry.addBucketForFluid(f);
}

NBTTagCompound tag = new NBTTagCompound();
tag.setString("fluid", f.getName());
tag.setString("ore", StringUtils.capitalize("ender"));
tag.setBoolean("toolforge", true);
FMLInterModComms.sendMessage("tconstruct", "integrateSmeltery", tag);

registerVanillaRecipesForEnder = true;
// Note: We match the old TE amounts
TicProxy.registerSmelterySmelting(new ItemStack(Items.ENDER_PEARL), f, 250);
}
f = FluidRegistry.getFluid(f.getName());
}

static boolean registerVanillaRecipesForEnder = false;

public static void ender(FMLPostInitializationEvent event) {
Fluid f = FluidRegistry.getFluid("ender");

if (registerVanillaRecipesForEnder) {
// Need to do this later because of the cast
Things cast = new Things("tconstruct:cast_custom:2");
List<ItemStack> casts = cast.getItemStacks();
if (!casts.isEmpty()) {
TicProxy.registerTableCast(new ItemStack(Items.ENDER_PEARL), casts.get(0), f, 250);
}
}
TicProxy.registerSmelterySmelting(new ItemStack(itemPowderIngot.getItem(), 1, PowderIngot.POWDER_ENDER.ordinal()), f, 250 / 9);
}

}

0 comments on commit b0be086

Please sign in to comment.