first test of the new RBMK card component shiz

This commit is contained in:
BallOfEnergy 2023-04-19 21:40:18 -05:00
parent 5f27c39094
commit 32fade1180
5 changed files with 128 additions and 15 deletions

View File

@ -1,18 +1,5 @@
package com.hbm.inventory.recipes;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
import com.google.gson.Gson;
import com.google.gson.JsonArray;
import com.google.gson.JsonElement;
@ -21,7 +8,6 @@ import com.google.gson.stream.JsonWriter;
import com.hbm.blocks.ModBlocks;
import com.hbm.config.GeneralConfig;
import com.hbm.inventory.OreDictManager;
import static com.hbm.inventory.OreDictManager.*;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.RecipesCommon.OreDictStack;
@ -33,7 +19,6 @@ import com.hbm.items.machine.ItemDrillbit.EnumDrillType;
import com.hbm.items.machine.ItemPistons.EnumPistonType;
import com.hbm.items.weapon.ItemAmmoHIMARS;
import com.hbm.main.MainRegistry;
import cpw.mods.fml.common.Loader;
import net.minecraft.block.Block;
import net.minecraft.init.Blocks;
@ -42,6 +27,15 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraftforge.oredict.OreDictionary;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.util.*;
import java.util.Map.Entry;
import static com.hbm.inventory.OreDictManager.*;
public class AssemblerRecipes {
public static File config;
@ -439,6 +433,13 @@ public class AssemblerRecipes {
makeRecipe(new ComparableStack(ModItems.fusion_shield_tungsten, 1), new AStack[] {new OreDictStack(W.block(), 32), new OreDictStack(OreDictManager.getReflector(), 96)}, 600);
makeRecipe(new ComparableStack(ModItems.fusion_shield_desh, 1), new AStack[] {new OreDictStack(DESH.block(), 16), new OreDictStack(CO.block(), 16), new OreDictStack(BIGMT.plate(), 96)}, 600);
makeRecipe(new ComparableStack(ModItems.fusion_shield_chlorophyte, 1), new AStack[] {new OreDictStack(W.block(), 16), new OreDictStack(DURA.block(), 16), new OreDictStack(OreDictManager.getReflector(), 48), new ComparableStack(ModItems.powder_chlorophyte, 48)}, 600);
makeRecipe(new ComparableStack(ModItems.rbmk_component_card, 1), new AStack[] {
new ComparableStack(ModItems.circuit_red_copper, 2),
new OreDictStack(STEEL.plate(), 4),
new ComparableStack(ModItems.wire_gold, 8),
new OreDictStack(ANY_PLASTIC.ingot(), 4),
new OreDictStack(U238.nugget(), 1)
}, 50);
makeRecipe(new ComparableStack(ModBlocks.machine_fensu, 1), new AStack[] {
new ComparableStack(ModItems.ingot_electronium, 32),
new ComparableStack(ModBlocks.machine_dineutronium_battery, 16),

View File

@ -2430,6 +2430,8 @@ public class ModItems {
public static Item nothing;
public static Item void_anim;
public static Item rbmk_component_card;
public static Item bob_metalworks;
public static Item bob_assembly;
public static Item bob_chemistry;
@ -5439,6 +5441,8 @@ public class ModItems {
nothing = new Item().setUnlocalizedName("nothing").setTextureName(RefStrings.MODID + ":nothing");
void_anim = new Item().setUnlocalizedName("void_anim").setTextureName(RefStrings.MODID + ":void_anim");
rbmk_component_card = new ItemCCard().setUnlocalizedName("rbmk_component_card").setMaxStackSize(1).setCreativeTab(MainRegistry.partsTab).setTextureName(RefStrings.MODID + ":rbmk_component_card");
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");
@ -8036,6 +8040,7 @@ public class ModItems {
GameRegistry.registerItem(ln2_10, ln2_10.getUnlocalizedName());
GameRegistry.registerItem(nothing, nothing.getUnlocalizedName());
GameRegistry.registerItem(void_anim, void_anim.getUnlocalizedName());
GameRegistry.registerItem(rbmk_component_card, rbmk_component_card.getUnlocalizedName());
GameRegistry.registerItem(bob_metalworks, bob_metalworks.getUnlocalizedName());
GameRegistry.registerItem(bob_assembly, bob_assembly.getUnlocalizedName());
GameRegistry.registerItem(bob_chemistry, bob_chemistry.getUnlocalizedName());

View File

@ -0,0 +1,39 @@
package com.hbm.items.special;
import li.cil.oc.api.Network;
import li.cil.oc.api.driver.item.Container;
import li.cil.oc.api.driver.item.Slot;
import li.cil.oc.api.machine.Arguments;
import li.cil.oc.api.machine.Callback;
import li.cil.oc.api.machine.Context;
import li.cil.oc.api.network.ManagedEnvironment;
import li.cil.oc.api.network.Node;
import li.cil.oc.api.network.Visibility;
import net.minecraft.item.ItemStack;
public class DriverItemCCard {
public String slot(ItemStack stack) {
return Slot.Card;
}
public ManagedEnvironment createEnvironment(ItemStack stack, Container container) {
return new Environment(container);
}
public class Environment extends li.cil.oc.api.prefab.ManagedEnvironment {
protected final Container container;
public Environment(Container container) {
this.container = container;
Node node = Network.newNode(this, Visibility.Neighbors).
withComponent("particle").
create();
}
}
@Callback(direct = true, limit = 16)
public Object[] Greet(Context context, Arguments args) {
return new Object[] {null};
}
}

View File

@ -0,0 +1,68 @@
package com.hbm.items.special;
import com.hbm.blocks.machine.rbmk.RBMKBase;
import com.hbm.tileentity.machine.rbmk.TileEntityRBMKBase;
import cpw.mods.fml.common.Mod;
import cpw.mods.fml.common.event.FMLInitializationEvent;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import java.util.List;
public class ItemCCard extends Item {
@Mod.EventHandler
public void init(FMLInitializationEvent e) {
li.cil.oc.api.Driver.add((li.cil.oc.api.driver.Item) new DriverItemCCard());
}
@Override
public void addInformation(ItemStack itemstack, EntityPlayer player, List list, boolean bool) {
list.add("Right-click to link RBMK.");
if(itemstack.getTagCompound() == null) {
list.add(EnumChatFormatting.RED + "No RBMK Linked!");
} else {
list.add(EnumChatFormatting.YELLOW + "Linked to RBMK at: " + itemstack.stackTagCompound.getInteger("x") + ", " + itemstack.stackTagCompound.getInteger("y") + ", " + itemstack.stackTagCompound.getInteger("z"));
}
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int p_77648_7_, float p_77648_8_, float p_77648_9_, float p_77648_10_) {
if(!world.isRemote) {
if (stack.stackTagCompound == null) {
stack.stackTagCompound = new NBTTagCompound();
}
Block block = world.getBlock(x, y, z);
if (block instanceof RBMKBase) {
RBMKBase rbmk = (RBMKBase) block;
int[] pos = rbmk.findCore(world, x, y, z);
if (pos != null) {
TileEntity te = world.getTileEntity(pos[0], pos[1], pos[2]);
if (te instanceof TileEntityRBMKBase) {
stack.stackTagCompound.setInteger("x", pos[0]);
stack.stackTagCompound.setInteger("y", pos[1]);
stack.stackTagCompound.setInteger("z", pos[2]);
player.addChatMessage(new ChatComponentText("Linked!"));
world.playSoundAtEntity(player, "hbm:item.techBoop", 2.0F, 1.0F);
}
}
}
}
return true;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 549 B