the mechanism

This commit is contained in:
Boblet 2024-11-07 15:50:14 +01:00
parent 4f60e44f8e
commit b9787fa08e
14 changed files with 246 additions and 60 deletions

View File

@ -66,3 +66,4 @@
* Fixed empty particle capsules not being extractable from the ICF pellet maker
* 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 the wood burner destroying container items like buckets when using lava as fuel

View File

@ -1,6 +1,8 @@
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;
@ -49,9 +51,20 @@ public class ContainerMachineAmmoPress extends Container {
return null;
}
} else {
if(!this.mergeItemStack(stack, 0, 9, false)) {
return null;
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) {

View File

@ -19,7 +19,6 @@ import com.hbm.packet.toserver.NBTControlPacket;
import com.hbm.tileentity.machine.TileEntityMachineAmmoPress;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.renderer.OpenGlHelper;
@ -30,7 +29,6 @@ import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.oredict.OreDictionary;
public class GUIMachineAmmoPress extends GuiInfoContainer {
@ -99,7 +97,7 @@ public class GUIMachineAmmoPress extends GuiInfoContainer {
private void resetPaging() {
this.index = 0;
this.size = Math.max(0, (int)Math.ceil((this.recipes.size() - 12) / 2D));
this.size = Math.max(0, (int)Math.ceil((this.recipes.size() - 12) / 3D));
}
@Override
@ -123,6 +121,21 @@ public class GUIMachineAmmoPress extends GuiInfoContainer {
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
@ -132,13 +145,13 @@ public class GUIMachineAmmoPress extends GuiInfoContainer {
this.search.mouseClicked(x, y, k);
if(guiLeft + 7 <= x && guiLeft + 7 + 9 > x && guiTop + 17 < y && guiTop + 17 + 54 >= y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
click();
if(this.index > 0) this.index--;
return;
}
if(guiLeft + 88 <= x && guiLeft + 88 + 9 > x && guiTop + 17 < y && guiTop + 17 + 54 >= y) {
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
click();
if(this.index < this.size) this.index++;
return;
}
@ -164,7 +177,7 @@ public class GUIMachineAmmoPress extends GuiInfoContainer {
NBTTagCompound data = new NBTTagCompound();
data.setInteger("selection", this.selection);
PacketDispatcher.wrapper.sendToServer(new NBTControlPacket(data, press.xCoord, press.yCoord, press.zCoord));
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
click();
return;
}
}
@ -208,11 +221,12 @@ public class GUIMachineAmmoPress extends GuiInfoContainer {
AmmoPressRecipe recipe = recipes.get(i);
FontRenderer font = null;
if (recipe.output != null) font = recipe.output.getItem().getFontRenderer(recipe.output);
if (font == null) font = fontRendererObj;
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);
@ -224,6 +238,12 @@ public class GUIMachineAmmoPress extends GuiInfoContainer {
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()) {
@ -232,6 +252,7 @@ public class GUIMachineAmmoPress extends GuiInfoContainer {
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()));
@ -239,22 +260,26 @@ public class GUIMachineAmmoPress extends GuiInfoContainer {
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(input.getItem().getFontRenderer(input), this.mc.getTextureManager(), input, guiLeft + 116 + 18 * (i % 3), guiTop + 18 + 18 * (i / 3));
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, guiTop + 18, 116, 18, 54, 54);
GL11.glColor4f(1F, 1F, 1F, 1F);
GL11.glDisable(GL11.GL_BLEND);
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();

View File

@ -22,6 +22,7 @@ import com.hbm.util.BobMathUtil;
import com.hbm.util.I18nUtil;
import net.minecraft.client.Minecraft;
import net.minecraft.client.audio.PositionedSoundRecord;
import net.minecraft.client.gui.FontRenderer;
import net.minecraft.client.gui.inventory.GuiContainer;
import net.minecraft.client.renderer.RenderHelper;
@ -291,6 +292,11 @@ public abstract class GuiInfoContainer extends GuiContainer implements INEIGuiHa
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
@Override
@Optional.Method(modid = "NotEnoughItems")

View File

@ -30,8 +30,10 @@ public class AmmoPressRecipes extends SerializableRecipe {
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);
@ -41,73 +43,140 @@ public class AmmoPressRecipes extends SerializableRecipe {
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.P9_SP, 8),
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.P9_FMJ, 8),
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.P9_JHP, 8),
plastic, copper, null,
null, smokeless, null,
null, cSmall, null));
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P9_JHP, 8),
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.P9_SP, 8),
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.P9_FMJ, 8),
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.P9_JHP, 8),
plastic, copper, null,
null, smokeless, null,
null, cSmall, null));
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P9_JHP, 8),
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.P9_SP, 8),
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.P9_FMJ, 8),
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.P9_JHP, 8),
plastic, copper, null,
null, smokeless, null,
null, cSmall, null));
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P9_JHP, 8),
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, 8),
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, 8),
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, 8),
plastic, copper, null,
null, smokeless, null,
null, cSmall, null));
recipes.add(new AmmoPressRecipe(DictFrame.fromOne(ModItems.ammo_standard, EnumAmmo.P9_JHP, 8),
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

View File

@ -74,7 +74,7 @@ public class GunFactory {
R762_SP, R762_FMJ, R762_JHP, R762_AP, R762_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,
G26_FLARE,
G26_FLARE, G26_FLARE_SUPPLY, G26_FLARE_WEAPON,
G40_HE, G40_HEAT, G40_DEMO, G40_INC, G40_PHOSPHORUS,
ROCKET_HE, ROCKET_HEAT, ROCKET_DEMO, ROCKET_INC, ROCKET_PHOSPHORUS,
FLAME_DIESEL, FLAME_GAS, FLAME_NAPALM, FLAME_BALEFIRE,

View File

@ -122,8 +122,10 @@ public class GunFactoryClient {
g12_phosphorus.setRenderer(LegoClient.RENDER_AP_BULLET);
g12_anthrax.setRenderer(LegoClient.RENDER_STANDARD_BULLET);
g12_equestrian.setRenderer(LegoClient.RENDER_LEGENDARY_BULLET);
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);

View File

@ -115,8 +115,12 @@ public class LegoClient {
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");
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;
@ -144,7 +148,7 @@ public class LegoClient {
double posZ = 0;
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, 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.glDisable(GL11.GL_BLEND);
GL11.glPopMatrix();
};
}
public static BiConsumer<EntityBulletBaseMK4, Float> RENDER_GRENADE = (bullet, interp) -> {
GL11.glScalef(0.25F, 0.25F, 0.25F);

View File

@ -41,6 +41,9 @@ import net.minecraftforge.common.util.ForgeDirection;
public class XFactory40mm {
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_heat;
public static BulletConfig g40_demo;
@ -99,7 +102,9 @@ public class XFactory40mm {
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);
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)
.rec(new Receiver(0)
.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)
.setupStandardFire().recoil(Lego.LAMBDA_STANDARD_RECOIL))
.setupStandardConfiguration()

View File

@ -3,6 +3,8 @@ 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.TileEntityMachineBase;
@ -11,6 +13,7 @@ import cpw.mods.fml.relauncher.SideOnly;
import io.netty.buffer.ByteBuf;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
@ -29,12 +32,68 @@ public class TileEntityMachineAmmoPress extends TileEntityMachineBase implements
@Override
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);
@ -47,9 +106,6 @@ public class TileEntityMachineAmmoPress extends TileEntityMachineBase implements
this.selectedRecipe = buf.readInt();
}
@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); }
@Override
public boolean hasPermission(EntityPlayer player) {
return this.isUseableByPlayer(player);
@ -62,4 +118,7 @@ public class TileEntityMachineAmmoPress extends TileEntityMachineBase implements
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); }
}

View File

@ -95,7 +95,9 @@ public class TileEntityMachineWoodBurner extends TileEntityMachineBase implement
if(processAsh(ashLevelMisc, EnumAshType.MISC, threshold)) ashLevelMisc -= threshold;
this.maxBurnTime = this.burnTime = burn;
ItemStack container = slots[0].getItem().getContainerItem(slots[0]);
this.decrStackSize(0, 1);
if(slots[0] == null) slots[0] = container.copy();
this.markChanged();
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 237 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 235 B