Updated camera and overlays, fixed some event handling
This commit is contained in:
parent
c16a17f6c1
commit
d7ac4cce76
3 changed files with 23 additions and 19 deletions
|
@ -16,6 +16,7 @@ import net.minecraftforge.common.DimensionManager;
|
|||
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingFallEvent;
|
||||
import cpw.mods.fml.common.FMLCommonHandler;
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cr0s.warpdrive.api.IBreathingHelmet;
|
||||
import cr0s.warpdrive.world.SpaceTeleporter;
|
||||
|
||||
|
@ -39,7 +40,7 @@ public class SpaceEventHandler {
|
|||
player_cloakTicks = new HashMap<String, Integer>();
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
@SubscribeEvent
|
||||
public void livingUpdate(LivingUpdateEvent event) {
|
||||
if (FMLCommonHandler.instance().getEffectiveSide().isClient()) {
|
||||
return;
|
||||
|
@ -218,7 +219,7 @@ public class SpaceEventHandler {
|
|||
return false;
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
@SubscribeEvent
|
||||
public void livingFall(LivingFallEvent event)
|
||||
{
|
||||
EntityLivingBase entity = event.entityLiving;
|
||||
|
|
|
@ -8,6 +8,7 @@ import net.minecraftforge.client.event.RenderGameOverlayEvent.ElementType;
|
|||
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cr0s.warpdrive.WarpDrive;
|
||||
import cr0s.warpdrive.WarpDriveConfig;
|
||||
|
||||
|
@ -70,7 +71,7 @@ public class CameraOverlay
|
|||
GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||
}
|
||||
|
||||
@ForgeSubscribe
|
||||
@SubscribeEvent
|
||||
public void onRender(RenderGameOverlayEvent.Pre event) {
|
||||
if (WarpDrive.instance.isOverlayEnabled) {
|
||||
if (event.type == ElementType.HELMET) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package cr0s.warpdrive.render;
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.settings.GameSettings;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
|
@ -47,9 +48,9 @@ public final class EntityCamera extends EntityLivingBase
|
|||
public EntityCamera(World world, ChunkPosition pos, EntityPlayer player) {
|
||||
super(world);
|
||||
this.setInvisible(true);
|
||||
int x = pos.x;
|
||||
int y = pos.y;
|
||||
int z = pos.z;
|
||||
int x = pos.chunkPosX;
|
||||
int y = pos.chunkPosY;
|
||||
int z = pos.chunkPosZ;
|
||||
this.xCoord = x;
|
||||
this.posX = x;
|
||||
this.yCoord = y;
|
||||
|
@ -83,7 +84,7 @@ public final class EntityCamera extends EntityLivingBase
|
|||
return;
|
||||
}
|
||||
|
||||
int blockID = worldObj.getBlockId(xCoord, yCoord, zCoord);
|
||||
Block block = worldObj.getBlock(xCoord, yCoord, zCoord);
|
||||
mc.renderViewEntity.rotationYaw = player.rotationYaw;
|
||||
//mc.renderViewEntity.rotationYawHead = player.rotationYawHead;
|
||||
mc.renderViewEntity.rotationPitch = player.rotationPitch;
|
||||
|
@ -121,7 +122,7 @@ public final class EntityCamera extends EntityLivingBase
|
|||
fireWaitTicks = 0;
|
||||
|
||||
// Make a shoot with camera-laser
|
||||
if (blockID == WarpDriveConfig.laserCamID) {
|
||||
if (block.isAssociatedBlock(WarpDrive.laserCamBlock)) {
|
||||
PacketHandler.sendLaserTargetingPacket(xCoord, yCoord, zCoord, mc.renderViewEntity.rotationYaw, mc.renderViewEntity.rotationPitch);
|
||||
}
|
||||
}
|
||||
|
@ -134,13 +135,13 @@ public final class EntityCamera extends EntityLivingBase
|
|||
dy = -1;
|
||||
} else if (Keyboard.isKeyDown(Keyboard.KEY_UP)) {
|
||||
dy = 2;
|
||||
} else if (Keyboard.isKeyDown(gamesettings.keyBindLeft.keyCode)) {
|
||||
} else if (Keyboard.isKeyDown(gamesettings.keyBindLeft.getKeyCode())) {
|
||||
dz = -1;
|
||||
} else if (Keyboard.isKeyDown(gamesettings.keyBindRight.keyCode)) {
|
||||
} else if (Keyboard.isKeyDown(gamesettings.keyBindRight.getKeyCode())) {
|
||||
dz = 1;
|
||||
} else if (Keyboard.isKeyDown(gamesettings.keyBindForward.keyCode)) {
|
||||
} else if (Keyboard.isKeyDown(gamesettings.keyBindForward.getKeyCode())) {
|
||||
dx = 1;
|
||||
} else if (Keyboard.isKeyDown(gamesettings.keyBindBack.keyCode)) {
|
||||
} else if (Keyboard.isKeyDown(gamesettings.keyBindBack.getKeyCode())) {
|
||||
dx = -1;
|
||||
} else if (Keyboard.isKeyDown(Keyboard.KEY_C)) { // centering view
|
||||
dx = 0;
|
||||
|
@ -165,6 +166,7 @@ public final class EntityCamera extends EntityLivingBase
|
|||
}
|
||||
|
||||
public void zoom() {
|
||||
/*//TODO: Find 1.7 version of EnumOptions
|
||||
if (zoomNumber == 0) {
|
||||
mc.gameSettings.setOptionFloatValue(EnumOptions.FOV, -0.75F);
|
||||
mc.gameSettings.setOptionFloatValue(EnumOptions.SENSITIVITY, 0.4F);
|
||||
|
@ -177,7 +179,7 @@ public final class EntityCamera extends EntityLivingBase
|
|||
} else if (zoomNumber == 3) {
|
||||
mc.gameSettings.setOptionFloatValue(EnumOptions.FOV, WarpDrive.normalFOV);
|
||||
mc.gameSettings.setOptionFloatValue(EnumOptions.SENSITIVITY, WarpDrive.normalSensitivity);
|
||||
}
|
||||
}*/
|
||||
zoomNumber = (zoomNumber + 1) % 4;
|
||||
}
|
||||
|
||||
|
@ -190,7 +192,7 @@ public final class EntityCamera extends EntityLivingBase
|
|||
protected void applyEntityAttributes()
|
||||
{
|
||||
super.applyEntityAttributes();
|
||||
this.getAttributeMap().func_111150_b(SharedMonsterAttributes.attackDamage).setAttribute(1.0D);
|
||||
this.getAttributeMap().getAttributeInstance(SharedMonsterAttributes.attackDamage).setBaseValue(1.0D);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -214,11 +216,6 @@ public final class EntityCamera extends EntityLivingBase
|
|||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getCurrentItemOrArmor(int i) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCurrentItemOrArmor(int i, ItemStack itemstack) {
|
||||
}
|
||||
|
@ -227,4 +224,9 @@ public final class EntityCamera extends EntityLivingBase
|
|||
public ItemStack[] getLastActiveItems() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getEquipmentInSlot(int i) {
|
||||
return null;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue