finished charger, nicer HUD overlay text

This commit is contained in:
Bob 2022-04-20 22:31:18 +02:00
parent 21cb84817e
commit a6e1d49861
19 changed files with 125 additions and 143 deletions

View File

@ -2012,7 +2012,7 @@ public class ModBlocks {
barbed_wire_ultradeath = new BarbedWire(Material.iron).setBlockName("barbed_wire_ultradeath").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":barbed_wire_ultradeath_model");
spikes = new Spikes(Material.iron).setBlockName("spikes").setHardness(2.5F).setResistance(5.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":spikes");
charger = new Charger(Material.iron).setBlockName("charger").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":charger");
charger = new Charger(Material.iron).setBlockName("charger").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":block_steel");
tesla = new MachineTesla(Material.iron).setBlockName("tesla").setHardness(5.0F).setResistance(10.0F).setCreativeTab(MainRegistry.blockTab).setBlockTextureName(RefStrings.MODID + ":tesla");

View File

@ -27,11 +27,11 @@ public class BarbedWire extends Block {
public void onEntityCollidedWithBlock(World p_149670_1_, int x, int y, int z, Entity ent) {
//ent.setInWeb();
ent.setInWeb();
ent.motionX *= 0.25D;
ent.motionX *= 0.15D;
ent.motionY *= 0.1D;
ent.motionZ *= 0.25D;
ent.motionZ *= 0.15D;
if(this == ModBlocks.barbed_wire) {
ent.attackEntityFrom(DamageSource.cactus, 2.0F);

View File

@ -60,7 +60,14 @@ public class Charger extends BlockContainer {
@Override
public void setBlockBoundsBasedOnState(IBlockAccess world, int x, int y, int z) {
float f = 0.0625F;
this.setBlockBounds(5 * f, 0.25F, 5 * f, 11 * f, 0.75F, 11 * f);
switch(world.getBlockMetadata(x, y, z)) {
case 2: this.setBlockBounds(5 * f, 0.25F, 12 * f, 11 * f, 0.75F, 1F); break;
case 3: this.setBlockBounds(5 * f, 0.25F, 0F, 11 * f, 0.75F, 4 * f); break;
case 4: this.setBlockBounds(12 * f, 0.25F, 5 * f, 1F, 0.75F, 11 * f); break;
case 5: this.setBlockBounds(0F, 0.25F, 5 * f, 4 * f, 0.75F, 11 * f); break;
default: this.setBlockBounds(5 * f, 0.25F, 5 * f, 11 * f, 0.75F, 11 * f); break;
}
}
@Override

View File

@ -60,17 +60,17 @@ public class HbmPlayerProps implements IExtendedEntityProperties {
this.enableBackpack = !this.enableBackpack;
if(this.enableBackpack)
MainRegistry.proxy.displayTooltip(EnumChatFormatting.GREEN + "Jetpack ON");
MainRegistry.proxy.displayTooltip(EnumChatFormatting.GREEN + "Jetpack ON", MainRegistry.proxy.ID_JETPACK);
else
MainRegistry.proxy.displayTooltip(EnumChatFormatting.RED + "Jetpack OFF");
MainRegistry.proxy.displayTooltip(EnumChatFormatting.RED + "Jetpack OFF", MainRegistry.proxy.ID_JETPACK);
}
if(key == EnumKeybind.TOGGLE_HEAD) {
this.enableHUD = !this.enableHUD;
if(this.enableHUD)
MainRegistry.proxy.displayTooltip(EnumChatFormatting.GREEN + "HUD ON");
MainRegistry.proxy.displayTooltip(EnumChatFormatting.GREEN + "HUD ON", MainRegistry.proxy.ID_HUD);
else
MainRegistry.proxy.displayTooltip(EnumChatFormatting.RED + "HUD OFF");
MainRegistry.proxy.displayTooltip(EnumChatFormatting.RED + "HUD OFF", MainRegistry.proxy.ID_HUD);
}
}

View File

@ -8,6 +8,7 @@ import com.hbm.handler.BulletConfiguration;
import com.hbm.handler.GunConfiguration;
import com.hbm.interfaces.IBomb;
import com.hbm.interfaces.IBomb.BombReturnCode;
import com.hbm.main.MainRegistry;
import com.hbm.interfaces.IBulletImpactBehavior;
import com.hbm.packet.PacketDispatcher;
import com.hbm.packet.PlayerInformPacket;
@ -101,7 +102,7 @@ public class GunDetonatorFactory {
if(ret.wasSuccessful() && bullet.shooter instanceof EntityPlayerMP) {
EntityPlayerMP player = (EntityPlayerMP) bullet.shooter;
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("").nextTranslation(ret.getUnlocalizedMessage()).color(EnumChatFormatting.YELLOW).flush()), (EntityPlayerMP) player);
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("").nextTranslation(ret.getUnlocalizedMessage()).color(EnumChatFormatting.YELLOW).flush(), MainRegistry.proxy.ID_DETONATOR), (EntityPlayerMP) player);
}
}
}

View File

@ -1,108 +1,16 @@
package com.hbm.handler.nei;
import static codechicken.lib.gui.GuiDraw.drawTexturedModalRect;
import java.util.Arrays;
import java.util.List;
import java.util.Map.Entry;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.RecipesCommon.ComparableStack;
import com.hbm.inventory.recipes.FuelPoolRecipes;
import com.hbm.lib.RefStrings;
import codechicken.nei.NEIServerUtils;
import codechicken.nei.PositionedStack;
import codechicken.nei.recipe.TemplateRecipeHandler;
import net.minecraft.item.ItemStack;
public class FuelPoolHandler extends NEIUniversalHandler {
public class FuelPoolHandler extends TemplateRecipeHandler {
public class RecipeSet extends TemplateRecipeHandler.CachedRecipe {
PositionedStack input;
PositionedStack output;
public RecipeSet(ItemStack in, ItemStack out) {
this.input = new PositionedStack(in, 48, 24);
this.output = new PositionedStack(out, 102, 24);
}
@Override
public List<PositionedStack> getIngredients() {
return getCycledIngredients(cycleticks / 48, Arrays.asList(input));
}
@Override
public PositionedStack getResult() {
return output;
}
@Override
public List<PositionedStack> getOtherStacks() {
return Arrays.asList(new PositionedStack(new ItemStack(ModBlocks.machine_waste_drum), 75, 31));
}
public FuelPoolHandler() {
super("Spent Fuel Pool Drum", ModBlocks.machine_waste_drum, FuelPoolRecipes.recipes);
}
@Override
public String getRecipeName() {
return "Spent Fuel Pool Drum";
}
@Override
public String getGuiTexture() {
return RefStrings.MODID + ":textures/gui/nei/gui_nei.png";
}
@Override
public void drawBackground(int recipe) {
super.drawBackground(recipe);
drawTexturedModalRect(47, 23, 5, 87, 18, 18);
drawTexturedModalRect(101, 23, 5, 87, 18, 18);
drawTexturedModalRect(74, 14, 59, 87, 18, 38);
}
@Override
public void loadCraftingRecipes(String outputId, Object... results) {
if(outputId.equals("ntmSpentDrum")) {
for(Entry<ComparableStack, ItemStack> recipe : FuelPoolRecipes.recipes.entrySet()) {
this.arecipes.add(new RecipeSet(recipe.getKey().toStack(), recipe.getValue()));
}
} else {
super.loadCraftingRecipes(outputId, results);
}
}
@Override
public void loadCraftingRecipes(ItemStack result) {
for(Entry<ComparableStack, ItemStack> recipe : FuelPoolRecipes.recipes.entrySet()) {
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getValue(), result)) {
this.arecipes.add(new RecipeSet(recipe.getKey().toStack(), recipe.getValue()));
}
}
}
@Override
public void loadUsageRecipes(String inputId, Object... ingredients) {
if(inputId.equals("ntmSpentDrum")) {
loadCraftingRecipes("ntmSpentDrum", new Object[0]);
} else {
super.loadUsageRecipes(inputId, ingredients);
}
}
@Override
public void loadUsageRecipes(ItemStack ingredient) {
for(Entry<ComparableStack, ItemStack> recipe : FuelPoolRecipes.recipes.entrySet()) {
if(NEIServerUtils.areStacksSameTypeCrafting(recipe.getKey().toStack(), ingredient)) {
this.arecipes.add(new RecipeSet(recipe.getKey().toStack(), recipe.getValue()));
}
}
public String getKey() {
return "ntmSpentDrum";
}
}

View File

@ -3,8 +3,6 @@ package com.hbm.handler.nei;
import com.hbm.blocks.ModBlocks;
import com.hbm.inventory.recipes.SolidificationRecipes;
import codechicken.nei.recipe.TemplateRecipeHandler;
public class SolidificationHandler extends NEIUniversalHandler {
public SolidificationHandler() {

View File

@ -34,7 +34,7 @@ public class ItemColtanCompass extends Item {
lease = System.currentTimeMillis() + 1000;
Vec3 vec = Vec3.createVectorHelper(entity.posX - lastX, 0, entity.posZ - lastZ);
MainRegistry.proxy.displayTooltip(((int) vec.lengthVector()) + "m");
MainRegistry.proxy.displayTooltip(((int) vec.lengthVector()) + "m", MainRegistry.proxy.ID_COMPASS);
}
if(ItemColtanCompass.this.lease < System.currentTimeMillis()) {

View File

@ -47,11 +47,11 @@ public class ItemLaserDetonator extends Item implements IHoldableWeapon {
MainRegistry.logger.log(Level.INFO, "[DET] Tried to detonate block at " + x + " / " + y + " / " + z + " by " + player.getDisplayName() + "!");
world.playSoundAtEntity(player, "hbm:item.techBleep", 1.0F, 1.0F);
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("").nextTranslation(ret.getUnlocalizedMessage()).color(ret.wasSuccessful() ? EnumChatFormatting.YELLOW : EnumChatFormatting.RED).flush()), (EntityPlayerMP) player);
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("").nextTranslation(ret.getUnlocalizedMessage()).color(ret.wasSuccessful() ? EnumChatFormatting.YELLOW : EnumChatFormatting.RED).flush(), MainRegistry.proxy.ID_DETONATOR), (EntityPlayerMP) player);
} else {
world.playSoundAtEntity(player, "hbm:item.techBoop", 1.0F, 1.0F);
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("").nextTranslation(BombReturnCode.ERROR_NO_BOMB.getUnlocalizedMessage()).color(EnumChatFormatting.RED).flush()), (EntityPlayerMP) player);
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket(ChatBuilder.start("").nextTranslation(BombReturnCode.ERROR_NO_BOMB.getUnlocalizedMessage()).color(EnumChatFormatting.RED).flush(), MainRegistry.proxy.ID_DETONATOR), (EntityPlayerMP) player);
}
} else {

View File

@ -111,7 +111,7 @@ public class ItemWiring extends Item {
entity.posY - stack.stackTagCompound.getInteger("y"),
entity.posZ - stack.stackTagCompound.getInteger("z"));
MainRegistry.proxy.displayTooltip(((int) vec.lengthVector()) + "m");
MainRegistry.proxy.displayTooltip(((int) vec.lengthVector()) + "m", MainRegistry.proxy.ID_CABLE);
}
}
}

View File

@ -1625,12 +1625,14 @@ public class ClientProxy extends ServerProxy {
@Override
public void playSound(String sound, Object data) { }
@Override
public void displayTooltip(String msg) {
//Minecraft.getMinecraft().ingameGUI.func_110326_a(msg, false);
public void displayTooltip(String msg, int time, int id) {
this.theInfoSystem.push(new InfoEntry(msg, 1000));
if(id != 0)
this.theInfoSystem.push(new InfoEntry(msg, time), id);
else
this.theInfoSystem.push(new InfoEntry(msg, time));
}
@Override

View File

@ -871,6 +871,8 @@ public class CraftingManager {
addShapelessAuto(new ItemStack(ModItems.book_guide, 1, BookType.RBMK.ordinal()), new Object[] { Items.book, Items.potato });
addShapelessAuto(new ItemStack(ModItems.book_guide, 1, BookType.HADRON.ordinal()), new Object[] { Items.book, ModItems.fuse });
addShapelessAuto(new ItemStack(ModItems.book_guide, 1, BookType.STARTER.ordinal()), new Object[] { Items.book, Items.iron_ingot });
addRecipeAuto(new ItemStack(ModBlocks.charger), new Object[] { "IGI", "ICI", "PDP", 'I', STEEL.ingot(), 'G', Items.glowstone_dust, 'C', ModBlocks.red_wire_coated, 'P', IRON.plate(), 'D', ModItems.coil_copper });
addShapelessAuto(new ItemStack(ModItems.holotape_image, 1, EnumHoloImage.HOLO_RESTORED.ordinal()), new Object[] { new ItemStack(ModItems.holotape_image, 1, EnumHoloImage.HOLO_DIGAMMA.ordinal()), KEY_TOOL_SCREWDRIVER, ModItems.ducttape, ModItems.armor_polish });
addShapelessAuto(new ItemStack(ModItems.holotape_damaged), new Object[] { DictFrame.fromOne(ModItems.holotape_image, EnumHoloImage.HOLO_RESTORED), ModBlocks.muffler, ModItems.crt_display, ModItems.gem_alexandrite /* placeholder for amplifier */ });

View File

@ -178,7 +178,7 @@ public class ModEventHandler {
}
if(MobConfig.enableDucks && event.player instanceof EntityPlayerMP && !event.player.getEntityData().getCompoundTag(EntityPlayer.PERSISTED_NBT_TAG).getBoolean("hasDucked"))
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket("Press O to Duck!"), (EntityPlayerMP) event.player);
PacketDispatcher.wrapper.sendTo(new PlayerInformPacket("Press O to Duck!", MainRegistry.proxy.ID_DUCK), (EntityPlayerMP) event.player);
}
}

View File

@ -686,7 +686,7 @@ public class ModEventHandlerClient {
}
if(ArmorUtil.isWearingEmptyMask(mc.thePlayer)) {
MainRegistry.proxy.displayTooltip(EnumChatFormatting.RED + "Your mask has no filter!");
MainRegistry.proxy.displayTooltip(EnumChatFormatting.RED + "Your mask has no filter!", MainRegistry.proxy.ID_FILTER);
}
}
}

View File

@ -10,6 +10,15 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.nbt.NBTTagCompound;
public class ServerProxy {
//sort by estimated time of display. longer lasting ones should be sortet at the top.
public static final int ID_DUCK = 0;
public static final int ID_FILTER = 1;
public static final int ID_COMPASS = 2;
public static final int ID_CABLE = 3;
public static final int ID_JETPACK = 4;
public static final int ID_HUD = 5;
public static final int ID_DETONATOR = 6;
public void registerRenderInfo() { }
public void registerTileEntitySpecialRenderer() { }
@ -28,8 +37,11 @@ public class ServerProxy {
public AudioWrapper getLoopedSound(String sound, float x, float y, float z, float volume, float pitch) { return null; }
public void playSound(String sound, Object data) { }
public void displayTooltip(String msg) { }
public void displayTooltip(String msg, int id) {
displayTooltip(msg, 1000, id);
}
public void displayTooltip(String msg, int time, int id) { }
public boolean getIsKeyPressed(EnumKeybind key) {
return false;

View File

@ -15,22 +15,24 @@ public class PlayerInformPacket implements IMessage {
boolean fancy;
private String dmesg = "";
private int id;
private IChatComponent component;
public PlayerInformPacket() { }
public PlayerInformPacket(String dmesg) {
public PlayerInformPacket(String dmesg, int id) {
this.fancy = false;
this.dmesg = dmesg;
}
public PlayerInformPacket(IChatComponent component) {
public PlayerInformPacket(IChatComponent component, int id) {
this.fancy = true;
this.component = component;
}
@Override
public void fromBytes(ByteBuf buf) {
id = buf.readInt();
fancy = buf.readBoolean();
if(!fancy) {
@ -42,6 +44,7 @@ public class PlayerInformPacket implements IMessage {
@Override
public void toBytes(ByteBuf buf) {
buf.writeInt(id);
buf.writeBoolean(fancy);
if(!fancy) {
ByteBufUtils.writeUTF8String(buf, dmesg);
@ -57,7 +60,7 @@ public class PlayerInformPacket implements IMessage {
public IMessage onMessage(PlayerInformPacket m, MessageContext ctx) {
try {
MainRegistry.proxy.displayTooltip(m.fancy ? m.component.getFormattedText() : m.dmesg);
MainRegistry.proxy.displayTooltip(m.fancy ? m.component.getFormattedText() : m.dmesg, m.id);
} catch (Exception x) { }
return null;

View File

@ -31,7 +31,7 @@ public class RenderCharger extends TileEntitySpecialRenderer {
TileEntityCharger charger = (TileEntityCharger) tile;
double time = (charger.lastUsingTicks + (charger.lastUsingTicks - charger.lastUsingTicks) * interp) / (double) charger.delay;
double time = (charger.lastUsingTicks + (charger.usingTicks - charger.lastUsingTicks) * interp) / (double) charger.delay;
double extend = Math.min(1, time * 2);
double swivel = Math.max(0, (time - 0.5) * 2);

View File

@ -14,12 +14,14 @@ import cpw.mods.fml.common.gameevent.TickEvent.ClientTickEvent;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.ScaledResolution;
import net.minecraft.client.renderer.OpenGlHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
public class RenderInfoSystem {
private static Random rand = new Random();
private static int nextID = 1000;
private static HashMap<Integer, InfoEntry> inbox = new HashMap();
private static HashMap<Integer, InfoEntry> messages = new HashMap();
@ -36,6 +38,7 @@ public class RenderInfoSystem {
if(entry.start + entry.millis < System.currentTimeMillis()) {
messages.remove(key);
keys = new ArrayList(messages.keySet());
i--;
}
}
@ -46,17 +49,46 @@ public class RenderInfoSystem {
if(event.type != ElementType.CROSSHAIRS)
return;
if(this.messages.isEmpty())
return;
Minecraft mc = Minecraft.getMinecraft();
ScaledResolution resolution = event.resolution;
int pX = 15; //resolution.getScaledWidth() / 2 + 8;
int pZ = 15; //resolution.getScaledHeight() / 2;
List<InfoEntry> entries = new ArrayList(messages.entrySet());
List<InfoEntry> entries = new ArrayList(messages.values());
Collections.sort(entries);
GL11.glPushMatrix();
GL11.glEnable(GL11.GL_BLEND);
OpenGlHelper.glBlendFunc(770, 771, 1, 0);
int longest = 0;
for(InfoEntry entry : messages.values()) {
int length = mc.fontRenderer.getStringWidth(entry.text);
if(length > longest)
longest = length;
}
int mode = 0;
int pX = mode == 0 ? 15 : mode == 1 ? (resolution.getScaledWidth() - longest - 15) : mode == 2 ? (resolution.getScaledWidth() / 2 + 7) : (resolution.getScaledWidth() / 2 - longest - 6);
int pZ = mode == 0 ? 15 : mode == 1 ? 15 : resolution.getScaledHeight() / 2 + 7;
int side = pX + 5 + longest;
int height = messages.size() * 10 + pZ + 2;
int z = 0;
Tessellator tess = Tessellator.instance;
tess.startDrawingQuads();
tess.setColorRGBA_F(0.5F, 0.5F, 0.5F, 0.5F);
tess.addVertex(pX - 5, pZ - 5, z);
tess.addVertex(pX - 5, height, z);
tess.addVertex(side, height, z);
tess.addVertex(side, pZ - 5, z);
tess.draw();
int off = 0;
long now = System.currentTimeMillis();
@ -65,7 +97,7 @@ public class RenderInfoSystem {
int elapsed = (int) (now - entry.start);
int alpha = Math.min(510 * (entry.millis - elapsed) / entry.millis, 255); //smoothly scales down from 510 to 0, then caps at 255
int alpha = Math.max(Math.min(510 * (entry.millis - elapsed) / entry.millis, 255), 5); //smoothly scales down from 510 to 0, then caps at 255
int color = entry.color + (alpha << 24 & -0xffffff);
mc.fontRenderer.drawString(entry.text, pX, pZ + off, color);
@ -92,7 +124,6 @@ public class RenderInfoSystem {
mc.fontRenderer.drawStringWithShadow(ex.getClass().getSimpleName(), pX, pZ + 10, 0xff0000);
}*/
GL11.glDisable(GL11.GL_BLEND);
GL11.glColor3f(1F, 1F, 1F);
GL11.glPopMatrix();
@ -100,7 +131,7 @@ public class RenderInfoSystem {
}
public static void push(InfoEntry entry) {
push(entry, rand.nextInt()); //range is so large, collisions are unlikely and if they do occur, not a big deal
push(entry, nextID++); //range is so large, collisions are unlikely and if they do occur, not a big deal
}
public static void push(InfoEntry entry, int id) {

View File

@ -9,8 +9,6 @@ import com.hbm.tileentity.TileEntityLoadedBase;
import api.hbm.energy.IBatteryItem;
import api.hbm.energy.IEnergyUser;
import cpw.mods.fml.relauncher.Side;
import cpw.mods.fml.relauncher.SideOnly;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
@ -32,12 +30,12 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyUs
@Override
public void updateEntity() {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata()).getOpposite();
if(!worldObj.isRemote) {
ForgeDirection dir = ForgeDirection.getOrientation(this.getBlockMetadata());
this.trySubscribe(worldObj, xCoord + dir.offsetX, yCoord, zCoord + dir.offsetZ, dir);
players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5).expand(1, 0.5, 1));
players = worldObj.getEntitiesWithinAABB(EntityPlayer.class, AxisAlignedBB.getBoundingBox(xCoord + 0.5, yCoord, zCoord + 0.5, xCoord + 0.5, yCoord + 0.5, zCoord + 0.5).expand(0.5, 0.0, 0.5));
charge = 0;
@ -54,22 +52,42 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyUs
}
}
particles = worldObj.getTotalWorldTime() - lastOp < 4;
if(particles) {
if(worldObj.getTotalWorldTime() % 20 == 0)
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "random.fizz", 0.2F, 0.5F);
}
NBTTagCompound data = new NBTTagCompound();
data.setLong("c", charge);
data.setBoolean("p", worldObj.getTotalWorldTime() - lastOp < 4);
data.setBoolean("p", particles);
INBTPacketReceiver.networkPack(this, data, 50);
}
lastUsingTicks = usingTicks;
if(charge > 0 && usingTicks < delay)
if((charge > 0 || particles) && usingTicks < delay) {
usingTicks++;
if(charge <= 0 && usingTicks > 0)
if(usingTicks == 2)
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "tile.piston.out", 0.5F, 0.5F);
}
if((charge <= 0 && !particles) && usingTicks > 0) {
usingTicks--;
if(usingTicks == 4)
worldObj.playSoundEffect(xCoord + 0.5, yCoord + 0.5, zCoord + 0.5, "tile.piston.in", 0.5F, 0.5F);
}
if(particles) {
Random rand = worldObj.rand;
worldObj.spawnParticle("magicCrit", xCoord + 0.25 + rand.nextDouble() * 0.5, yCoord + rand.nextDouble() * 0.5, zCoord + 0.25 + rand.nextDouble() * 0.5, 0.0, 0.0, 0.0);
worldObj.spawnParticle("magicCrit",
xCoord + 0.5 + rand.nextDouble() * 0.0625 + dir.offsetX * 0.75,
yCoord + 0.1,
zCoord + 0.5 + rand.nextDouble() * 0.0625 + dir.offsetZ * 0.75,
-dir.offsetX + rand.nextGaussian() * 0.1,
0,
-dir.offsetZ + rand.nextGaussian() * 0.1);
}
}
@ -110,7 +128,7 @@ public class TileEntityCharger extends TileEntityLoadedBase implements IEnergyUs
IBatteryItem battery = (IBatteryItem) stack.getItem();
long toCharge = Math.min(battery.getMaxCharge() - battery.getCharge(stack), battery.getChargeRate());
toCharge = Math.min(toCharge, power);
toCharge = Math.min(toCharge, power / 5);
battery.chargeBattery(stack, toCharge);
power -= toCharge;
}