mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
let me just *removes entire barrel*
This commit is contained in:
parent
e64a21ffd3
commit
4f60e44f8e
@ -9,21 +9,28 @@ 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.audio.PositionedSoundRecord;
|
||||
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;
|
||||
import net.minecraftforge.oredict.OreDictionary;
|
||||
|
||||
public class GUIMachineAmmoPress extends GuiInfoContainer {
|
||||
|
||||
@ -43,6 +50,8 @@ public class GUIMachineAmmoPress extends GuiInfoContainer {
|
||||
this.xSize = 176;
|
||||
this.ySize = 200;
|
||||
|
||||
this.selection = press.selectedRecipe;
|
||||
|
||||
regenerateRecipes();
|
||||
}
|
||||
|
||||
@ -90,7 +99,6 @@ public class GUIMachineAmmoPress extends GuiInfoContainer {
|
||||
private void resetPaging() {
|
||||
|
||||
this.index = 0;
|
||||
this.selection = -1;
|
||||
this.size = Math.max(0, (int)Math.ceil((this.recipes.size() - 12) / 2D));
|
||||
}
|
||||
|
||||
@ -125,19 +133,41 @@ public class GUIMachineAmmoPress extends GuiInfoContainer {
|
||||
|
||||
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));
|
||||
if(this.index > 0)
|
||||
this.index--;
|
||||
|
||||
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));
|
||||
if(this.index < this.size)
|
||||
this.index++;
|
||||
|
||||
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));
|
||||
mc.getSoundHandler().playSound(PositionedSoundRecord.func_147674_a(new ResourceLocation("gui.button.press"), 1.0F));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -190,12 +220,43 @@ public class GUIMachineAmmoPress extends GuiInfoContainer {
|
||||
this.mc.getTextureManager().bindTexture(texture);
|
||||
this.zLevel = 300.0F;
|
||||
|
||||
if(selection == i)
|
||||
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);
|
||||
}
|
||||
|
||||
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;
|
||||
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);
|
||||
|
||||
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.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);
|
||||
}
|
||||
|
||||
this.search.drawTextBox();
|
||||
}
|
||||
|
||||
|
||||
@ -882,7 +882,20 @@ public class Orchestras {
|
||||
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);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@ -54,9 +54,9 @@ public class XFactory556mm {
|
||||
).setUnlocalizedName("gun_g3");
|
||||
|
||||
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)
|
||||
.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))
|
||||
.offset(1, -0.0625 * 2.5, -0.25D)
|
||||
.setupStandardFire().recoil(Lego.LAMBDA_STANDARD_RECOIL))
|
||||
@ -132,7 +132,6 @@ public class XFactory556mm {
|
||||
};
|
||||
|
||||
@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) {
|
||||
case EQUIP: return new BusAnimation()
|
||||
.addBus("EQUIP", new BusAnimationSequence().addPos(45, 0, 0, 0).addPos(0, 0, 0, 500, IType.SIN_FULL));
|
||||
@ -140,7 +139,19 @@ public class XFactory556mm {
|
||||
.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("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;
|
||||
|
||||
@ -33,29 +33,50 @@ public class ItemRenderSTG77 extends ItemRenderWeaponBase {
|
||||
GL11.glScaled(scale, scale, scale);
|
||||
|
||||
double[] equip = HbmAnimations.getRelevantTransformation("EQUIP");
|
||||
double[] lift = HbmAnimations.getRelevantTransformation("LIFT");
|
||||
double[] recoil = HbmAnimations.getRelevantTransformation("RECOIL");
|
||||
double[] mag = HbmAnimations.getRelevantTransformation("MAG");
|
||||
double[] speen = HbmAnimations.getRelevantTransformation("SPEEN");
|
||||
double[] bolt = HbmAnimations.getRelevantTransformation("BOLT");
|
||||
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.glRotated(equip[0], 1, 0, 0);
|
||||
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.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("Barrel");
|
||||
ResourceManager.stg77.renderPart("Lever");
|
||||
ResourceManager.stg77.renderPart("Magazine");
|
||||
|
||||
GL11.glPushMatrix();
|
||||
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();
|
||||
|
||||
@ -63,6 +84,19 @@ public class ItemRenderSTG77 extends ItemRenderWeaponBase {
|
||||
GL11.glTranslated(safety[0], 0, 0);
|
||||
ResourceManager.stg77.renderPart("Safety");
|
||||
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;
|
||||
|
||||
@ -115,6 +149,7 @@ public class ItemRenderSTG77 extends ItemRenderWeaponBase {
|
||||
ResourceManager.stg77.renderPart("Magazine");
|
||||
ResourceManager.stg77.renderPart("Safety");
|
||||
ResourceManager.stg77.renderPart("Handle");
|
||||
ResourceManager.stg77.renderPart("Breech");
|
||||
GL11.glShadeModel(GL11.GL_FLAT);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
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.tileentity.IGUIProvider;
|
||||
@ -7,11 +8,15 @@ import com.hbm.tileentity.TileEntityMachineBase;
|
||||
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
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.nbt.NBTTagCompound;
|
||||
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() {
|
||||
super(10);
|
||||
@ -25,8 +30,36 @@ public class TileEntityMachineAmmoPress extends TileEntityMachineBase implements
|
||||
@Override
|
||||
public void updateEntity() {
|
||||
|
||||
if(!worldObj.isRemote) {
|
||||
|
||||
this.networkPackNT(25);
|
||||
}
|
||||
}
|
||||
|
||||
@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 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void receiveControl(NBTTagCompound data) {
|
||||
int newRecipe = data.getInteger("selection");
|
||||
if(newRecipe == selectedRecipe) this.selectedRecipe = -1;
|
||||
else this.selectedRecipe = newRecipe;
|
||||
this.markDirty();
|
||||
}
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
Binary file not shown.
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
Loading…
x
Reference in New Issue
Block a user