Merge remote-tracking branch 'origin/Optimization' into Optimization
@ -66,3 +66,4 @@
|
|||||||
* Fixed empty particle capsules not being extractable from the ICF pellet maker
|
* Fixed empty particle capsules not being extractable from the ICF pellet maker
|
||||||
* Fixed issue regarding mass storage filters when using GTNH-NEI
|
* Fixed issue regarding mass storage filters when using GTNH-NEI
|
||||||
* Fixed DFC emitters calculating their original 98% inefficiency twice when hitting another emitter or tungsten crate
|
* Fixed DFC emitters calculating their original 98% inefficiency twice when hitting another emitter or tungsten crate
|
||||||
|
* Fixed the wood burner destroying container items like buckets when using lava as fuel
|
||||||
|
|||||||
@ -279,6 +279,10 @@ public class RecipesCommon {
|
|||||||
return new ComparableStack(item, stacksize, meta);
|
return new ComparableStack(item, stacksize, meta);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public ComparableStack copy(int stacksize) {
|
||||||
|
return new ComparableStack(item, stacksize, meta);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesRecipe(ItemStack stack, boolean ignoreSize) {
|
public boolean matchesRecipe(ItemStack stack, boolean ignoreSize) {
|
||||||
|
|
||||||
@ -391,6 +395,10 @@ public class RecipesCommon {
|
|||||||
return new OreDictStack(name, stacksize);
|
return new OreDictStack(name, stacksize);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public OreDictStack copy(int stacksize) {
|
||||||
|
return new OreDictStack(name, stacksize);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean matchesRecipe(ItemStack stack, boolean ignoreSize) {
|
public boolean matchesRecipe(ItemStack stack, boolean ignoreSize) {
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,84 @@
|
|||||||
|
package com.hbm.inventory.container;
|
||||||
|
|
||||||
|
import com.hbm.inventory.SlotCraftingOutput;
|
||||||
|
import com.hbm.inventory.recipes.AmmoPressRecipes;
|
||||||
|
import com.hbm.inventory.recipes.AmmoPressRecipes.AmmoPressRecipe;
|
||||||
|
import com.hbm.tileentity.machine.TileEntityMachineAmmoPress;
|
||||||
|
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class ContainerMachineAmmoPress extends Container {
|
||||||
|
|
||||||
|
private TileEntityMachineAmmoPress press;
|
||||||
|
|
||||||
|
public ContainerMachineAmmoPress(InventoryPlayer playerInv, TileEntityMachineAmmoPress tile) {
|
||||||
|
press = tile;
|
||||||
|
|
||||||
|
//Inputs
|
||||||
|
for(int i = 0; i < 3; i++) {
|
||||||
|
for(int j = 0; j < 3; j++) {
|
||||||
|
this.addSlotToContainer(new Slot(tile, i * 3 + j, 116 + j * 18, 18 + i * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//Output
|
||||||
|
this.addSlotToContainer(new SlotCraftingOutput(playerInv.player, tile, 9, 134, 72));
|
||||||
|
|
||||||
|
for(int i = 0; i < 3; i++) {
|
||||||
|
for(int j = 0; j < 9; j++) {
|
||||||
|
this.addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 118 + i * 18));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
for(int i = 0; i < 9; i++) {
|
||||||
|
this.addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 176));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
|
||||||
|
ItemStack rStack = null;
|
||||||
|
Slot slot = (Slot) this.inventorySlots.get(index);
|
||||||
|
|
||||||
|
if(slot != null && slot.getHasStack()) {
|
||||||
|
ItemStack stack = slot.getStack();
|
||||||
|
rStack = stack.copy();
|
||||||
|
|
||||||
|
if(index <= 9) {
|
||||||
|
if(!this.mergeItemStack(stack, 10, this.inventorySlots.size(), true)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
|
||||||
|
if(press.selectedRecipe < 0 || press.selectedRecipe >= AmmoPressRecipes.recipes.size()) return null;
|
||||||
|
AmmoPressRecipe recipe = AmmoPressRecipes.recipes.get(press.selectedRecipe);
|
||||||
|
|
||||||
|
for(int i = 0; i < 9; i++) {
|
||||||
|
if(recipe.input[i] == null) continue;
|
||||||
|
if(recipe.input[i].matchesRecipe(stack, true)) {
|
||||||
|
if(!this.mergeItemStack(stack, i, i + 1, false)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(stack.stackSize == 0) {
|
||||||
|
slot.putStack((ItemStack) null);
|
||||||
|
} else {
|
||||||
|
slot.onSlotChanged();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return rStack;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canInteractWith(EntityPlayer player) {
|
||||||
|
return press.isUseableByPlayer(player);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -119,24 +119,6 @@ public class GUIAnvil extends GuiContainer {
|
|||||||
this.size = Math.max(0, (int)Math.ceil((this.recipes.size() - 10) / 2D));
|
this.size = Math.max(0, (int)Math.ceil((this.recipes.size() - 10) / 2D));
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@Override
|
|
||||||
protected void mouseMovedOrUp(int x, int y, int mode) {
|
|
||||||
super.mouseMovedOrUp(x, y, mode);
|
|
||||||
|
|
||||||
if(mode == -1) return; // we don't care about mouseMove
|
|
||||||
for(Object obj : this.inventorySlots.inventorySlots) {
|
|
||||||
Slot slot = (Slot) obj;
|
|
||||||
|
|
||||||
// if the mouse is over a slot, cancel
|
|
||||||
if(this.func_146978_c(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, x, y)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if(mode == 0 && this.index > 0) this.index--;
|
|
||||||
if(mode == 1 && this.index < this.size) this.index++;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void drawScreen(int x, int y, float interp) {
|
public void drawScreen(int x, int y, float interp) {
|
||||||
super.drawScreen(x, y, interp);
|
super.drawScreen(x, y, interp);
|
||||||
|
|||||||
302
src/main/java/com/hbm/inventory/gui/GUIMachineAmmoPress.java
Normal file
@ -0,0 +1,302 @@
|
|||||||
|
package com.hbm.inventory.gui;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
import org.lwjgl.input.Keyboard;
|
||||||
|
import org.lwjgl.input.Mouse;
|
||||||
|
import org.lwjgl.opengl.GL11;
|
||||||
|
import org.lwjgl.opengl.GL12;
|
||||||
|
|
||||||
|
import com.hbm.inventory.RecipesCommon.AStack;
|
||||||
|
import com.hbm.inventory.container.ContainerMachineAmmoPress;
|
||||||
|
import com.hbm.inventory.recipes.AmmoPressRecipes;
|
||||||
|
import com.hbm.inventory.recipes.AmmoPressRecipes.AmmoPressRecipe;
|
||||||
|
import com.hbm.lib.RefStrings;
|
||||||
|
import com.hbm.packet.PacketDispatcher;
|
||||||
|
import com.hbm.packet.toserver.NBTControlPacket;
|
||||||
|
import com.hbm.tileentity.machine.TileEntityMachineAmmoPress;
|
||||||
|
|
||||||
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
|
import net.minecraft.client.gui.GuiTextField;
|
||||||
|
import net.minecraft.client.renderer.OpenGlHelper;
|
||||||
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
import net.minecraft.client.resources.I18n;
|
||||||
|
import net.minecraft.entity.player.InventoryPlayer;
|
||||||
|
import net.minecraft.inventory.Slot;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
|
||||||
|
public class GUIMachineAmmoPress extends GuiInfoContainer {
|
||||||
|
|
||||||
|
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_ammo_press.png");
|
||||||
|
private TileEntityMachineAmmoPress press;
|
||||||
|
|
||||||
|
private List<AmmoPressRecipe> recipes = new ArrayList();
|
||||||
|
int index;
|
||||||
|
int size;
|
||||||
|
int selection;
|
||||||
|
private GuiTextField search;
|
||||||
|
|
||||||
|
public GUIMachineAmmoPress(InventoryPlayer invPlayer, TileEntityMachineAmmoPress press) {
|
||||||
|
super(new ContainerMachineAmmoPress(invPlayer, press));
|
||||||
|
this.press = press;
|
||||||
|
|
||||||
|
this.xSize = 176;
|
||||||
|
this.ySize = 200;
|
||||||
|
|
||||||
|
this.selection = press.selectedRecipe;
|
||||||
|
|
||||||
|
regenerateRecipes();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void initGui() {
|
||||||
|
|
||||||
|
super.initGui();
|
||||||
|
|
||||||
|
Keyboard.enableRepeatEvents(true);
|
||||||
|
this.search = new GuiTextField(this.fontRendererObj, guiLeft + 10, guiTop + 75, 66, 12);
|
||||||
|
this.search.setTextColor(-1);
|
||||||
|
this.search.setDisabledTextColour(-1);
|
||||||
|
this.search.setEnableBackgroundDrawing(false);
|
||||||
|
this.search.setMaxStringLength(25);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void regenerateRecipes() {
|
||||||
|
|
||||||
|
this.recipes.clear();
|
||||||
|
this.recipes.addAll(AmmoPressRecipes.recipes);
|
||||||
|
|
||||||
|
resetPaging();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void search(String search) {
|
||||||
|
|
||||||
|
search = search.toLowerCase(Locale.US);
|
||||||
|
|
||||||
|
this.recipes.clear();
|
||||||
|
|
||||||
|
if(search.isEmpty()) {
|
||||||
|
this.recipes.addAll(AmmoPressRecipes.recipes);
|
||||||
|
|
||||||
|
} else {
|
||||||
|
for(AmmoPressRecipe recipe : AmmoPressRecipes.recipes) {
|
||||||
|
if(recipe.output.getDisplayName().toLowerCase(Locale.US).contains(search)) {
|
||||||
|
this.recipes.add(recipe);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
resetPaging();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void resetPaging() {
|
||||||
|
|
||||||
|
this.index = 0;
|
||||||
|
this.size = Math.max(0, (int)Math.ceil((this.recipes.size() - 12) / 3D));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void drawScreen(int x, int y, float interp) {
|
||||||
|
super.drawScreen(x, y, interp);
|
||||||
|
|
||||||
|
for(Object obj : this.inventorySlots.inventorySlots) {
|
||||||
|
Slot slot = (Slot) obj;
|
||||||
|
|
||||||
|
// if the mouse is over a slot, cancel
|
||||||
|
if(this.func_146978_c(slot.xDisplayPosition, slot.yDisplayPosition, 16, 16, x, y) && slot.getHasStack()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if(guiLeft <= x && guiLeft + xSize > x && guiTop < y && guiTop + ySize >= y && getSlotAtPosition(x, y) == null) {
|
||||||
|
if(!Mouse.isButtonDown(0) && !Mouse.isButtonDown(1) && Mouse.next()) {
|
||||||
|
int scroll = Mouse.getEventDWheel();
|
||||||
|
|
||||||
|
if(scroll > 0 && this.index > 0) this.index--;
|
||||||
|
if(scroll < 0 && this.index < this.size) this.index++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = index * 3; i < index * 3 + 12; i++) {
|
||||||
|
|
||||||
|
if(i >= this.recipes.size())
|
||||||
|
break;
|
||||||
|
|
||||||
|
int ind = i - index * 3;
|
||||||
|
|
||||||
|
int ix = 16 + 18 * (ind / 3);
|
||||||
|
int iy = 17 + 18 * (ind % 3);
|
||||||
|
if(guiLeft + ix <= x && guiLeft + ix + 18 > x && guiTop + iy < y && guiTop + iy + 18 >= y) {
|
||||||
|
AmmoPressRecipe recipe = this.recipes.get(i);
|
||||||
|
this.renderToolTip(recipe.output, x, y);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void mouseClicked(int x, int y, int k) {
|
||||||
|
super.mouseClicked(x, y, k);
|
||||||
|
|
||||||
|
this.search.mouseClicked(x, y, k);
|
||||||
|
|
||||||
|
if(guiLeft + 7 <= x && guiLeft + 7 + 9 > x && guiTop + 17 < y && guiTop + 17 + 54 >= y) {
|
||||||
|
click();
|
||||||
|
if(this.index > 0) this.index--;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(guiLeft + 88 <= x && guiLeft + 88 + 9 > x && guiTop + 17 < y && guiTop + 17 + 54 >= y) {
|
||||||
|
click();
|
||||||
|
if(this.index < this.size) this.index++;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = index * 3; i < index * 3 + 12; i++) {
|
||||||
|
|
||||||
|
if(i >= this.recipes.size())
|
||||||
|
break;
|
||||||
|
|
||||||
|
int ind = i - index * 3;
|
||||||
|
|
||||||
|
int ix = 16 + 18 * (ind / 3);
|
||||||
|
int iy = 17 + 18 * (ind % 3);
|
||||||
|
if(guiLeft + ix <= x && guiLeft + ix + 18 > x && guiTop + iy < y && guiTop + iy + 18 >= y) {
|
||||||
|
|
||||||
|
int newSelection = AmmoPressRecipes.recipes.indexOf(this.recipes.get(i));
|
||||||
|
|
||||||
|
if(this.selection != newSelection)
|
||||||
|
this.selection = newSelection;
|
||||||
|
else
|
||||||
|
this.selection = -1;
|
||||||
|
|
||||||
|
NBTTagCompound data = new NBTTagCompound();
|
||||||
|
data.setInteger("selection", this.selection);
|
||||||
|
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, press.xCoord, press.yCoord, press.zCoord));
|
||||||
|
click();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerForegroundLayer(int i, int j) {
|
||||||
|
String name = this.press.hasCustomInventoryName() ? this.press.getInventoryName() : I18n.format(this.press.getInventoryName());
|
||||||
|
this.fontRendererObj.drawString(name, this.xSize / 2 - this.fontRendererObj.getStringWidth(name) / 2, 6, 0xffffff);
|
||||||
|
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void drawGuiContainerBackgroundLayer(float interp, int x, int y) {
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||||
|
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
|
||||||
|
|
||||||
|
if(guiLeft + 7 <= x && guiLeft + 7 + 9 > x && guiTop + 17 < y && guiTop + 17 + 54 >= y) {
|
||||||
|
drawTexturedModalRect(guiLeft + 7, guiTop + 17, 176, 0, 9, 54);
|
||||||
|
}
|
||||||
|
if(guiLeft + 88 <= x && guiLeft + 88 + 9 > x && guiTop + 17 < y && guiTop + 17 + 54 >= y) {
|
||||||
|
drawTexturedModalRect(guiLeft + 88, guiTop + 17, 185, 0, 9, 54);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.search.isFocused()) {
|
||||||
|
drawTexturedModalRect(guiLeft + 8, guiTop + 72, 176, 54, 70, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
for(int i = index * 3; i < index * 3 + 12; i++) {
|
||||||
|
if(i >= recipes.size())
|
||||||
|
break;
|
||||||
|
|
||||||
|
int ind = i - index * 3;
|
||||||
|
|
||||||
|
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
|
RenderHelper.enableGUIStandardItemLighting();
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||||
|
|
||||||
|
AmmoPressRecipe recipe = recipes.get(i);
|
||||||
|
|
||||||
|
FontRenderer font = null;
|
||||||
|
if(recipe.output != null) font = recipe.output.getItem().getFontRenderer(recipe.output);
|
||||||
|
if(font == null) font = fontRendererObj;
|
||||||
|
|
||||||
|
itemRender.zLevel = 100.0F;
|
||||||
|
itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), recipe.output, guiLeft + 17 + 18 * (ind / 3), guiTop + 18 + 18 * (ind % 3));
|
||||||
|
|
||||||
|
itemRender.zLevel = 0.0F;
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
this.mc.getTextureManager().bindTexture(texture);
|
||||||
|
this.zLevel = 300.0F;
|
||||||
|
|
||||||
|
if(selection == AmmoPressRecipes.recipes.indexOf(this.recipes.get(i)))
|
||||||
|
this.drawTexturedModalRect(guiLeft + 16 + 18 * (ind / 3), guiTop + 17 + 18 * (ind % 3), 194, 0, 18, 18);
|
||||||
|
else
|
||||||
|
this.drawTexturedModalRect(guiLeft + 16 + 18 * (ind / 3), guiTop + 17 + 18 * (ind % 3), 212, 0, 18, 18);
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslated(guiLeft + 17 + 18 * (ind / 3) + 8, guiTop + 18 + 18 * (ind % 3) + 8, 0);
|
||||||
|
GL11.glScaled(0.5, 0.5, 1);
|
||||||
|
itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), recipe.output, 0, 0, recipe.output.stackSize + "");
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
}
|
||||||
|
|
||||||
|
if(selection >= 0 && selection < AmmoPressRecipes.recipes.size()) {
|
||||||
|
AmmoPressRecipe recipe = AmmoPressRecipes.recipes.get(selection);
|
||||||
|
|
||||||
|
for(int i = 0; i < 9; i++) {
|
||||||
|
AStack stack = recipe.input[i];
|
||||||
|
if(stack == null) continue;
|
||||||
|
if(press.slots[i] != null) continue;
|
||||||
|
List<ItemStack> inputs = stack.extractForNEI();
|
||||||
|
ItemStack input = inputs.get((int) (Math.abs(System.currentTimeMillis() / 1000) % inputs.size()));
|
||||||
|
|
||||||
|
RenderHelper.enableGUIStandardItemLighting();
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||||
|
|
||||||
|
FontRenderer font = input.getItem().getFontRenderer(input);
|
||||||
|
if(font == null) font = fontRendererObj;
|
||||||
|
|
||||||
|
itemRender.zLevel = 10.0F;
|
||||||
|
itemRender.renderItemAndEffectIntoGUI(font, this.mc.getTextureManager(), input, guiLeft + 116 + 18 * (i % 3), guiTop + 18 + 18 * (i / 3));
|
||||||
|
itemRender.renderItemOverlayIntoGUI(font, this.mc.getTextureManager(), input, guiLeft + 116 + 18 * (i % 3), guiTop + 18 + 18 * (i / 3), input.stackSize > 1 ? (input.stackSize + "") : null);
|
||||||
|
itemRender.zLevel = 0.0F;
|
||||||
|
|
||||||
|
GL11.glEnable(GL11.GL_ALPHA_TEST);
|
||||||
|
GL11.glDisable(GL11.GL_LIGHTING);
|
||||||
|
|
||||||
|
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
|
||||||
|
this.zLevel = 300.0F;
|
||||||
|
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
|
||||||
|
GL11.glColor4f(1F, 1F, 1F, 0.5F);
|
||||||
|
GL11.glEnable(GL11.GL_BLEND);
|
||||||
|
drawTexturedModalRect(guiLeft + 116 + 18 * (i % 3), guiTop + 18+ 18 * (i / 3), 116 + 18 * (i % 3), 18+ 18 * (i / 3), 18, 18);
|
||||||
|
GL11.glColor4f(1F, 1F, 1F, 1F);
|
||||||
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.search.drawTextBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
protected void keyTyped(char c, int key) {
|
||||||
|
|
||||||
|
if(this.search.textboxKeyTyped(c, key)) {
|
||||||
|
search(this.search.getText());
|
||||||
|
} else {
|
||||||
|
super.keyTyped(c, key);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onGuiClosed() {
|
||||||
|
Keyboard.enableRepeatEvents(false);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -22,6 +22,7 @@ import com.hbm.util.BobMathUtil;
|
|||||||
import com.hbm.util.I18nUtil;
|
import com.hbm.util.I18nUtil;
|
||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.audio.PositionedSoundRecord;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.gui.inventory.GuiContainer;
|
import net.minecraft.client.gui.inventory.GuiContainer;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
@ -291,6 +292,11 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa
|
|||||||
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
GL11.glEnable(GL12.GL_RESCALE_NORMAL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void click() {
|
||||||
|
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||||
|
}
|
||||||
|
|
||||||
///NEI drag and drop support
|
///NEI drag and drop support
|
||||||
@Override
|
@Override
|
||||||
@Optional.Method(modid = "NotEnoughItems")
|
@Optional.Method(modid = "NotEnoughItems")
|
||||||
|
|||||||
249
src/main/java/com/hbm/inventory/recipes/AmmoPressRecipes.java
Normal file
@ -0,0 +1,249 @@
|
|||||||
|
package com.hbm.inventory.recipes;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import static com.hbm.inventory.OreDictManager.*;
|
||||||
|
|
||||||
|
import com.google.gson.JsonArray;
|
||||||
|
import com.google.gson.JsonElement;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import com.google.gson.stream.JsonWriter;
|
||||||
|
import com.hbm.inventory.OreDictManager.DictFrame;
|
||||||
|
import com.hbm.inventory.RecipesCommon.AStack;
|
||||||
|
import com.hbm.inventory.RecipesCommon.ComparableStack;
|
||||||
|
import com.hbm.inventory.RecipesCommon.OreDictStack;
|
||||||
|
import com.hbm.inventory.recipes.loader.SerializableRecipe;
|
||||||
|
import com.hbm.items.ItemEnums.EnumCasingType;
|
||||||
|
import com.hbm.items.ModItems;
|
||||||
|
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
|
||||||
|
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
|
public class AmmoPressRecipes extends SerializableRecipe {
|
||||||
|
|
||||||
|
public static List<AmmoPressRecipe> recipes = new ArrayList();
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void registerDefaults() {
|
||||||
|
|
||||||
|
OreDictStack lead = new OreDictStack(PB.ingot());
|
||||||
|
OreDictStack steel = new OreDictStack(STEEL.ingot());
|
||||||
|
OreDictStack wSteel = new OreDictStack(WEAPONSTEEL.ingot());
|
||||||
|
OreDictStack copper = new OreDictStack(CU.ingot());
|
||||||
|
OreDictStack plastic = new OreDictStack(ANY_PLASTIC.ingot());
|
||||||
|
OreDictStack uranium = new OreDictStack(U238.ingot());
|
||||||
|
OreDictStack smokeless = new OreDictStack(ANY_SMOKELESS.dust());
|
||||||
|
ComparableStack cSmall = new ComparableStack(ModItems.casing, 1, EnumCasingType.SMALL);
|
||||||
|
ComparableStack cBig = new ComparableStack(ModItems.casing, 1, EnumCasingType.LARGE);
|
||||||
|
ComparableStack sSmall = new ComparableStack(ModItems.casing, 1, EnumCasingType.SMALL_STEEL);
|
||||||
|
ComparableStack sBig = new ComparableStack(ModItems.casing, 1, EnumCasingType.LARGE_STEEL);
|
||||||
|
ComparableStack bpShell = new ComparableStack(ModItems.casing, 1, EnumCasingType.SHOTSHELL);
|
||||||
|
ComparableStack pShell = new ComparableStack(ModItems.casing, 1, EnumCasingType.BUCKSHOT);
|
||||||
|
ComparableStack sShell = new ComparableStack(ModItems.casing, 1, EnumCasingType.BUCKSHOT_ADVANCED);
|
||||||
|
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M357_SP, 8),
|
||||||
|
null, lead, null,
|
||||||
|
null, smokeless, null,
|
||||||
|
null, cSmall, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M357_FMJ, 8),
|
||||||
|
null, steel, null,
|
||||||
|
null, smokeless, null,
|
||||||
|
null, cSmall, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M357_JHP, 8),
|
||||||
|
plastic, copper, null,
|
||||||
|
null, smokeless, null,
|
||||||
|
null, cSmall, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M357_AP, 8),
|
||||||
|
null, wSteel, null,
|
||||||
|
null, smokeless.copy(2), null,
|
||||||
|
null, sSmall, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M357_EXPRESS, 8),
|
||||||
|
null, steel, null,
|
||||||
|
null, smokeless.copy(3), null,
|
||||||
|
null, cSmall, null));
|
||||||
|
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M44_SP, 6),
|
||||||
|
null, lead, null,
|
||||||
|
null, smokeless, null,
|
||||||
|
null, cSmall, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M44_FMJ, 6),
|
||||||
|
null, steel, null,
|
||||||
|
null, smokeless, null,
|
||||||
|
null, cSmall, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M44_JHP, 6),
|
||||||
|
plastic, copper, null,
|
||||||
|
null, smokeless, null,
|
||||||
|
null, cSmall, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M44_AP, 6),
|
||||||
|
null, wSteel, null,
|
||||||
|
null, smokeless.copy(2), null,
|
||||||
|
null, sSmall, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.M44_EXPRESS, 6),
|
||||||
|
null, steel, null,
|
||||||
|
null, smokeless.copy(3), null,
|
||||||
|
null, cSmall, null));
|
||||||
|
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P22_SP, 24),
|
||||||
|
null, lead, null,
|
||||||
|
null, smokeless, null,
|
||||||
|
null, cSmall, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P22_FMJ, 24),
|
||||||
|
null, steel, null,
|
||||||
|
null, smokeless, null,
|
||||||
|
null, cSmall, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P22_JHP, 24),
|
||||||
|
plastic, copper, null,
|
||||||
|
null, smokeless, null,
|
||||||
|
null, cSmall, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P22_AP, 24),
|
||||||
|
null, wSteel, null,
|
||||||
|
null, smokeless.copy(2), null,
|
||||||
|
null, sSmall, null));
|
||||||
|
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P9_SP, 12),
|
||||||
|
null, lead, null,
|
||||||
|
null, smokeless, null,
|
||||||
|
null, cSmall, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P9_FMJ, 12),
|
||||||
|
null, steel, null,
|
||||||
|
null, smokeless, null,
|
||||||
|
null, cSmall, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P9_JHP, 12),
|
||||||
|
plastic, copper, null,
|
||||||
|
null, smokeless, null,
|
||||||
|
null, cSmall, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P9_AP, 12),
|
||||||
|
null, wSteel, null,
|
||||||
|
null, smokeless.copy(2), null,
|
||||||
|
null, sSmall, null));
|
||||||
|
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R556_SP, 16),
|
||||||
|
null, lead.copy(2), null,
|
||||||
|
null, smokeless.copy(2), null,
|
||||||
|
null, cSmall.copy(2), null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R556_FMJ, 16),
|
||||||
|
null, steel.copy(2), null,
|
||||||
|
null, smokeless.copy(2), null,
|
||||||
|
null, cSmall.copy(2), null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R556_JHP, 16),
|
||||||
|
plastic, copper.copy(2), null,
|
||||||
|
null, smokeless.copy(2), null,
|
||||||
|
null, cSmall.copy(2), null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R556_AP, 16),
|
||||||
|
null, wSteel.copy(2), null,
|
||||||
|
null, smokeless.copy(4), null,
|
||||||
|
null, sSmall.copy(2), null));
|
||||||
|
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R762_SP, 12),
|
||||||
|
null, lead.copy(2), null,
|
||||||
|
null, smokeless.copy(2), null,
|
||||||
|
null, cSmall.copy(2), null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R762_FMJ, 12),
|
||||||
|
null, steel.copy(2), null,
|
||||||
|
null, smokeless.copy(2), null,
|
||||||
|
null, cSmall.copy(2), null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R762_JHP, 12),
|
||||||
|
plastic, copper.copy(2), null,
|
||||||
|
null, smokeless.copy(2), null,
|
||||||
|
null, cSmall.copy(2), null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R762_AP, 12),
|
||||||
|
null, wSteel.copy(2), null,
|
||||||
|
null, smokeless.copy(4), null,
|
||||||
|
null, sSmall.copy(2), null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.R762_DU, 12),
|
||||||
|
null, uranium.copy(2), null,
|
||||||
|
null, smokeless.copy(4), null,
|
||||||
|
null, sSmall.copy(2), null));
|
||||||
|
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.BMG50_SP, 12),
|
||||||
|
null, lead.copy(2), null,
|
||||||
|
null, smokeless.copy(3), null,
|
||||||
|
null, cBig, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.BMG50_FMJ, 12),
|
||||||
|
null, steel.copy(2), null,
|
||||||
|
null, smokeless.copy(3), null,
|
||||||
|
null, cBig, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.BMG50_JHP, 12),
|
||||||
|
plastic, copper.copy(2), null,
|
||||||
|
null, smokeless.copy(3), null,
|
||||||
|
null, cBig, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.BMG50_AP, 12),
|
||||||
|
null, wSteel.copy(2), null,
|
||||||
|
null, smokeless.copy(6), null,
|
||||||
|
null, sBig, null));
|
||||||
|
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.BMG50_DU, 12),
|
||||||
|
null, uranium.copy(2), null,
|
||||||
|
null, smokeless.copy(6), null,
|
||||||
|
null, sBig, null));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFileName() {
|
||||||
|
return "hbmAmmoPress.json";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getComment() {
|
||||||
|
return "Input array describes slots from left to right, top to bottom. Make sure the input array is exactly 9 elements long, empty slots are represented by null.";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Object getRecipeObject() {
|
||||||
|
return recipes;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void deleteRecipes() {
|
||||||
|
recipes.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void readRecipe(JsonElement recipe) {
|
||||||
|
JsonObject obj = (JsonObject) recipe;
|
||||||
|
|
||||||
|
ItemStack output = this.readItemStack(obj.get("output").getAsJsonArray());
|
||||||
|
JsonArray inputArray = obj.get("input").getAsJsonArray();
|
||||||
|
AStack[] input = new AStack[9];
|
||||||
|
|
||||||
|
for(int i = 0; i < 9; i++) {
|
||||||
|
JsonElement element = inputArray.get(i);
|
||||||
|
if(element.isJsonNull()) {
|
||||||
|
input[i] = null;
|
||||||
|
} else {
|
||||||
|
input[i] = this.readAStack(element.getAsJsonArray());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.recipes.add(new AmmoPressRecipe(output, input));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeRecipe(Object recipe, JsonWriter writer) throws IOException {
|
||||||
|
AmmoPressRecipe rec = (AmmoPressRecipe) recipe;
|
||||||
|
|
||||||
|
writer.name("output");
|
||||||
|
this.writeItemStack(rec.output, writer);
|
||||||
|
|
||||||
|
writer.name("input").beginArray();
|
||||||
|
for(int i = 0; i < rec.input.length; i++) {
|
||||||
|
if(rec.input[i] == null) {
|
||||||
|
writer.nullValue();
|
||||||
|
} else {
|
||||||
|
this.writeAStack(rec.input[i], writer);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
writer.endArray();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static class AmmoPressRecipe {
|
||||||
|
public ItemStack output;
|
||||||
|
public AStack[] input;
|
||||||
|
|
||||||
|
public AmmoPressRecipe(ItemStack output, AStack... input) {
|
||||||
|
this.output = output;
|
||||||
|
this.input = input;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -73,6 +73,7 @@ public abstract class SerializableRecipe {
|
|||||||
recipeHandlers.add(new ArcWelderRecipes());
|
recipeHandlers.add(new ArcWelderRecipes());
|
||||||
recipeHandlers.add(new RotaryFurnaceRecipes());
|
recipeHandlers.add(new RotaryFurnaceRecipes());
|
||||||
recipeHandlers.add(new ExposureChamberRecipes());
|
recipeHandlers.add(new ExposureChamberRecipes());
|
||||||
|
recipeHandlers.add(new AmmoPressRecipes());
|
||||||
recipeHandlers.add(new AssemblerRecipes());
|
recipeHandlers.add(new AssemblerRecipes());
|
||||||
|
|
||||||
recipeHandlers.add(new MatDistribution());
|
recipeHandlers.add(new MatDistribution());
|
||||||
|
|||||||
@ -201,7 +201,7 @@ public class BulletConfig implements Cloneable {
|
|||||||
|
|
||||||
float newHealth = living.getHealth();
|
float newHealth = living.getHealth();
|
||||||
|
|
||||||
if(bullet.config.damageFalloffByPen) bullet.damage -= Math.max(prevHealth - newHealth, 0);
|
if(bullet.config.damageFalloffByPen) bullet.damage -= Math.max(prevHealth - newHealth, 0) * 0.5;
|
||||||
if(!bullet.doesPenetrate() || bullet.damage < 0) {
|
if(!bullet.doesPenetrate() || bullet.damage < 0) {
|
||||||
bullet.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
bullet.setPosition(mop.hitVec.xCoord, mop.hitVec.yCoord, mop.hitVec.zCoord);
|
||||||
bullet.setDead();
|
bullet.setDead();
|
||||||
|
|||||||
@ -74,7 +74,7 @@ public class GunFactory {
|
|||||||
R762_SP, R762_FMJ, R762_JHP, R762_AP, R762_DU,
|
R762_SP, R762_FMJ, R762_JHP, R762_AP, R762_DU,
|
||||||
BMG50_SP, BMG50_FMJ, BMG50_JHP, BMG50_AP, BMG50_DU,
|
BMG50_SP, BMG50_FMJ, BMG50_JHP, BMG50_AP, BMG50_DU,
|
||||||
G12_BP, G12_BP_MAGNUM, G12_BP_SLUG, G12, G12_SLUG, G12_FLECHETTE, G12_MAGNUM, G12_EXPLOSIVE, G12_PHOSPHORUS, G12_ANTHRAX,
|
G12_BP, G12_BP_MAGNUM, G12_BP_SLUG, G12, G12_SLUG, G12_FLECHETTE, G12_MAGNUM, G12_EXPLOSIVE, G12_PHOSPHORUS, G12_ANTHRAX,
|
||||||
G26_FLARE,
|
G26_FLARE, G26_FLARE_SUPPLY, G26_FLARE_WEAPON,
|
||||||
G40_HE, G40_HEAT, G40_DEMO, G40_INC, G40_PHOSPHORUS,
|
G40_HE, G40_HEAT, G40_DEMO, G40_INC, G40_PHOSPHORUS,
|
||||||
ROCKET_HE, ROCKET_HEAT, ROCKET_DEMO, ROCKET_INC, ROCKET_PHOSPHORUS,
|
ROCKET_HE, ROCKET_HEAT, ROCKET_DEMO, ROCKET_INC, ROCKET_PHOSPHORUS,
|
||||||
FLAME_DIESEL, FLAME_GAS, FLAME_NAPALM, FLAME_BALEFIRE,
|
FLAME_DIESEL, FLAME_GAS, FLAME_NAPALM, FLAME_BALEFIRE,
|
||||||
|
|||||||
@ -124,6 +124,8 @@ public class GunFactoryClient {
|
|||||||
g12_equestrian.setRenderer(LegoClient.RENDER_LEGENDARY_BULLET);
|
g12_equestrian.setRenderer(LegoClient.RENDER_LEGENDARY_BULLET);
|
||||||
|
|
||||||
g26_flare.setRenderer(LegoClient.RENDER_FLARE);
|
g26_flare.setRenderer(LegoClient.RENDER_FLARE);
|
||||||
|
g26_flare_supply.setRenderer(LegoClient.RENDER_FLARE_SUPPLY);
|
||||||
|
g26_flare_weapon.setRenderer(LegoClient.RENDER_FLARE_WEAPON);
|
||||||
|
|
||||||
setRendererBulk(LegoClient.RENDER_GRENADE, g40_he, g40_heat, g40_demo, g40_inc);
|
setRendererBulk(LegoClient.RENDER_GRENADE, g40_he, g40_heat, g40_demo, g40_inc);
|
||||||
|
|
||||||
|
|||||||
@ -115,8 +115,12 @@ public class LegoClient {
|
|||||||
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
GL11.glEnable(GL11.GL_TEXTURE_2D);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_FLARE = (bullet, interp) -> { renderFlare(bullet, interp, 1F, 0.5F, 0.5F); };
|
||||||
|
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_FLARE_SUPPLY = (bullet, interp) -> { renderFlare(bullet, interp, 0.5F, 0.5F, 1F); };
|
||||||
|
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_FLARE_WEAPON = (bullet, interp) -> { renderFlare(bullet, interp, 0.5F, 1F, 0.5F); };
|
||||||
|
|
||||||
private static final ResourceLocation flare = new ResourceLocation(RefStrings.MODID + ":textures/particle/flare.png");
|
private static final ResourceLocation flare = new ResourceLocation(RefStrings.MODID + ":textures/particle/flare.png");
|
||||||
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_FLARE = (bullet, interp) -> {
|
public static void renderFlare(EntityBulletBaseMK4 bullet, float interp, float r, float g, float b) {
|
||||||
|
|
||||||
if(bullet.ticksExisted < 2) return;
|
if(bullet.ticksExisted < 2) return;
|
||||||
|
|
||||||
@ -144,7 +148,7 @@ public class LegoClient {
|
|||||||
double posZ = 0;
|
double posZ = 0;
|
||||||
double scale = Math.min(5, (bullet.ticksExisted + interp - 2) * 0.5) * (0.8 + bullet.worldObj.rand.nextDouble() * 0.4);
|
double scale = Math.min(5, (bullet.ticksExisted + interp - 2) * 0.5) * (0.8 + bullet.worldObj.rand.nextDouble() * 0.4);
|
||||||
|
|
||||||
tess.setColorRGBA_F(1F, 0.5F, 0.5F, 0.5F);
|
tess.setColorRGBA_F(r, g, b, 0.5F);
|
||||||
tess.addVertexWithUV((double) (posX - f1 * scale - f3 * scale), (double) (posY - f5 * scale), (double) (posZ - f2 * scale - f4 * scale), 1, 1);
|
tess.addVertexWithUV((double) (posX - f1 * scale - f3 * scale), (double) (posY - f5 * scale), (double) (posZ - f2 * scale - f4 * scale), 1, 1);
|
||||||
tess.addVertexWithUV((double) (posX - f1 * scale + f3 * scale), (double) (posY + f5 * scale), (double) (posZ - f2 * scale + f4 * scale), 1, 0);
|
tess.addVertexWithUV((double) (posX - f1 * scale + f3 * scale), (double) (posY + f5 * scale), (double) (posZ - f2 * scale + f4 * scale), 1, 0);
|
||||||
tess.addVertexWithUV((double) (posX + f1 * scale + f3 * scale), (double) (posY + f5 * scale), (double) (posZ + f2 * scale + f4 * scale), 0, 0);
|
tess.addVertexWithUV((double) (posX + f1 * scale + f3 * scale), (double) (posY + f5 * scale), (double) (posZ + f2 * scale + f4 * scale), 0, 0);
|
||||||
@ -166,7 +170,7 @@ public class LegoClient {
|
|||||||
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
|
||||||
GL11.glDisable(GL11.GL_BLEND);
|
GL11.glDisable(GL11.GL_BLEND);
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
};
|
}
|
||||||
|
|
||||||
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_GRENADE = (bullet, interp) -> {
|
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_GRENADE = (bullet, interp) -> {
|
||||||
GL11.glScalef(0.25F, 0.25F, 0.25F);
|
GL11.glScalef(0.25F, 0.25F, 0.25F);
|
||||||
|
|||||||
@ -875,5 +875,27 @@ public class Orchestras {
|
|||||||
if(entity.worldObj.isRemote) return;
|
if(entity.worldObj.isRemote) return;
|
||||||
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
AnimType type = ItemGunBaseNT.getLastAnim(stack, ctx.configIndex);
|
||||||
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
int timer = ItemGunBaseNT.getAnimTimer(stack, ctx.configIndex);
|
||||||
|
|
||||||
|
if(type == AnimType.CYCLE) {
|
||||||
|
if(timer == 40) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 0.25F, 1.25F);
|
||||||
|
}
|
||||||
|
if(type == AnimType.CYCLE_DRY) {
|
||||||
|
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 1F, 0.8F);
|
||||||
|
if(timer == 5) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.pistolCock", 1F, 0.9F);
|
||||||
|
if(timer == 40) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.dryFireClick", 0.25F, 1.25F);
|
||||||
|
}
|
||||||
|
if(type == AnimType.RELOAD) {
|
||||||
|
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 0.9F);
|
||||||
|
if(timer == 10) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magRemove", 1F, 1F);
|
||||||
|
if(timer == 24) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magInsert", 1F, 1F);
|
||||||
|
if(timer == 34) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F);
|
||||||
|
}
|
||||||
|
if(type == AnimType.INSPECT) {
|
||||||
|
if(timer == 0) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 0.9F);
|
||||||
|
if(timer == 10) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallRemove", 1F, 1F);
|
||||||
|
|
||||||
|
if(timer == 114) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.magSmallInsert", 1F, 1F);
|
||||||
|
if(timer == 124) entity.worldObj.playSoundAtEntity(entity, "hbm:weapon.reload.revolverClose", 1F, 1F);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -41,6 +41,9 @@ import net.minecraftforge.common.util.ForgeDirection;
|
|||||||
public class XFactory40mm {
|
public class XFactory40mm {
|
||||||
|
|
||||||
public static BulletConfig g26_flare;
|
public static BulletConfig g26_flare;
|
||||||
|
public static BulletConfig g26_flare_supply;
|
||||||
|
public static BulletConfig g26_flare_weapon;
|
||||||
|
|
||||||
public static BulletConfig g40_he;
|
public static BulletConfig g40_he;
|
||||||
public static BulletConfig g40_heat;
|
public static BulletConfig g40_heat;
|
||||||
public static BulletConfig g40_demo;
|
public static BulletConfig g40_demo;
|
||||||
@ -99,7 +102,9 @@ public class XFactory40mm {
|
|||||||
|
|
||||||
public static void init() {
|
public static void init() {
|
||||||
|
|
||||||
g26_flare = new BulletConfig().setItem(EnumAmmo.G26_FLARE).setLife(100).setVel(2F).setGrav(0.035D).setRenderRotations(false).setOnImpact(LAMBDA_STANDARD_IGNITE).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x9E1616).setScale(2F).register("G40Flare"));
|
g26_flare = new BulletConfig().setItem(EnumAmmo.G26_FLARE).setLife(100).setVel(2F).setGrav(0.015D).setRenderRotations(false).setOnImpact(LAMBDA_STANDARD_IGNITE).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x9E1616).setScale(2F).register("g26Flare"));
|
||||||
|
g26_flare_supply = new BulletConfig().setItem(EnumAmmo.G26_FLARE_SUPPLY).setLife(100).setVel(2F).setGrav(0.015D).setRenderRotations(false).setOnImpact(LAMBDA_STANDARD_IGNITE).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x3C80F0).setScale(2F).register("g26FlareSupply"));
|
||||||
|
g26_flare_weapon = new BulletConfig().setItem(EnumAmmo.G26_FLARE_WEAPON).setLife(100).setVel(2F).setGrav(0.015D).setRenderRotations(false).setOnImpact(LAMBDA_STANDARD_IGNITE).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x278400).setScale(2F).register("g26FlareWeapon"));
|
||||||
|
|
||||||
BulletConfig g40_base = new BulletConfig().setLife(200).setVel(2F).setGrav(0.035D);
|
BulletConfig g40_base = new BulletConfig().setLife(200).setVel(2F).setGrav(0.035D);
|
||||||
g40_he = g40_base.clone().setItem(EnumAmmo.G40_HE).setOnImpact(LAMBDA_STANDARD_EXPLODE).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x777777).setScale(2, 2F, 1.5F).register("g40"));
|
g40_he = g40_base.clone().setItem(EnumAmmo.G40_HE).setOnImpact(LAMBDA_STANDARD_EXPLODE).setCasing(new SpentCasing(CasingType.STRAIGHT).setColor(0x777777).setScale(2, 2F, 1.5F).register("g40"));
|
||||||
@ -111,7 +116,7 @@ public class XFactory40mm {
|
|||||||
.dura(100).draw(7).inspect(39).crosshair(Crosshair.L_CIRCUMFLEX).smoke(LAMBDA_SMOKE)
|
.dura(100).draw(7).inspect(39).crosshair(Crosshair.L_CIRCUMFLEX).smoke(LAMBDA_SMOKE)
|
||||||
.rec(new Receiver(0)
|
.rec(new Receiver(0)
|
||||||
.dmg(15F).delay(20).reload(28).jam(33).sound("hbm:weapon.hkShoot", 1.0F, 1.0F)
|
.dmg(15F).delay(20).reload(28).jam(33).sound("hbm:weapon.hkShoot", 1.0F, 1.0F)
|
||||||
.mag(new MagazineSingleReload(0, 1).addConfigs(g26_flare))
|
.mag(new MagazineSingleReload(0, 1).addConfigs(g26_flare, g26_flare_supply, g26_flare_weapon))
|
||||||
.offset(0.75, -0.0625, -0.1875D)
|
.offset(0.75, -0.0625, -0.1875D)
|
||||||
.setupStandardFire().recoil(Lego.LAMBDA_STANDARD_RECOIL))
|
.setupStandardFire().recoil(Lego.LAMBDA_STANDARD_RECOIL))
|
||||||
.setupStandardConfiguration()
|
.setupStandardConfiguration()
|
||||||
|
|||||||
@ -13,7 +13,6 @@ import com.hbm.items.weapon.sedna.ItemGunBaseNT.GunState;
|
|||||||
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
|
import com.hbm.items.weapon.sedna.ItemGunBaseNT.LambdaContext;
|
||||||
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
|
import com.hbm.items.weapon.sedna.ItemGunBaseNT.WeaponQuality;
|
||||||
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
|
import com.hbm.items.weapon.sedna.factory.GunFactory.EnumAmmo;
|
||||||
import com.hbm.items.weapon.sedna.mags.IMagazine;
|
|
||||||
import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
|
import com.hbm.items.weapon.sedna.mags.MagazineFullReload;
|
||||||
import com.hbm.main.MainRegistry;
|
import com.hbm.main.MainRegistry;
|
||||||
import com.hbm.particle.SpentCasing;
|
import com.hbm.particle.SpentCasing;
|
||||||
@ -55,9 +54,9 @@ public class XFactory556mm {
|
|||||||
).setUnlocalizedName("gun_g3");
|
).setUnlocalizedName("gun_g3");
|
||||||
|
|
||||||
ModItems.gun_stg77 = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
|
ModItems.gun_stg77 = new ItemGunBaseNT(WeaponQuality.A_SIDE, new GunConfig()
|
||||||
.dura(3_000).draw(10).inspect(33).crosshair(Crosshair.CIRCLE).smoke(LAMBDA_SMOKE)
|
.dura(3_000).draw(10).inspect(125).crosshair(Crosshair.CIRCLE).smoke(LAMBDA_SMOKE)
|
||||||
.rec(new Receiver(0)
|
.rec(new Receiver(0)
|
||||||
.dmg(15F).delay(2).dry(15).auto(true).spread(0.0F).reload(50).jam(47).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
|
.dmg(15F).delay(2).dry(15).auto(true).spread(0.0F).reload(37).jam(0).sound("hbm:weapon.fire.blackPowder", 1.0F, 1.0F)
|
||||||
.mag(new MagazineFullReload(0, 30).addConfigs(r556_sp, r556_fmj, r556_jhp, r556_ap))
|
.mag(new MagazineFullReload(0, 30).addConfigs(r556_sp, r556_fmj, r556_jhp, r556_ap))
|
||||||
.offset(1, -0.0625 * 2.5, -0.25D)
|
.offset(1, -0.0625 * 2.5, -0.25D)
|
||||||
.setupStandardFire().recoil(Lego.LAMBDA_STANDARD_RECOIL))
|
.setupStandardFire().recoil(Lego.LAMBDA_STANDARD_RECOIL))
|
||||||
@ -133,12 +132,26 @@ public class XFactory556mm {
|
|||||||
};
|
};
|
||||||
|
|
||||||
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_STG77_ANIMS = (stack, type) -> {
|
@SuppressWarnings("incomplete-switch") public static BiFunction<ItemStack, AnimType, BusAnimation> LAMBDA_STG77_ANIMS = (stack, type) -> {
|
||||||
boolean empty = ((ItemGunBaseNT) stack.getItem()).getConfig(stack, 0).getReceivers(stack)[0].getMagazine(stack).getAmount(stack, MainRegistry.proxy.me().inventory) <= 0;
|
|
||||||
switch(type) {
|
switch(type) {
|
||||||
case EQUIP: return new BusAnimation()
|
case EQUIP: return new BusAnimation()
|
||||||
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL));
|
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL));
|
||||||
case CYCLE: return new BusAnimation()
|
case CYCLE: return new BusAnimation()
|
||||||
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, ItemGunBaseNT.getIsAiming(stack) ? -0.125 : -0.375, 25, IType.SIN_DOWN).addPos(0, 0, 0, 75, IType.SIN_FULL));
|
.addBus("RECOIL", new BusAnimationSequence().addPos(0, 0, ItemGunBaseNT.getIsAiming(stack) ? -0.125 : -0.375, 25, IType.SIN_DOWN).addPos(0, 0, 0, 75, IType.SIN_FULL))
|
||||||
|
.addBus("SAFETY", new BusAnimationSequence().addPos(0.25, 0, 0, 0).addPos(0.25, 0, 0, 2000).addPos(0, 0, 0, 50));
|
||||||
|
case CYCLE_DRY: return new BusAnimation()
|
||||||
|
.addBus("BOLT", new BusAnimationSequence().addPos(0, 0, 0, 250).addPos(0, 0, -2, 150).addPos(0, 0, 0, 100, IType.SIN_UP))
|
||||||
|
.addBus("SAFETY", new BusAnimationSequence().addPos(0.25, 0, 0, 0).addPos(0.25, 0, 0, 2000).addPos(0, 0, 0, 50));
|
||||||
|
case RELOAD: return new BusAnimation()
|
||||||
|
.addBus("BOLT", new BusAnimationSequence().addPos(0, 0, -2, 150).addPos(0, 0, -2, 1600).addPos(0, 0, 0, 100, IType.SIN_UP))
|
||||||
|
.addBus("HANDLE", new BusAnimationSequence().addPos(0, 0, 0, 150).addPos(0, 0, 20, 50).addPos(0, 0, 20, 1500).addPos(0, 0, 0, 50))
|
||||||
|
.addBus("LIFT", new BusAnimationSequence().addPos(0, 0, 0, 200).addPos(-2, 0, 0, 100, IType.SIN_DOWN).addPos(0, 0, 0, 100, IType.SIN_FULL));
|
||||||
|
case INSPECT: return new BusAnimation()
|
||||||
|
.addBus("BOLT", new BusAnimationSequence().addPos(0, 0, -2, 150).addPos(0, 0, -2, 6100).addPos(0, 0, 0, 100, IType.SIN_UP))
|
||||||
|
.addBus("HANDLE", new BusAnimationSequence().addPos(0, 0, 0, 150).addPos(0, 0, 20, 50).addPos(0, 0, 20, 6000).addPos(0, 0, 0, 50))
|
||||||
|
.addBus("INSPECT_LEVER", new BusAnimationSequence().addPos(0, 0, 0, 500).addPos(0, 0, -10, 100).addPos(0, 0, -10, 100).addPos(0, 0, 0, 100))
|
||||||
|
.addBus("INSPECT_BARREL", new BusAnimationSequence().addPos(0, 0, 0, 600).addPos(0, 0, 20, 150).addPos(0, 0, 0, 400).addPos(0, 0, 0, 500).addPos(15, 0, 0, 500).addPos(15, 0, 0, 2000).addPos(0, 0, 0, 500).addPos(0, 0, 0, 500).addPos(0, 0, 20, 200).addPos(0, 0, 20, 400).addPos(0, 0, 0, 150))
|
||||||
|
.addBus("INSPECT_MOVE", new BusAnimationSequence().addPos(0, 0, 0, 750).addPos(0, 0, 6, 1000).addPos(2, 0, 3, 500, IType.SIN_FULL).addPos(2, 0.75, 0, 500, IType.SIN_FULL).addPos(2, 0.75, 0, 1000).addPos(2, 0, 3, 500, IType.SIN_FULL).addPos(0, 0, 6, 500).addPos(0, 0, 0, 1000))
|
||||||
|
.addBus("INSPECT_GUN", new BusAnimationSequence().addPos(0, 0, 0, 1750).addPos(15, 0, -70, 500, IType.SIN_FULL).addPos(15, 0, -70, 1500).addPos(0, 0, 0, 500, IType.SIN_FULL));
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@ -8,8 +8,6 @@ import com.hbm.render.anim.HbmAnimations;
|
|||||||
|
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraftforge.client.IItemRenderer;
|
|
||||||
import net.minecraftforge.client.IItemRenderer.ItemRenderType;
|
|
||||||
|
|
||||||
public class ItemRenderSTG77 extends ItemRenderWeaponBase {
|
public class ItemRenderSTG77 extends ItemRenderWeaponBase {
|
||||||
|
|
||||||
@ -35,31 +33,71 @@ public class ItemRenderSTG77 extends ItemRenderWeaponBase {
|
|||||||
GL11.glScaled(scale, scale, scale);
|
GL11.glScaled(scale, scale, scale);
|
||||||
|
|
||||||
double[] equip = HbmAnimations.getRelevantTransformation("EQUIP");
|
double[] equip = HbmAnimations.getRelevantTransformation("EQUIP");
|
||||||
|
double[] lift = HbmAnimations.getRelevantTransformation("LIFT");
|
||||||
double[] recoil = HbmAnimations.getRelevantTransformation("RECOIL");
|
double[] recoil = HbmAnimations.getRelevantTransformation("RECOIL");
|
||||||
double[] mag = HbmAnimations.getRelevantTransformation("MAG");
|
|
||||||
double[] speen = HbmAnimations.getRelevantTransformation("SPEEN");
|
|
||||||
double[] bolt = HbmAnimations.getRelevantTransformation("BOLT");
|
double[] bolt = HbmAnimations.getRelevantTransformation("BOLT");
|
||||||
double[] handle = HbmAnimations.getRelevantTransformation("HANDLE");
|
double[] handle = HbmAnimations.getRelevantTransformation("HANDLE");
|
||||||
double[] bullet = HbmAnimations.getRelevantTransformation("BULLET");
|
double[] safety = HbmAnimations.getRelevantTransformation("SAFETY");
|
||||||
|
|
||||||
|
double[] inspectGun = HbmAnimations.getRelevantTransformation("INSPECT_GUN");
|
||||||
|
double[] inspectBarrel = HbmAnimations.getRelevantTransformation("INSPECT_BARREL");
|
||||||
|
double[] inspectMove = HbmAnimations.getRelevantTransformation("INSPECT_MOVE");
|
||||||
|
double[] inspectLever = HbmAnimations.getRelevantTransformation("INSPECT_LEVER");
|
||||||
|
|
||||||
GL11.glTranslated(0, -1, -4);
|
GL11.glTranslated(0, -1, -4);
|
||||||
GL11.glRotated(equip[0], 1, 0, 0);
|
GL11.glRotated(equip[0], 1, 0, 0);
|
||||||
GL11.glTranslated(0, 1, 4);
|
GL11.glTranslated(0, 1, 4);
|
||||||
|
|
||||||
|
GL11.glTranslated(0, 0, -4);
|
||||||
|
GL11.glRotated(lift[0], 1, 0, 0);
|
||||||
|
GL11.glTranslated(0, 0, 4);
|
||||||
|
|
||||||
GL11.glTranslated(0, 0, recoil[2]);
|
GL11.glTranslated(0, 0, recoil[2]);
|
||||||
|
|
||||||
GL11.glShadeModel(GL11.GL_SMOOTH);
|
GL11.glShadeModel(GL11.GL_SMOOTH);
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
|
||||||
|
//GL11.glRotated(-70, 0, 0, 1);
|
||||||
|
//GL11.glRotated(15, 1, 0, 0);
|
||||||
|
GL11.glRotated(inspectGun[2], 0, 0, 1);
|
||||||
|
GL11.glRotated(inspectGun[0], 1, 0, 0);
|
||||||
|
|
||||||
ResourceManager.stg77.renderPart("Gun");
|
ResourceManager.stg77.renderPart("Gun");
|
||||||
ResourceManager.stg77.renderPart("Barrel");
|
|
||||||
ResourceManager.stg77.renderPart("Lever");
|
|
||||||
ResourceManager.stg77.renderPart("Magazine");
|
ResourceManager.stg77.renderPart("Magazine");
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
GL11.glTranslated(0.25, 0, 0);
|
GL11.glRotated(inspectLever[2], 0, 0, 1);
|
||||||
|
ResourceManager.stg77.renderPart("Lever");
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslated(0, 0, bolt[2]);
|
||||||
|
ResourceManager.stg77.renderPart("Breech");
|
||||||
|
GL11.glTranslated(0.125, 0, 0);
|
||||||
|
GL11.glRotated(handle[2], 0, 0, 1);
|
||||||
|
GL11.glTranslated(-0.125, 0, 0);
|
||||||
|
ResourceManager.stg77.renderPart("Handle");
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
GL11.glTranslated(safety[0], 0, 0);
|
||||||
ResourceManager.stg77.renderPart("Safety");
|
ResourceManager.stg77.renderPart("Safety");
|
||||||
GL11.glPopMatrix();
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
|
GL11.glPushMatrix();
|
||||||
|
//GL11.glTranslated(2, 0.75, 0);
|
||||||
|
//GL11.glRotated(15, 1, 0, 0);
|
||||||
|
//GL11.glRotated(0, 0, 0, 1);
|
||||||
|
|
||||||
|
GL11.glTranslated(inspectMove[0], inspectMove[1], inspectMove[2]);
|
||||||
|
GL11.glRotated(inspectBarrel[0], 1, 0, 0);
|
||||||
|
GL11.glRotated(inspectBarrel[2], 0, 0, 1);
|
||||||
|
ResourceManager.stg77.renderPart("Barrel");
|
||||||
|
GL11.glPopMatrix();
|
||||||
|
|
||||||
double smokeScale = 0.75;
|
double smokeScale = 0.75;
|
||||||
|
|
||||||
GL11.glPushMatrix();
|
GL11.glPushMatrix();
|
||||||
@ -83,9 +121,9 @@ public class ItemRenderSTG77 extends ItemRenderWeaponBase {
|
|||||||
@Override
|
@Override
|
||||||
public void setupThirdPerson(ItemStack stack) {
|
public void setupThirdPerson(ItemStack stack) {
|
||||||
super.setupThirdPerson(stack);
|
super.setupThirdPerson(stack);
|
||||||
double scale = 1D;
|
double scale = 1.5D;
|
||||||
GL11.glScaled(scale, scale, scale);
|
GL11.glScaled(scale, scale, scale);
|
||||||
GL11.glTranslated(0, 2, 4);
|
GL11.glTranslated(0, 1, 2);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,6 +148,8 @@ public class ItemRenderSTG77 extends ItemRenderWeaponBase {
|
|||||||
ResourceManager.stg77.renderPart("Lever");
|
ResourceManager.stg77.renderPart("Lever");
|
||||||
ResourceManager.stg77.renderPart("Magazine");
|
ResourceManager.stg77.renderPart("Magazine");
|
||||||
ResourceManager.stg77.renderPart("Safety");
|
ResourceManager.stg77.renderPart("Safety");
|
||||||
|
ResourceManager.stg77.renderPart("Handle");
|
||||||
|
ResourceManager.stg77.renderPart("Breech");
|
||||||
GL11.glShadeModel(GL11.GL_FLAT);
|
GL11.glShadeModel(GL11.GL_FLAT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -101,6 +101,7 @@ public class TileMappings {
|
|||||||
put(TileEntityCrateDesh.class, "tileentity_crate_desh");
|
put(TileEntityCrateDesh.class, "tileentity_crate_desh");
|
||||||
put(TileEntityMassStorage.class, "tileentity_mass_storage");
|
put(TileEntityMassStorage.class, "tileentity_mass_storage");
|
||||||
put(TileEntityMachinePress.class, "tileentity_press");
|
put(TileEntityMachinePress.class, "tileentity_press");
|
||||||
|
put(TileEntityMachineAmmoPress.class, "tileentity_ammo_press");
|
||||||
put(TileEntityMachineSiren.class, "tileentity_siren");
|
put(TileEntityMachineSiren.class, "tileentity_siren");
|
||||||
put(TileEntityMachineSPP.class, "tileentity_spp");
|
put(TileEntityMachineSPP.class, "tileentity_spp");
|
||||||
put(TileEntityMachineRadGen.class, "tileentity_radgen");
|
put(TileEntityMachineRadGen.class, "tileentity_radgen");
|
||||||
|
|||||||
@ -1,15 +1,25 @@
|
|||||||
package com.hbm.tileentity.machine;
|
package com.hbm.tileentity.machine;
|
||||||
|
|
||||||
|
import com.hbm.interfaces.IControlReceiver;
|
||||||
|
import com.hbm.inventory.container.ContainerMachineAmmoPress;
|
||||||
|
import com.hbm.inventory.gui.GUIMachineAmmoPress;
|
||||||
|
import com.hbm.inventory.recipes.AmmoPressRecipes;
|
||||||
|
import com.hbm.inventory.recipes.AmmoPressRecipes.AmmoPressRecipe;
|
||||||
import com.hbm.tileentity.IGUIProvider;
|
import com.hbm.tileentity.IGUIProvider;
|
||||||
import com.hbm.tileentity.TileEntityMachineBase;
|
import com.hbm.tileentity.TileEntityMachineBase;
|
||||||
|
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import io.netty.buffer.ByteBuf;
|
||||||
import net.minecraft.entity.player.EntityPlayer;
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.inventory.Container;
|
import net.minecraft.inventory.Container;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
|
|
||||||
public class TileEntityMachineAmmoPress extends TileEntityMachineBase implements IGUIProvider {
|
public class TileEntityMachineAmmoPress extends TileEntityMachineBase implements IControlReceiver, IGUIProvider {
|
||||||
|
|
||||||
|
public int selectedRecipe = -1;
|
||||||
|
|
||||||
public TileEntityMachineAmmoPress() {
|
public TileEntityMachineAmmoPress() {
|
||||||
super(10);
|
super(10);
|
||||||
@ -22,17 +32,93 @@ public class TileEntityMachineAmmoPress extends TileEntityMachineBase implements
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void updateEntity() {
|
public void updateEntity() {
|
||||||
|
if(!worldObj.isRemote) {
|
||||||
|
this.performRecipe();
|
||||||
|
this.networkPackNT(25);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// we want to update the output every time the grid changes, but producing output changes the grid again, so we just put a recursion brake on this fucker
|
||||||
|
public static boolean recipeLock = false;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setInventorySlotContents(int slot, ItemStack stack) {
|
||||||
|
super.setInventorySlotContents(slot, stack);
|
||||||
|
|
||||||
|
if(!recipeLock) {
|
||||||
|
recipeLock = true;
|
||||||
|
if(slot < 10) this.performRecipe();
|
||||||
|
recipeLock = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void performRecipe() {
|
||||||
|
if(selectedRecipe < 0 || selectedRecipe >= AmmoPressRecipes.recipes.size()) return;
|
||||||
|
|
||||||
|
AmmoPressRecipe recipe = AmmoPressRecipes.recipes.get(selectedRecipe);
|
||||||
|
|
||||||
|
if(slots[9] != null) {
|
||||||
|
if(slots[9].getItem() != recipe.output.getItem()) return;
|
||||||
|
if(slots[9].getItemDamage() != recipe.output.getItemDamage()) return;
|
||||||
|
if(slots[9].stackSize + recipe.output.stackSize > slots[9].getMaxStackSize()) return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(this.hasIngredients(recipe)) {
|
||||||
|
this.produceAmmo(recipe);
|
||||||
|
performRecipe();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public boolean hasIngredients(AmmoPressRecipe recipe) {
|
||||||
|
|
||||||
|
for(int i = 0; i < 9; i++) {
|
||||||
|
if(recipe.input[i] == null && slots[i] == null) continue;
|
||||||
|
if(recipe.input[i] != null && slots[i] == null) return false;
|
||||||
|
if(recipe.input[i] == null && slots[i] != null) return false;
|
||||||
|
if(!recipe.input[i].matchesRecipe(slots[i], false)) return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
//implies hasIngredients returns true, will violently explode otherwise
|
||||||
|
protected void produceAmmo(AmmoPressRecipe recipe) {
|
||||||
|
|
||||||
|
for(int i = 0; i < 9; i++) {
|
||||||
|
if(recipe.input[i] != null) this.decrStackSize(i, recipe.input[i].stacksize);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(slots[9] == null) {
|
||||||
|
slots[9] = recipe.output.copy();
|
||||||
|
} else {
|
||||||
|
slots[9].stackSize += recipe.output.stackSize;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void serialize(ByteBuf buf) {
|
||||||
|
super.serialize(buf);
|
||||||
|
buf.writeInt(this.selectedRecipe);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override public void deserialize(ByteBuf buf) {
|
||||||
|
super.deserialize(buf);
|
||||||
|
this.selectedRecipe = buf.readInt();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
public boolean hasPermission(EntityPlayer player) {
|
||||||
return null;
|
return this.isUseableByPlayer(player);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SideOnly(Side.CLIENT)
|
public void receiveControl(NBTTagCompound data) {
|
||||||
public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
|
int newRecipe = data.getInteger("selection");
|
||||||
return null;
|
if(newRecipe == selectedRecipe) this.selectedRecipe = -1;
|
||||||
|
else this.selectedRecipe = newRecipe;
|
||||||
|
this.markDirty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) { return new ContainerMachineAmmoPress(player.inventory, this); }
|
||||||
|
@Override @SideOnly(Side.CLIENT) public Object provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) { return new GUIMachineAmmoPress(player.inventory, this); }
|
||||||
}
|
}
|
||||||
|
|||||||
@ -95,7 +95,9 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
|
|||||||
if(processAsh(ashLevelMisc, EnumAshType.MISC, threshold)) ashLevelMisc -= threshold;
|
if(processAsh(ashLevelMisc, EnumAshType.MISC, threshold)) ashLevelMisc -= threshold;
|
||||||
|
|
||||||
this.maxBurnTime = this.burnTime = burn;
|
this.maxBurnTime = this.burnTime = burn;
|
||||||
|
ItemStack container = slots[0].getItem().getContainerItem(slots[0]);
|
||||||
this.decrStackSize(0, 1);
|
this.decrStackSize(0, 1);
|
||||||
|
if(slots[0] == null) slots[0] = container.copy();
|
||||||
this.markChanged();
|
this.markChanged();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1598,13 +1598,13 @@ item.casing_44.name=.44 Magnum-Hülsen
|
|||||||
item.casing_50.name=Großkaliberhülsen
|
item.casing_50.name=Großkaliberhülsen
|
||||||
item.casing_9.name=Kleinkaliberhülsen
|
item.casing_9.name=Kleinkaliberhülsen
|
||||||
item.casing_buckshot.name=Schrothülsen
|
item.casing_buckshot.name=Schrothülsen
|
||||||
item.casing.small.name=Kleine Rotgussgehäuse
|
item.casing.small.name=Kleine Patronenhülse
|
||||||
item.casing.small_steel.name=Stahlhülsen für kleine Waffen
|
item.casing.small_steel.name=Kleine Waffenstahlhülse
|
||||||
item.casing.large.name=Large Rotgussgehäuse
|
item.casing.large.name=Große Patronenhülse
|
||||||
item.casing.large_steel.name=Große Waffenstahlhülsen
|
item.casing.large_steel.name=Große Waffenstahlhülse
|
||||||
item.casing.shotshell.name=Schrotpatronenhülsen
|
item.casing.shotshell.name=Schwarzpulver-Schrothülse
|
||||||
item.casing.buckshot.name=Schrothülsen
|
item.casing.buckshot.name=Plastik-Schrothülse
|
||||||
item.casing.buckshot_advanced.name=Fortschrittliche Schrothülsen
|
item.casing.buckshot_advanced.name=Fortgeschrittene Schrothülse
|
||||||
item.catalyst_clay.name=Tonerde-Katalysator
|
item.catalyst_clay.name=Tonerde-Katalysator
|
||||||
item.catalytic_converter.name=Katalytischer Konverter
|
item.catalytic_converter.name=Katalytischer Konverter
|
||||||
item.cbt_device.name=CBT-Gerät
|
item.cbt_device.name=CBT-Gerät
|
||||||
|
|||||||
@ -2367,14 +2367,14 @@ item.casing_357.name=.357 Magnum Casings
|
|||||||
item.casing_44.name=.44 Magnum Casings
|
item.casing_44.name=.44 Magnum Casings
|
||||||
item.casing_50.name=Large Caliber Casings
|
item.casing_50.name=Large Caliber Casings
|
||||||
item.casing_9.name=Small Caliber Casings
|
item.casing_9.name=Small Caliber Casings
|
||||||
item.casing_buckshot.name=Buckshot Casings
|
item.casing_buckshot.name=Buckshot Casing
|
||||||
item.casing.small.name=Small Gunmetal Casings
|
item.casing.small.name=Small Gunmetal Casing
|
||||||
item.casing.small_steel.name=Small Weapon Steel Casings
|
item.casing.small_steel.name=Small Weapon Steel Casing
|
||||||
item.casing.large.name=Large Gunmetal Casings
|
item.casing.large.name=Large Gunmetal Casing
|
||||||
item.casing.large_steel.name=Large Weapon Steel Casings
|
item.casing.large_steel.name=Large Weapon Steel Casing
|
||||||
item.casing.shotshell.name=Shotshell Casings
|
item.casing.shotshell.name=Black Powder Shotshell Casing
|
||||||
item.casing.buckshot.name=Buckshot Casings
|
item.casing.buckshot.name=Plastic Shotshell Casing
|
||||||
item.casing.buckshot_advanced.name=Advanced Buckshot Casings
|
item.casing.buckshot_advanced.name=Advanced Shotshell Casing
|
||||||
item.catalyst_clay.name=Clay Catalyst
|
item.catalyst_clay.name=Clay Catalyst
|
||||||
item.catalytic_converter.name=Catalytic Converter
|
item.catalytic_converter.name=Catalytic Converter
|
||||||
item.cbt_device.name=CBT Device
|
item.cbt_device.name=CBT Device
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 1.9 KiB After Width: | Height: | Size: 3.5 KiB |
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
|
After Width: | Height: | Size: 237 B |
|
After Width: | Height: | Size: 235 B |
|
Before Width: | Height: | Size: 7.7 KiB After Width: | Height: | Size: 5.0 KiB |