spicy himars ammo, more glyphid crap, compressor work

This commit is contained in:
Bob 2023-06-18 20:11:36 +02:00
parent febeafe459
commit f2886ea33e
29 changed files with 6820 additions and 1816 deletions

View File

@ -1,9 +1,15 @@
package com.hbm.blocks.generic;
import java.util.List;
import java.util.Random;
import com.hbm.entity.mob.EntityGlyphid;
import com.hbm.entity.mob.EntityGlyphidBlaster;
import com.hbm.entity.mob.EntityGlyphidBombardier;
import com.hbm.entity.mob.EntityGlyphidBrawler;
import com.hbm.entity.mob.EntityGlyphidScout;
import com.hbm.handler.pollution.PollutionHandler;
import com.hbm.handler.pollution.PollutionHandler.PollutionType;
import net.minecraft.block.BlockContainer;
import net.minecraft.block.material.Material;
@ -29,21 +35,33 @@ public class BlockGlyphidSpawner extends BlockContainer {
public void updateEntity() {
if(!worldObj.isRemote && worldObj.getTotalWorldTime() % 60 == 0 && this.worldObj.difficultySetting != EnumDifficulty.PEACEFUL) {
List<EntityGlyphid> list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 4, yCoord + 1, zCoord - 4, xCoord + 5, yCoord + 4, zCoord + 5));
float soot = PollutionHandler.getPollution(worldObj, xCoord, yCoord, zCoord, PollutionType.SOOT);
List<EntityGlyphid> list = worldObj.getEntitiesWithinAABB(EntityGlyphid.class, AxisAlignedBB.getBoundingBox(xCoord - 6, yCoord + 1, zCoord - 6, xCoord + 7, yCoord + 9, zCoord + 7));
if(list.size() < 3) {
EntityGlyphid glyphid = new EntityGlyphid(worldObj);
EntityGlyphid glyphid = createGlyphid(soot);
glyphid.setLocationAndAngles(xCoord + 0.5, yCoord + 1, zCoord + 0.5, worldObj.rand.nextFloat() * 360.0F, 0.0F);
this.worldObj.spawnEntityInWorld(glyphid);
}
if(worldObj.rand.nextInt(20) == 0) {
if(worldObj.rand.nextInt(20) == 0 && soot > 0) {
EntityGlyphidScout scout = new EntityGlyphidScout(worldObj);
scout.setLocationAndAngles(xCoord + 0.5, yCoord + 1, zCoord + 0.5, worldObj.rand.nextFloat() * 360.0F, 0.0F);
this.worldObj.spawnEntityInWorld(scout);
}
}
}
public EntityGlyphid createGlyphid(float soot) {
Random rand = new Random();
if(soot < 1) {
return rand.nextInt(5) == 0 ? new EntityGlyphidBombardier(worldObj) : new EntityGlyphid(worldObj);
}
return rand.nextInt(5) == 0 ? new EntityGlyphidBlaster(worldObj) : new EntityGlyphidBrawler(worldObj);
}
}
}

View File

@ -4,8 +4,10 @@ import com.hbm.blocks.BlockDummyable;
import com.hbm.tileentity.machine.TileEntityMachineCompressor;
import net.minecraft.block.material.Material;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.world.World;
import net.minecraftforge.common.util.ForgeDirection;
public class MachineCompressor extends BlockDummyable {
@ -29,4 +31,19 @@ public class MachineCompressor extends BlockDummyable {
public int getOffset() {
return 2;
}
@Override
public boolean onBlockActivated(World world, int x, int y, int z, EntityPlayer player, int side, float hitX, float hitY, float hitZ) {
return this.standardOpenBehavior(world, x, y, z, player, 0);
}
@Override
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
return super.checkRequirement(world, x, y, z, dir, o);
}
@Override
public void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
super.fillSpace(world, x, y, z, dir, o);
}
}

View File

@ -142,4 +142,60 @@ public class RailStandardCurve extends BlockDummyable implements IRailNTM {
this.setBlockBounds(0F, 0F, 0F, 1F, 0.125F, 1F);
return AxisAlignedBB.getBoundingBox(x + this.minX, y + this.minY, z + this.minZ, x + this.maxX, y + this.maxY, z + this.maxZ);
}
@Override
protected boolean checkRequirement(World world, int x, int y, int z, ForgeDirection dir, int o) {
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
dir = dir.getOpposite();
int dX = dir.offsetX;
int dZ = dir.offsetZ;
int rX = rot.offsetX;
int rZ = rot.offsetZ;
return world.getBlock(x + dX, y, z + dZ).isReplaceable(world, x + dX, y, z + dZ) &&
world.getBlock(x + rX, y, z + rZ).isReplaceable(world, x + rX, y, z + rZ) &&
world.getBlock(x + dX + rX, y, z + dZ + rZ).isReplaceable(world, x + dX + rX, y, z + dZ + rZ) &&
world.getBlock(x + dX + rX * 2, y, z + dZ + rZ * 2).isReplaceable(world, x + dX + rX * 2, y, z + dZ + rZ * 2) &&
world.getBlock(x + dX * 2 + rX, y, z + dZ * 2 + rZ).isReplaceable(world, x + dX * 2 + rX, y, z + dZ * 2 + rZ) &&
world.getBlock(x + dX * 2 + rX * 2, y, z + dZ * 2 + rZ * 2).isReplaceable(world, x + dX * 2 + rX * 2, y, z + dZ * 2 + rZ * 2) &&
world.getBlock(x + dX * 3 + rX, y, z + dZ * 3 + rZ).isReplaceable(world, x + dX * 3 + rX, y, z + dZ * 3 + rZ) &&
world.getBlock(x + dX * 3 + rX * 2, y, z + dZ * 3 + rZ * 2).isReplaceable(world, x + dX * 3 + rX * 2, y, z + dZ * 3 + rZ * 2) &&
world.getBlock(x + dX * 2 + rX * 3, y, z + dZ * 2 + rZ * 3).isReplaceable(world, x + dX * 2 + rX * 3, y, z + dZ * 2 + rZ * 3) &&
world.getBlock(x + dX * 3 + rX * 3, y, z + dZ * 3 + rZ * 3).isReplaceable(world, x + dX * 3 + rX * 3, y, z + dZ * 3 + rZ * 3) &&
world.getBlock(x + dX * 4 + rX * 3, y, z + dZ * 4 + rZ * 3).isReplaceable(world, x + dX * 4 + rX * 3, y, z + dZ * 4 + rZ * 3) &&
world.getBlock(x + dX * 3 + rX * 4, y, z + dZ * 3 + rZ * 4).isReplaceable(world, x + dX * 3 + rX * 4, y, z + dZ * 3 + rZ * 4) &&
world.getBlock(x + dX * 4 + rX * 4, y, z + dZ * 4 + rZ * 4).isReplaceable(world, x + dX * 4 + rX * 4, y, z + dZ * 4 + rZ * 4);
}
@Override
protected void fillSpace(World world, int x, int y, int z, ForgeDirection dir, int o) {
BlockDummyable.safeRem = true;
ForgeDirection rot = dir.getRotation(ForgeDirection.UP);
dir = dir.getOpposite();
int dX = dir.offsetX;
int dZ = dir.offsetZ;
int rX = rot.offsetX;
int rZ = rot.offsetZ;
world.setBlock(x + dX, y, z + dZ, this, dir.ordinal(), 3);
world.setBlock(x + rX, y, z + rZ, this, rot.ordinal(), 3);
world.setBlock(x + dX + rX, y, z + dZ + rZ, this, rot.ordinal(), 3);
world.setBlock(x + dX + rX * 2, y, z + dZ + rZ * 2, this, rot.ordinal(), 3);
world.setBlock(x + dX * 2 + rX, y, z + dZ * 2 + rZ, this, dir.ordinal(), 3);
world.setBlock(x + dX * 2 + rX * 2, y, z + dZ * 2 + rZ * 2, this, dir.ordinal(), 3);
world.setBlock(x + dX * 3 + rX, y, z + dZ * 3 + rZ, this, dir.ordinal(), 3);
world.setBlock(x + dX * 3 + rX * 2, y, z + dZ * 3 + rZ * 2, this, dir.ordinal(), 3);
world.setBlock(x + dX * 2 + rX * 3, y, z + dZ * 2 + rZ * 3, this, rot.ordinal(), 3);
world.setBlock(x + dX * 3 + rX * 3, y, z + dZ * 3 + rZ * 3, this, rot.ordinal(), 3);
world.setBlock(x + dX * 4 + rX * 3, y, z + dZ * 4 + rZ * 3, this, dir.ordinal(), 3);
world.setBlock(x + dX * 3 + rX * 4, y, z + dZ * 3 + rZ * 4, this, rot.ordinal(), 3);
world.setBlock(x + dX * 4 + rX * 4, y, z + dZ * 4 + rZ * 4, this, rot.ordinal(), 3);
BlockDummyable.safeRem = false;
}
}

View File

@ -24,7 +24,6 @@ public class GeneralConfig {
public static boolean enableCrosshairs = true;
public static boolean enableReflectorCompat = false;
public static boolean enableRenderDistCheck = true;
public static boolean enableCustomDashKeybind = false;
public static boolean enableReEval = true;
public static boolean enableSilentCompStackErrors = true;
public static boolean enableChunkyNEIHandler = true;
@ -82,7 +81,6 @@ public class GeneralConfig {
enableCrosshairs = config.get(CATEGORY_GENERAL, "1.22_enableCrosshairs", true, "Shows custom crosshairs when an NTM gun is being held").getBoolean(true);
enableReflectorCompat = config.get(CATEGORY_GENERAL, "1.24_enableReflectorCompat", false, "Enable old reflector oredict name (\"plateDenseLead\") instead of new \"plateTungCar\"").getBoolean(false);
enableRenderDistCheck = config.get(CATEGORY_GENERAL, "1.25_enableRenderDistCheck", true, "Check invalid render distances (over 16, without OptiFine) and fix it").getBoolean(true);
enableCustomDashKeybind = config.get(CATEGORY_GENERAL, "1.26_enableCustomDashKeybind", false, "Enable custom dash keybind instead of shift").getBoolean(false);
enableReEval = config.get(CATEGORY_GENERAL, "1.27_enableReEval", true, "Allows re-evaluating power networks on link remove instead of destroying and recreating").getBoolean(true);
enableSilentCompStackErrors = config.get(CATEGORY_GENERAL, "1.28_enableSilentCompStackErrors", false, "Enabling this will disable log spam created by unregistered items in ComparableStack instances.").getBoolean(false);
hintPos = CommonConfig.createConfigInt(config, CATEGORY_GENERAL, "1.29_hudOverlayPosition", "0: Top left\n1: Top right\n2: Center right\n3: Center Left", 0);

View File

@ -61,6 +61,12 @@ public class EntityGlyphid extends EntityMob {
this.getEntityAttribute(SharedMonsterAttributes.movementSpeed).setBaseValue(1D);
this.getEntityAttribute(SharedMonsterAttributes.attackDamage).setBaseValue(5D);
}
@Override
protected Entity findPlayerToAttack() {
EntityPlayer entityplayer = this.worldObj.getClosestVulnerablePlayerToEntity(this, 32.0D);
return entityplayer != null && this.canEntityBeSeen(entityplayer) ? entityplayer : null;
}
@Override
public boolean attackEntityFrom(DamageSource source, float amount) {
@ -123,6 +129,7 @@ public class EntityGlyphid extends EntityMob {
armor &= ~bit;
armor = (byte) (armor & 0b11111);
this.dataWatcher.updateObject(17, armor);
worldObj.playSoundAtEntity(this, "mob.zombie.woodbreak", 1.0F, 1.25F);
break;
}
}

View File

@ -5,8 +5,11 @@ import com.hbm.main.ResourceManager;
import com.hbm.world.feature.GlyphidHive;
import net.minecraft.block.Block;
import net.minecraft.block.material.Material;
import net.minecraft.entity.SharedMonsterAttributes;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.MathHelper;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Vec3;
import net.minecraft.world.World;
@ -68,12 +71,33 @@ public class EntityGlyphidScout extends EntityGlyphid {
this.homeZ = posZ;
this.hasHome = true;
}
if(rand.nextInt(20) == 0) fleeingTick = 2;
if(this.ticksExisted > 0 && this.ticksExisted % 1200 == 0 && Vec3.createVectorHelper(posX - homeX, posY - homeY, posZ - homeZ).lengthVector() > 16) {
if(this.ticksExisted > 0 && this.ticksExisted % 1200 == 0 && Vec3.createVectorHelper(posX - homeX, posY - homeY, posZ - homeZ).lengthVector() > 8) {
Block b = worldObj.getBlock((int) Math.floor(posX), (int) Math.floor(posY - 1), (int) Math.floor(posZ));
if(b.isNormalCube() && b != ModBlocks.glyphid_base) {
int accuracy = 16;
for(int i = 0; i < accuracy; i++) {
float angle = (float) Math.toRadians(360D / accuracy * i);
Vec3 rot = Vec3.createVectorHelper(0, 0, 16);
rot.rotateAroundY(angle);
Vec3 pos = Vec3.createVectorHelper(this.posX, this.posY + 1, this.posZ);
Vec3 nextPos = Vec3.createVectorHelper(this.posX + rot.xCoord, this.posY + 1, this.posZ + rot.zCoord);
MovingObjectPosition mop = this.worldObj.rayTraceBlocks(pos, nextPos);
if(mop != null && mop.typeOfHit == mop.typeOfHit.BLOCK) {
Block block = worldObj.getBlock(mop.blockX, mop.blockY, mop.blockZ);
if(block == ModBlocks.glyphid_base) {
return;
}
}
}
if(b.getMaterial() != Material.air && b.isNormalCube() && b != ModBlocks.glyphid_base) {
this.setDead();
worldObj.newExplosion(this, posX, posY, posZ, 5F, false, false);
GlyphidHive.generate(worldObj, (int) Math.floor(posX), (int) Math.floor(posY), (int) Math.floor(posZ), rand);
@ -82,6 +106,37 @@ public class EntityGlyphidScout extends EntityGlyphid {
}
}
@Override
protected void updateWanderPath() {
this.worldObj.theProfiler.startSection("stroll");
boolean flag = false;
int pathX = -1;
int pathY = -1;
int pathZ = -1;
float maxWeight = -99999.0F;
for(int l = 0; l < 5; ++l) {
int x = MathHelper.floor_double(this.posX + (double) this.rand.nextInt(25) - 12.0D);
int y = MathHelper.floor_double(this.posY + (double) this.rand.nextInt(11) - 5.0D);
int z = MathHelper.floor_double(this.posZ + (double) this.rand.nextInt(25) - 12.0D);
float weight = this.getBlockPathWeight(x, y, z);
if(weight > maxWeight) {
maxWeight = weight;
pathX = x;
pathY = y;
pathZ = z;
flag = true;
}
}
if(flag) {
this.setPathToEntity(this.worldObj.getEntityPathToXYZ(this, pathX, pathY, pathZ, 10.0F, true, false, false, true));
}
this.worldObj.theProfiler.endSection();
}
@Override
public void writeEntityToNBT(NBTTagCompound nbt) {
super.writeEntityToNBT(nbt);

View File

@ -484,16 +484,7 @@ public class EntityEffectHandler {
int dashCount = armorDashCount + armorModDashCount;
boolean dashActivated = false;
if(!GeneralConfig.enableCustomDashKeybind) {
dashActivated = !player.capabilities.isFlying && player.isSneaking();
} else {
dashActivated = props.getKeyPressed(EnumKeybind.DASH);
}
//System.out.println(dashCount);
boolean dashActivated = props.getKeyPressed(EnumKeybind.DASH);
if(dashCount * 30 < props.getStamina())
props.setStamina(dashCount * 30);

View File

@ -22,7 +22,7 @@ public class HbmKeybinds {
public static KeyBinding jetpackKey = new KeyBinding(category + ".toggleBack", Keyboard.KEY_C, category);
public static KeyBinding hudKey = new KeyBinding(category + ".toggleHUD", Keyboard.KEY_V, category);
public static KeyBinding reloadKey = new KeyBinding(category + ".reload", Keyboard.KEY_R, category);
public static KeyBinding dashKey = new KeyBinding(category + ".dash", Keyboard.KEY_F, category);
public static KeyBinding dashKey = new KeyBinding(category + ".dash", Keyboard.KEY_LSHIFT, category);
public static KeyBinding trainKey = new KeyBinding(category + ".trainInv", Keyboard.KEY_R, category);
public static KeyBinding craneUpKey = new KeyBinding(category + ".craneMoveUp", Keyboard.KEY_UP, category);

View File

@ -35,8 +35,8 @@ public class CrucibleAlloyingHandler extends TemplateRecipeHandler {
public RecipeSet(CrucibleRecipe recipe) {
List<ItemStack> inputs = new ArrayList();
List<ItemStack> outputs = new ArrayList();
for(MaterialStack stack : recipe.input) inputs.add(ItemScraps.create(stack));
for(MaterialStack stack : recipe.output) outputs.add(ItemScraps.create(stack));
for(MaterialStack stack : recipe.input) inputs.add(ItemScraps.create(stack, true));
for(MaterialStack stack : recipe.output) outputs.add(ItemScraps.create(stack, true));
this.template = new PositionedStack(new ItemStack(ModItems.crucible_template, 1, recipe.getId()), 75, 6);
this.crucible = new PositionedStack(new ItemStack(ModBlocks.machine_crucible), 75, 42);

View File

@ -0,0 +1,63 @@
package com.hbm.inventory.container;
import com.hbm.tileentity.machine.TileEntityMachineCompressor;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.inventory.Slot;
import net.minecraft.item.ItemStack;
public class ContainerCompressor extends Container {
private TileEntityMachineCompressor compressor;
public ContainerCompressor(InventoryPlayer playerInv, TileEntityMachineCompressor tile) {
compressor = tile;
//Fluid ID
this.addSlotToContainer(new Slot(tile, 0, 35, 72));
for(int i = 0; i < 3; i++) {
for(int j = 0; j < 9; j++) {
this.addSlotToContainer(new Slot(playerInv, j + i * 9 + 9, 8 + j * 18, 122 + i * 18));
}
}
for(int i = 0; i < 9; i++) {
this.addSlotToContainer(new Slot(playerInv, i, 8 + i * 18, 180));
}
}
@Override
public boolean canInteractWith(EntityPlayer player) {
return compressor.isUseableByPlayer(player);
}
@Override
public ItemStack transferStackInSlot(EntityPlayer player, int index) {
ItemStack var3 = null;
Slot var4 = (Slot) this.inventorySlots.get(index);
if(var4 != null && var4.getHasStack()) {
ItemStack var5 = var4.getStack();
var3 = var5.copy();
if(index == 0) {
if(!this.mergeItemStack(var5, 1, this.inventorySlots.size(), true)) {
return null;
}
} else if(!this.mergeItemStack(var5, 0, 1, false)) {
return null;
}
if(var5.stackSize == 0) {
var4.putStack((ItemStack) null);
} else {
var4.onSlotChanged();
}
}
return var3;
}
}

View File

@ -238,7 +238,7 @@ public class FluidTank {
list.add(fluid + "/" + maxFluid + "mB");
if(this.pressure != 0) {
list.add(EnumChatFormatting.RED + "" + this.pressure + "mB/l");
list.add(EnumChatFormatting.RED + "" + this.pressure + " PU");
}
type.addInfo(list);

View File

@ -0,0 +1,50 @@
package com.hbm.inventory.gui;
import org.lwjgl.opengl.GL11;
import com.hbm.inventory.container.ContainerCompressor;
import com.hbm.lib.RefStrings;
import com.hbm.tileentity.machine.TileEntityMachineCompressor;
import net.minecraft.client.Minecraft;
import net.minecraft.client.resources.I18n;
import net.minecraft.entity.player.InventoryPlayer;
import net.minecraft.util.ResourceLocation;
public class GUICompressor extends GuiInfoContainer {
private static ResourceLocation texture = new ResourceLocation(RefStrings.MODID + ":textures/gui/processing/gui_compressor.png");
private TileEntityMachineCompressor solidifier;
public GUICompressor(InventoryPlayer invPlayer, TileEntityMachineCompressor tedf) {
super(new ContainerCompressor(invPlayer, tedf));
solidifier = tedf;
this.xSize = 176;
this.ySize = 204;
}
@Override
public void drawScreen(int mouseX, int mouseY, float f) {
super.drawScreen(mouseX, mouseY, f);
//solidifier.tank.renderTankInfo(this, mouseX, mouseY, guiLeft + 35, guiTop + 36, 16, 52);
//this.drawElectricityInfo(this, mouseX, mouseY, guiLeft + 134, guiTop + 18, 16, 52, solidifier.power, solidifier.maxPower);
}
@Override
protected void drawGuiContainerForegroundLayer(int i, int j) {
String name = this.solidifier.hasCustomInventoryName() ? this.solidifier.getInventoryName() : I18n.format(this.solidifier.getInventoryName());
this.fontRendererObj.drawString(name, 70 - this.fontRendererObj.getStringWidth(name) / 2, 6, 0xC7C1A3);
this.fontRendererObj.drawString(I18n.format("container.inventory"), 8, this.ySize - 96 + 2, 4210752);
}
@Override
protected void drawGuiContainerBackgroundLayer(float p_146976_1_, int p_146976_2_, int p_146976_3_) {
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
Minecraft.getMinecraft().getTextureManager().bindTexture(texture);
drawTexturedModalRect(guiLeft, guiTop, 0, 0, xSize, ySize);
}
}

View File

@ -69,7 +69,7 @@ public class MatDistribution extends SerializableRecipe {
registerOre(OreDictManager.AL.ore(), MAT_ALUMINIUM, INGOT.q(2), MAT_STONE, QUART.q(1));
}
registerOre(OreDictManager.COAL.ore(), MAT_COAL, GEM.q(4), MAT_STONE, QUART.q(1));
registerOre(OreDictManager.COAL.ore(), MAT_CARBON, GEM.q(3), MAT_STONE, QUART.q(1));
registerOre(OreDictManager.GOLD.ore(), MAT_GOLD, INGOT.q(2), MAT_LEAD, NUGGET.q(3), MAT_STONE, QUART.q(1));
registerOre(OreDictManager.U.ore(), MAT_URANIUM, INGOT.q(2), MAT_LEAD, NUGGET.q(3), MAT_STONE, QUART.q(1));
registerOre(OreDictManager.TH232.ore(), MAT_THORIUM, INGOT.q(2), MAT_URANIUM, NUGGET.q(3), MAT_STONE, QUART.q(1));

View File

@ -248,7 +248,7 @@ public class CrucibleRecipes extends SerializableRecipe {
if(!ores.isEmpty()) {
List<ItemStack> stacks = new ArrayList();
stacks.add(ItemScraps.create(new MaterialStack(convert, (int) (shape.q(1) * out / in))));
stacks.add(ItemScraps.create(new MaterialStack(convert, (int) (shape.q(1) * out / in)), true));
map.put(new OreDictStack(name), stacks);
}
}
@ -257,7 +257,7 @@ public class CrucibleRecipes extends SerializableRecipe {
for(Entry<String, List<MaterialStack>> entry : Mats.materialOreEntries.entrySet()) {
List<ItemStack> stacks = new ArrayList();
for(MaterialStack mat : entry.getValue()) {
stacks.add(ItemScraps.create(mat));
stacks.add(ItemScraps.create(mat, true));
}
map.put(new OreDictStack(entry.getKey()), stacks);
}
@ -265,7 +265,7 @@ public class CrucibleRecipes extends SerializableRecipe {
for(Entry<ComparableStack, List<MaterialStack>> entry : Mats.materialEntries.entrySet()) {
List<ItemStack> stacks = new ArrayList();
for(MaterialStack mat : entry.getValue()) {
stacks.add(ItemScraps.create(mat));
stacks.add(ItemScraps.create(mat, true));
}
map.put(entry.getKey().copy(), stacks);
}
@ -293,7 +293,7 @@ public class CrucibleRecipes extends SerializableRecipe {
for(Mold mold : ItemMold.molds) {
ItemStack out = mold.getOutput(material);
if(out != null) {
ItemStack scrap = ItemScraps.create(new MaterialStack(material, mold.getCost()));
ItemStack scrap = ItemScraps.create(new MaterialStack(material, mold.getCost()), true);
ItemStack shape = new ItemStack(ModItems.mold, 1, mold.id);
ItemStack basin = new ItemStack(mold.size == 0 ? ModBlocks.foundry_mold : mold.size == 1 ? ModBlocks.foundry_basin : Blocks.fire);
ItemStack[] entry = new ItemStack[] {scrap, shape, basin, out};

View File

@ -9,25 +9,39 @@ import com.hbm.inventory.material.Mats;
import com.hbm.inventory.material.Mats.MaterialStack;
import com.hbm.items.ModItems;
import com.hbm.items.special.ItemAutogen;
import com.hbm.lib.RefStrings;
import com.hbm.util.I18nUtil;
import com.hbm.inventory.material.NTMMaterial;
import com.hbm.inventory.material.NTMMaterial.SmeltingBehavior;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.renderer.texture.IIconRegister;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IIcon;
import net.minecraft.util.StatCollector;
public class ItemScraps extends ItemAutogen {
@SideOnly(Side.CLIENT) public IIcon liquidIcon;
@SideOnly(Side.CLIENT) public IIcon addiviceIcon;
public ItemScraps() {
super(null);
}
@SideOnly(Side.CLIENT)
public void registerIcons(IIconRegister reg) {
super.registerIcons(reg);
this.liquidIcon = reg.registerIcon(RefStrings.MODID + ":scraps_liquid");
this.addiviceIcon = reg.registerIcon(RefStrings.MODID + ":scraps_additive");
}
@Override
@SideOnly(Side.CLIENT)
public void getSubItems(Item item, CreativeTabs tab, List list) {
@ -38,8 +52,48 @@ public class ItemScraps extends ItemAutogen {
}
}
@Override
@SideOnly(Side.CLIENT)
public int getColorFromItemStack(ItemStack stack, int layer) {
if(stack.hasTagCompound() && stack.stackTagCompound.getBoolean("liquid")) {
NTMMaterial mat = Mats.matById.get(stack.getItemDamage());
if(mat != null) {
return mat.moltenColor;
}
}
return super.getColorFromItemStack(stack, layer);
}
@SideOnly(Side.CLIENT)
public IIcon getIconIndex(ItemStack stack) {
if(stack.hasTagCompound() && stack.stackTagCompound.getBoolean("liquid")) {
NTMMaterial mat = Mats.matById.get(stack.getItemDamage());
if(mat != null) {
if(mat.smeltable == mat.smeltable.SMELTABLE) return this.liquidIcon;
if(mat.smeltable == mat.smeltable.ADDITIVE) return this.addiviceIcon;
}
}
return this.getIconFromDamage(stack.getItemDamage());
}
@Override
public String getItemStackDisplayName(ItemStack stack) {
if(stack.hasTagCompound() && stack.stackTagCompound.getBoolean("liquid")) {
MaterialStack contents = getMats(stack);
if(contents != null) {
return I18nUtil.resolveKey(contents.material.getUnlocalizedName());
}
}
return ("" + StatCollector.translateToLocal(this.getUnlocalizedNameInefficiently(stack) + ".name")).trim();
}
@ -48,7 +102,13 @@ public class ItemScraps extends ItemAutogen {
MaterialStack contents = getMats(stack);
if(contents != null) {
list.add(I18nUtil.resolveKey(contents.material.getUnlocalizedName()) + ", " + Mats.formatAmount(contents.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
if(stack.hasTagCompound() && stack.stackTagCompound.getBoolean("liquid")) {
list.add(Mats.formatAmount(contents.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
if(contents.material.smeltable == contents.material.smeltable.ADDITIVE) list.add(EnumChatFormatting.DARK_RED + "Additive, not castable!");
} else {
list.add(I18nUtil.resolveKey(contents.material.getUnlocalizedName()) + ", " + Mats.formatAmount(contents.amount, Keyboard.isKeyDown(Keyboard.KEY_LSHIFT)));
}
}
}
@ -69,11 +129,16 @@ public class ItemScraps extends ItemAutogen {
}
public static ItemStack create(MaterialStack stack) {
return create(stack, false);
}
public static ItemStack create(MaterialStack stack, boolean liquid) {
if(stack.material == null)
return new ItemStack(ModItems.nothing); //why do i bother adding checks for fucking everything when they don't work
ItemStack scrap = new ItemStack(ModItems.scraps, 1, stack.material.id);
scrap.stackTagCompound = new NBTTagCompound();
scrap.stackTagCompound.setInteger("amount", stack.amount);
if(liquid) scrap.stackTagCompound.setBoolean("liquid", true);
return scrap;
}
}

View File

@ -23,6 +23,7 @@ import com.hbm.potion.HbmPotion;
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.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
@ -39,7 +40,7 @@ import net.minecraft.util.Vec3;
public class ItemAmmoHIMARS extends Item {
public static HIMARSRocket[] itemTypes = new HIMARSRocket[ /* >>> */ 7 /* <<< */ ];
public static HIMARSRocket[] itemTypes = new HIMARSRocket[ /* >>> */ 8 /* <<< */ ];
public static final int SMALL = 0;
public static final int LARGE = 1;
@ -48,6 +49,7 @@ public class ItemAmmoHIMARS extends Item {
public static final int SMALL_TB = 4;
public static final int LARGE_TB = 5;
public static final int SMALL_MINI_NUKE = 6;
public static final int SMALL_LAVA = 7;
public ItemAmmoHIMARS() {
this.setHasSubtypes(true);
@ -64,6 +66,7 @@ public class ItemAmmoHIMARS extends Item {
list.add(new ItemStack(item, 1, SMALL_HE));
list.add(new ItemStack(item, 1, SMALL_WP));
list.add(new ItemStack(item, 1, SMALL_TB));
list.add(new ItemStack(item, 1, SMALL_LAVA));
list.add(new ItemStack(item, 1, SMALL_MINI_NUKE));
list.add(new ItemStack(item, 1, LARGE));
list.add(new ItemStack(item, 1, LARGE_TB));
@ -103,6 +106,11 @@ public class ItemAmmoHIMARS extends Item {
list.add(r + "Deals nuclear damage");
list.add(r + "Destroys blocks");
break;
case SMALL_LAVA:
list.add(y + "Strength: 20");
list.add(r + "Creates volcanic lava");
list.add(r + "Destroys blocks");
break;
case LARGE:
list.add(y + "Strength: 50");
list.add(y + "Damage modifier: 5x");
@ -139,13 +147,13 @@ public class ItemAmmoHIMARS extends Item {
public void onUpdate(EntityArtilleryRocket rocket) { }
}
public static void standardExplosion(EntityArtilleryRocket rocket, MovingObjectPosition mop, float size, float rangeMod, boolean breaksBlocks) {
public static void standardExplosion(EntityArtilleryRocket rocket, MovingObjectPosition mop, float size, float rangeMod, boolean breaksBlocks, Block slag, int slagMeta) {
rocket.worldObj.playSoundEffect(rocket.posX, rocket.posY, rocket.posZ, "hbm:weapon.explosionMedium", 20.0F, 0.9F + rocket.worldObj.rand.nextFloat() * 0.2F);
Vec3 vec = Vec3.createVectorHelper(rocket.motionX, rocket.motionY, rocket.motionZ).normalize();
ExplosionVNT xnt = new ExplosionVNT(rocket.worldObj, mop.hitVec.xCoord - vec.xCoord, mop.hitVec.yCoord - vec.yCoord, mop.hitVec.zCoord - vec.zCoord, size);
if(breaksBlocks) {
xnt.setBlockAllocator(new BlockAllocatorStandard(48));
xnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop().withBlockEffect(new BlockMutatorDebris(ModBlocks.block_slag, 1)));
xnt.setBlockProcessor(new BlockProcessorStandard().setNoDrop().withBlockEffect(new BlockMutatorDebris(slag, slagMeta)));
}
xnt.setEntityProcessor(new EntityProcessorCross(7.5).withRangeMod(rangeMod));
xnt.setPlayerProcessor(new PlayerProcessorStandard());
@ -163,9 +171,10 @@ public class ItemAmmoHIMARS extends Item {
private void init() {
/* STANDARD ROCKETS */
this.itemTypes[SMALL] = new HIMARSRocket("standard", "himars_standard", 0) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 20F, 3F, false); }};
this.itemTypes[SMALL_HE] = new HIMARSRocket("standard_he", "himars_standard_he", 0) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 20F, 3F, true); }};
this.itemTypes[LARGE] = new HIMARSRocket("single", "himars_single", 1) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 50F, 5F, true); }};
this.itemTypes[SMALL] = new HIMARSRocket("standard", "himars_standard", 0) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 20F, 3F, false, ModBlocks.slag, 1); }};
this.itemTypes[SMALL_HE] = new HIMARSRocket("standard_he", "himars_standard_he", 0) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 20F, 3F, true, ModBlocks.slag, 1); }};
this.itemTypes[SMALL_LAVA] = new HIMARSRocket("standard_lava", "himars_standard_lava", 0) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 20F, 3F, true, ModBlocks.volcanic_lava_block, 0); }};
this.itemTypes[LARGE] = new HIMARSRocket("single", "himars_single", 1) { public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) { standardExplosion(rocket, mop, 50F, 5F, true, ModBlocks.slag, 1); }};
this.itemTypes[SMALL_MINI_NUKE] = new HIMARSRocket("standard_mini_nuke", "himars_standard_mini_nuke", 0) {
public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) {
@ -177,7 +186,7 @@ public class ItemAmmoHIMARS extends Item {
this.itemTypes[SMALL_WP] = new HIMARSRocket("standard_wp", "himars_standard_wp", 0) {
public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) {
standardExplosion(rocket, mop, 20F, 3F, false);
standardExplosion(rocket, mop, 20F, 3F, false, ModBlocks.slag, 1);
ExplosionLarge.spawnShrapnels(rocket.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 30);
ExplosionChaos.burn(rocket.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 20);
int radius = 30;
@ -200,14 +209,14 @@ public class ItemAmmoHIMARS extends Item {
this.itemTypes[SMALL_TB] = new HIMARSRocket("standard_tb", "himars_standard_tb", 0) {
public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) {
standardExplosion(rocket, mop, 20F, 10F, true);
standardExplosion(rocket, mop, 20F, 10F, true, ModBlocks.slag, 1);
ExplosionLarge.spawnShrapnels(rocket.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 30);
standardMush(rocket, mop, 20);
}};
this.itemTypes[LARGE_TB] = new HIMARSRocket("single_tb", "himars_single_tb", 1) {
public void onImpact(EntityArtilleryRocket rocket, MovingObjectPosition mop) {
standardExplosion(rocket, mop, 50F, 12F, true);
standardExplosion(rocket, mop, 50F, 12F, true, ModBlocks.slag, 1);
ExplosionLarge.spawnShrapnels(rocket.worldObj, (int) mop.hitVec.xCoord, (int) mop.hitVec.yCoord, (int) mop.hitVec.zCoord, 30);
standardMush(rocket, mop, 35);
}};

View File

@ -2,6 +2,7 @@ package com.hbm.render.tileentity;
import org.lwjgl.opengl.GL11;
import com.hbm.blocks.BlockDummyable;
import com.hbm.main.ResourceManager;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
@ -14,11 +15,35 @@ public class RenderCompressor extends TileEntitySpecialRenderer {
GL11.glPushMatrix();
GL11.glTranslated(x + 0.5D, y, z + 0.5D);
GL11.glEnable(GL11.GL_LIGHTING);
switch(tile.getBlockMetadata() - BlockDummyable.offset) {
case 3: GL11.glRotatef(270, 0F, 1F, 0F); break;
case 5: GL11.glRotatef(0, 0F, 1F, 0F); break;
case 2: GL11.glRotatef(90, 0F, 1F, 0F); break;
case 4: GL11.glRotatef(180, 0F, 1F, 0F); break;
}
GL11.glDisable(GL11.GL_CULL_FACE);
GL11.glShadeModel(GL11.GL_SMOOTH);
bindTexture(ResourceManager.compressor_tex);
ResourceManager.compressor.renderAll();
ResourceManager.compressor.renderPart("Compressor");
double h = (System.currentTimeMillis() * 0.005) % 6D;
if(h > 3) h = 6 - h;
GL11.glPushMatrix();
GL11.glTranslated(0, h - 3, 0);
ResourceManager.compressor.renderPart("Pump");
GL11.glPopMatrix();
GL11.glPushMatrix();
GL11.glTranslated(0, 1.5, 0);
GL11.glRotated((System.currentTimeMillis() * -0.5) % 360, 1, 0, 0);
GL11.glTranslated(0, -1.5, 0);
ResourceManager.compressor.renderPart("Fan");
GL11.glPopMatrix();
GL11.glShadeModel(GL11.GL_FLAT);
GL11.glEnable(GL11.GL_CULL_FACE);

View File

@ -1,21 +1,45 @@
package com.hbm.tileentity.machine;
import com.hbm.inventory.container.ContainerCompressor;
import com.hbm.inventory.gui.GUICompressor;
import com.hbm.tileentity.IGUIProvider;
import com.hbm.tileentity.TileEntityMachineBase;
public class TileEntityMachineCompressor extends TileEntityMachineBase {
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.Container;
import net.minecraft.world.World;
public class TileEntityMachineCompressor extends TileEntityMachineBase implements IGUIProvider {
public TileEntityMachineCompressor() {
super(0);
super(1);
}
@Override
public String getName() {
return null;
return "container.machineCompressor";
}
@Override
public void updateEntity() {
if(!worldObj.isRemote) {
}
}
@Override
public Container provideContainer(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new ContainerCompressor(player.inventory, this);
}
@Override
@SideOnly(Side.CLIENT)
public GuiScreen provideGUI(int ID, EntityPlayer player, World world, int x, int y, int z) {
return new GUICompressor(player.inventory, this);
}
}

View File

@ -40,7 +40,7 @@ public class TileEntityConverterRfHe extends TileEntityLoadedBase implements IEn
return 0;
if(simulate)
return 0;
return maxReceive;
recursionBrake = true;

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 731 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 697 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.1 KiB

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 860 B