mirror of
https://github.com/HbmMods/Hbm-s-Nuclear-Tech-GIT.git
synced 2026-01-25 10:32:49 +00:00
more gunbase work
This commit is contained in:
parent
0c18361b8b
commit
706e5731e3
@ -1344,6 +1344,29 @@ item.gun_hp_ammo.name=Tintenpatrone
|
||||
item.gun_euthanasia_ammo.name=Spritze
|
||||
item.gun_defabricator_ammo.name=Defabrikator-Energiezelle
|
||||
|
||||
item.ammo_12gauge.name=Kaliber 12 Schrot
|
||||
item.ammo_12gauge_incendiary.name=Kaliber 12 Schrot (Brand)
|
||||
item.ammo_20gauge.name=Kaliber 20 Schrot
|
||||
item.ammo_20gauge_slug.name=Kaliber 20 Brenneke
|
||||
item.ammo_20gauge_flechette.name=Kaliber 20 Flechet
|
||||
item.ammo_20gauge_incendiary.name=Kaliber 20 Schrot (Brand)
|
||||
item.ammo_20gauge_shock.name=Kaliber 20 Schrot (Schock)
|
||||
item.ammo_20gauge_caustic.name=Kaliber 20 Schrot (Ätzend)
|
||||
item.ammo_20gauge_explosive.name=Kaliber 20 Schrot (Explosiv)
|
||||
item.ammo_20gauge_wither.name=Kaliber 20 Schrot (Wither)
|
||||
item.ammo_5mm.name=5mm Patrone
|
||||
item.ammo_5mm_explosive.name=5mm Patrone (Explosiv)
|
||||
item.ammo_50bmg.name=.50 BMG Patrone
|
||||
item.ammo_50bmg_incendiary.name=.50 BMG Patrone (Brand)
|
||||
item.ammo_50bmg_explosive.name=.50 BMG Patrone (Explosiv)
|
||||
item.ammo_9mm.name=9mm Patrone
|
||||
item.ammo_9mm_ap.name=9mm Patrone (Panzerbrechend)
|
||||
item.gun_folly_ammo_taint.name=Silbernes Geschoss (Original)
|
||||
item.gun_folly_ammo_nuclear.name=Silbernes Geschoss (Atomar)
|
||||
item.gun_folly_ammo_du.name=Silbernes Geschoss (DU, Nicht-Explosiv)
|
||||
|
||||
item.cordite.name=Kordit
|
||||
|
||||
item.weaponized_starblaster_cell.name=§cManipulierte Sternenblaster-Energiezelle§r
|
||||
|
||||
item.turret_light_ammo.name=Leichte MG Munitionskiste
|
||||
|
||||
@ -1344,6 +1344,29 @@ item.gun_hp_ammo.name=Ink Cartridge
|
||||
item.gun_euthanasia_ammo.name=Syringe
|
||||
item.gun_defabricator_ammo.name=Defabricator Energy Cell
|
||||
|
||||
item.ammo_12gauge.name=12 Gauge Buckshot
|
||||
item.ammo_12gauge_incendiary.name=12 Gauge Buckshot (Incendiary)
|
||||
item.ammo_20gauge.name=20 Gauge Buckshot
|
||||
item.ammo_20gauge_slug.name=20 Gauge Brenneke Slug
|
||||
item.ammo_20gauge_flechette.name=20 Gauge Flechette Shell
|
||||
item.ammo_20gauge_incendiary.name=20 Gauge Buckshot (Incendiary)
|
||||
item.ammo_20gauge_shock.name=20 Gauge Buckshot (Shock)
|
||||
item.ammo_20gauge_caustic.name=20 Gauge Buckshot (Caustic)
|
||||
item.ammo_20gauge_explosive.name=20 Gauge Buckshot (Explosive)
|
||||
item.ammo_20gauge_wither.name=20 Gauge Buckshot (Withering)
|
||||
item.ammo_5mm.name=5mm Round
|
||||
item.ammo_5mm_explosive.name=5mm Round (Explosive)
|
||||
item.ammo_50bmg.name=.50 BMG Round
|
||||
item.ammo_50bmg_incendiary.name=.50 BMG Round (Incendiary)
|
||||
item.ammo_50bmg_explosive.name=.50 BMG Round (Explosive)
|
||||
item.ammo_9mm.name=9mm Round
|
||||
item.ammo_9mm_ap.name=9mm Round (Armor Piercing)
|
||||
item.gun_folly_ammo_taint.name=Silver Bullet (Original)
|
||||
item.gun_folly_ammo_nuclear.name=Silver Bullet (Nuclear)
|
||||
item.gun_folly_ammo_du.name=Silver Bullet (DU, Non-Explosive)
|
||||
|
||||
item.cordite.name=Cordite
|
||||
|
||||
item.weaponized_starblaster_cell.name=§cRigged Star Blaster Energy Cell§r
|
||||
|
||||
item.turret_light_ammo.name=Light MG Turret Ammo Box
|
||||
|
||||
@ -4,6 +4,14 @@ import java.util.List;
|
||||
|
||||
public class GunConfiguration {
|
||||
|
||||
/**
|
||||
* alt function restrictions:
|
||||
* alt can not be reloaded (reload type of 0, ammo cap of 0)
|
||||
* alt cooldown and main cooldown are shared (alt cooldown will almoast always be greater or equal)
|
||||
* alt is always the lower priority, mouse2 will be canceled then mouse1 is activated at the same time
|
||||
* restrictions must be applied in gun's logic, mechanism may be dysfunctional if these rules are ignored
|
||||
*/
|
||||
|
||||
//amount of ticks between each bullet
|
||||
public int rateOfFire;
|
||||
//greatest amount of pellets created each shot
|
||||
|
||||
@ -11,7 +11,10 @@ import com.hbm.packet.GunButtonPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
@ -19,14 +22,17 @@ import net.minecraft.item.Item;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.client.event.MouseEvent;
|
||||
|
||||
public class ItemGunBase extends Item implements IHoldableWeapon {
|
||||
|
||||
private GunConfiguration mainConfig;
|
||||
private GunConfiguration altConfig;
|
||||
|
||||
private boolean m1 = false;
|
||||
private boolean m2 = false;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean m1 = false;
|
||||
@SideOnly(Side.CLIENT)
|
||||
public boolean m2 = false;
|
||||
|
||||
public ItemGunBase(GunConfiguration config) {
|
||||
mainConfig = config;
|
||||
@ -37,11 +43,6 @@ public class ItemGunBase extends Item implements IHoldableWeapon {
|
||||
altConfig = alt;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack onItemRightClick(ItemStack stack, World world, EntityPlayer player) {
|
||||
return stack;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdate(ItemStack stack, World world, Entity entity, int slot, boolean isCurrentItem) {
|
||||
|
||||
@ -53,12 +54,13 @@ public class ItemGunBase extends Item implements IHoldableWeapon {
|
||||
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
private void updateClient(ItemStack stack, World world, EntityPlayer entity, int slot, boolean isCurrentItem) {
|
||||
|
||||
boolean clickLeft = Mouse.isButtonDown(0);
|
||||
boolean clickRight = Mouse.isButtonDown(1);
|
||||
boolean left = m1; //getIsMouseDown(stack);
|
||||
boolean right = m2; //getIsAltDown(stack);
|
||||
boolean left = m1;
|
||||
boolean right = m2;
|
||||
|
||||
if(isCurrentItem) {
|
||||
if(left && right) {
|
||||
@ -70,7 +72,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon {
|
||||
m2 = false;
|
||||
}
|
||||
|
||||
if(!left && !right) {
|
||||
/*if(!left && !right) {
|
||||
if(clickLeft) {
|
||||
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(true, (byte) 0));
|
||||
//setIsMouseDown(stack, true);
|
||||
@ -80,7 +82,7 @@ public class ItemGunBase extends Item implements IHoldableWeapon {
|
||||
//setIsAltDown(stack, true);
|
||||
m2 = true;
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
if(left && !clickLeft) {
|
||||
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(false, (byte) 0));
|
||||
@ -101,6 +103,16 @@ public class ItemGunBase extends Item implements IHoldableWeapon {
|
||||
setIsReloading(stack, true);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
if(left) {
|
||||
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(false, (byte) 0));
|
||||
m1 = false;
|
||||
}
|
||||
if(right) {
|
||||
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(false, (byte) 1));
|
||||
m2 = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -108,13 +120,18 @@ public class ItemGunBase extends Item implements IHoldableWeapon {
|
||||
|
||||
}
|
||||
|
||||
//called every time the gun shoots
|
||||
//tries to shoot, bullet checks are done here
|
||||
private boolean tryShoot(ItemStack stack, World world, EntityPlayer player, boolean main) {
|
||||
return false;
|
||||
}
|
||||
|
||||
//called every time the gun shoots, overridden to change bullet entity/special additions
|
||||
private void fire(ItemStack stack, World world, EntityPlayer player) {
|
||||
|
||||
}
|
||||
|
||||
//called on click
|
||||
private void startAction(ItemStack stack, World world, EntityPlayer player, boolean main) {
|
||||
//called on click (server side, called by mouse packet)
|
||||
public void startAction(ItemStack stack, World world, EntityPlayer player, boolean main) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -5,7 +5,10 @@ import com.hbm.entity.projectile.EntityChopperMine;
|
||||
import com.hbm.interfaces.IHoldableWeapon;
|
||||
import com.hbm.items.ModItems;
|
||||
import com.hbm.items.tool.ItemGeigerCounter;
|
||||
import com.hbm.items.weapon.ItemGunBase;
|
||||
import com.hbm.lib.Library;
|
||||
import com.hbm.packet.GunButtonPacket;
|
||||
import com.hbm.packet.PacketDispatcher;
|
||||
import com.hbm.render.misc.RenderScreenOverlay;
|
||||
import com.hbm.saveddata.RadEntitySavedData;
|
||||
import com.hbm.saveddata.RadiationSavedData;
|
||||
@ -24,6 +27,7 @@ import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraft.world.chunk.Chunk;
|
||||
import net.minecraftforge.client.event.MouseEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
||||
import net.minecraftforge.client.event.RenderPlayerEvent;
|
||||
@ -34,10 +38,10 @@ public class ModEventHandlerClient {
|
||||
@SubscribeEvent
|
||||
public void onOverlayRender(RenderGameOverlayEvent event) {
|
||||
|
||||
if(event.type == ElementType.HOTBAR) {
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if(event.type == ElementType.HOTBAR) {
|
||||
|
||||
if(player.inventory.hasItem(ModItems.geiger_counter)) {
|
||||
|
||||
float rads = 0;
|
||||
@ -48,6 +52,8 @@ public class ModEventHandlerClient {
|
||||
|
||||
RenderScreenOverlay.renderRadCounter(event.resolution, rads, Minecraft.getMinecraft().ingameGUI);
|
||||
}
|
||||
} else if(event.type == ElementType.CROSSHAIRS && player.getHeldItem() != null && player.getHeldItem().getItem() instanceof IHoldableWeapon) {
|
||||
event.setCanceled(true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -61,6 +67,32 @@ public class ModEventHandlerClient {
|
||||
renderer.modelBipedMain.aimedBow = true;
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void clickHandler(MouseEvent event) {
|
||||
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
|
||||
if(player.getHeldItem() != null && player.getHeldItem().getItem() instanceof ItemGunBase) {
|
||||
|
||||
if(event.button == 0)
|
||||
event.setCanceled(true);
|
||||
|
||||
ItemGunBase item = (ItemGunBase)player.getHeldItem().getItem();
|
||||
|
||||
if(event.button == 0 && !item.m1 && !item.m2) {
|
||||
item.m1 = true;
|
||||
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(true, (byte) 0));
|
||||
System.out.println("M1");
|
||||
}
|
||||
else if(event.button == 1 && !item.m2 && !item.m1) {
|
||||
item.m2 = true;
|
||||
PacketDispatcher.wrapper.sendToServer(new GunButtonPacket(true, (byte) 1));
|
||||
System.out.println("M2");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public void onPlaySound(PlaySoundEvent17 e) {
|
||||
ResourceLocation r = e.sound.getPositionedSoundLocation();
|
||||
|
||||
@ -18,6 +18,7 @@ import com.hbm.tileentity.machine.TileEntityMachineSeleniumEngine;
|
||||
import com.hbm.tileentity.machine.TileEntityRadioRec;
|
||||
import com.hbm.tileentity.machine.TileEntityReactorControl;
|
||||
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessage;
|
||||
import cpw.mods.fml.common.network.simpleimpl.IMessageHandler;
|
||||
import cpw.mods.fml.common.network.simpleimpl.MessageContext;
|
||||
@ -62,18 +63,23 @@ public class GunButtonPacket implements IMessage {
|
||||
@Override
|
||||
public IMessage onMessage(GunButtonPacket m, MessageContext ctx) {
|
||||
|
||||
if(FMLCommonHandler.instance().getEffectiveSide() == Side.CLIENT)
|
||||
return null;
|
||||
|
||||
EntityPlayer p = ctx.getServerHandler().playerEntity;
|
||||
|
||||
if(p.getHeldItem() != null && p.getHeldItem().getItem() instanceof ItemGunBase) {
|
||||
|
||||
ItemGunBase item = (ItemGunBase)p.getHeldItem().getItem();
|
||||
|
||||
switch(m.button) {
|
||||
case 0: ItemGunBase.setIsMouseDown(p.getHeldItem(), m.state); break;
|
||||
case 1: ItemGunBase.setIsAltDown(p.getHeldItem(), m.state); break;
|
||||
case 0: ItemGunBase.setIsMouseDown(p.getHeldItem(), m.state); item.startAction(p.getHeldItem(), p.worldObj, p, true); break;
|
||||
case 1: ItemGunBase.setIsAltDown(p.getHeldItem(), m.state); item.startAction(p.getHeldItem(), p.worldObj, p, false); break;
|
||||
case 2: ItemGunBase.setIsReloading(p.getHeldItem(), true); break;
|
||||
}
|
||||
}
|
||||
|
||||
System.out.println(m.button + ": " + m.state);
|
||||
//System.out.println(m.button + ": " + m.state);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -7,8 +7,11 @@ import com.hbm.lib.RefStrings;
|
||||
import com.hbm.render.model.ModelRevolver;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.RenderBlocks;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.MathHelper;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import net.minecraftforge.client.IItemRenderer;
|
||||
|
||||
@ -41,6 +44,7 @@ public class ItemRenderRevolver implements IItemRenderer {
|
||||
switch(type) {
|
||||
case EQUIPPED_FIRST_PERSON:
|
||||
GL11.glPushMatrix();
|
||||
|
||||
if(item.getItem() == ModItems.gun_revolver)
|
||||
Minecraft.getMinecraft().renderEngine.bindTexture(new ResourceLocation(RefStrings.MODID +":textures/models/ModelRevolver.png"));
|
||||
if(item.getItem() == ModItems.gun_revolver_saturnite)
|
||||
@ -49,6 +53,9 @@ public class ItemRenderRevolver implements IItemRenderer {
|
||||
GL11.glTranslatef(-0.5F, 0.0F, -0.2F);
|
||||
//GL11.glScalef(2.0F, 2.0F, 2.0F);
|
||||
GL11.glScalef(0.5F, 0.5F, 0.5F);
|
||||
|
||||
//((EntityPlayer)data[1]).isSwingInProgress = false;
|
||||
|
||||
swordModel.render((Entity)data[1], 0.0F, 0.0F, 0.0F, 0.0F, 0.0F, 0.0625F);
|
||||
GL11.glPopMatrix();
|
||||
break;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user