mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
hadron recipes, hopper IO, NEI
This commit is contained in:
parent
ba08905bc1
commit
2526d8e100
@ -145,6 +145,7 @@ container.fusionaryWatzPlant=Fusionares Watzwerk
|
||||
container.gasCentrifuge=Gaszentrifuge
|
||||
container.gasFlare=Abfackelturm
|
||||
container.generator=Atomreaktor
|
||||
container.hadron=Teilchenbeschleuniger
|
||||
container.iGenerator=Industrieller Generator
|
||||
container.keyForge=Schlossertisch
|
||||
container.launchPad=Raketenabschussrampe
|
||||
@ -284,7 +285,9 @@ hadron.hopper1=§eTrichtermodus:$Ein Item bleibt immer übrig.
|
||||
hadron.idle=Leerlauf
|
||||
hadron.modeCircular=§eRingbeschleuniger:$Magnete bilden eine Schleife.$Schaltet mehr Rezepte frei.
|
||||
hadron.modeLine=§eLinearbeschleuniger:$Beschleuniger ended mit Analysekammer.$Weniger Rezepte.
|
||||
hadron.noresult=Kein Ergebnis.
|
||||
hadron.progress=Verarbeite...
|
||||
hadron.success=Abgeschlossen!
|
||||
|
||||
hbmfluid.acid=Wasserstoffperoxid
|
||||
hbmfluid.amat=Antimaterie
|
||||
@ -1469,16 +1472,17 @@ item.part_plutonium.name=Plutoniumstaubkiste
|
||||
item.particle_aelectron.name=Positronenkapsel
|
||||
item.particle_amat.name=Antimaterienkapsel
|
||||
item.particle_aproton.name=Antiprotonenkapsel
|
||||
item.particle_aschrab.name=Kupferionenkapsel
|
||||
item.particle_copper.name=Copper Ion Capsule
|
||||
item.particle_aschrab.name=Antischrabidiumkapsel
|
||||
item.particle_copper.name=Kupferionenkapsel
|
||||
item.particle_dark.name=Dunkle Materien Kapsel
|
||||
item.particle_digamma.name=§cDas Digamma-Teilchen§r
|
||||
item.particle_empty.name=Leere Partikelkapsel
|
||||
item.particle_higgs.name=Higgs Bosonen Kapsel
|
||||
item.particle_hydrogen.name=Wasserstoffionenkapsel
|
||||
item.particle_lead.name=Bleiionenkapsel
|
||||
item.particle_muon.name=Myonenkapsel
|
||||
item.particle_sparkticle.name=Sparktikelkapsel
|
||||
item.particle_strange.name=Strange Quark Capsule
|
||||
item.particle_strange.name=Strange-Quark-Kapsel
|
||||
item.pedestal_steel.name=Stahlsockel
|
||||
item.pellet_advanced.name=Fortgeschrittenes Watzaufwertugspellet
|
||||
item.pellet_antimatter.name=Antimateriencluster
|
||||
@ -2221,19 +2225,22 @@ tile.glass_trinitite.name=Trinity-Glas
|
||||
tile.glass_uranium.name=Uranglas
|
||||
tile.gravel_diamond.name=Diamantkies
|
||||
tile.gravel_obsidian.name=Gebrochener Obsidian
|
||||
tile.hadron_analysis.name=Partikelbeschleuniger-Analysekammernwand
|
||||
tile.hadron_analysis.name=Partikelbeschleuniger-Analysekammernfenster
|
||||
tile.hadron_access.name=Teilchenbeschleuniger-Zugriffskonsole
|
||||
tile.hadron_analysis.name=Teilchenbeschleuniger-Analysekammernwand
|
||||
tile.hadron_analysis.name=Teilchenbeschleuniger-Analysekammernfenster
|
||||
tile.hadron_coil_alloy.name=Dichte Supraleiterspule
|
||||
tile.hadron_coil_schrabidium.name=Dichte Schrabidiumspule
|
||||
tile.hadron_coil_starmetal.name=Dichte Sternenmetallspule
|
||||
tile.hadron_core.name=Teilchenbeschleuniger-Kernkomponente
|
||||
tile.hadron_diode.name=Schottky-Partikeldiode
|
||||
tile.hadron_plating.name=Partikelbeschleuniger-Außenwand
|
||||
tile.hadron_plating_black.name=Partikelbeschleuniger-Außenwand (Schwarz)
|
||||
tile.hadron_plating_blue.name=Partikelbeschleuniger-Außenwand (Blau)
|
||||
tile.hadron_plating_glass.name=Partikelbeschleuniger-Außenwand (Fenster)
|
||||
tile.hadron_plating_striped.name=Partikelbeschleuniger-Außenwand (Coole Gefahrenstreifen)
|
||||
tile.hadron_plating_voltz.name=Partikelbeschleuniger-Außenwand (VOLTZ)
|
||||
tile.hadron_plating_yellow.name=Partikelbeschleuniger-Außenwand (Gelb)
|
||||
tile.hadron_plating.name=Teilchenbeschleuniger-Außenwand
|
||||
tile.hadron_plating_black.name=Teilchenbeschleuniger-Außenwand (Schwarz)
|
||||
tile.hadron_plating_blue.name=Teilchenbeschleuniger-Außenwand (Blau)
|
||||
tile.hadron_plating_glass.name=Teilchenbeschleuniger-Außenwand (Fenster)
|
||||
tile.hadron_plating_striped.name=Teilchenbeschleuniger-Außenwand (Coole Gefahrenstreifen)
|
||||
tile.hadron_plating_voltz.name=Teilchenbeschleuniger-Außenwand (VOLTZ)
|
||||
tile.hadron_plating_yellow.name=Teilchenbeschleuniger-Außenwand (Gelb)
|
||||
tile.hadron_power.name=Teilchenbeschleuniger-Stromanschluss
|
||||
tile.hazmat.name=Strahlenschutzstoff-Block
|
||||
tile.iter.name=Kernfusionsreaktor
|
||||
tile.launch_pad.name=Raketenabschussrampe
|
||||
|
||||
@ -145,6 +145,7 @@ container.fusionaryWatzPlant=Fusionary Watz Plant
|
||||
container.gasCentrifuge=Gas Centrifuge
|
||||
container.gasFlare=Gas Flare
|
||||
container.generator=Nuclear Reactor
|
||||
container.hadron=Particle Accelerator
|
||||
container.iGenerator=Industrial Generator
|
||||
container.keyForge=Locksmith Table
|
||||
container.launchPad=Missile Launch Pad
|
||||
@ -284,7 +285,9 @@ hadron.hopper1=§eHopper Mode:$One item will always remain.
|
||||
hadron.idle=Idle
|
||||
hadron.modeCircular=§eCircular Accelerator Mode:$Magnets must loop back into core.$Unlocks more recipes.
|
||||
hadron.modeLine=§eLinear Accelerator Mode:$Accelerator ends with analysis chamber.$Fewer Recipes.
|
||||
hadron.noresult=No Result.
|
||||
hadron.progress=In Progress...
|
||||
hadron.success=Completed!
|
||||
|
||||
hbmfluid.acid=Hydrogen Peroxide
|
||||
hbmfluid.amat=Antimatter
|
||||
@ -1475,6 +1478,7 @@ item.particle_dark.name=Dark Matter Capsule
|
||||
item.particle_digamma.name=§cThe Digamma Particle§r
|
||||
item.particle_empty.name=Empty Particle Capsule
|
||||
item.particle_higgs.name=Higgs Boson Capsule
|
||||
item.particle_hydrogen.name=Hydrogen Ion Capsule
|
||||
item.particle_lead.name=Lead Ion Capsule
|
||||
item.particle_muon.name=Muon Capsule
|
||||
item.particle_sparkticle.name=Sparkticle Capsule
|
||||
@ -2221,11 +2225,13 @@ tile.glass_trinitite.name=Trinity Glass
|
||||
tile.glass_uranium.name=Uranium Glass
|
||||
tile.gravel_diamond.name=Diamond Gravel
|
||||
tile.gravel_obsidian.name=Crushed Obsidian
|
||||
tile.hadron_access.name=Particle Accelerator Access Terminal
|
||||
tile.hadron_analysis.name=Particle Accelerator Analysis Chamber Wall
|
||||
tile.hadron_analysis_glass.name=Particle Accelerator Analysis Chamber Window
|
||||
tile.hadron_coil_alloy.name=Dense Super Conducting Coil
|
||||
tile.hadron_coil_schrabidium.name=Dense Schrabidic Coil
|
||||
tile.hadron_coil_starmetal.name=Dense Starmetal Coil
|
||||
tile.hadron_core.name=Particle Accelerator Core Commponent
|
||||
tile.hadron_diode.name=Schottky Particle Diode
|
||||
tile.hadron_plating.name=Particle Accelerator Plating
|
||||
tile.hadron_plating_black.name=Particle Accelerator Plating (Black)
|
||||
@ -2234,6 +2240,7 @@ tile.hadron_plating_glass.name=Particle Accelerator Plating (Window)
|
||||
tile.hadron_plating_striped.name=Particle Accelerator Plating (Cool Hazard Stripes)
|
||||
tile.hadron_plating_voltz.name=Particle Accelerator Plating (VOLTZ)
|
||||
tile.hadron_plating_yellow.name=Particle Accelerator Plating (Yellow)
|
||||
tile.hadron_power.name=Particle Accelerator Power Plug
|
||||
tile.hazmat.name=Hazmat Cloth Block
|
||||
tile.iter.name=Fusion Reactor
|
||||
tile.launch_pad.name=Missile Launch Pad
|
||||
|
||||
BIN
src/main/java/assets/hbm/textures/gui/gui_nei_hadron.png
Normal file
BIN
src/main/java/assets/hbm/textures/gui/gui_nei_hadron.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.2 KiB After Width: | Height: | Size: 7.3 KiB |
BIN
src/main/java/assets/hbm/textures/items/particle_hydrogen.png
Normal file
BIN
src/main/java/assets/hbm/textures/items/particle_hydrogen.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 274 B |
@ -2,25 +2,32 @@ package com.hbm.blocks.machine;
|
||||
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.main.MainRegistry;
|
||||
import com.hbm.tileentity.TileEntityProxyInventory;
|
||||
|
||||
import cpw.mods.fml.common.network.internal.FMLNetworkHandler;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.block.BlockContainer;
|
||||
import net.minecraft.block.BlockPistonBase;
|
||||
import net.minecraft.block.material.Material;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class BlockHadronAccess extends Block {
|
||||
public class BlockHadronAccess extends BlockContainer {
|
||||
|
||||
public BlockHadronAccess(Material mat) {
|
||||
super(mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TileEntity createNewTileEntity(World world, int meta) {
|
||||
return new TileEntityProxyInventory();
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
public IIcon getIcon(int side, int meta) {
|
||||
@ -46,11 +53,11 @@ public class BlockHadronAccess extends Block {
|
||||
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)).getOpposite();
|
||||
|
||||
for(ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
|
||||
/*for(ForgeDirection d : ForgeDirection.VALID_DIRECTIONS) {
|
||||
System.out.println(d.name() + " " + d.getOpposite().name());
|
||||
}
|
||||
|
||||
System.out.println(dir.name());
|
||||
System.out.println(dir.name());*/
|
||||
|
||||
for(int i = 1; i < 3; i++) {
|
||||
|
||||
@ -58,7 +65,7 @@ public class BlockHadronAccess extends Block {
|
||||
FMLNetworkHandler.openGui(player, MainRegistry.instance, ModBlocks.guiID_hadron, world, x + dir.offsetX * i, y + dir.offsetY * i, z + dir.offsetZ * i);
|
||||
}
|
||||
|
||||
System.out.println(world.getBlock(x + dir.offsetX * i, y + dir.offsetY * i, z + dir.offsetZ * i).getUnlocalizedName());
|
||||
//System.out.println(world.getBlock(x + dir.offsetX * i, y + dir.offsetY * i, z + dir.offsetZ * i).getUnlocalizedName());
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
152
src/main/java/com/hbm/handler/nei/HadronRecipeHandler.java
Normal file
152
src/main/java/com/hbm/handler/nei/HadronRecipeHandler.java
Normal file
@ -0,0 +1,152 @@
|
||||
package com.hbm.handler.nei;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
|
||||
|
||||
import java.awt.Rectangle;
|
||||
import java.util.Arrays;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.inventory.HadronRecipes;
|
||||
import com.hbm.inventory.HadronRecipes.HadronRecipe;
|
||||
import com.hbm.inventory.gui.GUIHadron;
|
||||
import com.hbm.lib.RefStrings;
|
||||
|
||||
import codechicken.nei.NEIServerUtils;
|
||||
import codechicken.nei.PositionedStack;
|
||||
import codechicken.nei.recipe.TemplateRecipeHandler;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.FontRenderer;
|
||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
|
||||
public class HadronRecipeHandler extends TemplateRecipeHandler {
|
||||
|
||||
public LinkedList<RecipeTransferRect> transferRectsRec = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<RecipeTransferRect> transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiRec = new LinkedList<Class<? extends GuiContainer>>();
|
||||
public LinkedList<Class<? extends GuiContainer>> guiGui = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
public class SmeltingSet extends TemplateRecipeHandler.CachedRecipe {
|
||||
|
||||
PositionedStack input1;
|
||||
PositionedStack input2;
|
||||
PositionedStack output1;
|
||||
PositionedStack output2;
|
||||
int momentum;
|
||||
boolean analysisOnly;
|
||||
|
||||
public SmeltingSet(HadronRecipe recipe) {
|
||||
|
||||
this.input1 = new PositionedStack(recipe.in1.toStack(), 12, 24);
|
||||
this.input2 = new PositionedStack(recipe.in2.toStack(), 30, 24);
|
||||
this.output1 = new PositionedStack(recipe.out1, 84, 24);
|
||||
this.output2 = new PositionedStack(recipe.out2, 102, 24);
|
||||
this.momentum = recipe.momentum;
|
||||
this.analysisOnly = recipe.analysisOnly;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getIngredients() {
|
||||
return Arrays.asList(new PositionedStack[] {input1, input2});
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PositionedStack> getOtherStacks() {
|
||||
return Arrays.asList(new PositionedStack[] {output1, output2});
|
||||
}
|
||||
|
||||
@Override
|
||||
public PositionedStack getResult() {
|
||||
return output1;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getRecipeName() {
|
||||
return "Particle Accelerator";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(String outputId, Object... results) {
|
||||
|
||||
if(outputId.equals("hadron") && getClass() == HadronRecipeHandler.class) {
|
||||
|
||||
List<HadronRecipe> recipes = HadronRecipes.getRecipes();
|
||||
|
||||
for(HadronRecipe recipe : recipes) {
|
||||
this.arecipes.add(new SmeltingSet(recipe));
|
||||
}
|
||||
|
||||
} else {
|
||||
super.loadCraftingRecipes(outputId, results);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadCraftingRecipes(ItemStack result) {
|
||||
|
||||
List<HadronRecipe> recipes = HadronRecipes.getRecipes();
|
||||
|
||||
for(HadronRecipe recipe : recipes) {
|
||||
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.out1, result) || NEIServerUtils.areStacksSameTypeCrafting(recipe.out2, result)) {
|
||||
this.arecipes.add(new SmeltingSet(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(String inputId, Object... ingredients) {
|
||||
|
||||
if(inputId.equals("hadron") && getClass() == HadronRecipeHandler.class) {
|
||||
loadCraftingRecipes("hadron", new Object[0]);
|
||||
} else {
|
||||
super.loadUsageRecipes(inputId, ingredients);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadUsageRecipes(ItemStack ingredient) {
|
||||
|
||||
List<HadronRecipe> recipes = HadronRecipes.getRecipes();
|
||||
|
||||
for(HadronRecipe recipe : recipes) {
|
||||
|
||||
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.in1.toStack(), ingredient) || NEIServerUtils.areStacksSameTypeCrafting(recipe.in2.toStack(), ingredient)) {
|
||||
this.arecipes.add(new SmeltingSet(recipe));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadTransferRects() {
|
||||
transferRectsGui = new LinkedList<RecipeTransferRect>();
|
||||
guiGui = new LinkedList<Class<? extends GuiContainer>>();
|
||||
|
||||
transferRects.add(new RecipeTransferRect(new Rectangle(58 - 5, 34 - 11, 24, 18), "hadron"));
|
||||
transferRectsGui.add(new RecipeTransferRect(new Rectangle(72 - 5, 28 - 11, 30, 30), "hadron"));
|
||||
guiGui.add(GUIHadron.class);
|
||||
RecipeTransferRectHandler.registerRectsToGuis(getRecipeTransferRectGuis(), transferRects);
|
||||
RecipeTransferRectHandler.registerRectsToGuis(guiGui, transferRectsGui);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void drawExtras(int recipe) {
|
||||
|
||||
SmeltingSet rec = (SmeltingSet)this.arecipes.get(recipe);
|
||||
|
||||
if(rec.analysisOnly)
|
||||
drawTexturedModalRect(128, 23, 0, 86, 18, 18);
|
||||
|
||||
FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
|
||||
|
||||
String mom = "" + rec.momentum;
|
||||
fontRenderer.drawString(mom, -fontRenderer.getStringWidth(mom) / 2 + 30, 42, 0x404040);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getGuiTexture() {
|
||||
return RefStrings.MODID + ":textures/gui/gui_nei_hadron.png";
|
||||
}
|
||||
}
|
||||
@ -77,14 +77,18 @@ public class HadronRecipes {
|
||||
return null;
|
||||
}
|
||||
|
||||
public static List<HadronRecipe> getRecipes() {
|
||||
return recipes;
|
||||
}
|
||||
|
||||
public static class HadronRecipe {
|
||||
|
||||
ComparableStack in1;
|
||||
ComparableStack in2;
|
||||
int momentum;
|
||||
ItemStack out1;
|
||||
ItemStack out2;
|
||||
boolean analysisOnly;
|
||||
public ComparableStack in1;
|
||||
public ComparableStack in2;
|
||||
public int momentum;
|
||||
public ItemStack out1;
|
||||
public ItemStack out2;
|
||||
public boolean analysisOnly;
|
||||
|
||||
public HadronRecipe(ItemStack in1, ItemStack in2, int momentum, ItemStack out1, ItemStack out2, boolean analysisOnly) {
|
||||
this.in1 = new ComparableStack(in1);
|
||||
|
||||
@ -7,6 +7,7 @@ import com.hbm.lib.RefStrings;
|
||||
import com.hbm.packet.AuxButtonPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.machine.TileEntityHadron;
|
||||
import com.hbm.tileentity.machine.TileEntityHadron.EnumHadronState;
|
||||
import com.hbm.util.I18nUtil;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
@ -73,6 +74,9 @@ public class GUIHadron extends GuiInfoContainer {
|
||||
|
||||
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 4210752);
|
||||
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||
|
||||
String state = I18n.format("hadron." + this.hadron.state.name().toLowerCase());
|
||||
this.fontRendererObj.drawString(state, this.xSize / 2 - this.fontRendererObj.getStringWidth(state) / 2, 76, this.hadron.state.color);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -89,8 +93,27 @@ public class GUIHadron extends GuiInfoContainer {
|
||||
|
||||
if(hadron.hopperMode)
|
||||
drawTexturedModalRect(guiLeft + 142, guiTop + 89, 206, 36, 18, 18);
|
||||
|
||||
if(hadron.state == EnumHadronState.SUCCESS) {
|
||||
drawTexturedModalRect(guiLeft + 73, guiTop + 29, 176, 0, 30, 30);
|
||||
}
|
||||
if(hadron.state == EnumHadronState.NORESULT) {
|
||||
drawTexturedModalRect(guiLeft + 73, guiTop + 29, 176, 30, 30, 30);
|
||||
}
|
||||
if(hadron.state == EnumHadronState.ERROR) {
|
||||
drawTexturedModalRect(guiLeft + 73, guiTop + 29, 176, 106, 30, 30);
|
||||
}
|
||||
|
||||
int i = hadron.getPowerScaled(70);
|
||||
drawTexturedModalRect(guiLeft + 62, guiTop + 108, 176, 60, i, 16);
|
||||
|
||||
int color = hadron.state.color;
|
||||
float red = (color & 0xff0000) >> 16;
|
||||
float green = (color & 0x00ff00) >> 8;
|
||||
float blue = (color & 0x0000ff);
|
||||
|
||||
GL11.glColor4f(red, green, blue, 1.0F);
|
||||
drawTexturedModalRect(guiLeft + 45, guiTop + 73, 0, 222, 86, 14);
|
||||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
}
|
||||
|
||||
@ -600,6 +600,7 @@ public class ModItems {
|
||||
public static Item cell_anti_schrabidium;
|
||||
|
||||
public static Item particle_empty;
|
||||
public static Item particle_hydrogen;
|
||||
public static Item particle_copper;
|
||||
public static Item particle_lead;
|
||||
public static Item particle_aproton;
|
||||
@ -2472,6 +2473,7 @@ public class ModItems {
|
||||
cell_anti_schrabidium = new ItemDrop().setUnlocalizedName("cell_anti_schrabidium").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.cell_empty).setTextureName(RefStrings.MODID + ":cell_anti_schrabidium");
|
||||
|
||||
particle_empty = new Item().setUnlocalizedName("particle_empty").setCreativeTab(MainRegistry.controlTab).setTextureName(RefStrings.MODID + ":particle_empty");
|
||||
particle_hydrogen = new Item().setUnlocalizedName("particle_hydrogen").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_hydrogen");
|
||||
particle_copper = new Item().setUnlocalizedName("particle_copper").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_copper");
|
||||
particle_lead = new Item().setUnlocalizedName("particle_lead").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_lead");
|
||||
particle_aproton = new Item().setUnlocalizedName("particle_aproton").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_aproton");
|
||||
@ -2483,7 +2485,7 @@ public class ModItems {
|
||||
particle_strange = new Item().setUnlocalizedName("particle_strange").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_strange");
|
||||
particle_dark = new Item().setUnlocalizedName("particle_dark").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_dark");
|
||||
particle_sparkticle = new Item().setUnlocalizedName("particle_sparkticle").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_sparkticle");
|
||||
particle_digamma = new Item().setUnlocalizedName("particle_digamma").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_digamma");
|
||||
particle_digamma = new ItemDigamma(100F, 60).setUnlocalizedName("particle_digamma").setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.particle_empty).setTextureName(RefStrings.MODID + ":particle_digamma");
|
||||
|
||||
singularity = new ItemDrop().setUnlocalizedName("singularity").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.nuclear_waste).setTextureName(RefStrings.MODID + ":singularity");
|
||||
singularity_counter_resonant = new ItemDrop().setUnlocalizedName("singularity_counter_resonant").setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setContainerItem(ModItems.nuclear_waste).setTextureName(RefStrings.MODID + ":singularity_alt");
|
||||
@ -4653,6 +4655,7 @@ public class ModItems {
|
||||
|
||||
//Particle Containers
|
||||
GameRegistry.registerItem(particle_empty, particle_empty.getUnlocalizedName());
|
||||
GameRegistry.registerItem(particle_hydrogen, particle_hydrogen.getUnlocalizedName());
|
||||
GameRegistry.registerItem(particle_copper, particle_copper.getUnlocalizedName());
|
||||
GameRegistry.registerItem(particle_lead, particle_lead.getUnlocalizedName());
|
||||
GameRegistry.registerItem(particle_aproton, particle_aproton.getUnlocalizedName());
|
||||
|
||||
83
src/main/java/com/hbm/items/special/ItemDigamma.java
Normal file
83
src/main/java/com/hbm/items/special/ItemDigamma.java
Normal file
@ -0,0 +1,83 @@
|
||||
package com.hbm.items.special;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.entity.effect.EntityRagingVortex;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.item.EntityItem;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumChatFormatting;
|
||||
import net.minecraft.world.World;
|
||||
|
||||
public class ItemDigamma extends ItemRadioactive {
|
||||
|
||||
int digamma;
|
||||
|
||||
public ItemDigamma(float radiation, int digamma) {
|
||||
super(radiation);
|
||||
this.digamma = digamma;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int i, boolean b) {
|
||||
super.onUpdate(stack, world, entity, i, b);
|
||||
|
||||
if(entity instanceof EntityPlayer) {
|
||||
|
||||
EntityPlayer player = (EntityPlayer) entity;
|
||||
|
||||
if(player.ticksExisted % digamma == 0 && !player.capabilities.isCreativeMode) {
|
||||
|
||||
player.getEntityAttribute(SharedMonsterAttributes.maxHealth).applyModifier(new AttributeModifier("digamma", -0.5D, 2));
|
||||
|
||||
if(player.getHealth() > player.getMaxHealth())
|
||||
player.setHealth(player.getMaxHealth());
|
||||
|
||||
if(player.getMaxHealth() <= 0) {
|
||||
player.attackEntityFrom(ModDamageSource.radiation, 100F);
|
||||
player.onDeath(ModDamageSource.radiation);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addInformation(ItemStack stack, EntityPlayer player, List list, boolean bool) {
|
||||
|
||||
list.add(EnumChatFormatting.GOLD + "Particle Half-Life: 1.67*10³⁴a");
|
||||
list.add(EnumChatFormatting.RED + "Player Half-Life: " + (digamma / 20F) + "s");
|
||||
|
||||
list.add("");
|
||||
super.addInformation(stack, player, list, bool);
|
||||
|
||||
float d = ((int)((1000F / 60) * 10)) / 10F;
|
||||
|
||||
list.add(EnumChatFormatting.DARK_RED + "" + d + "DRX/s");
|
||||
|
||||
list.add(EnumChatFormatting.RED + "[Dangerous Drop]");
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onEntityItemUpdate(EntityItem entityItem) {
|
||||
if (entityItem != null) {
|
||||
|
||||
if (entityItem.onGround) {
|
||||
|
||||
EntityRagingVortex bl = new EntityRagingVortex(entityItem.worldObj, 10F);
|
||||
bl.posX = entityItem.posX ;
|
||||
bl.posY = entityItem.posY ;
|
||||
bl.posZ = entityItem.posZ ;
|
||||
entityItem.worldObj.spawnEntityInWorld(bl);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@ -3,11 +3,14 @@ package com.hbm.items.special;
|
||||
import java.util.List;
|
||||
|
||||
import com.hbm.inventory.BreederRecipes;
|
||||
import com.hbm.lib.ModDamageSource;
|
||||
import com.hbm.util.ArmorUtil;
|
||||
import com.hbm.util.ContaminationUtil;
|
||||
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.SharedMonsterAttributes;
|
||||
import net.minecraft.entity.ai.attributes.AttributeModifier;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.potion.Potion;
|
||||
|
||||
@ -16,9 +16,9 @@ public class NEIConfig implements IConfigureNEI {
|
||||
API.registerRecipeHandler(new AlloyFurnaceRecipeHandler());
|
||||
API.registerUsageHandler(new AlloyFurnaceRecipeHandler());
|
||||
API.registerRecipeHandler(new CentrifugeRecipeHandler());
|
||||
API.registerUsageHandler(new GasCentrifugeRecipeHandler());
|
||||
API.registerRecipeHandler(new GasCentrifugeRecipeHandler());
|
||||
API.registerUsageHandler(new CentrifugeRecipeHandler());
|
||||
API.registerRecipeHandler(new GasCentrifugeRecipeHandler());
|
||||
API.registerUsageHandler(new GasCentrifugeRecipeHandler());
|
||||
API.registerRecipeHandler(new ReactorRecipeHandler());
|
||||
API.registerUsageHandler(new ReactorRecipeHandler());
|
||||
API.registerRecipeHandler(new ShredderRecipeHandler());
|
||||
@ -45,6 +45,8 @@ public class NEIConfig implements IConfigureNEI {
|
||||
API.registerUsageHandler(new BookRecipeHandler());
|
||||
API.registerRecipeHandler(new FusionRecipeHandler());
|
||||
API.registerUsageHandler(new FusionRecipeHandler());
|
||||
API.registerRecipeHandler(new HadronRecipeHandler());
|
||||
API.registerUsageHandler(new HadronRecipeHandler());
|
||||
|
||||
//Some things are even beyond my control...or are they?
|
||||
API.hideItem(new ItemStack(ModItems.memory));
|
||||
|
||||
@ -1,8 +1,12 @@
|
||||
package com.hbm.tileentity;
|
||||
|
||||
import com.hbm.blocks.BlockDummyable;
|
||||
import com.hbm.blocks.ModBlocks;
|
||||
import com.hbm.blocks.machine.BlockHadronAccess;
|
||||
import com.hbm.tileentity.machine.TileEntityHadron;
|
||||
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
public class TileEntityProxyBase extends TileEntity {
|
||||
|
||||
@ -28,6 +32,22 @@ public class TileEntityProxyBase extends TileEntity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// this spares me the hassle of registering a new child class TE that aims at the right target ///
|
||||
|
||||
if(this.getBlockType() instanceof BlockHadronAccess) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata()).getOpposite();
|
||||
|
||||
|
||||
for(int i = 1; i < 3; i++) {
|
||||
TileEntity te = worldObj.getTileEntity(xCoord + dir.offsetX * i, yCoord + dir.offsetY * i, zCoord + dir.offsetZ * i);
|
||||
|
||||
if(te instanceof TileEntityHadron) {
|
||||
return te;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -10,6 +10,7 @@ import com.hbm.blocks.machine.BlockHadronCoil;
|
||||
import com.hbm.blocks.machine.BlockHadronPlating;
|
||||
import com.hbm.interfaces.IConsumer;
|
||||
import com.hbm.inventory.HadronRecipes;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.AuxParticlePacketNT;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.tileentity.TileEntityMachineBase;
|
||||
@ -33,6 +34,12 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
|
||||
public boolean analysisOnly = false;
|
||||
public boolean hopperMode = false;
|
||||
|
||||
private int delay;
|
||||
public EnumHadronState state = EnumHadronState.IDLE;
|
||||
private static final int delaySuccess = 20;
|
||||
private static final int delayNoResult = 60;
|
||||
private static final int delayError = 60;
|
||||
|
||||
public TileEntityHadron() {
|
||||
super(5);
|
||||
}
|
||||
@ -41,15 +48,33 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
|
||||
public String getName() {
|
||||
return "container.hadron";
|
||||
}
|
||||
|
||||
private static final int[] access = new int[] {0, 1, 2, 3};
|
||||
|
||||
@Override
|
||||
public int[] getAccessibleSlotsFromSide(int side) {
|
||||
return access;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canExtractItem(int i, ItemStack itemStack, int j) {
|
||||
return i == 2 || i == 3;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isItemValidForSlot(int i, ItemStack itemStack) {
|
||||
return i == 0 || i == 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
power = Library.chargeTEFromItems(slots, 4, power, maxPower);
|
||||
drawPower();
|
||||
|
||||
if(this.isOn && particles.size() < maxParticles && slots[0] != null && slots[1] != null && power >= maxPower * 0.75) {
|
||||
if(delay <= 0 && this.isOn && particles.size() < maxParticles && slots[0] != null && slots[1] != null && power >= maxPower * 0.75) {
|
||||
|
||||
if(!hopperMode || (slots[0].stackSize > 1 && slots[1].stackSize > 1)) {
|
||||
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
|
||||
@ -57,9 +82,16 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
|
||||
this.decrStackSize(0, 1);
|
||||
this.decrStackSize(1, 1);
|
||||
power -= maxPower * 0.75;
|
||||
this.state = EnumHadronState.PROGRESS;
|
||||
}
|
||||
}
|
||||
|
||||
if(delay > 0)
|
||||
delay--;
|
||||
else if(particles.isEmpty()) {
|
||||
this.state = EnumHadronState.IDLE;
|
||||
}
|
||||
|
||||
if(!particles.isEmpty())
|
||||
updateParticles();
|
||||
|
||||
@ -74,6 +106,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
|
||||
data.setLong("power", power);
|
||||
data.setBoolean("analysis", analysisOnly);
|
||||
data.setBoolean("hopperMode", hopperMode);
|
||||
data.setByte("state", (byte) state.ordinal());
|
||||
this.networkPack(data, 50);
|
||||
}
|
||||
}
|
||||
@ -82,8 +115,12 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
|
||||
|
||||
ItemStack[] result = HadronRecipes.getOutput(p.item1, p.item2, p.momentum, analysisOnly);
|
||||
|
||||
if(result == null)
|
||||
if(result == null) {
|
||||
this.state = EnumHadronState.NORESULT;
|
||||
this.delay = delayNoResult;
|
||||
worldObj.playSoundEffect(p.posX, p.posY, p.posZ, "random.orb", 2, 0.5F);
|
||||
return;
|
||||
}
|
||||
|
||||
if((slots[2] == null || (slots[2].getItem() == result[0].getItem() && slots[2].stackSize < slots[2].getMaxStackSize())) &&
|
||||
(slots[3] == null || (slots[3].getItem() == result[1].getItem() && slots[3].stackSize < slots[3].getMaxStackSize()))) {
|
||||
@ -97,6 +134,10 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
|
||||
slots[i].stackSize++;
|
||||
}
|
||||
}
|
||||
|
||||
worldObj.playSoundEffect(p.posX, p.posY, p.posZ, "random.orb", 2, 1F);
|
||||
this.delay = delaySuccess;
|
||||
this.state = EnumHadronState.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -105,6 +146,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
|
||||
this.power = data.getLong("power");
|
||||
this.analysisOnly = data.getBoolean("analysis");
|
||||
this.hopperMode = data.getBoolean("hopperMode");
|
||||
this.state = EnumHadronState.values()[data.getByte("state")];
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -144,8 +186,11 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
|
||||
|
||||
private void finishParticle(Particle p) {
|
||||
particlesToRemove.add(p);
|
||||
worldObj.playSoundEffect(p.posX, p.posY, p.posZ, "random.orb", 10, 1);
|
||||
process(p);
|
||||
|
||||
if(!p.isExpired())
|
||||
process(p);
|
||||
|
||||
p.expired = true;
|
||||
}
|
||||
|
||||
static final int maxParticles = 1;
|
||||
@ -213,7 +258,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
|
||||
int momentum;
|
||||
int charge;
|
||||
int analysis;
|
||||
static final int maxCharge = 10;
|
||||
static final int maxCharge = 80;
|
||||
boolean isCheckExempt = false;
|
||||
|
||||
boolean expired = false;
|
||||
@ -242,7 +287,10 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
|
||||
worldObj.newExplosion(null, posX + 0.5, posY + 0.5, posZ + 0.5, 10, false, false);
|
||||
//System.out.println("Last dir: " + dir.name());
|
||||
//System.out.println("Last pos: " + posX + " " + posY + " " + posZ);
|
||||
Thread.currentThread().dumpStack();
|
||||
//Thread.currentThread().dumpStack();
|
||||
|
||||
TileEntityHadron.this.state = EnumHadronState.ERROR;
|
||||
TileEntityHadron.this.delay = delayError;
|
||||
}
|
||||
|
||||
public boolean isExpired() {
|
||||
@ -253,12 +301,13 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
|
||||
|
||||
if(expired) //just in case
|
||||
return;
|
||||
|
||||
this.charge--;
|
||||
|
||||
changeDirection(this);
|
||||
makeSteppy(this);
|
||||
checkSegment(this);
|
||||
|
||||
if(!this.isExpired()) //only important for when the current segment is the core
|
||||
checkSegment(this);
|
||||
|
||||
isCheckExempt = false; //clearing up the exemption we might have held from the previous turn, AFTER stepping
|
||||
|
||||
if(charge <= 0)
|
||||
@ -371,6 +420,7 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
|
||||
p.expire();
|
||||
} else {
|
||||
p.momentum += coilVal;
|
||||
p.charge -= coilVal;
|
||||
}
|
||||
|
||||
continue;
|
||||
@ -433,6 +483,8 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
|
||||
p.expire();
|
||||
|
||||
if(p.analysis == 2) {
|
||||
this.worldObj.playSoundEffect(p.posX + 0.5, p.posY + 0.5, p.posZ + 0.5, "fireworks.blast", 2.0F, 2F);
|
||||
this.state = EnumHadronState.ANALYSIS;
|
||||
NBTTagCompound data = new NBTTagCompound();
|
||||
data.setString("type", "hadron");
|
||||
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, p.posX + 0.5, p.posY + 0.5, p.posZ + 0.5), new TargetPoint(worldObj.provider.dimensionId, p.posX + 0.5, p.posY + 0.5, p.posZ + 0.5, 25));
|
||||
@ -609,4 +661,19 @@ public class TileEntityHadron extends TileEntityMachineBase implements IConsumer
|
||||
return b == ModBlocks.hadron_analysis ||
|
||||
b == ModBlocks.hadron_analysis_glass;
|
||||
}
|
||||
|
||||
public static enum EnumHadronState {
|
||||
IDLE(0x8080ff),
|
||||
PROGRESS(0xffff00),
|
||||
ANALYSIS(0xffff00),
|
||||
NORESULT(0xff8000),
|
||||
SUCCESS(0x00ff00),
|
||||
ERROR(0xff0000);
|
||||
|
||||
public int color;
|
||||
|
||||
private EnumHadronState(int color) {
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user