From 6a716728ccc3beb5b7e4b17bdbce19d222e58281 Mon Sep 17 00:00:00 2001 From: strubium <113206902+strubium@users.noreply.github.com> Date: Fri, 25 Oct 2024 21:57:45 -0500 Subject: [PATCH] A bunch of cleanup, new EquipmentFactory, all the vehicles now use VehicleFactory --- .../com/paneedah/mwc/equipment/Armors.java | 5 +- .../com/paneedah/mwc/equipment/Backpacks.java | 6 +- .../com/paneedah/mwc/equipment/Belts.java | 7 +- .../paneedah/mwc/equipment/Electronics.java | 16 +-- .../mwc/equipment/EquipmentFactory.java | 10 ++ .../com/paneedah/mwc/equipment/Vests.java | 24 ++-- .../com/paneedah/mwc/proxies/CommonProxy.java | 12 +- .../mwc/vehicle/AE86TruenoFactory.java | 6 +- .../com/paneedah/mwc/vehicle/ATVFactory.java | 6 +- .../paneedah/mwc/vehicle/AudiS4Factory.java | 3 +- .../mwc/vehicle/JLTVM1280Factory.java | 3 +- .../mwc/vehicle/McLarenSennaFactory.java | 3 +- .../com/paneedah/mwc/vehicle/PartInit.java | 13 +- .../mwc/vehicle/SampleVehicleFactory.java | 3 +- .../java/com/paneedah/weaponlib/ItemVest.java | 58 +++------ .../paneedah/weaponlib/WeaponRenderer.java | 6 +- .../weaponlib/render/ResourceManager.java | 10 -- .../weaponlib/render/modern/RayTraceUtil.java | 6 - .../weaponlib/render/qrender/QBoxer.java | 111 ------------------ .../weaponlib/render/qrender/QOven.java | 11 -- .../weaponlib/render/scopes/Reticle.java | 30 +---- .../vehicle/jimphysics/Transmission.java | 4 +- 22 files changed, 95 insertions(+), 258 deletions(-) create mode 100644 src/main/java/com/paneedah/mwc/equipment/EquipmentFactory.java delete mode 100644 src/main/java/com/paneedah/weaponlib/render/ResourceManager.java delete mode 100644 src/main/java/com/paneedah/weaponlib/render/modern/RayTraceUtil.java delete mode 100644 src/main/java/com/paneedah/weaponlib/render/qrender/QBoxer.java delete mode 100644 src/main/java/com/paneedah/weaponlib/render/qrender/QOven.java diff --git a/src/main/java/com/paneedah/mwc/equipment/Armors.java b/src/main/java/com/paneedah/mwc/equipment/Armors.java index 874603ea4..2b152bc77 100644 --- a/src/main/java/com/paneedah/mwc/equipment/Armors.java +++ b/src/main/java/com/paneedah/mwc/equipment/Armors.java @@ -8,7 +8,7 @@ import net.minecraft.item.ItemArmor.ArmorMaterial; import net.minecraftforge.common.util.EnumHelper; -public class Armors { +public class Armors implements EquipmentFactory { // realistic armors public static Item JPNVG18helmet; @@ -65,7 +65,8 @@ public class Armors { static ArmorMaterial Juggernaut = EnumHelper.addArmorMaterial("Juggernaut", "Juggernaut", 20, new int[]{5, 6, 2, 5}, 20, null, 0); static ArmorMaterial Marine = EnumHelper.addArmorMaterial("Marine", "Marine", 60, new int[]{2, 3, 3, 3}, 15, null, 0); - public static void init(Object mod, ModContext modContext) { + @Override + public void createEquipment(ModContext modContext) { Builder marineArmorBuilder = new CustomArmor.Builder() .withMaterial(Armors.Marine) .withUnlocalizedName("Marine") diff --git a/src/main/java/com/paneedah/mwc/equipment/Backpacks.java b/src/main/java/com/paneedah/mwc/equipment/Backpacks.java index 228f422f2..29ccc1271 100644 --- a/src/main/java/com/paneedah/mwc/equipment/Backpacks.java +++ b/src/main/java/com/paneedah/mwc/equipment/Backpacks.java @@ -1,10 +1,11 @@ package com.paneedah.mwc.equipment; import com.paneedah.mwc.items.equipment.carryable.ItemBackpack; +import com.paneedah.weaponlib.ModContext; import com.paneedah.weaponlib.animation.Transform; import net.minecraft.item.Item; -public class Backpacks { +public class Backpacks implements EquipmentFactory { public static Item combatSustainmentBackpackTan; public static Item combatSustainmentBackpackBlack; @@ -22,7 +23,8 @@ public class Backpacks { public static Item duffleBag; - public static void init() { + @Override + public void createEquipment(ModContext modContext) { combatSustainmentBackpackTan = new ItemBackpack.Builder() .withName("combat_sustainment_backpack_tan") diff --git a/src/main/java/com/paneedah/mwc/equipment/Belts.java b/src/main/java/com/paneedah/mwc/equipment/Belts.java index 237fd61a3..20feae64a 100644 --- a/src/main/java/com/paneedah/mwc/equipment/Belts.java +++ b/src/main/java/com/paneedah/mwc/equipment/Belts.java @@ -1,13 +1,14 @@ package com.paneedah.mwc.equipment; +import com.paneedah.weaponlib.ModContext; import net.minecraft.item.Item; -public class Belts { +public class Belts implements EquipmentFactory { public static Item magazineBelt; - public static void init() { - + @Override + public void createEquipment(ModContext modContext) { // TODO: Finish implementing belts // magazineBelt = new ItemBelt.Builder() // .withName("magazine_belt") diff --git a/src/main/java/com/paneedah/mwc/equipment/Electronics.java b/src/main/java/com/paneedah/mwc/equipment/Electronics.java index d8f631d93..4e627a0a9 100644 --- a/src/main/java/com/paneedah/mwc/equipment/Electronics.java +++ b/src/main/java/com/paneedah/mwc/equipment/Electronics.java @@ -3,6 +3,7 @@ import com.paneedah.mwc.MWC; import com.paneedah.mwc.models.GasDetector; import com.paneedah.weaponlib.ItemAttachment; +import com.paneedah.weaponlib.ModContext; import com.paneedah.weaponlib.electronics.ItemHandheld; import com.paneedah.weaponlib.electronics.ItemTablet; import com.paneedah.weaponlib.electronics.ItemWirelessCamera; @@ -11,15 +12,16 @@ import com.paneedah.weaponlib.perspective.GasDetectorScreenPerspective; import org.lwjgl.opengl.GL11; -public class Electronics { +public class Electronics implements EquipmentFactory { public static ItemAttachment Tablet; - public static void init() { + @Override + public void createEquipment(ModContext modContext) { Tablet = new ItemTablet.Builder<>() .withViewfinderPositioning(() -> { float scale = 5.9f; - GL11.glScalef(scale, scale / MWC.modContext.getAspectRatio(), scale); + GL11.glScalef(scale, scale / modContext.getAspectRatio(), scale); GL11.glTranslatef(-0.12f, 0.56f, 0.01f); }) .withCreativeTab(MWC.EQUIPMENT_TAB) @@ -77,7 +79,7 @@ public static void init() { .withName("tablet") .withTextureName("Dummy.png") - .build(MWC.modContext); + .build(modContext); new ItemWirelessCamera.Builder() @@ -135,14 +137,14 @@ public static void init() { } ) - .build(MWC.modContext); + .build(modContext); new ItemHandheld.Builder<>() .withScreenPerspectiveType(GasDetectorScreenPerspective.class) .withScreenPositioning(() -> { float scale = 1.9f; - GL11.glScalef(scale, scale / MWC.modContext.getAspectRatio(), scale); + GL11.glScalef(scale, scale / modContext.getAspectRatio(), scale); GL11.glTranslatef(0.017f, 0.16f, 0.17f); }) .withCreativeTab(MWC.EQUIPMENT_TAB) @@ -205,6 +207,6 @@ public static void init() { .withName("gas-detector") .withTextureName("Dummy.png") - .build(MWC.modContext); + .build(modContext); } } diff --git a/src/main/java/com/paneedah/mwc/equipment/EquipmentFactory.java b/src/main/java/com/paneedah/mwc/equipment/EquipmentFactory.java new file mode 100644 index 000000000..11a5138d1 --- /dev/null +++ b/src/main/java/com/paneedah/mwc/equipment/EquipmentFactory.java @@ -0,0 +1,10 @@ +package com.paneedah.mwc.equipment; + +import com.paneedah.weaponlib.ModContext; + +public interface EquipmentFactory { + + void createEquipment(ModContext modContext); + +} + diff --git a/src/main/java/com/paneedah/mwc/equipment/Vests.java b/src/main/java/com/paneedah/mwc/equipment/Vests.java index 2f936f80d..9f1102187 100644 --- a/src/main/java/com/paneedah/mwc/equipment/Vests.java +++ b/src/main/java/com/paneedah/mwc/equipment/Vests.java @@ -2,12 +2,14 @@ import com.paneedah.mwc.MWC; import com.paneedah.weaponlib.ItemVest; +import com.paneedah.weaponlib.ModContext; import com.paneedah.weaponlib.animation.Transform; import org.lwjgl.opengl.GL11; -public class Vests { +public class Vests implements EquipmentFactory { - public static void init(Object mod) { + @Override + public void createEquipment(ModContext modContext) { new ItemVest.Builder() .withName("m43a_chest_harness") @@ -27,7 +29,7 @@ public static void init(Object mod) { .withScale(3, 3, 3) .doGLDirect(); }) - .build(MWC.modContext); + .build(modContext); new ItemVest.Builder() .withName("flyye_field_compact_plate_carrier") @@ -67,7 +69,7 @@ public static void init(Object mod) { .withScale(3, 3, 3) .doGLDirect(); }) - .build(MWC.modContext); + .build(modContext); new ItemVest.Builder() .withName("molle_green") @@ -87,7 +89,7 @@ public static void init(Object mod) { .withScale(3, 3, 3) .doGLDirect(); }) - .build(MWC.modContext); + .build(modContext); new ItemVest.Builder() .withName("molle_urban") @@ -107,7 +109,7 @@ public static void init(Object mod) { .withScale(3, 3, 3) .doGLDirect(); }) - .build(MWC.modContext); + .build(modContext); new ItemVest.Builder() .withName("swat_vest") @@ -127,7 +129,7 @@ public static void init(Object mod) { .withScale(3, 3, 3) .doGLDirect(); }) - .build(MWC.modContext); + .build(modContext); new ItemVest.Builder() .withName("usMC_vest") @@ -152,7 +154,7 @@ public static void init(Object mod) { .withScale(2.6, 2.6, 2.6) .doGLDirect(); }) - .build(MWC.modContext); + .build(modContext); new ItemVest.Builder() .withName("usMC_vest_black") @@ -178,7 +180,7 @@ public static void init(Object mod) { .withScale(2.6, 2.6, 2.6) .doGLDirect(); }) - .build(MWC.modContext); + .build(modContext); new ItemVest.Builder() .withName("usMC_vest_green") @@ -204,7 +206,7 @@ public static void init(Object mod) { .withScale(2.6, 2.6, 2.6) .doGLDirect(); }) - .build(MWC.modContext); + .build(modContext); new ItemVest.Builder() .withName("usMC_vest_urban") @@ -230,6 +232,6 @@ public static void init(Object mod) { .withScale(2.6, 2.6, 2.6) .doGLDirect(); }) - .build(MWC.modContext); + .build(modContext); } } diff --git a/src/main/java/com/paneedah/mwc/proxies/CommonProxy.java b/src/main/java/com/paneedah/mwc/proxies/CommonProxy.java index 66401fbcd..5490467e1 100644 --- a/src/main/java/com/paneedah/mwc/proxies/CommonProxy.java +++ b/src/main/java/com/paneedah/mwc/proxies/CommonProxy.java @@ -62,17 +62,19 @@ public void preInit(final MWC mod) { // Special object initialization SpecialAttachments.init(mod, MWC.modContext); - Backpacks.init(); - Belts.init(); - Vests.init(mod); - Armors.init(mod, MWC.modContext); + + new Backpacks().createEquipment(MWC.modContext); + new Belts().createEquipment(MWC.modContext); + new Vests().createEquipment(MWC.modContext); + new Armors().createEquipment(MWC.modContext); + Attachments.init(mod); AuxiliaryAttachments.init(mod); GunSkins.init(mod); Bullets.init(mod); Magazines.init(mod); Guns.init(mod, this); - Electronics.init(); + new Electronics().createEquipment(MWC.modContext); Grenades.init(mod, this); CustomSpawnEggs.init(mod, this); TileEntities.init(this); diff --git a/src/main/java/com/paneedah/mwc/vehicle/AE86TruenoFactory.java b/src/main/java/com/paneedah/mwc/vehicle/AE86TruenoFactory.java index 344ab7ab4..90b1e658a 100644 --- a/src/main/java/com/paneedah/mwc/vehicle/AE86TruenoFactory.java +++ b/src/main/java/com/paneedah/mwc/vehicle/AE86TruenoFactory.java @@ -15,10 +15,8 @@ public class AE86TruenoFactory implements VehicleFactory { - + @Override public void createVehicle(ModContext modContext) { - - StatefulRenderer renderer = null; if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { @@ -282,7 +280,7 @@ public void createVehicle(ModContext modContext) { .withOBBDimensions(3.3, 2.5, 1.75) .withSeat(new Vec3d(-0.89, -0.2, 0.0)) .withRenderer(renderer) - .build(MWC.modContext); + .build(modContext); } } diff --git a/src/main/java/com/paneedah/mwc/vehicle/ATVFactory.java b/src/main/java/com/paneedah/mwc/vehicle/ATVFactory.java index 884eac66a..9fe6b53df 100644 --- a/src/main/java/com/paneedah/mwc/vehicle/ATVFactory.java +++ b/src/main/java/com/paneedah/mwc/vehicle/ATVFactory.java @@ -21,10 +21,8 @@ public class ATVFactory implements VehicleFactory { - + @Override public void createVehicle(ModContext modContext) { - - StatefulRenderer renderer = null; if (FMLCommonHandler.instance().getSide() == Side.CLIENT) { @@ -263,7 +261,7 @@ public void createVehicle(ModContext modContext) { .withOBBDimensions(1, 1, 1) .withSeat(new Vec3d(-0.5, 0.2, -0.3)) .withRenderer(renderer) - .build(MWC.modContext); + .build(modContext); } } diff --git a/src/main/java/com/paneedah/mwc/vehicle/AudiS4Factory.java b/src/main/java/com/paneedah/mwc/vehicle/AudiS4Factory.java index bdc66eb06..012df0a4a 100644 --- a/src/main/java/com/paneedah/mwc/vehicle/AudiS4Factory.java +++ b/src/main/java/com/paneedah/mwc/vehicle/AudiS4Factory.java @@ -14,6 +14,7 @@ public class AudiS4Factory implements VehicleFactory { + @Override public void createVehicle(ModContext modContext) { StatefulRenderer renderer = null; @@ -241,7 +242,7 @@ public void createVehicle(ModContext modContext) { .withSeat(new Vec3d(0.0, -0.2, 0.0)) .withSeat(new Vec3d(0.5, -0.2, 0.0)) .withRenderer(renderer) - .build(MWC.modContext); + .build(modContext); } } diff --git a/src/main/java/com/paneedah/mwc/vehicle/JLTVM1280Factory.java b/src/main/java/com/paneedah/mwc/vehicle/JLTVM1280Factory.java index 2239bd7a8..070fbc892 100644 --- a/src/main/java/com/paneedah/mwc/vehicle/JLTVM1280Factory.java +++ b/src/main/java/com/paneedah/mwc/vehicle/JLTVM1280Factory.java @@ -9,6 +9,7 @@ public class JLTVM1280Factory implements VehicleFactory { + @Override public void createVehicle(ModContext modContext) { StatefulRenderer renderer = new VehicleRendererBuilder() @@ -204,7 +205,7 @@ public void createVehicle(ModContext modContext) { // .withAccelerationIncrement(0.015) // .withForwardDeccelerationFactor(0.97) .withRenderer(renderer) - .build(MWC.modContext); + .build(modContext); } } diff --git a/src/main/java/com/paneedah/mwc/vehicle/McLarenSennaFactory.java b/src/main/java/com/paneedah/mwc/vehicle/McLarenSennaFactory.java index 11816b39c..0fa488dff 100644 --- a/src/main/java/com/paneedah/mwc/vehicle/McLarenSennaFactory.java +++ b/src/main/java/com/paneedah/mwc/vehicle/McLarenSennaFactory.java @@ -19,6 +19,7 @@ public class McLarenSennaFactory implements VehicleFactory { + @Override public void createVehicle(ModContext modContext) { StatefulRenderer renderer = null; @@ -235,7 +236,7 @@ public void createVehicle(ModContext modContext) { .withOBBDimensions(3.5, 2.5, 1.75) .withSeat(new Vec3d(-0.15, -0.4, 0.5)) .withRenderer(renderer) - .build(MWC.modContext); + .build(modContext); } } diff --git a/src/main/java/com/paneedah/mwc/vehicle/PartInit.java b/src/main/java/com/paneedah/mwc/vehicle/PartInit.java index fe62e262a..19f2c9ab3 100644 --- a/src/main/java/com/paneedah/mwc/vehicle/PartInit.java +++ b/src/main/java/com/paneedah/mwc/vehicle/PartInit.java @@ -12,21 +12,16 @@ public class PartInit { // .withEcoShift(2500, 1200); public static final Transmission audiS4B7Transmission = new Transmission(3.889f, 3.4f, 4500, 1800) - .quickSixSpeed(3.667f, 2.050f, 1.462f, 1.133f, 0.919f, 0.778f) - .withEcoShift(2500, 1200); + .quickSixSpeed(3.667f, 2.050f, 1.462f, 1.133f, 0.919f, 0.778f); public static final Transmission McLarenSennaTransmission = new Transmission(3.31f, 2.8f, 8450, 4000) - .quickSpeed(3.98f, 2.61f, 1.9f, 1.48f, 1.16f, 0.91f, 0.69f) - .withEcoShift(2500, 1200); + .quickSpeed(3.98f, 2.61f, 1.9f, 1.48f, 1.16f, 0.91f, 0.69f); public static final Transmission AE86TruenoTransmission = new Transmission(4.3f, 4.2f, 5300, 3000) - .quickSixSpeed(3.587f, 2.022f, 1.384f, 1.00f, 0.861f, 0.778f) - .withEcoShift(2500, 1200); + .quickSixSpeed(3.587f, 2.022f, 1.384f, 1.00f, 0.861f, 0.778f); public static final Transmission ATVTransmission = new Transmission(3.937f, 3.544f, 2462, 2738) - .quickSixSpeed(3.525f, 2.218f, 1.433f, 1f, 0.861f, 0.778f) - .withEcoShift(2500, 1200); - + .quickSixSpeed(3.525f, 2.218f, 1.433f, 1f, 0.861f, 0.778f); //Gear shift patterns public static final GearShiftPattern STANDARD_SIX_SHIFT = new GearShiftPattern() diff --git a/src/main/java/com/paneedah/mwc/vehicle/SampleVehicleFactory.java b/src/main/java/com/paneedah/mwc/vehicle/SampleVehicleFactory.java index 2e6c12402..94c4dbcc7 100644 --- a/src/main/java/com/paneedah/mwc/vehicle/SampleVehicleFactory.java +++ b/src/main/java/com/paneedah/mwc/vehicle/SampleVehicleFactory.java @@ -10,6 +10,7 @@ public class SampleVehicleFactory implements VehicleFactory { + @Override public void createVehicle(ModContext modContext) { StatefulRenderer renderer = new VehicleRendererBuilder() @@ -208,7 +209,7 @@ public void createVehicle(ModContext modContext) { // .withAccelerationIncrement(0.015) // .withForwardDeccelerationFactor(0.97) .withRenderer(renderer) - .build(MWC.modContext); + .build(modContext); } } diff --git a/src/main/java/com/paneedah/weaponlib/ItemVest.java b/src/main/java/com/paneedah/weaponlib/ItemVest.java index 8bba6f22f..2cebb0848 100644 --- a/src/main/java/com/paneedah/weaponlib/ItemVest.java +++ b/src/main/java/com/paneedah/weaponlib/ItemVest.java @@ -1,5 +1,6 @@ package com.paneedah.weaponlib; +import com.paneedah.mwc.ProjectConstants; import com.paneedah.mwc.renderer.ModelSourceTransforms; import com.paneedah.mwc.renderer.StaticModelSourceRenderer; import com.paneedah.weaponlib.animation.Transform; @@ -167,73 +168,50 @@ public Builder withFirstPersonHandPositioning(Runnable leftHand, Runnable rightH public ItemVest build(ModContext modContext) { if (name == null) { - throw new IllegalStateException("ItemBackpack name not set"); + throw new IllegalStateException("ItemVest name not set"); } -// if(size <= 0) { -// throw new IllegalStateException("ItemBackpack size must be greater than 0"); -// } - -// if(guiTextureName == null) { -// throw new IllegalStateException("ItemBackpack gui texture not set"); -// } -// -// if(!guiTextureName.startsWith("textures/gui/")) { -// guiTextureName = "textures/gui/" + guiTextureName; -// } -// ResourceLocation guiTextureLocation = new ResourceLocation(addFileExtension(guiTextureName, ".png")); - - ItemVest item = new ItemVest(modContext, percentDamageBlocked, durability); - + // Register model and texture for the item ServerGearModelHookRegistry.modelArray.add(this.modelFileString); - item.modelFileString = this.modelFileString; item.textureName = this.properTextureName; item.setTranslationKey(ID + "_" + name); - // Register hook + // Register crafting hook for the item CraftingRegistry.registerHook(item); - + // Register the model for the client side, if applicable if (this.modelFileString != null && !FMLCommonHandler.instance().getSide().isServer()) { - try { - //System.out.println("FOR ITEM: " + item.getRegistryName() + " | "); - ModelBase base = (ModelBase) Class.forName(this.modelFileString).newInstance(); - item.texturedModels.add(new Tuple<>(base, addFileExtension(this.properTextureName, ".png"))); - - - } catch (InstantiationException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (IllegalAccessException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } catch (ClassNotFoundException e) { - // TODO Auto-generated catch block + ModelBase baseModel = (ModelBase) Class.forName(this.modelFileString).newInstance(); + item.texturedModels.add(new Tuple<>(baseModel, addFileExtension(this.properTextureName, ".png"))); + } catch (InstantiationException | IllegalAccessException | ClassNotFoundException e) { + ProjectConstants.LOGGER.info("Error loading model for: " + this.modelFileString); e.printStackTrace(); } - - } + // Add additional model if specified if (model != null) { item.texturedModels.add(new Tuple<>(model, addFileExtension(textureName, ".png"))); } + // Set creative tab if provided if (tab != null) { item.setCreativeTab(tab); - - } - // lientEventHandler.ITEM_REG.add(item); - - modContext.registerRenderableItem(name, item, FMLCommonHandler.instance().getSide() == Side.CLIENT ? new StaticModelSourceRenderer(transforms) : null); + // Register the item with the mod context as renderable + modContext.registerRenderableItem( + name, + item, + FMLCommonHandler.instance().getSide() == Side.CLIENT ? new StaticModelSourceRenderer(transforms) : null + ); + // Queue item for client-side processing if on client side if (FMLCommonHandler.instance().getSide().isClient()) { COOKING_QUEUE.add(item); } diff --git a/src/main/java/com/paneedah/weaponlib/WeaponRenderer.java b/src/main/java/com/paneedah/weaponlib/WeaponRenderer.java index 405ff30db..6d596e8cc 100644 --- a/src/main/java/com/paneedah/weaponlib/WeaponRenderer.java +++ b/src/main/java/com/paneedah/weaponlib/WeaponRenderer.java @@ -99,6 +99,8 @@ public class WeaponRenderer extends ModelSource implements IBakedModel { private static final int INVENTORY_TEXTURE_WIDTH = 128; private static final int INVENTORY_TEXTURE_HEIGHT = 128; + private static final ResourceLocation GUN_ICON_SHEET = new ResourceLocation(ID + ":textures/gui/guniconsheet.png"); + private static final Map ARMOR_TEXTURE_RES_MAP = Maps.newHashMap(); private final org.apache.commons.lang3.tuple.Pair pair; @@ -4575,7 +4577,7 @@ private void renderCachedInventoryTexture(RenderContext renderC GL11.glScalef(1.0F, -1.0F, 1F); GlStateManager.translate(-8.0F, -8.0F, 0.0F); - MC.getTextureManager().bindTexture(ResourceManager.GUN_ICON_SHEET); + MC.getTextureManager().bindTexture(GUN_ICON_SHEET); // Checks to see if the gun icon sheet has already @@ -4585,7 +4587,7 @@ private void renderCachedInventoryTexture(RenderContext renderC try { - InputStream inputStream = MC.getResourceManager().getResource(ResourceManager.GUN_ICON_SHEET).getInputStream(); + InputStream inputStream = MC.getResourceManager().getResource(GUN_ICON_SHEET).getInputStream(); BufferedImage bf = ImageIO.read(inputStream); gunIconSheetWidth = bf.getWidth(); diff --git a/src/main/java/com/paneedah/weaponlib/render/ResourceManager.java b/src/main/java/com/paneedah/weaponlib/render/ResourceManager.java deleted file mode 100644 index 630f5e6fe..000000000 --- a/src/main/java/com/paneedah/weaponlib/render/ResourceManager.java +++ /dev/null @@ -1,10 +0,0 @@ -package com.paneedah.weaponlib.render; - -import net.minecraft.util.ResourceLocation; - -import static com.paneedah.mwc.ProjectConstants.ID; - -public class ResourceManager { - // Controls some guns icon textures - public static final ResourceLocation GUN_ICON_SHEET = new ResourceLocation(ID + ":textures/gui/guniconsheet.png"); -} diff --git a/src/main/java/com/paneedah/weaponlib/render/modern/RayTraceUtil.java b/src/main/java/com/paneedah/weaponlib/render/modern/RayTraceUtil.java deleted file mode 100644 index 2cfbdce87..000000000 --- a/src/main/java/com/paneedah/weaponlib/render/modern/RayTraceUtil.java +++ /dev/null @@ -1,6 +0,0 @@ -package com.paneedah.weaponlib.render.modern; - -public class RayTraceUtil { - - -} diff --git a/src/main/java/com/paneedah/weaponlib/render/qrender/QBoxer.java b/src/main/java/com/paneedah/weaponlib/render/qrender/QBoxer.java deleted file mode 100644 index f7e062a8e..000000000 --- a/src/main/java/com/paneedah/weaponlib/render/qrender/QBoxer.java +++ /dev/null @@ -1,111 +0,0 @@ -package com.paneedah.weaponlib.render.qrender; - -import net.minecraft.client.model.ModelBox; -import net.minecraft.client.model.ModelRenderer; -import net.minecraft.client.model.PositionTextureVertex; -import net.minecraft.client.model.TexturedQuad; -import net.minecraft.util.math.Vec3d; -import org.lwjgl.util.vector.Matrix4f; -import org.lwjgl.util.vector.Vector4f; - -public class QBoxer extends ModelBox { - - private PositionTextureVertex[] vertexPositions; - private TexturedQuad[] quadList; - - - /* - * CONSTRUCTOR INFO - */ - public int texU; - public int texV; - public float x; - public float y; - public float z; - public int dx; - public int dy; - public int dz; - public float delta; - public boolean mirror; - - - public QBoxer(ModelRenderer renderer, int texU, int texV, float x, float y, float z, int dx, int dy, int dz, - float delta, boolean mirror) { - super(renderer, texU, texV, x, y, z, dx, dy, dz, delta, mirror); - - /* - this.vertexPositions = new PositionTextureVertex[8]; - this.quadList = new TexturedQuad[6]; - float f = x + (float)dx; - float f1 = y + (float)dy; - float f2 = z + (float)dz; - x = x - delta; - y = y - delta; - z = z - delta; - f = f + delta; - f1 = f1 + delta; - f2 = f2 + delta; - - if (mirror) - { - float f3 = f; - f = x; - x = f3; - } - - PositionTextureVertex positiontexturevertex7 = new PositionTextureVertex(x, y, z, 0.0F, 0.0F); - PositionTextureVertex positiontexturevertex = new PositionTextureVertex(f, y, z, 0.0F, 8.0F); - PositionTextureVertex positiontexturevertex1 = new PositionTextureVertex(f, f1, z, 8.0F, 8.0F); - PositionTextureVertex positiontexturevertex2 = new PositionTextureVertex(x, f1, z, 8.0F, 0.0F); - PositionTextureVertex positiontexturevertex3 = new PositionTextureVertex(x, y, f2, 0.0F, 0.0F); - PositionTextureVertex positiontexturevertex4 = new PositionTextureVertex(f, y, f2, 0.0F, 8.0F); - PositionTextureVertex positiontexturevertex5 = new PositionTextureVertex(f, f1, f2, 8.0F, 8.0F); - PositionTextureVertex positiontexturevertex6 = new PositionTextureVertex(x, f1, f2, 8.0F, 0.0F); - - - applyMatrixTransforms(positiontexturevertex, openGLMAT); - applyMatrixTransforms(positiontexturevertex1, openGLMAT); - applyMatrixTransforms(positiontexturevertex2, openGLMAT); - applyMatrixTransforms(positiontexturevertex3, openGLMAT); - applyMatrixTransforms(positiontexturevertex4, openGLMAT); - applyMatrixTransforms(positiontexturevertex5, openGLMAT); - applyMatrixTransforms(positiontexturevertex6, openGLMAT); - applyMatrixTransforms(positiontexturevertex7, openGLMAT); - - this.vertexPositions[0] = positiontexturevertex7; - this.vertexPositions[1] = positiontexturevertex; - this.vertexPositions[2] = positiontexturevertex1; - this.vertexPositions[3] = positiontexturevertex2; - this.vertexPositions[4] = positiontexturevertex3; - this.vertexPositions[5] = positiontexturevertex4; - this.vertexPositions[6] = positiontexturevertex5; - this.vertexPositions[7] = positiontexturevertex6; - this.quadList[0] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex4, positiontexturevertex, positiontexturevertex1, positiontexturevertex5}, texU + dz + dx, texV + dz, texU + dz + dx + dz, texV + dz + dy, renderer.textureWidth, renderer.textureHeight); - this.quadList[1] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex7, positiontexturevertex3, positiontexturevertex6, positiontexturevertex2}, texU, texV + dz, texU + dz, texV + dz + dy, renderer.textureWidth, renderer.textureHeight); - this.quadList[2] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex4, positiontexturevertex3, positiontexturevertex7, positiontexturevertex}, texU + dz, texV, texU + dz + dx, texV + dz, renderer.textureWidth, renderer.textureHeight); - this.quadList[3] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex1, positiontexturevertex2, positiontexturevertex6, positiontexturevertex5}, texU + dz + dx, texV + dz, texU + dz + dx + dx, texV, renderer.textureWidth, renderer.textureHeight); - this.quadList[4] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex, positiontexturevertex7, positiontexturevertex2, positiontexturevertex1}, texU + dz, texV + dz, texU + dz + dx, texV + dz + dy, renderer.textureWidth, renderer.textureHeight); - this.quadList[5] = new TexturedQuad(new PositionTextureVertex[] {positiontexturevertex3, positiontexturevertex4, positiontexturevertex5, positiontexturevertex6}, texU + dz + dx + dz, texV + dz, texU + dz + dx + dz + dx, texV + dz + dy, renderer.textureWidth, renderer.textureHeight); - - if (mirror) - { - for (TexturedQuad texturedquad : this.quadList) - { - texturedquad.flipFace(); - } - }*/ - } - - - public void applyMatrixTransforms(PositionTextureVertex vert, Matrix4f openGLMAT) { - Vec3d v = vert.vector3D; - Vector4f v3d = new Vector4f((float) v.x, (float) v.y, (float) v.z, 1.0f); - - - //org.lwjgl.util.vector.Matrix4f openGLMAT = MatrixHelper.captureMatrix(); - Vector4f r = org.lwjgl.util.vector.Matrix4f.transform(openGLMAT, v3d, null); - vert.vector3D = new Vec3d(r.x, r.y, r.z); - - } - -} diff --git a/src/main/java/com/paneedah/weaponlib/render/qrender/QOven.java b/src/main/java/com/paneedah/weaponlib/render/qrender/QOven.java deleted file mode 100644 index 59705ac9a..000000000 --- a/src/main/java/com/paneedah/weaponlib/render/qrender/QOven.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.paneedah.weaponlib.render.qrender; - -import net.minecraft.client.model.ModelBase; - -public class QOven { - - public void bake(ModelBase model) { - - } - -} diff --git a/src/main/java/com/paneedah/weaponlib/render/scopes/Reticle.java b/src/main/java/com/paneedah/weaponlib/render/scopes/Reticle.java index f71d62ad7..ca6de448a 100644 --- a/src/main/java/com/paneedah/weaponlib/render/scopes/Reticle.java +++ b/src/main/java/com/paneedah/weaponlib/render/scopes/Reticle.java @@ -1,5 +1,7 @@ package com.paneedah.weaponlib.render.scopes; +import lombok.Getter; +import lombok.Setter; import net.minecraft.util.ResourceLocation; import net.minecraft.util.math.Vec3d; @@ -11,11 +13,13 @@ public class Reticle { private static final int DEFAULT_TINT = 0x576574; + @Getter @Setter private ResourceLocation reticleTexture; private Type reticleType; - + @Setter @Getter private float textureScale; + @Setter @Getter private Vec3d backgroundColor; public enum Type { @@ -45,30 +49,6 @@ private static Vec3d extractColorFromHex(int color) { return new Vec3d(col.getRed() / 255f, col.getBlue() / 255f, col.getGreen() / 255f); } - public ResourceLocation getReticleTexture() { - return reticleTexture; - } - - public void setReticleTexture(ResourceLocation reticleTexture) { - this.reticleTexture = reticleTexture; - } - - public float getTextureScale() { - return textureScale; - } - - public void setTextureScale(float textureScale) { - this.textureScale = textureScale; - } - - - public Vec3d getBackgroundColor() { - return backgroundColor; - } - - public void setBackgroundColor(Vec3d backgroundColor) { - this.backgroundColor = backgroundColor; - } public static int getDefaultTint() { return DEFAULT_TINT; diff --git a/src/main/java/com/paneedah/weaponlib/vehicle/jimphysics/Transmission.java b/src/main/java/com/paneedah/weaponlib/vehicle/jimphysics/Transmission.java index d61415126..c1a967acf 100644 --- a/src/main/java/com/paneedah/weaponlib/vehicle/jimphysics/Transmission.java +++ b/src/main/java/com/paneedah/weaponlib/vehicle/jimphysics/Transmission.java @@ -27,8 +27,8 @@ public class Transmission { public int upshiftRPM = 0; public int downshiftRPM = 0; - public int eUShift = 0; - public int eDShift = 0; + public int eUShift = 2500; + public int eDShift = 1200; /** * Transmission Alterable Settings