mirror of
https://github.com/GTNewHorizons/EnderIO.git
synced 2026-11-25 06:24:24 +00:00
Add SAG Mill sounds/particles, fix off-by-one in isActive().
Add nightvision sounds.
This commit is contained in:
1 parent
752ab336e8
commit
d0a2e97b5d
9 files changed
+90
-16
No files matched your search
@@ -1,20 +1,21 @@
|
||||
package crazypants.enderio.item.darksteel;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import cpw.mods.fml.client.registry.ClientRegistry;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.InputEvent.KeyInputEvent;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.EnderIO;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
import crazypants.util.Lang;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.entity.EntityClientPlayerMP;
|
||||
import net.minecraft.client.settings.KeyBinding;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.ChatComponentTranslation;
|
||||
|
||||
public class KeyTracker {
|
||||
|
||||
@@ -87,19 +88,18 @@ public class KeyTracker {
|
||||
}
|
||||
|
||||
private void handleNightVision() {
|
||||
if(!DarkSteelController.instance.isNightVisionUpgradeEquipped(Minecraft.getMinecraft().thePlayer)) {
|
||||
EntityPlayer player = Minecraft.getMinecraft().thePlayer;
|
||||
if(!DarkSteelController.instance.isNightVisionUpgradeEquipped(player)){
|
||||
isNightVisionActive = false;
|
||||
return;
|
||||
}
|
||||
if(nightVisionKey.getIsKeyPressed()) {
|
||||
isNightVisionActive = !isNightVisionActive;
|
||||
String message;
|
||||
if(isNightVisionActive) {
|
||||
message = Lang.localize("darksteel.upgrade.nightVision.enabled");
|
||||
player.worldObj.playSound(player.posX, player.posY, player.posZ, EnderIO.MODID + ":ds.nightvision.on", 0.1f, player.worldObj.rand.nextFloat() * 0.4f - 0.2f + 1.0f, false);
|
||||
} else {
|
||||
message = Lang.localize("darksteel.upgrade.nightVision.disabled");
|
||||
player.worldObj.playSound(player.posX, player.posY, player.posZ, EnderIO.MODID + ":ds.nightvision.off", 0.1f, 1.0f, false);
|
||||
}
|
||||
Minecraft.getMinecraft().thePlayer.addChatComponentMessage(new ChatComponentTranslation(message));
|
||||
DarkSteelController.instance.setNightVisionActive(isNightVisionActive);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,7 +61,7 @@ public abstract class AbstractPoweredTaskEntity extends AbstractMachineEntity {
|
||||
|
||||
@Override
|
||||
public boolean isActive() {
|
||||
return currentTask == null ? false : currentTask.getProgress() > 0 && hasPower() && redstoneCheckPassed;
|
||||
return currentTask == null ? false : currentTask.getProgress() >= 0 && hasPower() && redstoneCheckPassed;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,12 +1,16 @@
|
||||
package crazypants.enderio.machine.crusher;
|
||||
|
||||
import java.util.Random;
|
||||
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import crazypants.enderio.GuiHandler;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.AbstractMachineBlock;
|
||||
import crazypants.enderio.machine.generator.stirling.TileEntityStirlingGenerator;
|
||||
import crazypants.enderio.network.PacketHandler;
|
||||
|
||||
public class BlockCrusher extends AbstractMachineBlock {
|
||||
@@ -55,6 +59,31 @@ public class BlockCrusher extends AbstractMachineBlock {
|
||||
}
|
||||
return "enderio:crusherFront";
|
||||
}
|
||||
|
||||
@Override
|
||||
public void randomDisplayTick(World world, int x, int y, int z, Random rand) {
|
||||
TileCrusher te = (TileCrusher) world.getTileEntity(x, y, z);
|
||||
if(te != null && te.isActive()) {
|
||||
ForgeDirection front = ForgeDirection.values()[te.facing];
|
||||
|
||||
for (int i = 0; i < 3; i++) {
|
||||
double px = x + 0.5 + front.offsetX * 0.51;
|
||||
double pz = z + 0.5 + front.offsetZ * 0.51;
|
||||
double py = y + world.rand.nextFloat() * 0.8f + 0.1f;
|
||||
double v = 0.05;
|
||||
double vx = 0;
|
||||
double vz = 0;
|
||||
|
||||
if(front == ForgeDirection.NORTH || front == ForgeDirection.SOUTH) {
|
||||
px += world.rand.nextFloat() * 0.8 - 0.4;
|
||||
vz += front == ForgeDirection.NORTH ? -v : v;
|
||||
} else {
|
||||
pz += world.rand.nextFloat() * 0.8 - 0.4;
|
||||
vx += front == ForgeDirection.WEST ? -v : v;
|
||||
}
|
||||
|
||||
world.spawnParticle("smoke", px, py, pz, vx, 0, vz);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@ package crazypants.enderio.machine.crusher;
|
||||
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.util.ResourceLocation;
|
||||
import cpw.mods.fml.relauncher.Side;
|
||||
import cpw.mods.fml.relauncher.SideOnly;
|
||||
import crazypants.enderio.ModObject;
|
||||
import crazypants.enderio.machine.AbstractPoweredTaskEntity;
|
||||
import crazypants.enderio.machine.IMachineRecipe;
|
||||
@@ -18,6 +21,8 @@ public class TileCrusher extends AbstractPoweredTaskEntity {
|
||||
|
||||
protected int lastSendGbScaled = 0;
|
||||
private boolean useGrindingBall;
|
||||
|
||||
private static final ResourceLocation sound = getSoundFor("machine.sagmill");
|
||||
|
||||
public TileCrusher() {
|
||||
super(new SlotDefinition(2, 4));
|
||||
@@ -135,4 +140,13 @@ public class TileCrusher extends AbstractPoweredTaskEntity {
|
||||
return false;
|
||||
}
|
||||
|
||||
@SideOnly(Side.CLIENT)
|
||||
@Override
|
||||
public ResourceLocation getSound() {
|
||||
return sound;
|
||||
}
|
||||
|
||||
public float getVolume() {
|
||||
return 0.5f;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user