mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
cap blocks with meta, customizable bedrock ores
This commit is contained in:
parent
bc3a3ef2a2
commit
3e716bf3fc
@ -5,10 +5,12 @@
|
||||
* We'll see how it goes
|
||||
* Did some spring cleaning
|
||||
* Removed cloud residue (looked horrible, allowed for weird dupes and made no sense overall)
|
||||
* Removed bottle cap blocks (took up a ton of block IDs and nobody used those anyway)
|
||||
* Bottlecap blocks now use a single block ID and metadata instead of using one ID per type. This change however will delete all existing bottlecap blocks in the world
|
||||
* Removed the config option for silos (the option no longer works anyway since the new silos use the structure component system)
|
||||
* Removed a few other minor things that won't be mentioned because nobody's gonna even notice their absence anyway
|
||||
* Retextured the laser detonator to look more like the old detonator, but keeping the 3D model
|
||||
* Bedrock ores can now be customized in creative mode. Using a drillbit sets the tier, a fluid container sets the borefluid requirement and any other item sets the resource.
|
||||
* The texture used is random, and the color applied is based on the auto detect system. The system doesn't work with layered items, so the resulting color won't be the same as naturally generated bedrock ore. The bedrock ore item in particular will always result in a white ore, no matter the type
|
||||
|
||||
## Fixed
|
||||
* WarTec should now be compatible again
|
||||
|
||||
@ -14,4 +14,8 @@ public interface IFillableItem {
|
||||
public boolean providesFluid(FluidType type, ItemStack stack);
|
||||
/** Provides fluid with the maximum being the requested amount */
|
||||
public int tryEmpty(FluidType type, int amount, ItemStack stack);
|
||||
/** Returns the first (or only) corrently held type, may return null. Currently only used for setting bedrock ores */
|
||||
public FluidType getFirstFluidType(ItemStack stack);
|
||||
/** Returns the fillstate for the specified fluid. Currently only used for setting bedrock ores */
|
||||
public int getFill(ItemStack stack);
|
||||
}
|
||||
|
||||
@ -278,6 +278,8 @@ public class ModBlocks {
|
||||
public static Block block_daffergon;
|
||||
public static Block block_verticium;
|
||||
|
||||
public static Block block_cap;
|
||||
|
||||
public static Block deco_titanium;
|
||||
public static Block deco_red_copper;
|
||||
public static Block deco_tungsten;
|
||||
@ -1509,6 +1511,8 @@ public class ModBlocks {
|
||||
block_daffergon = new BlockBeaconable(Material.iron).setBlockName("block_daffergon").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_daffergon");
|
||||
block_verticium = new BlockBeaconable(Material.iron).setBlockName("block_verticium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":block_verticium");
|
||||
|
||||
block_cap = new BlockCap().setBlockName("block_cap").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F);
|
||||
|
||||
deco_titanium = new BlockOre(Material.iron).noFortune().setBlockName("deco_titanium").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_titanium");
|
||||
deco_red_copper = new BlockDecoCT(Material.iron).noFortune().setBlockName("deco_red_copper").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_red_copper");
|
||||
deco_tungsten = new BlockDecoCT(Material.iron).noFortune().setBlockName("deco_tungsten").setCreativeTab(MainRegistry.blockTab).setHardness(5.0F).setResistance(10.0F).setBlockTextureName(RefStrings.MODID + ":deco_tungsten");
|
||||
@ -2693,6 +2697,7 @@ public class ModBlocks {
|
||||
GameRegistry.registerBlock(block_unobtainium, ItemOreBlock.class, block_unobtainium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_daffergon, ItemOreBlock.class, block_daffergon.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_verticium, ItemOreBlock.class, block_verticium.getUnlocalizedName());
|
||||
register(block_cap);
|
||||
GameRegistry.registerBlock(block_lanthanium, block_lanthanium.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_ra226, block_ra226.getUnlocalizedName());
|
||||
GameRegistry.registerBlock(block_actinium, block_actinium.getUnlocalizedName());
|
||||
|
||||
@ -6,20 +6,26 @@ import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.IBlockMultiPass;
|
||||
import com.hbm.blocks.ILookOverlay;
|
||||
import com.hbm.inventory.FluidContainerRegistry;
|
||||
import com.hbm.inventory.FluidStack;
|
||||
import com.hbm.inventory.fluid.FluidType;
|
||||
import com.hbm.inventory.fluid.Fluids;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.machine.ItemDrillbit.EnumDrillType;
|
||||
import com.hbm.lib.RefStrings;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.render.block.RenderBlockMultipass;
|
||||
import com.hbm.util.EnumUtil;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import api.hbm.fluid.IFillableItem;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.client.renderer.texture.IIconRegister;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
@ -57,6 +63,45 @@ public class BlockBedrockOreTE extends BlockContainer implements ILookOverlay, I
|
||||
super.onBlockPlacedBy(world, x, y, z, entity, stack);
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int i, float fx, float fy, float fz) {
|
||||
|
||||
ItemStack stack = player.getHeldItem();
|
||||
if(stack == null) return false;
|
||||
if(!player.capabilities.isCreativeMode) return false;
|
||||
if(world.isRemote) return true;
|
||||
|
||||
TileEntity te = world.getTileEntity(x, y, z);
|
||||
|
||||
if(te instanceof TileEntityBedrockOre) {
|
||||
TileEntityBedrockOre ore = (TileEntityBedrockOre) te;
|
||||
|
||||
if(stack.getItem() == ModItems.drillbit) {
|
||||
EnumDrillType type = EnumUtil.grabEnumSafely(EnumDrillType.class, stack.getItemDamage());
|
||||
ore.tier = type.ordinal();
|
||||
} else if(FluidContainerRegistry.getFluidType(stack) != Fluids.NONE) {
|
||||
FluidType type = FluidContainerRegistry.getFluidType(stack);
|
||||
int amount = FluidContainerRegistry.getFluidContent(stack, type);
|
||||
ore.acidRequirement = new FluidStack(type, amount);
|
||||
} else if(stack.getItem() instanceof IFillableItem) {
|
||||
IFillableItem item = (IFillableItem) stack.getItem();
|
||||
FluidType type = item.getFirstFluidType(stack);
|
||||
if(type != null) {
|
||||
ore.acidRequirement = new FluidStack(type, item.getFill(stack));
|
||||
}
|
||||
} else {
|
||||
ore.resource = stack.copy();
|
||||
ore.shape = world.rand.nextInt(10);
|
||||
}
|
||||
|
||||
ore.markDirty();
|
||||
}
|
||||
|
||||
world.markBlockForUpdate(x, y, z);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getRenderType(){
|
||||
@ -219,6 +264,12 @@ public class BlockBedrockOreTE extends BlockContainer implements ILookOverlay, I
|
||||
@Override
|
||||
public void onDataPacket(NetworkManager net, S35PacketUpdateTileEntity pkt) {
|
||||
this.readFromNBT(pkt.func_148857_g());
|
||||
|
||||
if(color == 0) {
|
||||
this.color = MainRegistry.proxy.getStackColor(resource, true);
|
||||
}
|
||||
|
||||
worldObj.markBlockForUpdate(xCoord, yCoord, zCoord);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
71
src/main/java/com/hbm/blocks/generic/BlockCap.java
Normal file
71
src/main/java/com/hbm/blocks/generic/BlockCap.java
Normal file
@ -0,0 +1,71 @@
|
||||
package com.hbm.blocks.generic;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Random;
|
||||
|
||||
import com.hbm.blocks.BlockEnumMulti;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.util.EnumUtil;
|
||||
|
||||
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.item.Item;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
||||
public class BlockCap extends BlockEnumMulti {
|
||||
|
||||
protected IIcon[] iconsTop;
|
||||
|
||||
public BlockCap() {
|
||||
super(Material.iron, EnumCapBlock.class, true, true);
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public void registerBlockIcons(IIconRegister reg) {
|
||||
|
||||
Enum[] enums = theEnum.getEnumConstants();
|
||||
this.icons = new IIcon[enums.length];
|
||||
this.iconsTop = new IIcon[enums.length];
|
||||
|
||||
for(int i = 0; i < icons.length; i++) {
|
||||
Enum num = enums[i];
|
||||
this.icons[i] = reg.registerIcon(this.getTextureMultiName(num));
|
||||
this.iconsTop[i] = reg.registerIcon(this.getTextureMultiName(num) + "_top");
|
||||
}
|
||||
}
|
||||
|
||||
@Override public String getTextureMultiName(Enum num) { return this.getTextureName() + "_" + num.name().toLowerCase(Locale.US); }
|
||||
@Override public String getUnlocalizedMultiName(Enum num) { return super.getUnlocalizedName() + "_" + num.name().toLowerCase(Locale.US); }
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
return side == 0 || side == 1 ? this.iconsTop[meta % this.iconsTop.length] : this.icons[meta % this.icons.length];
|
||||
}
|
||||
|
||||
@Override
|
||||
public Item getItemDropped(int meta, Random rand, int j) {
|
||||
|
||||
EnumCapBlock cap = EnumUtil.grabEnumSafely(EnumCapBlock.class, meta);
|
||||
|
||||
if(cap == EnumCapBlock.NUKA) return ModItems.cap_nuka;
|
||||
if(cap == EnumCapBlock.QUANTUM) return ModItems.cap_quantum;
|
||||
if(cap == EnumCapBlock.SPARKLE) return ModItems.cap_sparkle;
|
||||
if(cap == EnumCapBlock.RAD) return ModItems.cap_rad;
|
||||
if(cap == EnumCapBlock.KORL) return ModItems.cap_korl;
|
||||
if(cap == EnumCapBlock.FRITZ) return ModItems.cap_fritz;
|
||||
if(cap == EnumCapBlock.SUNSET) return ModItems.cap_sunset;
|
||||
if(cap == EnumCapBlock.STAR) return ModItems.cap_star;
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override public int quantityDropped(Random rand) { return 128; }
|
||||
|
||||
public static enum EnumCapBlock {
|
||||
NUKA, QUANTUM, SPARKLE, RAD, KORL, FRITZ, SUNSET, STAR;
|
||||
}
|
||||
}
|
||||
@ -17,6 +17,7 @@ import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.stream.JsonWriter;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.generic.BlockCap.EnumCapBlock;
|
||||
import com.hbm.config.GeneralConfig;
|
||||
import com.hbm.inventory.OreDictManager;
|
||||
import com.hbm.inventory.RecipesCommon.*;
|
||||
@ -956,6 +957,15 @@ public class AssemblerRecipes extends SerializableRecipe {
|
||||
new ComparableStack(ModItems.powder_nitan_mix, 18),
|
||||
}, 600);
|
||||
|
||||
makeRecipe(new ComparableStack(DictFrame.fromOne(ModBlocks.block_cap, EnumCapBlock.NUKA)), new AStack[] { new ComparableStack(ModItems.cap_nuka, 128) }, 10);
|
||||
makeRecipe(new ComparableStack(DictFrame.fromOne(ModBlocks.block_cap, EnumCapBlock.QUANTUM)), new AStack[] { new ComparableStack(ModItems.cap_quantum, 128) }, 10);
|
||||
makeRecipe(new ComparableStack(DictFrame.fromOne(ModBlocks.block_cap, EnumCapBlock.SPARKLE)), new AStack[] { new ComparableStack(ModItems.cap_sparkle, 128) }, 10);
|
||||
makeRecipe(new ComparableStack(DictFrame.fromOne(ModBlocks.block_cap, EnumCapBlock.RAD)), new AStack[] { new ComparableStack(ModItems.cap_rad, 128) }, 10);
|
||||
makeRecipe(new ComparableStack(DictFrame.fromOne(ModBlocks.block_cap, EnumCapBlock.FRITZ)), new AStack[] { new ComparableStack(ModItems.cap_fritz, 128) }, 10);
|
||||
makeRecipe(new ComparableStack(DictFrame.fromOne(ModBlocks.block_cap, EnumCapBlock.KORL)), new AStack[] { new ComparableStack(ModItems.cap_korl, 128) }, 10);
|
||||
makeRecipe(new ComparableStack(DictFrame.fromOne(ModBlocks.block_cap, EnumCapBlock.SUNSET)), new AStack[] { new ComparableStack(ModItems.cap_sunset, 128) }, 10);
|
||||
makeRecipe(new ComparableStack(DictFrame.fromOne(ModBlocks.block_cap, EnumCapBlock.STAR)), new AStack[] { new ComparableStack(ModItems.cap_star, 128) }, 10);
|
||||
|
||||
if(!GeneralConfig.enable528) {
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_hephaestus, 1), new AStack[] { new ComparableStack(ModItems.pipes_steel, 1), !exp ? new OreDictStack(STEEL.ingot(), 24) : new OreDictStack(STEEL.heavyComp(), 2), !exp ? new OreDictStack(CU.plate(), 24) : new OreDictStack(CU.heavyComp(), 2), new OreDictStack(NB.ingot(), 4), new OreDictStack(RUBBER.ingot(), 12), new ComparableStack(ModBlocks.glass_quartz, 16) }, 150);
|
||||
makeRecipe(new ComparableStack(ModBlocks.machine_radgen, 1), new AStack[] {new OreDictStack(STEEL.ingot(), 8), new OreDictStack(STEEL.plate(), 32), new ComparableStack(ModItems.coil_magnetized_tungsten, 6), new ComparableStack(ModItems.wire_magnetized_tungsten, 24), new ComparableStack(ModItems.circuit_gold, 4), new ComparableStack(ModItems.reactor_core, 3), new OreDictStack(STAR.ingot(), 1), new OreDictStack("dyeRed", 1), }, 400, ModItems.journal_pip);
|
||||
|
||||
@ -30,6 +30,7 @@ public class ArmorFSBFueled extends ArmorFSB implements IFillableItem {
|
||||
this.maxFuel = maxFuel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFill(ItemStack stack) {
|
||||
if(stack.stackTagCompound == null) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
@ -123,4 +124,9 @@ public class ArmorFSBFueled extends ArmorFSB implements IFillableItem {
|
||||
public int tryEmpty(FluidType type, int amount, ItemStack stack) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidType getFirstFluidType(ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -176,4 +176,14 @@ public abstract class JetpackBase extends ItemArmorMod implements IFillableItem
|
||||
public int tryEmpty(FluidType type, int amount, ItemStack stack) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidType getFirstFluidType(ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFill(ItemStack stack) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -204,4 +204,14 @@ public class ItemBlowtorch extends Item implements IFillableItem {
|
||||
|
||||
@Override public boolean providesFluid(FluidType type, ItemStack stack) { return false; }
|
||||
@Override public int tryEmpty(FluidType type, int amount, ItemStack stack) { return amount; }
|
||||
|
||||
@Override
|
||||
public FluidType getFirstFluidType(ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFill(ItemStack stack) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,8 @@ public class ItemPipette extends Item implements IFillableItem {
|
||||
stack.stackTagCompound.setShort("fill", fill);
|
||||
}
|
||||
|
||||
public short getFill(ItemStack stack) {
|
||||
@Override
|
||||
public int getFill(ItemStack stack) {
|
||||
if(!stack.hasTagCompound()) {
|
||||
initNBT(stack);
|
||||
}
|
||||
@ -203,4 +204,8 @@ public class ItemPipette extends Item implements IFillableItem {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidType getFirstFluidType(ItemStack stack) {
|
||||
return this.getType(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,6 +68,7 @@ public class ItemToolAbilityFueled extends ItemToolAbility implements IFillableI
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFill(ItemStack stack) {
|
||||
if(stack.stackTagCompound == null) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
@ -120,4 +121,9 @@ public class ItemToolAbilityFueled extends ItemToolAbility implements IFillableI
|
||||
tool.setFill(stack, 0);
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidType getFirstFluidType(ItemStack stack) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -214,4 +214,14 @@ public class ItemGunChemthrower extends ItemGunBase implements IFillableItem {
|
||||
|
||||
return toUnload;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FluidType getFirstFluidType(ItemStack stack) {
|
||||
return this.getFluidType(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFill(ItemStack stack) {
|
||||
return this.getMag(stack);
|
||||
}
|
||||
}
|
||||
|
||||
@ -38,6 +38,7 @@ public class ItemPlasmaSpear extends Item implements IFillableItem, ISyncButtons
|
||||
return 1 - (double) getFill(stack) / (double) maxFuel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getFill(ItemStack stack) {
|
||||
if(stack.stackTagCompound == null) {
|
||||
stack.stackTagCompound = new NBTTagCompound();
|
||||
@ -170,4 +171,9 @@ public class ItemPlasmaSpear extends Item implements IFillableItem, ISyncButtons
|
||||
|
||||
@Override public boolean providesFluid(FluidType type, ItemStack stack) { return false; }
|
||||
@Override public int tryEmpty(FluidType type, int amount, ItemStack stack) { return 0; }
|
||||
|
||||
@Override
|
||||
public FluidType getFirstFluidType(ItemStack stack) {
|
||||
return Fluids.SCHRABIDIC;
|
||||
}
|
||||
}
|
||||
|
||||
@ -22,6 +22,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.init.Items;
|
||||
import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemBlock;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.MovingObjectPosition;
|
||||
@ -117,6 +118,7 @@ import com.hbm.tileentity.machine.storage.*;
|
||||
import com.hbm.tileentity.network.*;
|
||||
import com.hbm.tileentity.turret.*;
|
||||
import com.hbm.util.BobMathUtil;
|
||||
import com.hbm.util.ColorUtil;
|
||||
import com.hbm.util.fauxpointtwelve.BlockPos;
|
||||
import com.hbm.wiaj.cannery.Jars;
|
||||
|
||||
@ -2115,4 +2117,16 @@ public class ClientProxy extends ServerProxy {
|
||||
Language lang = Minecraft.getMinecraft().getLanguageManager().getCurrentLanguage();
|
||||
return lang.getLanguageCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStackColor(ItemStack stack, boolean amplify) {
|
||||
if(stack == null) return 0x000000;
|
||||
if(stack.getItem() instanceof ItemBlock) {
|
||||
Block b = Block.getBlockFromItem(stack.getItem());
|
||||
return b.getMaterial().getMaterialMapColor().colorValue;
|
||||
}
|
||||
int color = ColorUtil.getAverageColorFromStack(stack);
|
||||
if(amplify) color = ColorUtil.amplifyColor(color);
|
||||
return color;
|
||||
}
|
||||
}
|
||||
|
||||
@ -88,4 +88,6 @@ public class ServerProxy {
|
||||
public void playSoundClient(double x, double y, double z, String sound, float volume, float pitch) { }
|
||||
|
||||
public String getLanguageCode() { return "en_US"; }
|
||||
|
||||
public int getStackColor(ItemStack stack, boolean amplify) { return 0x000000; }
|
||||
}
|
||||
@ -35,7 +35,7 @@ public class RenderIGenerator extends TileEntitySpecialRenderer {
|
||||
|
||||
GL11.glTranslated(0, 0, 1);
|
||||
GL11.glScaled(1D/6D, 1D/6D, 1D/6D);
|
||||
GL11.glTranslated(0, 0, -1);
|
||||
GL11.glTranslated(0, 0, -0.5);
|
||||
|
||||
bindTexture(ResourceManager.igen_tex);
|
||||
ResourceManager.igen.renderPart("Body");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user