This commit is contained in:
Bob 2023-04-16 21:28:45 +02:00
parent ba02c7fa9e
commit cc2833098f
14 changed files with 2708 additions and 18 deletions

View File

@ -12,6 +12,7 @@ public interface IToolable {
HAND_DRILL,
DEFUSER,
WRENCH,
TORCH
TORCH,
BOLT
}
}

View File

@ -1981,7 +1981,7 @@ public class ModBlocks {
watz_element = new BlockPillar(Material.iron, RefStrings.MODID + ":watz_element_top").setBlockName("watz_element").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":watz_element_side");
watz_control = new BlockPillar(Material.iron, RefStrings.MODID + ":watz_control_top").setBlockName("watz_control").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":watz_control_side");
watz_cooler = new BlockGeneric(Material.iron).setBlockName("watz_cooler").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":watz_cooler");
watz_end = new BlockGeneric(Material.iron).setBlockName("watz_end").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":watz_casing");
watz_end = new BlockBoltable(Material.iron).setBlockName("watz_end").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":watz_casing");
watz_hatch = new WatzHatch(Material.iron).setBlockName("watz_hatch").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":watz_hatch");
watz_conductor = new BlockCableConnect(Material.iron).setBlockName("watz_conductor").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":watz_conductor_top");
watz_core = new WatzCore(Material.iron).setBlockName("watz_core").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.machineTab).setBlockTextureName(RefStrings.MODID + ":watz_computer");
@ -3263,7 +3263,7 @@ public class ModBlocks {
GameRegistry.registerBlock(watz_element, watz_element.getUnlocalizedName());
GameRegistry.registerBlock(watz_control, watz_control.getUnlocalizedName());
GameRegistry.registerBlock(watz_cooler, watz_cooler.getUnlocalizedName());
GameRegistry.registerBlock(watz_end, watz_end.getUnlocalizedName());
register(watz_end);
GameRegistry.registerBlock(watz_hatch, watz_hatch.getUnlocalizedName());
GameRegistry.registerBlock(watz_conductor, watz_conductor.getUnlocalizedName());
GameRegistry.registerBlock(watz_core, watz_core.getUnlocalizedName());

View File

@ -0,0 +1,72 @@
package com.hbm.blocks.generic;
import java.util.ArrayList;
import java.util.List;
import com.hbm.blocks.BlockBase;
import com.hbm.blocks.IBlockMulti;
import com.hbm.blocks.ILookOverlay;
import com.hbm.inventory.RecipesCommon.AStack;
import com.hbm.items.ModItems;
import com.hbm.util.I18nUtil;
import api.hbm.block.IToolable;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.world.World;
import net.minecraftforge.client.event.RenderGameOverlayEvent.Pre;
public class BlockBoltable extends BlockBase implements IToolable, ILookOverlay, IBlockMulti {
public BlockBoltable(Material mat) {
super(mat);
}
@Override
public boolean onScrew(World world, EntityPlayer player, int x, int y, int z, int side, float fX, float fY, float fZ, ToolType tool) {
if(tool != ToolType.BOLT) return false;
return true;
}
public List<AStack> getMaterials(int meta) {
List<AStack> list = new ArrayList();
return list;
}
@Override
@SideOnly(Side.CLIENT)
public void printHook(Pre event, World world, int x, int y, int z) {
ItemStack held = Minecraft.getMinecraft().thePlayer.getHeldItem();
if(held == null || held.getItem() != ModItems.boltgun) return;
List<String> text = new ArrayList();
text.add(EnumChatFormatting.GOLD + "Requires:");
List<AStack> materials = getMaterials(world.getBlockMetadata(x, y, z));
for(AStack stack : materials) {
try {
ItemStack display = stack.extractForCyclingDisplay(20);
text.add("- " + display.getDisplayName() + " x" + display.stackSize);
} catch(Exception ex) {
text.add(EnumChatFormatting.RED + "- ERROR");
}
}
if(!materials.isEmpty()) {
ILookOverlay.printGeneric(event, I18nUtil.resolveKey(this.getUnlocalizedName() + ".name"), 0xffff00, 0x404000, text);
}
}
@Override
public int getSubCount() {
return 1;
}
}

View File

@ -0,0 +1,14 @@
package com.hbm.items;
import com.hbm.render.anim.BusAnimation;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@SideOnly(Side.CLIENT)
public interface IAnimatedItem {
public BusAnimation getAnimation(NBTTagCompound data, ItemStack stack);
}

View File

@ -1802,6 +1802,7 @@ public class ModItems {
public static Item chemistry_set_boron;
public static Item blowtorch;
public static Item acetylene_torch;
public static Item boltgun;
public static Item overfuse;
public static Item arc_electrode;
public static Item arc_electrode_burnt;
@ -4408,6 +4409,7 @@ public class ModItems {
chemistry_set_boron = new ItemCraftingDegradation(0).setUnlocalizedName("chemistry_set_boron");
blowtorch = new ItemBlowtorch().setUnlocalizedName("blowtorch");
acetylene_torch = new ItemBlowtorch().setUnlocalizedName("acetylene_torch");
boltgun = new ItemBoltgun().setUnlocalizedName("boltgun");
overfuse = new ItemCustomLore().setUnlocalizedName("overfuse").setMaxStackSize(1).setFull3D().setTextureName(RefStrings.MODID + ":overfuse");
arc_electrode = new ItemCustomLore().setUnlocalizedName("arc_electrode").setMaxDamage(250).setCreativeTab(MainRegistry.controlTab).setMaxStackSize(1).setCreativeTab(MainRegistry.controlTab).setFull3D().setTextureName(RefStrings.MODID + ":arc_electrode");
arc_electrode_burnt = new Item().setUnlocalizedName("arc_electrode_burnt").setMaxStackSize(1).setFull3D().setTextureName(RefStrings.MODID + ":arc_electrode_burnt");
@ -6431,15 +6433,12 @@ public class ModItems {
GameRegistry.registerItem(chemistry_set_boron, chemistry_set_boron.getUnlocalizedName());
GameRegistry.registerItem(blowtorch, blowtorch.getUnlocalizedName());
GameRegistry.registerItem(acetylene_torch, acetylene_torch.getUnlocalizedName());
GameRegistry.registerItem(boltgun, boltgun.getUnlocalizedName());
GameRegistry.registerItem(overfuse, overfuse.getUnlocalizedName());
GameRegistry.registerItem(arc_electrode, arc_electrode.getUnlocalizedName());
GameRegistry.registerItem(arc_electrode_burnt, arc_electrode_burnt.getUnlocalizedName());
GameRegistry.registerItem(arc_electrode_desh, arc_electrode_desh.getUnlocalizedName());
//Particle Collider Items
//GameRegistry.registerItem(crystal_energy, crystal_energy.getUnlocalizedName());
//GameRegistry.registerItem(pellet_coolant, pellet_coolant.getUnlocalizedName());
//Particle Collider Fuel
GameRegistry.registerItem(part_lithium, part_lithium.getUnlocalizedName());
GameRegistry.registerItem(part_beryllium, part_beryllium.getUnlocalizedName());

View File

@ -28,6 +28,7 @@ import net.minecraft.world.World;
public class ItemBlowtorch extends Item implements IFillableItem {
public ItemBlowtorch() {
this.setMaxStackSize(1);
this.setFull3D();
this.setCreativeTab(MainRegistry.controlTab);
}

View File

@ -0,0 +1,78 @@
package com.hbm.items.tool;
import com.hbm.items.IAnimatedItem;
import com.hbm.lib.RefStrings;
import com.hbm.packet.AuxParticlePacketNT;
import com.hbm.packet.PacketDispatcher;
import com.hbm.render.anim.BusAnimation;
import com.hbm.render.anim.BusAnimationKeyframe;
import com.hbm.render.anim.BusAnimationSequence;
import api.hbm.block.IToolable;
import api.hbm.block.IToolable.ToolType;
import cpw.mods.fml.common.network.NetworkRegistry.TargetPoint;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.block.Block;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class ItemBoltgun extends Item implements IAnimatedItem {
public ItemBoltgun() {
this.setMaxStackSize(1);
}
@Override
public Item setUnlocalizedName(String unlocalizedName) {
super.setUnlocalizedName(unlocalizedName);
this.setTextureName(RefStrings.MODID + ":"+ unlocalizedName);
return this;
}
@Override
public boolean onItemUse(ItemStack stack, EntityPlayer player, World world, int x, int y, int z, int side, float fX, float fY, float fZ) {
Block b = world.getBlock(x, y, z);
if(b instanceof IToolable && ((IToolable)b).onScrew(world, player, x, y, z, side, fX, fY, fZ, ToolType.BOLT)) {
if(!world.isRemote) {
player.inventoryContainer.detectAndSendChanges();
ForgeDirection dir = ForgeDirection.getOrientation(side);
double off = 0.25;
NBTTagCompound data = new NBTTagCompound();
data.setString("type", "vanillaExt");
data.setString("mode", "largeexplode");
data.setFloat("size", 1F);
data.setByte("count", (byte)1);
PacketDispatcher.wrapper.sendToAllAround(new AuxParticlePacketNT(data, x + fX + dir.offsetX * off, y + fY + dir.offsetY * off, z + fZ + dir.offsetZ * off), new TargetPoint(world.provider.dimensionId, x, y, z, 50));
NBTTagCompound d0 = new NBTTagCompound();
d0.setString("type", "anim");
d0.setString("mode", "generic");
PacketDispatcher.wrapper.sendTo(new AuxParticlePacketNT(d0, 0, 0, 0), (EntityPlayerMP) player);
}
return false;
}
return false;
}
@Override
@SideOnly(Side.CLIENT)
public BusAnimation getAnimation(NBTTagCompound data, ItemStack stack) {
return new BusAnimation()
.addBus("RECOIL", new BusAnimationSequence()
.addKeyframe(new BusAnimationKeyframe(1, 0, 1, 50))
.addKeyframe(new BusAnimationKeyframe(0, 0, 1, 100)));
}
}

View File

@ -64,6 +64,7 @@ import com.hbm.handler.CasingEjector;
import com.hbm.handler.HbmKeybinds;
import com.hbm.handler.ImpactWorldHandler;
import com.hbm.handler.HbmKeybinds.EnumKeybind;
import com.hbm.items.IAnimatedItem;
import com.hbm.items.ModItems;
import com.hbm.particle.*;
import com.hbm.particle.psys.engine.EventHandlerParticleEngine;
@ -428,6 +429,7 @@ public class ClientProxy extends ServerProxy {
MinecraftForgeClient.registerItemRenderer(ModItems.mese_gavel, new ItemRenderGavel());
MinecraftForgeClient.registerItemRenderer(ModItems.crucible, new ItemRenderCrucible());
MinecraftForgeClient.registerItemRenderer(ModItems.chainsaw, new ItemRenderChainsaw());
MinecraftForgeClient.registerItemRenderer(ModItems.boltgun, new ItemRenderBoltgun());
//guns
MinecraftForgeClient.registerItemRenderer(ModItems.gun_rpg, new ItemRenderRpg());
MinecraftForgeClient.registerItemRenderer(ModItems.gun_karl, new ItemRenderRpg());
@ -1630,8 +1632,10 @@ public class ClientProxy extends ServerProxy {
if("anim".equals(type)) {
String mode = data.getString("mode");
/* crucible deploy */
if("crucible".equals(data.getString("mode")) && player.getHeldItem() != null) {
if("crucible".equals(mode) && player.getHeldItem() != null) {
BusAnimation animation = new BusAnimation()
.addBus("GUARD_ROT", new BusAnimationSequence()
@ -1643,7 +1647,7 @@ public class ClientProxy extends ServerProxy {
}
/* crucible swing */
if("cSwing".equals(data.getString("mode"))) {
if("cSwing".equals(mode)) {
if(HbmAnimations.getRelevantTransformation("SWING_ROT")[0] == 0) {
@ -1666,7 +1670,7 @@ public class ClientProxy extends ServerProxy {
}
/* chainsaw swing */
if("sSwing".equals(data.getString("mode")) || "lSwing".equals(data.getString("mode"))) { //temp for lance
if("sSwing".equals(mode) || "lSwing".equals(mode)) { //temp for lance
int forward = 150;
int sideways = 100;
@ -1709,6 +1713,19 @@ public class ClientProxy extends ServerProxy {
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), animation);
}
}
if("generic".equals(mode)) {
ItemStack stack = player.getHeldItem();
if(stack != null && stack.getItem() instanceof IAnimatedItem) {
IAnimatedItem item = (IAnimatedItem) stack.getItem();
BusAnimation anim = item.getAnimation(data, stack);
if(anim != null) {
HbmAnimations.hotbar[player.inventory.currentItem] = new Animation(player.getHeldItem().getItem().getUnlocalizedName(), System.currentTimeMillis(), anim);
}
}
}
}
if("tau".equals(type)) {

View File

@ -681,6 +681,7 @@ public class ResourceManager {
public static final IModelCustom gavel = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/gavel.obj"));
public static final IModelCustom crucible = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/crucible.obj"));
public static final IModelCustom chainsaw = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/chainsaw.obj"), false);
public static final IModelCustom boltgun = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/boltgun.obj"));
public static final IModelCustom hk69 = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/hk69.obj"));
public static final IModelCustom deagle = new HFRWavefrontObject(new ResourceLocation(RefStrings.MODID, "models/weapons/deagle.obj"));
@ -754,6 +755,7 @@ public class ResourceManager {
public static final ResourceLocation crucible_guard = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/crucible_guard.png");
public static final ResourceLocation crucible_blade = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/crucible_blade.png");
public static final ResourceLocation chainsaw_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/chainsaw.png");
public static final ResourceLocation boltgun_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/boltgun.png");
public static final ResourceLocation hk69_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/hk69.png");
public static final ResourceLocation deagle_tex = new ResourceLocation(RefStrings.MODID, "textures/models/weapons/deagle.png");

View File

@ -0,0 +1,98 @@
package com.hbm.render.item;
import org.lwjgl.opengl.GL11;
import com.hbm.main.ResourceManager;
import com.hbm.render.anim.HbmAnimations;
import net.minecraft.client.Minecraft;
import net.minecraft.item.ItemStack;
import net.minecraftforge.client.IItemRenderer;
public class ItemRenderBoltgun implements IItemRenderer {
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
switch(type) {
case EQUIPPED:
case EQUIPPED_FIRST_PERSON:
case ENTITY:
case INVENTORY:
return true;
default: return false;
}
}
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return type == ItemRenderType.ENTITY && (helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING);
}
@Override
public void renderItem(ItemRenderType type, ItemStack item, Object... data) {
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_CULL_FACE);
Minecraft.getMinecraft().renderEngine.bindTexture(ResourceManager.boltgun_tex);
switch(type) {
case EQUIPPED_FIRST_PERSON:
double s0 = 0.15D;
GL11.glTranslated(0.5, 0.35, -0.25F);
GL11.glRotated(15, 0, 0, 1);
GL11.glRotated(80, 0, 1, 0);
GL11.glScaled(s0, s0, s0);
GL11.glPushMatrix();
double[] anim = HbmAnimations.getRelevantTransformation("RECOIL");
GL11.glTranslated(0, 0, -anim[0]);
ResourceManager.boltgun.renderPart("Barrel");
GL11.glPopMatrix();
break;
case EQUIPPED:
double scale = -0.375D;
GL11.glScaled(scale, scale, scale);
GL11.glRotated(85, 0, 1, 0);
GL11.glRotated(135D, 1.0D, 0.0D, 0.0D);
GL11.glTranslated(-0.125, -2.0, 1.75);
break;
case ENTITY:
double s1 = 0.1D;
GL11.glScaled(s1, s1, s1);
break;
case INVENTORY:
GL11.glEnable(GL11.GL_ALPHA_TEST);
GL11.glEnable(GL11.GL_LIGHTING);
double s = 1.75D;
GL11.glTranslated(7, 10, 0);
GL11.glRotated(-90, 0, 1, 0);
GL11.glRotated(-135, 1, 0, 0);
GL11.glScaled(s, s, -s);
break;
default: break;
}
GL11.glShadeModel(GL11.GL_SMOOTH);
ResourceManager.boltgun.renderPart("Gun");
if(type != type.EQUIPPED_FIRST_PERSON) {
ResourceManager.boltgun.renderPart("Barrel");
}
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glPopMatrix();
}
}

View File

@ -12,8 +12,6 @@ import net.minecraft.util.MathHelper;
import net.minecraftforge.client.IItemRenderer;
public class ItemRenderChainsaw implements IItemRenderer {
public ItemRenderChainsaw() { }
@Override
public boolean handleRenderType(ItemStack item, ItemRenderType type) {
@ -29,7 +27,6 @@ public class ItemRenderChainsaw implements IItemRenderer {
@Override
public boolean shouldUseRenderHelper(ItemRenderType type, ItemStack item, ItemRendererHelper helper) {
return type == ItemRenderType.ENTITY && (helper == ItemRendererHelper.ENTITY_ROTATION || helper == ItemRendererHelper.ENTITY_BOBBING);
}

View File

@ -131,11 +131,7 @@ public class TileEntityWatz extends TileEntityMachineBase implements IFluidStand
/** basic sanity checking, usually wouldn't do anything except when NBT loading borks */
public void setupCoolant() {
if(!tanks[0].getTankType().hasTrait(FT_Heatable.class)) {
tanks[0].setTankType(Fluids.COOLANT);
}
tanks[0].setTankType(Fluids.COOLANT);
tanks[1].setTankType(tanks[0].getTankType().getTrait(FT_Heatable.class).getFirstStep().typeProduced);
}

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.0 KiB