mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
I think this works :P we will find out that Im an
idiot in like 30seconds
This commit is contained in:
parent
d02b328c27
commit
96298a5c31
@ -49,6 +49,13 @@ public class BlockEnums {
|
||||
GOLD,
|
||||
SCHRABIDIUM
|
||||
}
|
||||
|
||||
public static enum EnumAbsorberTier {
|
||||
BASE,
|
||||
RED,
|
||||
GREEN,
|
||||
PINK;
|
||||
}
|
||||
|
||||
/** DECO / STRUCTURE ENUMS */
|
||||
//i apologize in advance
|
||||
@ -80,4 +87,5 @@ public class BlockEnums {
|
||||
FLUORESCENT,
|
||||
HALOGEN
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1189,10 +1189,7 @@ public class ModBlocks {
|
||||
public static Block gas_explosive;
|
||||
public static Block vacuum;
|
||||
|
||||
public static Block absorber;
|
||||
public static Block absorber_red;
|
||||
public static Block absorber_green;
|
||||
public static Block absorber_pink;
|
||||
public static BlockAbsorber rad_absorber;
|
||||
public static Block decon;
|
||||
|
||||
public static Block mud_block;
|
||||
@ -2362,10 +2359,7 @@ public class ModBlocks {
|
||||
gas_explosive = new BlockGasExplosive().setBlockName("gas_explosive").setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":gas_explosive");
|
||||
vacuum = new BlockVacuum().setBlockName("vacuum").setResistance(1000000F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":vacuum");
|
||||
|
||||
absorber = new BlockAbsorber(Material.iron, 2.5F).setBlockName("absorber").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":absorber");
|
||||
absorber_red = new BlockAbsorber(Material.iron, 10F).setBlockName("absorber_red").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":absorber_red");
|
||||
absorber_green = new BlockAbsorber(Material.iron, 100F).setBlockName("absorber_green").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":absorber_green");
|
||||
absorber_pink = new BlockAbsorber(Material.iron, 10000F).setBlockName("absorber_pink").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":absorber_pink");
|
||||
rad_absorber = new BlockAbsorber(Material.iron).setBlockName("rad_absorber").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab);
|
||||
decon = new BlockDecon(Material.iron).setBlockName("decon").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":decon_side");
|
||||
|
||||
if (Loader.isModLoaded("OpenComputers")) {
|
||||
@ -3405,10 +3399,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(struct_icf_core, struct_icf_core.getUnlocalizedName());
|
||||
|
||||
//Absorbers
|
||||
GameRegistry.registerBlock(absorber, absorber.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(absorber_red, absorber_red.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(absorber_green, absorber_green.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(absorber_pink, absorber_pink.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(rad_absorber, ItemBlockAbsorber.class, "rad_absorber");
|
||||
GameRegistry.registerBlock(decon, decon.getUnlocalizedName());
|
||||
|
||||
//Solar Tower Blocks
|
||||
|
||||
@ -1,39 +1,148 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.BlockEnumMulti;
|
||||
import com.hbm.blocks.IBlockMulti;
|
||||
import com.hbm.handler.radiation.ChunkRadiationManager;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.creativetab.CreativeTabs;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.util.StatCollector;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class BlockAbsorber extends Block {
|
||||
public class BlockAbsorber extends BlockEnumMulti implements IBlockMulti {
|
||||
|
||||
float absorb = 0;
|
||||
// Enum for tiers they are in order of meta data, 0, 1, 2, 3 for Base, Red, Green, Pink
|
||||
public static enum EnumAbsorberTier {
|
||||
|
||||
BASE("Radiation Absorber", 2.5F, "absorber"),
|
||||
RED("Enhanced Radiation Absorber", 10F, "absorber_red"),
|
||||
GREEN("Advanced Radiation Absorber", 100F, "absorber_green"),
|
||||
PINK("Elite Radiation Absorber", 10000F, "absorber_pink");
|
||||
|
||||
public final String displayName;
|
||||
public final float absorbAmount;
|
||||
public final String textureName;
|
||||
|
||||
public BlockAbsorber(Material mat, float ab) {
|
||||
super(mat);
|
||||
this.setTickRandomly(true);
|
||||
absorb = ab;
|
||||
}
|
||||
private EnumAbsorberTier(String name, float absorb, String texture) {
|
||||
this.displayName = name;
|
||||
this.absorbAmount = absorb;
|
||||
this.textureName = texture;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int tickRate(World world) {
|
||||
private IIcon[] icons;
|
||||
|
||||
return 10;
|
||||
}
|
||||
public BlockAbsorber(Material mat) {
|
||||
super(mat, EnumAbsorberTier.class, true, true);
|
||||
this.setTickRandomly(true);
|
||||
this.setBlockName("rad_absorber");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
//More Enum stuff I copied from the other enum blocks, I have no idea how this really works tbh
|
||||
|
||||
ChunkRadiationManager.proxy.decrementRad(world, x, y, z, absorb);
|
||||
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
|
||||
}
|
||||
public EnumAbsorberTier getTier(int meta) {
|
||||
return EnumAbsorberTier.values()[rectify(meta)];
|
||||
}
|
||||
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
@Override
|
||||
public int getSubCount() {
|
||||
return EnumAbsorberTier.values().length;
|
||||
}
|
||||
|
||||
world.scheduleBlockUpdate(x, y, z, this, this.tickRate(world));
|
||||
}
|
||||
@Override
|
||||
public int damageDropped(int meta) {
|
||||
return meta;
|
||||
}
|
||||
|
||||
//HARDEST PART WORK GODDAMMIT WORK
|
||||
|
||||
@Override
|
||||
public String getUnlocalizedName(ItemStack stack) {
|
||||
EnumAbsorberTier tier = getTier(stack.getItemDamage());
|
||||
return "tile.rad_absorber." + tier.name().toLowerCase();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOverrideDisplayName(ItemStack stack) {
|
||||
return StatCollector.translateToLocal(getUnlocalizedName(stack) + ".name");
|
||||
}
|
||||
|
||||
//Creative tab && textures
|
||||
|
||||
@Override
|
||||
public void getSubBlocks(Item item, CreativeTabs tab, List list) {
|
||||
for (int i = 0; i < EnumAbsorberTier.values().length; i++) {
|
||||
list.add(new ItemStack(item, 1, i));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(net.minecraft.client.renderer.texture.IIconRegister reg) {
|
||||
icons = new IIcon[EnumAbsorberTier.values().length];
|
||||
for (int i = 0; i < icons.length; i++) {
|
||||
icons[i] = reg.registerIcon(RefStrings.MODID + ":" + EnumAbsorberTier.values()[i].textureName);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return icons[rectify(meta)];
|
||||
}
|
||||
|
||||
//All that rad math shit that was on there already, did not touch this -Wolf
|
||||
|
||||
@Override
|
||||
public int tickRate(World world) {
|
||||
return 10;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateTick(World world, int x, int y, int z, Random rand) {
|
||||
EnumAbsorberTier tier = getTier(world.getBlockMetadata(x, y, z));
|
||||
ChunkRadiationManager.proxy.decrementRad(world, x, y, z, tier.absorbAmount);
|
||||
world.scheduleBlockUpdate(x, y, z, this, tickRate(world));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBlockAdded(World world, int x, int y, int z) {
|
||||
super.onBlockAdded(world, x, y, z);
|
||||
world.scheduleBlockUpdate(x, y, z, this, tickRate(world));
|
||||
}
|
||||
|
||||
//Block wanted these or no work, probably a better way to do it but I dont know it.
|
||||
|
||||
@Override
|
||||
public BlockAbsorber setBlockName(String name) {
|
||||
super.setBlockName(name);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockAbsorber setHardness(float hardness) {
|
||||
super.setHardness(hardness);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockAbsorber setResistance(float resistance) {
|
||||
super.setResistance(resistance);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BlockAbsorber setCreativeTab(CreativeTabs tab) {
|
||||
super.setCreativeTab(tab);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
|
||||
31
src/main/java/com/hbm/items/block/ItemBlockAbsorber.java
Normal file
31
src/main/java/com/hbm/items/block/ItemBlockAbsorber.java
Normal file
@ -0,0 +1,31 @@
|
||||
package com.hbm.items.block;
|
||||
|
||||
import com.hbm.blocks.generic.BlockAbsorber;
|
||||
import com.hbm.blocks.generic.BlockAbsorber.EnumAbsorberTier;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.StatCollector;
|
||||
|
||||
public class ItemBlockAbsorber extends ItemBlock {
|
||||
|
||||
public ItemBlockAbsorber(Block block) {
|
||||
super(block);
|
||||
this.setMaxDamage(0);
|
||||
this.setHasSubtypes(true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMetadata(int damage) {
|
||||
return damage;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getItemStackDisplayName(ItemStack stack) {
|
||||
BlockAbsorber block = (BlockAbsorber)this.field_150939_a;
|
||||
EnumAbsorberTier tier = block.getTier(stack.getItemDamage());
|
||||
return StatCollector.translateToLocal("tile.rad_absorber." + tier.name().toLowerCase() + ".name");
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@ -5048,10 +5048,10 @@ stat.ntmBullets=Rounds Fired
|
||||
stat.ntmLegendary=Legendary Items Created
|
||||
stat.ntmMines=Mines Stepped on
|
||||
|
||||
tile.absorber.name=Radiation Absorber
|
||||
tile.absorber_green.name=Advanced Radiation Absorber
|
||||
tile.absorber_pink.name=Elite Radiation Absorber
|
||||
tile.absorber_red.name=Enhanced Radiation Absorber
|
||||
tile.rad_absorber.base.name=Radiation Absorber
|
||||
tile.rad_absorber.red.name=Enhanced Radiation Absorber
|
||||
tile.rad_absorber.green.name=Advanced Radiation Absorber
|
||||
tile.rad_absorber.pink.name=Elite Radiation Absorber
|
||||
tile.acid_block.name=Acid
|
||||
tile.ams_base.name=AMS Base (Deco)
|
||||
tile.ams_emitter.name=AMS Emitter (Deco)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user