mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
proper sulfuric acid
This commit is contained in:
parent
8400098be0
commit
ff87b1a062
@ -2218,16 +2218,9 @@ public class ModBlocks {
|
||||
FluidRegistry.registerFluid(volcanic_lava_fluid);
|
||||
volcanic_lava_block = new VolcanicBlock(volcanic_lava_fluid, Material.lava).setBlockName("volcanic_lava_block").setResistance(500F);
|
||||
|
||||
sulfuric_acid_fluid = new SchrabidicFluid().setDensity(1840).setViscosity(1000).setTemperature(273).setUnlocalizedName("sulfuric_acid_fluid");
|
||||
sulfuric_acid_fluid = new GenericFluid("sulfuric_acid_fluid").setDensity(1840).setViscosity(1000).setTemperature(273);
|
||||
FluidRegistry.registerFluid(sulfuric_acid_fluid);
|
||||
sulfuric_acid_block = new SchrabidicBlock(sulfuric_acid_fluid, Material.water, ModDamageSource.acid) { //TODO: make a new block class
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
stillIcon = register.registerIcon(RefStrings.MODID + ":sulfuric_acid_still");
|
||||
flowingIcon = register.registerIcon(RefStrings.MODID + ":sulfuric_acid_flowing");
|
||||
}
|
||||
}.setBlockName("sulfuric_acid_block").setResistance(500F);
|
||||
sulfuric_acid_block = new GenericFluidBlock(sulfuric_acid_fluid, Material.water, "sulfuric_acid_still", "sulfuric_acid_flowing").setDamage(ModDamageSource.acid, 5F).setBlockName("sulfuric_acid_block").setResistance(500F);
|
||||
|
||||
dummy_block_flare = new DummyBlockFlare(Material.iron, false).setBlockName("dummy_block_flare").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_aluminium");
|
||||
dummy_port_flare = new DummyBlockFlare(Material.iron, true).setBlockName("dummy_port_flare").setHardness(5.0F).setResistance(10.0F).setCreativeTab(null).setBlockTextureName(RefStrings.MODID + ":block_aluminium");
|
||||
|
||||
31
src/main/java/com/hbm/blocks/fluid/GenericFluid.java
Normal file
31
src/main/java/com/hbm/blocks/fluid/GenericFluid.java
Normal file
@ -0,0 +1,31 @@
|
||||
package com.hbm.blocks.fluid;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class GenericFluid extends Fluid {
|
||||
|
||||
public GenericFluid(String name) {
|
||||
super("corium_fluid");
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon() {
|
||||
return getStillIcon();
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getStillIcon() {
|
||||
return this.block.getIcon(0, 0);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getFlowingIcon() {
|
||||
return this.block.getIcon(1, 0);
|
||||
}
|
||||
}
|
||||
96
src/main/java/com/hbm/blocks/fluid/GenericFluidBlock.java
Normal file
96
src/main/java/com/hbm/blocks/fluid/GenericFluidBlock.java
Normal file
@ -0,0 +1,96 @@
|
||||
package com.hbm.blocks.fluid;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.util.ArmorUtil;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.passive.EntitySquid;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.DamageSource;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fluids.BlockFluidClassic;
|
||||
import net.minecraftforge.fluids.Fluid;
|
||||
|
||||
public class GenericFluidBlock extends BlockFluidClassic {
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon stillIcon;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public static IIcon flowingIcon;
|
||||
public Random rand = new Random();
|
||||
|
||||
private String stillName;
|
||||
private String flowingName;
|
||||
|
||||
public float damage;
|
||||
public DamageSource damageSource;
|
||||
|
||||
public GenericFluidBlock(Fluid fluid, Material material, String still, String flowing) {
|
||||
super(fluid, material);
|
||||
setCreativeTab(null);
|
||||
stillName = still;
|
||||
flowingName = flowing;
|
||||
displacements.put(this, false);
|
||||
}
|
||||
|
||||
public GenericFluidBlock setDamage(DamageSource source, float amount) {
|
||||
damageSource = source;
|
||||
damage = amount;
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return (side == 0 || side == 1) ? stillIcon : flowingIcon;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister register) {
|
||||
stillIcon = register.registerIcon(RefStrings.MODID + ":" + stillName);
|
||||
flowingIcon = register.registerIcon(RefStrings.MODID + ":" + flowingName);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
|
||||
if(damageSource != null) {
|
||||
|
||||
if(entity instanceof EntityItem) {
|
||||
|
||||
entity.motionX = 0;
|
||||
entity.motionY = 0;
|
||||
entity.motionZ = 0;
|
||||
|
||||
if(entity.ticksExisted % 20 == 0 && !world.isRemote) {
|
||||
entity.attackEntityFrom(damageSource, damage * 0.1F);
|
||||
}
|
||||
if(entity.ticksExisted % 5 == 0) {
|
||||
world.spawnParticle("cloud", entity.posX, entity.posY, entity.posZ, 0.0, 0.0, 0.0);
|
||||
}
|
||||
} else {
|
||||
|
||||
if(entity.motionY < -0.2)
|
||||
entity.motionY *= 0.5;
|
||||
|
||||
if(!world.isRemote) {
|
||||
entity.attackEntityFrom(damageSource, damage);
|
||||
}
|
||||
}
|
||||
|
||||
if(entity.ticksExisted % 5 == 0) {
|
||||
world.playSoundAtEntity(entity, "random.fizz", 0.2F, 1F);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -77,7 +77,9 @@ public class SchrabidicBlock extends BlockFluidClassic {
|
||||
|
||||
@Override
|
||||
public void onEntityCollidedWithBlock(World world, int x, int y, int z, Entity entity) {
|
||||
entity.setInWeb();
|
||||
|
||||
if(this.getMaterial() == ModBlocks.fluidschrabidic)
|
||||
entity.setInWeb();
|
||||
|
||||
if(entity instanceof EntityLivingBase)
|
||||
ContaminationUtil.contaminate((EntityLivingBase)entity, HazardType.RADIATION, ContaminationType.CREATIVE, 1.0F);
|
||||
@ -97,7 +99,7 @@ public class SchrabidicBlock extends BlockFluidClassic {
|
||||
}
|
||||
|
||||
public boolean reactToBlocks(World world, int x, int y, int z) {
|
||||
if(world.getBlock(x, y, z).getMaterial() != ModBlocks.fluidschrabidic) {
|
||||
if(world.getBlock(x, y, z).getMaterial() != this.getMaterial()) {
|
||||
if(world.getBlock(x, y, z).getMaterial().isLiquid()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 320 B After Width: | Height: | Size: 325 B |
|
Before Width: | Height: | Size: 9.6 KiB After Width: | Height: | Size: 9.6 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
Loading…
x
Reference in New Issue
Block a user