generated from tilera/1710mod
feat: fix and add some bugs
This commit is contained in:
parent
63f12376f7
commit
8008a3cece
|
@ -0,0 +1,6 @@
|
|||
- plant effects not implemented
|
||||
- entity position borked on client after teleport
|
||||
- machines not yet implemented
|
||||
- portal renders corners (GL stencil borked)
|
||||
- portal seals that are broken sometimes don't get unregistered
|
||||
- chunks not loading randomly???
|
|
@ -3,10 +3,14 @@ package net.anvilcraft.arcaneseals;
|
|||
import cpw.mods.fml.common.eventhandler.SubscribeEvent;
|
||||
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
|
||||
import net.anvilcraft.arcaneseals.render.PortalRenderer;
|
||||
import net.minecraft.client.Minecraft;
|
||||
|
||||
public class RenderTicker {
|
||||
@SubscribeEvent
|
||||
public void onRenderTickEvent(RenderTickEvent ev) {
|
||||
if (Minecraft.getMinecraft().theWorld == null)
|
||||
return;
|
||||
|
||||
for (PortalRenderer ren : PortalRenderer.INSTANCES) {
|
||||
// TODO: optimize
|
||||
ren.createPortalView();
|
||||
|
|
|
@ -12,8 +12,6 @@ import net.minecraft.entity.EntityLivingBase;
|
|||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.util.ChunkCoordinates;
|
||||
import net.minecraft.util.IChatComponent;
|
||||
import net.minecraftforge.common.util.ForgeDirection;
|
||||
|
||||
import org.lwjgl.opengl.EXTFramebufferObject;
|
||||
import org.lwjgl.opengl.GL11;
|
||||
|
||||
|
@ -23,7 +21,6 @@ public class PortalRenderer {
|
|||
public int portalTexture;
|
||||
public int depthRenderBuffer;
|
||||
public int frameBuffer;
|
||||
public static int renderRecursion;
|
||||
public TileSeal seal;
|
||||
|
||||
public PortalRenderer(TileSeal seal) {
|
||||
|
@ -55,7 +52,6 @@ public class PortalRenderer {
|
|||
}
|
||||
|
||||
public void createPortalView() {
|
||||
++PortalRenderer.renderRecursion;
|
||||
if (this.seal.otherSeal == null)
|
||||
return;
|
||||
|
||||
|
@ -67,19 +63,25 @@ public class PortalRenderer {
|
|||
int prevFbo = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT);
|
||||
EXTFramebufferObject.glBindFramebufferEXT(36160, this.frameBuffer);
|
||||
|
||||
// TODO: stencils aren't stenciling
|
||||
GL11.glEnable(2960);
|
||||
GL11.glStencilFunc(519, 1, 1);
|
||||
GL11.glStencilOp(7680, 7680, 7681);
|
||||
GL11.glViewport(0, 0, 512, 512);
|
||||
GL11.glMatrixMode(5889);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glMatrixMode(5888);
|
||||
GL11.glLoadIdentity();
|
||||
GL11.glDisable(3553);
|
||||
GL11.glColor3f(1.0f, 1.0f, 1.0f);
|
||||
GL11.glColor3f(1.0F, 1.0F, 1.0F);
|
||||
GL11.glBegin(6);
|
||||
GL11.glVertex2f(0.0f, 0.0f);
|
||||
GL11.glVertex2f(0.0F, 0.0F);
|
||||
|
||||
for (int oh = 0; oh <= 10; ++oh) {
|
||||
final double aa = 6.283185307179586 * oh / 10.0;
|
||||
double aa = 6.283185307179586 * (double) oh / 10.0;
|
||||
GL11.glVertex2f((float) Math.cos(aa), (float) Math.sin(aa));
|
||||
}
|
||||
|
||||
GL11.glEnd();
|
||||
GL11.glStencilFunc(514, 1, 1);
|
||||
GL11.glStencilOp(7680, 7680, 7680);
|
||||
|
@ -162,7 +164,7 @@ public class PortalRenderer {
|
|||
}
|
||||
}
|
||||
mc.renderViewEntity.setPositionAndRotation(
|
||||
target.x + 0.5 + xm, target.y - 0.5f + ym, target.z + 0.5 + zm, yaw, pitch
|
||||
target.x + 0.5 + xm, target.y + 0.5f + ym, target.z + 0.5 + zm, yaw, pitch
|
||||
);
|
||||
final boolean di = mc.gameSettings.showDebugInfo;
|
||||
mc.gameSettings.showDebugInfo = false;
|
||||
|
@ -187,9 +189,8 @@ public class PortalRenderer {
|
|||
mc.gameSettings.fovSetting = fov;
|
||||
mc.gameSettings.thirdPersonView = tpv;
|
||||
GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight);
|
||||
//GL11.glDisable(2960);
|
||||
GL11.glDisable(2960);
|
||||
EXTFramebufferObject.glBindFramebufferEXT(36160, prevFbo);
|
||||
GL11.glPopMatrix();
|
||||
--PortalRenderer.renderRecursion;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -6,7 +6,6 @@ import net.anvilcraft.arcaneseals.utils.UtilsFX;
|
|||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.Tessellator;
|
||||
import net.minecraft.client.renderer.texture.TextureMap;
|
||||
import net.minecraft.client.renderer.texture.TextureUtil;
|
||||
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
import net.minecraft.util.IIcon;
|
||||
|
|
|
@ -27,12 +27,16 @@ import net.minecraft.entity.passive.EntityAnimal;
|
|||
import net.minecraft.entity.passive.EntityTameable;
|
||||
import net.minecraft.entity.passive.EntityVillager;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.entity.player.EntityPlayerMP;
|
||||
import net.minecraft.init.Blocks;
|
||||
import net.minecraft.inventory.IInventory;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.nbt.NBTTagCompound;
|
||||
import net.minecraft.network.NetworkManager;
|
||||
import net.minecraft.network.Packet;
|
||||
import net.minecraft.network.play.server.S08PacketPlayerPosLook;
|
||||
import net.minecraft.network.play.server.S12PacketEntityVelocity;
|
||||
import net.minecraft.network.play.server.S18PacketEntityTeleport;
|
||||
import net.minecraft.network.play.server.S35PacketUpdateTileEntity;
|
||||
import net.minecraft.potion.Potion;
|
||||
import net.minecraft.potion.PotionEffect;
|
||||
|
@ -1543,7 +1547,7 @@ public class TileSeal extends TileEntity {
|
|||
|
||||
if (this.delay <= 0 && p) {
|
||||
//this.renderTeleportDest();
|
||||
this.delay = 3;
|
||||
this.delay = 10;
|
||||
}
|
||||
|
||||
--this.delay;
|
||||
|
@ -1561,17 +1565,14 @@ public class TileSeal extends TileEntity {
|
|||
list = this.getEntitiesSorted(super.worldObj, 2, this.orientation, false);
|
||||
|
||||
for (q = 0; q < list.size(); ++q) {
|
||||
if (list.get(q) instanceof EntityPlayer) {
|
||||
super.worldObj.playSoundEffect(
|
||||
(double) super.xCoord + 0.5,
|
||||
(double) super.yCoord + 0.5,
|
||||
(double) super.zCoord + 0.5,
|
||||
"arcaneseals:pclose",
|
||||
0.4F,
|
||||
1.0F + super.worldObj.rand.nextFloat() * 0.2F
|
||||
);
|
||||
break;
|
||||
}
|
||||
super.worldObj.playSoundEffect(
|
||||
(double) super.xCoord + 0.5,
|
||||
(double) super.yCoord + 0.5,
|
||||
(double) super.zCoord + 0.5,
|
||||
"arcaneseals:pclose",
|
||||
0.4F,
|
||||
1.0F + super.worldObj.rand.nextFloat() * 0.2F
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1627,217 +1628,244 @@ public class TileSeal extends TileEntity {
|
|||
//}
|
||||
|
||||
public boolean teleport() {
|
||||
if (this.delay > 0) {
|
||||
List<Entity> list = super.worldObj.getEntitiesWithinAABB(
|
||||
Entity.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) super.xCoord,
|
||||
(double) super.yCoord,
|
||||
(double) super.zCoord,
|
||||
(double) (super.xCoord + 1),
|
||||
(double) (super.yCoord + 1),
|
||||
(double) (super.zCoord + 1)
|
||||
)
|
||||
);
|
||||
|
||||
if (list.isEmpty()) {
|
||||
return false;
|
||||
} else {
|
||||
List<Entity> list = super.worldObj.getEntitiesWithinAABB(
|
||||
Entity.class,
|
||||
AxisAlignedBB.getBoundingBox(
|
||||
(double) super.xCoord,
|
||||
(double) super.yCoord,
|
||||
(double) super.zCoord,
|
||||
(double) (super.xCoord + 1),
|
||||
(double) (super.yCoord + 1),
|
||||
(double) (super.zCoord + 1)
|
||||
)
|
||||
);
|
||||
if (list.size() == 0) {
|
||||
Entity entity = (Entity) list.get(0);
|
||||
if (entity instanceof EntityFX) {
|
||||
return false;
|
||||
} else {
|
||||
Entity entity = (Entity) list.get(0);
|
||||
if (entity instanceof EntityFX) {
|
||||
if (this.otherSeal == null) {
|
||||
return false;
|
||||
} else {
|
||||
if (this.otherSeal == null) {
|
||||
return false;
|
||||
} else {
|
||||
SealData targetDest = this.otherSeal;
|
||||
TileEntity ts = super.worldObj.getTileEntity(
|
||||
targetDest.x, targetDest.y, targetDest.z
|
||||
);
|
||||
if (ts != null && ts instanceof TileSeal) {
|
||||
TileSeal target = (TileSeal) ts;
|
||||
if (target.runes[0] == 0 && target.runes[1] == 1) {
|
||||
target.delay = 40;
|
||||
float tYaw = entity.rotationYaw;
|
||||
switch (target.orientation) {
|
||||
case 2:
|
||||
tYaw = 180.0F;
|
||||
break;
|
||||
case 3:
|
||||
tYaw = 0.0F;
|
||||
break;
|
||||
case 4:
|
||||
tYaw = 90.0F;
|
||||
break;
|
||||
case 5:
|
||||
tYaw = 270.0F;
|
||||
}
|
||||
SealData targetDest = this.otherSeal;
|
||||
TileEntity ts = super.worldObj.getTileEntity(
|
||||
targetDest.x, targetDest.y, targetDest.z
|
||||
);
|
||||
if (ts != null && ts instanceof TileSeal) {
|
||||
TileSeal target = (TileSeal) ts;
|
||||
if (target.runes[0] == 0 && target.runes[1] == 1) {
|
||||
target.delay = 40;
|
||||
float tYaw = entity.rotationYaw;
|
||||
switch (target.orientation) {
|
||||
case 2:
|
||||
tYaw = 180.0F;
|
||||
break;
|
||||
case 3:
|
||||
tYaw = 0.0F;
|
||||
break;
|
||||
case 4:
|
||||
tYaw = 90.0F;
|
||||
break;
|
||||
case 5:
|
||||
tYaw = 270.0F;
|
||||
}
|
||||
|
||||
int diff = this.orientation - target.orientation;
|
||||
double t;
|
||||
if (diff == -3 || diff == 2
|
||||
|| diff == -1
|
||||
&& this.orientation + target.orientation != 5
|
||||
&& this.orientation + target.orientation != 9) {
|
||||
t = entity.motionX;
|
||||
entity.motionX = entity.motionZ;
|
||||
entity.motionZ = -t;
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.motionX
|
||||
= entity.ridingEntity.motionZ;
|
||||
entity.ridingEntity.motionZ = -t;
|
||||
}
|
||||
} else if (diff == -2 || diff == 3 || diff == 1 &&
|
||||
int diff = this.orientation - target.orientation;
|
||||
double t;
|
||||
if (diff == -3 || diff == 2
|
||||
|| diff == -1
|
||||
&& this.orientation + target.orientation != 5
|
||||
&& this.orientation + target.orientation != 9) {
|
||||
t = entity.motionX;
|
||||
entity.motionX = entity.motionZ;
|
||||
entity.motionZ = -t;
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.motionX
|
||||
= entity.ridingEntity.motionZ;
|
||||
entity.ridingEntity.motionZ = -t;
|
||||
}
|
||||
} else if (diff == -2 || diff == 3 || diff == 1 &&
|
||||
this.orientation + target.orientation != 5 &&
|
||||
this.orientation + target.orientation != 9) {
|
||||
t = entity.motionX;
|
||||
entity.motionX = -entity.motionZ;
|
||||
entity.motionZ = t;
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.motionX
|
||||
= -entity.ridingEntity.motionZ;
|
||||
entity.ridingEntity.motionZ = t;
|
||||
}
|
||||
} else if (diff == 0) {
|
||||
entity.motionX = -entity.motionX;
|
||||
entity.motionZ = -entity.motionZ;
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.motionX
|
||||
= -entity.ridingEntity.motionX;
|
||||
entity.ridingEntity.motionZ
|
||||
= -entity.ridingEntity.motionZ;
|
||||
}
|
||||
t = entity.motionX;
|
||||
entity.motionX = -entity.motionZ;
|
||||
entity.motionZ = t;
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.motionX
|
||||
= -entity.ridingEntity.motionZ;
|
||||
entity.ridingEntity.motionZ = t;
|
||||
}
|
||||
|
||||
if (diff == 0
|
||||
&& (this.orientation == 1 || this.orientation == 0)) {
|
||||
entity.motionY = -entity.motionY;
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.motionY
|
||||
= -entity.ridingEntity.motionY;
|
||||
}
|
||||
} else if (diff == 0) {
|
||||
entity.motionX = -entity.motionX;
|
||||
entity.motionZ = -entity.motionZ;
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.motionX
|
||||
= -entity.ridingEntity.motionX;
|
||||
entity.ridingEntity.motionZ
|
||||
= -entity.ridingEntity.motionZ;
|
||||
}
|
||||
}
|
||||
|
||||
UtilsFX.poof(
|
||||
super.worldObj,
|
||||
(float) entity.posX - 0.5F,
|
||||
(float) entity.posY - 0.5F,
|
||||
(float) entity.posZ - 0.5F
|
||||
);
|
||||
super.worldObj.playSoundEffect(
|
||||
entity.posX,
|
||||
entity.posY,
|
||||
entity.posZ,
|
||||
"mob.endermen.portal",
|
||||
1.0F,
|
||||
1.0F
|
||||
);
|
||||
int xm = 0;
|
||||
int zm = 0;
|
||||
int ym = 0;
|
||||
switch (target.orientation) {
|
||||
case 0:
|
||||
ym = -1;
|
||||
break;
|
||||
case 1:
|
||||
ym = 1;
|
||||
break;
|
||||
case 2:
|
||||
zm = -1;
|
||||
break;
|
||||
case 3:
|
||||
zm = 1;
|
||||
break;
|
||||
case 4:
|
||||
xm = -1;
|
||||
break;
|
||||
case 5:
|
||||
xm = 1;
|
||||
if (diff == 0
|
||||
&& (this.orientation == 1 || this.orientation == 0)) {
|
||||
entity.motionY = -entity.motionY;
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.motionY
|
||||
= -entity.ridingEntity.motionY;
|
||||
}
|
||||
}
|
||||
|
||||
if (target.orientation > 1
|
||||
&& super.worldObj.isAirBlock(
|
||||
target.xCoord + xm,
|
||||
target.yCoord + ym - 1,
|
||||
target.zCoord + zm
|
||||
)) {
|
||||
--ym;
|
||||
}
|
||||
UtilsFX.poof(
|
||||
super.worldObj,
|
||||
(float) entity.posX - 0.5F,
|
||||
(float) entity.posY - 0.5F,
|
||||
(float) entity.posZ - 0.5F
|
||||
);
|
||||
super.worldObj.playSoundEffect(
|
||||
entity.posX,
|
||||
entity.posY,
|
||||
entity.posZ,
|
||||
"mob.endermen.portal",
|
||||
1.0F,
|
||||
1.0F
|
||||
);
|
||||
int xm = 0;
|
||||
int zm = 0;
|
||||
int ym = 0;
|
||||
switch (target.orientation) {
|
||||
case 0:
|
||||
ym = -1;
|
||||
break;
|
||||
case 1:
|
||||
ym = 1;
|
||||
break;
|
||||
case 2:
|
||||
zm = -1;
|
||||
break;
|
||||
case 3:
|
||||
zm = 1;
|
||||
break;
|
||||
case 4:
|
||||
xm = -1;
|
||||
break;
|
||||
case 5:
|
||||
xm = 1;
|
||||
}
|
||||
|
||||
entity.setLocationAndAngles(
|
||||
if (target.orientation > 1
|
||||
&& super.worldObj.isAirBlock(
|
||||
target.xCoord + xm,
|
||||
target.yCoord + ym - 1,
|
||||
target.zCoord + zm
|
||||
)) {
|
||||
--ym;
|
||||
}
|
||||
|
||||
entity.setLocationAndAngles(
|
||||
(double) target.xCoord + 0.5 + (double) xm,
|
||||
(double) target.yCoord + 0.5 + (double) ym,
|
||||
(double) target.zCoord + 0.5 + (double) zm,
|
||||
tYaw,
|
||||
entity.rotationPitch
|
||||
);
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.setLocationAndAngles(
|
||||
(double) target.xCoord + 0.5 + (double) xm,
|
||||
(double) target.yCoord + 0.5 + (double) ym,
|
||||
(double) target.zCoord + 0.5 + (double) zm,
|
||||
tYaw,
|
||||
entity.rotationPitch
|
||||
entity.ridingEntity.rotationPitch
|
||||
);
|
||||
if (entity.ridingEntity != null) {
|
||||
entity.ridingEntity.setLocationAndAngles(
|
||||
(double) target.xCoord + 0.5 + (double) xm,
|
||||
(double) target.yCoord + 0.5 + (double) ym,
|
||||
(double) target.zCoord + 0.5 + (double) zm,
|
||||
tYaw,
|
||||
entity.ridingEntity.rotationPitch
|
||||
);
|
||||
}
|
||||
|
||||
UtilsFX.poof(
|
||||
super.worldObj,
|
||||
(float) entity.posX - 0.5F,
|
||||
(float) entity.posY - 0.5F,
|
||||
(float) entity.posZ - 0.5F
|
||||
);
|
||||
super.worldObj.playSoundEffect(
|
||||
entity.posX,
|
||||
entity.posY,
|
||||
entity.posZ,
|
||||
"mob.endermen.portal",
|
||||
1.0F,
|
||||
1.0F
|
||||
);
|
||||
|
||||
// TODO: use specific aspect for flux
|
||||
int thisAura = AuraManager.getClosestAuraWithinRange(
|
||||
this.worldObj,
|
||||
this.xCoord,
|
||||
this.yCoord,
|
||||
this.zCoord,
|
||||
512
|
||||
);
|
||||
|
||||
if (thisAura >= 0) {
|
||||
AuraManager.addRandomFlux(
|
||||
this.worldObj,
|
||||
AuraManager.getNode(thisAura),
|
||||
(entity instanceof EntityItem) ? 1 : 4
|
||||
);
|
||||
}
|
||||
|
||||
int otherAura = AuraManager.getClosestAuraWithinRange(
|
||||
target.worldObj,
|
||||
target.xCoord,
|
||||
target.yCoord,
|
||||
target.zCoord,
|
||||
512
|
||||
);
|
||||
|
||||
if (otherAura >= 0) {
|
||||
AuraManager.addRandomFlux(
|
||||
this.worldObj,
|
||||
AuraManager.getNode(otherAura),
|
||||
(entity instanceof EntityItem) ? 1 : 4
|
||||
);
|
||||
}
|
||||
|
||||
this.worked = true;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
||||
UtilsFX.poof(
|
||||
super.worldObj,
|
||||
(float) entity.posX - 0.5F,
|
||||
(float) entity.posY - 0.5F,
|
||||
(float) entity.posZ - 0.5F
|
||||
);
|
||||
super.worldObj.playSoundEffect(
|
||||
entity.posX,
|
||||
entity.posY,
|
||||
entity.posZ,
|
||||
"mob.endermen.portal",
|
||||
1.0F,
|
||||
1.0F
|
||||
);
|
||||
|
||||
// TODO: use specific aspect for flux
|
||||
int thisAura = AuraManager.getClosestAuraWithinRange(
|
||||
this.worldObj, this.xCoord, this.yCoord, this.zCoord, 512
|
||||
);
|
||||
|
||||
if (thisAura >= 0) {
|
||||
AuraManager.addRandomFlux(
|
||||
this.worldObj,
|
||||
AuraManager.getNode(thisAura),
|
||||
(entity instanceof EntityItem) ? 1 : 4
|
||||
);
|
||||
}
|
||||
|
||||
int otherAura = AuraManager.getClosestAuraWithinRange(
|
||||
target.worldObj,
|
||||
target.xCoord,
|
||||
target.yCoord,
|
||||
target.zCoord,
|
||||
512
|
||||
);
|
||||
|
||||
if (otherAura >= 0) {
|
||||
AuraManager.addRandomFlux(
|
||||
this.worldObj,
|
||||
AuraManager.getNode(otherAura),
|
||||
(entity instanceof EntityItem) ? 1 : 4
|
||||
);
|
||||
}
|
||||
|
||||
if (entity instanceof EntityPlayer) {
|
||||
((EntityPlayerMP) entity)
|
||||
.playerNetServerHandler.sendPacket(
|
||||
new S08PacketPlayerPosLook(
|
||||
entity.posX,
|
||||
entity.posY + 1.6,
|
||||
entity.posZ,
|
||||
entity.rotationYaw,
|
||||
entity.rotationPitch,
|
||||
false
|
||||
)
|
||||
);
|
||||
} else {
|
||||
System.out.println(entity.posX + " " + entity.posY + " " + entity.posZ);
|
||||
Packet pkt1
|
||||
= new S18PacketEntityTeleport(
|
||||
entity.getEntityId(),
|
||||
MathHelper.floor_double(entity.posX * 32.0D),
|
||||
MathHelper.floor_double(entity.posY * 32.0D),
|
||||
MathHelper.floor_double(entity.posZ * 32.0D),
|
||||
(byte
|
||||
) ((int) (entity.rotationYaw * 256.0F / 360.0F)),
|
||||
(byte
|
||||
) ((int) (entity.rotationPitch * 256.0F / 360.0F))
|
||||
);
|
||||
Packet pkt2 = new S12PacketEntityVelocity(entity);
|
||||
|
||||
for (EntityPlayerMP pl : (List<EntityPlayerMP>) this
|
||||
.worldObj.playerEntities) {
|
||||
pl.playerNetServerHandler.sendPacket(pkt1);
|
||||
pl.playerNetServerHandler.sendPacket(pkt2);
|
||||
}
|
||||
}
|
||||
|
||||
this.worked = true;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Reference in New Issue