some AStack crap, fusion torus struct block

This commit is contained in:
Boblet 2025-11-10 15:37:35 +01:00
parent bc1073f734
commit f7d2038f7e
30 changed files with 384 additions and 151 deletions

View File

@ -31,6 +31,7 @@
* Defusing creepers now also works if the creeper hasn't lit its fuse yet
* Defused creepers are now permanently harmless, they can no longer be manually re-ignited at all
* Manual defusers now also affect big man johnson
* Defusing only works if the timer is active
* The glpyhid will explode instantly, but only about as powerful as a conventional rocket, not destroying blocks
* Doing so will also drop one usable demolition mini nuke
* The painsaw ability no longer plays the blood splash particle effect
@ -43,6 +44,7 @@
* The old NITAN powder chests have been removed
* In their place, there's now a different, more useful structure with similar but not identical spawn rules
* ROR controller torches can now set the threshold of particle accelerator dipoles
* Removed the legacy recipes from the terra drills
## Fixed
* Fixed arc furnace only allowing electrodes to be inserted when the lid is down instead of up

View File

@ -866,6 +866,7 @@ public class ModBlocks {
public static Block struct_soyuz_core;
public static Block struct_iter_core;
public static Block struct_plasma_core;
public static Block struct_torus_core;
public static Block struct_watz_core;
public static Block struct_icf_core;
@ -2009,6 +2010,7 @@ public class ModBlocks {
struct_soyuz_core = new BlockSoyuzStruct(Material.iron).setBlockName("struct_soyuz_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.missileTab).setBlockTextureName(RefStrings.MODID + ":struct_soyuz_core");
struct_iter_core = new BlockITERStruct(Material.iron).setBlockName("struct_iter_core").setLightLevel(1F).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":struct_iter_core");
struct_plasma_core = new BlockPlasmaStruct(Material.iron).setBlockName("struct_plasma_core").setLightLevel(1F).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":struct_plasma_core");
struct_torus_core = new BlockFusionTorusStruct(Material.iron).setBlockName("struct_torus_core").setLightLevel(1F).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":struct_torus_core");
struct_watz_core = new BlockWatzStruct(Material.iron).setBlockName("struct_watz_core").setLightLevel(1F).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":struct_watz_core");
struct_icf_core = new BlockICFStruct(Material.iron).setBlockName("struct_icf_core").setLightLevel(1F).setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":struct_icf_core");
@ -3378,6 +3380,7 @@ public class ModBlocks {
GameRegistry.registerBlock(struct_soyuz_core, struct_soyuz_core.getUnlocalizedName());
GameRegistry.registerBlock(struct_iter_core, struct_iter_core.getUnlocalizedName());
GameRegistry.registerBlock(struct_plasma_core, struct_plasma_core.getUnlocalizedName());
register(struct_torus_core);
GameRegistry.registerBlock(struct_watz_core, struct_watz_core.getUnlocalizedName());
GameRegistry.registerBlock(struct_icf_core, struct_icf_core.getUnlocalizedName());

View File

@ -0,0 +1,16 @@
package com.hbm.blocks.machine;
import com.hbm.tileentity.machine.TileEntityFusionTorusStruct;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
public class BlockFusionTorusStruct extends BlockContainer {
public BlockFusionTorusStruct(Material mat) { super(mat); }
@Override public TileEntity createNewTileEntity(World world, int meta) { return new TileEntityFusionTorusStruct(); }
@Override public boolean isOpaqueCube() { return false; }
}

View File

@ -9,7 +9,6 @@ import static com.hbm.inventory.OreDictManager.*;
import com.hbm.items.ItemEnums.EnumPlantType;
import com.hbm.items.ItemGenericPart.EnumPartType;
import com.hbm.items.ModItems;
import com.hbm.items.machine.ItemBattery;
import com.hbm.items.machine.ItemCircuit.EnumCircuitType;
import com.hbm.items.tool.ItemBlowtorch;
import com.hbm.items.tool.ItemModMinecart;
@ -72,11 +71,6 @@ public class ToolRecipes {
CraftingManager.addRecipeAuto(new ItemStack(ModItems.meteorite_sword, 1), new Object[] { " B", "GB ", "SG ", 'B', ModItems.blade_meteorite, 'G', GOLD.plate(), 'S', KEY_STICK });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.dwarven_pickaxe, 1), new Object[] { "CIC", " S ", " S ", 'C', CU.ingot(), 'I', IRON.ingot(), 'S', KEY_STICK });
//Drax
CraftingManager.addRecipeAuto(new ItemStack(ModItems.drax, 1), new Object[] { "BDS", "CDC", "FMF", 'B', ModItems.starmetal_pickaxe, 'S', ModItems.starmetal_shovel, 'C', CO.ingot(), 'F', ModItems.fusion_core, 'D', DESH.ingot(), 'M', ModItems.motor_desh });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.drax_mk2, 1), new Object[] { "SCS", "IDI", "FEF", 'S', STAR.ingot(), 'C', ModItems.crystal_trixite, 'I', BIGMT.ingot(), 'D', ModItems.drax, 'F', ModItems.fusion_core, 'E', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.ADVANCED) });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.drax_mk3, 1), new Object[] { "ECE", "CDC", "SBS", 'E', ModBlocks.block_euphemium_cluster, 'C', ModItems.crystal_schrabidium, 'D', ModItems.drax_mk2, 'S', DictFrame.fromOne(ModItems.circuit, EnumCircuitType.BISMOID), 'B', ItemBattery.getFullBattery(ModItems.battery_spark) });
//Super pickaxes
CraftingManager.addRecipeAuto(new ItemStack(ModItems.bismuth_pickaxe, 1), new Object[] { " BM", "BPB", "TB ", 'B', ModItems.ingot_bismuth, 'M', ModItems.ingot_meteorite, 'P', ModItems.starmetal_pickaxe, 'T', W.bolt() });
CraftingManager.addRecipeAuto(new ItemStack(ModItems.volcanic_pickaxe, 1), new Object[] { " BM", "BPB", "TB ", 'B', ModItems.gem_volcanic, 'M', ModItems.ingot_meteorite, 'P', ModItems.starmetal_pickaxe, 'T', W.bolt() });

View File

@ -141,7 +141,7 @@ public class BookRecipeHandler extends TemplateRecipeHandler implements ICompatN
for(AStack astack : recipe.in) {
if(astack.isApplicable(ingredient)) {
if(astack.matchesRecipe(ingredient, true)) {
List<Object> input = new ArrayList();

View File

@ -3,6 +3,7 @@ package com.hbm.inventory;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Set;
import com.hbm.config.GeneralConfig;
import com.hbm.items.ModItems;
@ -11,6 +12,7 @@ import com.hbm.main.MainRegistry;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraftforge.oredict.OreDictionary;
@ -35,6 +37,7 @@ public class RecipesCommon {
public static ItemStack[] objectToStackArray(Object[] array) {
if(array == null)
return null;
ItemStack[] clone = new ItemStack[array.length];
@ -52,34 +55,6 @@ public class RecipesCommon {
public int stacksize;
public boolean isApplicable(ItemStack stack) {
return isApplicable(new ComparableStack(stack));
}
/*
* Is it unprofessional to pool around in child classes from an abstract superclass? Do I look like I give a shit?
*
* Major fuckup: comparablestacks need EQUAL stacksize but the oredictstack ignores stack size entirely
*/
public boolean isApplicable(ComparableStack comp) {
if(this instanceof ComparableStack) {
return ((ComparableStack)this).equals(comp);
}
if(this instanceof OreDictStack) {
List<ItemStack> ores = OreDictionary.getOres(((OreDictStack)this).name);
for(ItemStack stack : ores) {
if(stack.getItem() == comp.item && stack.getItemDamage() == comp.meta)
return true;
}
}
return false;
}
/**
* Whether the supplied itemstack is applicable for a recipe (e.g. anvils). Slightly different from {@code isApplicable}.
* @param stack the ItemStack to check
@ -87,8 +62,9 @@ public class RecipesCommon {
* @return
*/
public abstract boolean matchesRecipe(ItemStack stack, boolean ignoreSize);
public abstract AStack copy();
public abstract AStack copy(int stacksize);
/**
* Generates either an ItemStack or an ArrayList of ItemStacks
@ -230,28 +206,27 @@ public class RecipesCommon {
@Override
public boolean equals(Object obj) {
if(this == obj)
return true;
if(obj == null)
return false;
if(getClass() != obj.getClass())
return false;
if(this == obj) return true;
if(obj == null) return false;
if(getClass() != obj.getClass()) return false;
ComparableStack other = (ComparableStack) obj;
if(item == null) {
if(other.item != null)
return false;
if(other.item != null) return false;
} else if(!item.equals(other.item))
return false;
if(meta != OreDictionary.WILDCARD_VALUE && other.meta != OreDictionary.WILDCARD_VALUE && meta != other.meta)
return false;
if(stacksize != other.stacksize)
return false;
if(meta != OreDictionary.WILDCARD_VALUE && other.meta != OreDictionary.WILDCARD_VALUE && meta != other.meta) return false;
if(stacksize != other.stacksize) return false;
return true;
}
@Override
public int compareTo(AStack stack) {
//if compared with a NBTStack, the CStack will yield
if(stack instanceof NBTStack) return -1;
//if compared with an ODStack, the CStack will take priority
if(stack instanceof OreDictStack) return 1;
if(stack instanceof ComparableStack) {
ComparableStack comp = (ComparableStack) stack;
@ -259,31 +234,24 @@ public class RecipesCommon {
int thisID = Item.getIdFromItem(item);
int thatID = Item.getIdFromItem(comp.item);
if(thisID > thatID)
return 1;
if(thatID > thisID)
return -1;
if(thisID > thatID) return 1;
if(thatID > thisID) return -1;
if(meta > comp.meta)
return 1;
if(comp.meta > meta)
return -1;
if(meta > comp.meta) return 1;
if(comp.meta > meta) return -1;
return 0;
}
//if compared with an ODStack, the CStack will take priority
if(stack instanceof OreDictStack)
return 1;
return 0;
}
@Override
public AStack copy() {
public ComparableStack copy() {
return new ComparableStack(item, stacksize, meta);
}
@Override
public ComparableStack copy(int stacksize) {
return new ComparableStack(item, stacksize, meta);
}
@ -291,17 +259,10 @@ public class RecipesCommon {
@Override
public boolean matchesRecipe(ItemStack stack, boolean ignoreSize) {
if(stack == null)
return false;
if(stack.getItem() != this.item)
return false;
if(this.meta != OreDictionary.WILDCARD_VALUE && stack.getItemDamage() != this.meta)
return false;
if(!ignoreSize && stack.stackSize < this.stacksize)
return false;
if(stack == null) return false;
if(stack.getItem() != this.item) return false;
if(this.meta != OreDictionary.WILDCARD_VALUE && stack.getItemDamage() != this.meta) return false;
if(!ignoreSize && stack.stackSize < this.stacksize) return false;
return true;
}
@ -312,53 +273,107 @@ public class RecipesCommon {
}
}
/*
* This implementation does not override the compare function, which effectively makes it ignore stack data.
* This is still in line with the use-case of the ComparableNBTStack holding machine output stack information,
* since the compare function is not needed. In case the compare function is required, make a new child class.
*/
public static class ComparableNBTStack extends ComparableStack {
public static class NBTStack extends ComparableStack {
NBTTagCompound nbt;
public NBTTagCompound nbt;
public ComparableNBTStack(ItemStack stack) {
super(stack);
}
public ComparableNBTStack(Item item) {
super(item);
}
public ComparableNBTStack(Block item) {
super(item);
}
public ComparableNBTStack(Block item, int stacksize) {
super(item, stacksize);
}
public ComparableNBTStack(Block item, int stacksize, int meta) {
super(item, stacksize, meta);
}
public ComparableNBTStack(Item item, int stacksize) {
super(item, stacksize);
}
public ComparableNBTStack(Item item, int stacksize, int meta) {
super(item, stacksize, meta);
}
public ComparableNBTStack addNBT(NBTTagCompound nbt) {
public NBTStack(Item item) { super(item); }
public NBTStack(Block item) { super(item); }
public NBTStack(Block item, int stacksize) { super(item, stacksize); }
public NBTStack(Block item, int stacksize, int meta) { super(item, stacksize, meta); }
public NBTStack(Block item, int stacksize, Enum meta) { super(item, stacksize, meta); }
public NBTStack(Item item, int stacksize) { super(item, stacksize); }
public NBTStack(Item item, int stacksize, int meta) { super(item, stacksize, meta); }
public NBTStack(Item item, int stacksize, Enum meta) { super(item, stacksize, meta); }
public NBTStack(ItemStack stack) { super(stack.getItem(), stack.stackSize, stack.getItemDamage()); this.withNBT(stack.stackTagCompound); }
public NBTStack withNBT(NBTTagCompound nbt) {
this.nbt = nbt;
return this;
}
public NBTStack initNBT() {
if(this.nbt == null) this.nbt = new NBTTagCompound();
return this;
}
public NBTStack setInt(String key, int value) {
initNBT().nbt.setInteger(key, value);
return this;
}
@Override
public ItemStack toStack() {
ItemStack stack = super.toStack();
stack.stackTagCompound = this.nbt;
ItemStack stack = new ItemStack(item == null ? ModItems.nothing : item, stacksize, meta);
if(this.nbt != null) stack.stackTagCompound = (NBTTagCompound) nbt.copy();
return stack;
}
/**
* For an ItemStack to match an NBTStack, all the rules from ComparableStack apply, with the added condition that all
* tags in the NBTStack's NBTTagCompound need to be present and equal the tags of the ItemStack. Any additional tags
* the ItemStack has are ignored.
*/
@Override
public boolean matchesRecipe(ItemStack stack, boolean ignoreSize) {
if(stack == null) return false;
if(stack.getItem() != this.item) return false;
if(this.meta != OreDictionary.WILDCARD_VALUE && stack.getItemDamage() != this.meta) return false;
if(!ignoreSize && stack.stackSize < this.stacksize) return false;
if(this.nbt != null && !this.nbt.hasNoTags() && stack.stackTagCompound == null) return false;
if(this.nbt != null && stack.stackTagCompound != null) {
Set<String> neededKeys = this.nbt.func_150296_c();
for(String key : neededKeys) {
NBTBase tag = stack.stackTagCompound.getTag(key);
if(tag == null) return false;
if(!this.nbt.getTag(key).equals(tag)) return false;
}
}
return true;
}
@Override
public NBTStack copy() {
return new NBTStack(item, stacksize, meta).withNBT(nbt != null ? (NBTTagCompound) nbt.copy() : null);
}
@Override
public NBTStack copy(int stacksize) {
return new NBTStack(item, stacksize, meta).withNBT(nbt != null ? (NBTTagCompound) nbt.copy() : null);
}
@Override
public int compareTo(AStack stack) {
if(stack instanceof NBTStack) {
NBTStack comp = (NBTStack) stack;
int thisID = Item.getIdFromItem(item);
int thatID = Item.getIdFromItem(comp.item);
if(thisID > thatID) return 1;
if(thatID > thisID) return -1;
if(meta > comp.meta) return 1;
if(comp.meta > meta) return -1;
if(nbt != null && comp.nbt == null) return 1;
if(nbt == null && comp.nbt != null) return -1;
return 0;
}
//if compared with a CStack, the NBTStack will take priority
if(stack instanceof ComparableStack) return 1;
//if compared with an ODStack, the NBTStack will take priority
if(stack instanceof OreDictStack) return 1;
return 0;
}
}
public static class OreDictStack extends AStack {
@ -387,19 +402,19 @@ public class RecipesCommon {
OreDictStack comp = (OreDictStack) stack;
return name.compareTo(comp.name);
}
//if compared with a CStack, the ODStack will yield
if(stack instanceof ComparableStack)
return -1;
if(stack instanceof ComparableStack) return -1;
return 0;
}
@Override
public AStack copy() {
public OreDictStack copy() {
return new OreDictStack(name, stacksize);
}
@Override
public OreDictStack copy(int stacksize) {
return new OreDictStack(name, stacksize);
}

View File

@ -56,6 +56,11 @@ public class AssemblyMachineRecipes extends GenericRecipes<GenericRecipe> {
@Override
public void registerDefaults() {
// NBTStack test
// this.register(new GenericRecipe("demo1").setup(20, 100).outputItems(BrokenItem.make(ModItems.plate_iron)).inputItems(new OreDictStack(IRON.ingot())));
// this.register(new GenericRecipe("demo2").setup(20, 100).outputItems(BrokenItem.make(ModItems.plate_gold)).inputItems(new OreDictStack(IRON.ingot())));
// this.register(new GenericRecipe("demo3").setup(20, 100).outputItems(new ItemStack(Items.iron_ingot)).inputItems(new NBTStack(BrokenItem.make(ModItems.plate_iron))));
// plates and ingots
String autoPlate = "autoswitch.plates";
this.register(new GenericRecipe("ass.plateiron").setup(60, 100).outputItems(new ItemStack(ModItems.plate_iron, 1)).inputItems(new OreDictStack(IRON.ingot())).setPools(GenericRecipes.POOL_PREFIX_ALT + "plates").setGroup(autoPlate, this));

View File

@ -353,7 +353,7 @@ public class CentrifugeRecipes extends SerializableRecipe {
return RecipesCommon.copyStackArray(recipes.get(comp));
for(Entry<AStack, ItemStack[]> entry : recipes.entrySet()) {
if(entry.getKey().isApplicable(stack)) {
if(entry.getKey().matchesRecipe(stack, true)) {
return RecipesCommon.copyStackArray(entry.getValue());
}
}

View File

@ -103,16 +103,12 @@ public class CyclotronRecipes extends SerializableRecipe {
public static Object[] getOutput(ItemStack stack, ItemStack box) {
if(stack == null || stack.getItem() == null || box == null)
return null;
if(stack == null || stack.getItem() == null || box == null) return null;
ComparableStack boxStack = new ComparableStack(box).makeSingular();
ComparableStack comp = new ComparableStack(stack).makeSingular();
//boo hoo we iterate over a hash map, cry me a river
for(Entry<Pair<ComparableStack, AStack>, Pair<ItemStack, Integer>> entry : recipes.entrySet()) {
if(entry.getKey().getKey().isApplicable(boxStack) && entry.getKey().getValue().isApplicable(comp)) {
if(entry.getKey().getKey().matchesRecipe(box, true) && entry.getKey().getValue().matchesRecipe(stack, true)) {
return new Object[] { entry.getValue().getKey().copy(), entry.getValue().getValue() };
}
}

View File

@ -133,8 +133,8 @@ import net.minecraft.item.ItemStack;
for(HadronRecipe r : recipes) {
if((r.in1.isApplicable(in1) && r.in2.isApplicable(in2)) ||
(r.in1.isApplicable(in2) && r.in2.isApplicable(in1))) {
if((r.in1.matchesRecipe(in1, false) && r.in2.matchesRecipe(in2, false)) ||
(r.in1.matchesRecipe(in2, false) && r.in2.matchesRecipe(in1, false))) {
if(analysisOnly && !r.analysisOnly) returnCode = EnumHadronState.NORESULT_WRONG_MODE;
if(momentum < r.momentum) returnCode = EnumHadronState.NORESULT_TOO_SLOW;

View File

@ -79,8 +79,7 @@ public class MagicRecipes {
for(int i = 0; i < in.size(); i++) {
if(!in.get(i).isApplicable(comps.get(i)))
return false;
if(!in.get(i).matchesRecipe(comps.get(i).toStack(), false)) return false;
}
return true;

View File

@ -16,6 +16,7 @@ import com.google.gson.stream.JsonWriter;
import com.hbm.inventory.FluidStack;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.NBTStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
import com.hbm.inventory.fluid.FluidType;
import com.hbm.inventory.fluid.Fluids;
@ -29,6 +30,9 @@ import com.hbm.util.Tuple.Pair;
import api.hbm.recipe.IRecipeRegisterListener;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.JsonToNBT;
import net.minecraft.nbt.NBTBase;
import net.minecraft.nbt.NBTTagCompound;
//the anti-spaghetti. this class provides so much functionality and saves so much time, i just love you, SerializableRecipe <3
public abstract class SerializableRecipe {
@ -253,6 +257,12 @@ public abstract class SerializableRecipe {
try {
String type = array.get(0).getAsString();
int stacksize = array.size() > 2 ? array.get(2).getAsInt() : 1;
if("nbt".equals(type)) {
Item item = (Item) Item.itemRegistry.getObject(array.get(1).getAsString());
int meta = array.size() > 3 ? array.get(3).getAsInt() : 0;
NBTBase nbt = JsonToNBT.func_150315_a(array.get(array.size() - 1).getAsString());
return new NBTStack(item, stacksize, meta).withNBT(nbt instanceof NBTTagCompound ? (NBTTagCompound) nbt : null);
}
if("item".equals(type)) {
Item item = (Item) Item.itemRegistry.getObject(array.get(1).getAsString());
int meta = array.size() > 3 ? array.get(3).getAsInt() : 0;
@ -280,18 +290,24 @@ public abstract class SerializableRecipe {
public static void writeAStack(AStack astack, JsonWriter writer) throws IOException {
writer.beginArray();
writer.setIndent("");
if(astack instanceof ComparableStack) {
if(astack instanceof NBTStack) {
NBTStack comp = (NBTStack) astack;
writer.value(comp.nbt != null ? "nbt" : "item"); //NBT identifier
writer.value(Item.itemRegistry.getNameForObject(comp.toStack().getItem())); //item name
if(comp.stacksize != 1 || comp.meta > 0) writer.value(comp.stacksize); //stack size
if(comp.meta > 0) writer.value(comp.meta); //metadata
if(comp.nbt != null) writer.value(comp.nbt.toString()); //NBT
} else if(astack instanceof ComparableStack) {
ComparableStack comp = (ComparableStack) astack;
writer.value("item"); //ITEM identifier
writer.value(Item.itemRegistry.getNameForObject(comp.toStack().getItem())); //item name
if(comp.stacksize != 1 || comp.meta > 0) writer.value(comp.stacksize); //stack size
if(comp.stacksize != 1 || comp.meta > 0) writer.value(comp.stacksize); //stack size
if(comp.meta > 0) writer.value(comp.meta); //metadata
}
if(astack instanceof OreDictStack) {
} else if(astack instanceof OreDictStack) {
OreDictStack ore = (OreDictStack) astack;
writer.value("dict"); //DICT identifier
writer.value(ore.name); //dict name
if(ore.stacksize != 1) writer.value(ore.stacksize); //stacksize
writer.value("dict"); //DICT identifier
writer.value(ore.name); //dict name
if(ore.stacksize != 1) writer.value(ore.stacksize); //stacksize
}
writer.endArray();
writer.setIndent(" ");

View File

@ -0,0 +1,64 @@
package com.hbm.items;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
public class BrokenItem extends Item {
@Override
@SideOnly(Side.CLIENT)
public boolean requiresMultipleRenderPasses() {
return true;
}
@Override
public int getRenderPasses(int meta) {
return 2;
}
@SideOnly(Side.CLIENT)
public IIcon getIcon(ItemStack stack, int pass) {
if(pass == 1) return this.itemIcon;
if(stack.stackTagCompound == null) return this.itemIcon;
String id = stack.stackTagCompound.getString("itemID");
int meta = stack.stackTagCompound.getInteger("itemMeta");
Item item = (Item) Item.itemRegistry.getObject(id);
if(item == null) return this.itemIcon;
return item.getIconFromDamage(meta);
}
@Override
public String getItemStackDisplayName(ItemStack stack) {
if(stack.stackTagCompound == null) return super.getItemStackDisplayName(stack);
String id = stack.stackTagCompound.getString("itemID");
int meta = stack.stackTagCompound.getInteger("itemMeta");
Item item = (Item) Item.itemRegistry.getObject(id);
if(item == null) return super.getItemStackDisplayName(stack);
ItemStack sta = new ItemStack(item, 1, meta);
return StatCollector.translateToLocalFormatted(this.getUnlocalizedNameInefficiently(stack) + ".prefix", sta.getDisplayName());
}
public static ItemStack make(ItemStack stack) { return make(stack.getItem(), stack.stackSize, stack.getItemDamage()); }
public static ItemStack make(Item item) { return make(item, 1, 0); }
public static ItemStack make(Item item, int meta) { return make(item, 1, meta); }
public static ItemStack make(Item item, int stacksize, int meta) {
ItemStack stack = new ItemStack(ModItems.broken_item, stacksize);
NBTTagCompound nbt = new NBTTagCompound();
nbt.setString("itemID", Item.itemRegistry.getNameForObject(item));
nbt.setInteger("itemMeta", meta);
stack.stackTagCompound = nbt;
return stack;
}
}

View File

@ -2223,14 +2223,11 @@ public class ModItems {
public static Item orange6;
public static Item orange7;
public static Item orange8;
public static Item nothing;
public static Item broken_item;
public static Item achievement_icon;
public static Item bob_metalworks;
public static Item bob_assembly;
public static Item bob_chemistry;
public static Item bob_oil;
public static Item bob_nuclear;
public static Item mysteryshovel;
public static Item memory;
@ -4963,15 +4960,11 @@ public class ModItems {
orange6 = new Item().setUnlocalizedName("orange6").setTextureName(RefStrings.MODID + ":orange6");
orange7 = new Item().setUnlocalizedName("orange7").setTextureName(RefStrings.MODID + ":orange7");
orange8 = new Item().setUnlocalizedName("orange8").setTextureName(RefStrings.MODID + ":orange8");
nothing = new Item().setUnlocalizedName("nothing").setTextureName(RefStrings.MODID + ":nothing");
broken_item = new BrokenItem().setUnlocalizedName("broken_item").setTextureName(RefStrings.MODID + ":broken_item");
achievement_icon = new ItemEnumMulti(ItemEnums.EnumAchievementType.class, true, true).setUnlocalizedName("achievement_icon");
bob_metalworks = new Item().setUnlocalizedName("bob_metalworks").setTextureName(RefStrings.MODID + ":bob_metalworks");
bob_assembly = new Item().setUnlocalizedName("bob_assembly").setTextureName(RefStrings.MODID + ":bob_assembly");
bob_chemistry = new Item().setUnlocalizedName("bob_chemistry").setTextureName(RefStrings.MODID + ":bob_chemistry");
bob_oil = new Item().setUnlocalizedName("bob_oil").setTextureName(RefStrings.MODID + ":bob_oil");
bob_nuclear = new Item().setUnlocalizedName("bob_nuclear").setTextureName(RefStrings.MODID + ":bob_nuclear");
mysteryshovel = new ItemMS().setUnlocalizedName("mysteryshovel").setFull3D().setMaxStackSize(1).setTextureName(RefStrings.MODID + ":cursed_shovel");
memory = new ItemBattery(Long.MAX_VALUE / 100L, 100000000000000L, 100000000000000L).setUnlocalizedName("memory").setMaxStackSize(1).setTextureName(RefStrings.MODID + ":mo8_anim");
@ -7169,16 +7162,14 @@ public class ModItems {
GameRegistry.registerItem(orange6, orange6.getUnlocalizedName());
GameRegistry.registerItem(orange7, orange7.getUnlocalizedName());
GameRegistry.registerItem(orange8, orange8.getUnlocalizedName());
GameRegistry.registerItem(nothing, nothing.getUnlocalizedName());
GameRegistry.registerItem(achievement_icon, achievement_icon.getUnlocalizedName());
GameRegistry.registerItem(bob_metalworks, bob_metalworks.getUnlocalizedName());
GameRegistry.registerItem(bob_assembly, bob_assembly.getUnlocalizedName());
GameRegistry.registerItem(bob_chemistry, bob_chemistry.getUnlocalizedName());
GameRegistry.registerItem(bob_oil, bob_oil.getUnlocalizedName());
GameRegistry.registerItem(bob_nuclear, bob_nuclear.getUnlocalizedName());
GameRegistry.registerItem(mysteryshovel, mysteryshovel.getUnlocalizedName());
GameRegistry.registerItem(memory, memory.getUnlocalizedName());
GameRegistry.registerItem(conveyor_wand, conveyor_wand.getUnlocalizedName());
GameRegistry.registerItem(nothing, nothing.getUnlocalizedName());
GameRegistry.registerItem(broken_item, broken_item.getUnlocalizedName());
}
public static void addRemap(String unloc, Item item, Enum sub) {

View File

@ -424,6 +424,7 @@ public class ClientProxy extends ServerProxy {
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityICF.class, new RenderICF());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityICFController.class, new RenderICFController());
//Fusion
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFusionTorusStruct.class, new RenderFusionTorusMultiblock());
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityFusionTorus.class, new RenderFusionTorus());
//Watz
ClientRegistry.bindTileEntitySpecialRenderer(TileEntityWatz.class, new RenderWatz());

View File

@ -1442,6 +1442,11 @@ public class MainRegistry {
ignoreMappings.add("hbm:tile.hadron_power_100m");
ignoreMappings.add("hbm:tile.hadron_power_1g");
ignoreMappings.add("hbm:tile.hadron_power_10g");
ignoreMappings.add("hbm:item.bob_metalworks");
ignoreMappings.add("hbm:item.bob_assembly");
ignoreMappings.add("hbm:item.bob_chemistry");
ignoreMappings.add("hbm:item.bob_oil");
ignoreMappings.add("hbm:item.bob_nuclear");
/// REMAP ///
remapItems.put("hbm:item.gadget_explosive8", ModItems.early_explosive_lenses);

View File

@ -0,0 +1,39 @@
package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.machine.fusion.MachineFusionTorus;
import com.hbm.render.util.SmallBlockPronter;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity;
public class RenderFusionTorusMultiblock extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity tile, double x, double y, double z, float interp) {
GL11.glPushMatrix();
GL11.glTranslated(x, y, z);
bindTexture(TextureMap.locationBlocksTexture);
SmallBlockPronter.startDrawing();
for(int iy = 0; iy < 5; iy++) {
for(int ix = 0; ix < MachineFusionTorus.layout[0].length; ix++) {
for(int iz = 0; iz < MachineFusionTorus.layout[0][0].length; iz++) {
int ly = iy > 2 ? 4 - iy : iy;
int i = MachineFusionTorus.layout[ly][ix][iz];
if(i == 0) continue;
SmallBlockPronter.drawSmolBlockAt(ModBlocks.fusion_component, i, ix - 7, iy, iz - 7);
}
}
}
SmallBlockPronter.draw();
GL11.glPopMatrix();
}
}

View File

@ -413,6 +413,7 @@ public class TileMappings {
}
private static void putFusion() {
put(TileEntityFusionTorusStruct.class, "tileentity_fusion_torus_struct");
put(TileEntityFusionTorus.class, "tileentity_fusion_torus");
}

View File

@ -0,0 +1,82 @@
package com.hbm.tileentity.machine;
import com.hbm.blocks.BlockDummyable;
import com.hbm.blocks.ModBlocks;
import com.hbm.blocks.machine.fusion.MachineFusionTorus;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraftforge.common.util.ForgeDirection;
public class TileEntityFusionTorusStruct extends TileEntity {
@Override
public void updateEntity() {
if(worldObj.isRemote) return;
if(worldObj.getTotalWorldTime() % 20 != 0) return;
for(int y = 0; y < 5; y++) {
for(int x = 0; x < MachineFusionTorus.layout[0].length; x++) {
for(int z = 0; z < MachineFusionTorus.layout[0][0].length; z++) {
int ly = y > 2 ? 4 - y : y;
int i = MachineFusionTorus.layout[ly][x][z];
if(i == 0) continue; // ignore air
if(x == 7 && y == 0 && z == 7) continue; // ignore core component position
if(!cbr(ModBlocks.fusion_component, i, x - 7, y, z - 7)) return;
}
}
}
MachineFusionTorus block = (MachineFusionTorus) ModBlocks.fusion_torus;
BlockDummyable.safeRem = true;
worldObj.setBlock(xCoord, yCoord, zCoord, ModBlocks.fusion_torus, 12, 3);
block.fillSpace(worldObj, xCoord, yCoord, zCoord, ForgeDirection.NORTH, 0);
BlockDummyable.safeRem = false;
}
/** [G]et [B]lock at [R]elative position */
private Block gbr(int x, int y, int z) {
return worldObj.getBlock(xCoord + x, yCoord + y, zCoord + z);
}
/** [G]et [M]eta at [R]elative position */
private int gmr(int x, int y, int z) {
return worldObj.getBlockMetadata(xCoord + x, yCoord + y, zCoord + z);
}
/** [C]heck [B]lock at [R]elative position */
private boolean cbr(Block b, int meta, int x, int y, int z) {
return b == gbr(x, y, z) && meta == gmr(x, y, z);
}
AxisAlignedBB bb = null;
@Override
public AxisAlignedBB getRenderBoundingBox() {
if(bb == null) {
bb = AxisAlignedBB.getBoundingBox(
xCoord - 7,
yCoord,
zCoord - 7,
xCoord + 8,
yCoord + 5,
zCoord + 8
);
}
return bb;
}
@Override
@SideOnly(Side.CLIENT)
public double getMaxRenderDistanceSquared() {
return 65536.0D;
}
}

View File

@ -1484,6 +1484,8 @@ item.boy_target.name=Unterkritischer U235 Hohlkörper
item.briquette.coal.name=Kohlebrikett
item.briquette.lignite.name=Braunkohlebrikett
item.briquette.wood.name=Holzbrikett
item.broken_item.name=Defekter Gegenstand
item.broken_item.prefix=%s (Defekt)
item.bucket_acid.name=Säureeimer
item.bucket_mud.name=Eimer mit giftigem Schlamm
item.bucket_schrabidic_acid.name=Eimer mit Schrabidischer Säure

View File

@ -2257,6 +2257,8 @@ item.boy_target.name=Subcritical U235 Target
item.briquette.coal.name=Coal Briquette
item.briquette.lignite.name=Lignite Briquette
item.briquette.wood.name=Sawdust Briquette
item.broken_item.name=Broken Item
item.broken_item.prefix=Broken %s
item.bucket_acid.name=Bucket of Acid
item.bucket_mud.name=Bucket of Poisonous Mud
item.bucket_schrabidic_acid.name=Bucket of Schrabidic Acid

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 295 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 255 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 306 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 193 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 192 B