feat: fix and add some bugs

This commit is contained in:
LordMZTE 2022-11-23 18:30:48 +01:00
parent 63f12376f7
commit 8008a3cece
Signed by: LordMZTE
GPG key ID: B64802DC33A64FF6
5 changed files with 248 additions and 210 deletions

6
austri3Fix.md Normal file
View file

@ -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???

View file

@ -3,10 +3,14 @@ package net.anvilcraft.arcaneseals;
import cpw.mods.fml.common.eventhandler.SubscribeEvent; import cpw.mods.fml.common.eventhandler.SubscribeEvent;
import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent; import cpw.mods.fml.common.gameevent.TickEvent.RenderTickEvent;
import net.anvilcraft.arcaneseals.render.PortalRenderer; import net.anvilcraft.arcaneseals.render.PortalRenderer;
import net.minecraft.client.Minecraft;
public class RenderTicker { public class RenderTicker {
@SubscribeEvent @SubscribeEvent
public void onRenderTickEvent(RenderTickEvent ev) { public void onRenderTickEvent(RenderTickEvent ev) {
if (Minecraft.getMinecraft().theWorld == null)
return;
for (PortalRenderer ren : PortalRenderer.INSTANCES) { for (PortalRenderer ren : PortalRenderer.INSTANCES) {
// TODO: optimize // TODO: optimize
ren.createPortalView(); ren.createPortalView();

View file

@ -12,8 +12,6 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ChunkCoordinates; import net.minecraft.util.ChunkCoordinates;
import net.minecraft.util.IChatComponent; import net.minecraft.util.IChatComponent;
import net.minecraftforge.common.util.ForgeDirection;
import org.lwjgl.opengl.EXTFramebufferObject; import org.lwjgl.opengl.EXTFramebufferObject;
import org.lwjgl.opengl.GL11; import org.lwjgl.opengl.GL11;
@ -23,7 +21,6 @@ public class PortalRenderer {
public int portalTexture; public int portalTexture;
public int depthRenderBuffer; public int depthRenderBuffer;
public int frameBuffer; public int frameBuffer;
public static int renderRecursion;
public TileSeal seal; public TileSeal seal;
public PortalRenderer(TileSeal seal) { public PortalRenderer(TileSeal seal) {
@ -55,7 +52,6 @@ public class PortalRenderer {
} }
public void createPortalView() { public void createPortalView() {
++PortalRenderer.renderRecursion;
if (this.seal.otherSeal == null) if (this.seal.otherSeal == null)
return; return;
@ -67,19 +63,25 @@ public class PortalRenderer {
int prevFbo = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT); int prevFbo = GL11.glGetInteger(EXTFramebufferObject.GL_FRAMEBUFFER_BINDING_EXT);
EXTFramebufferObject.glBindFramebufferEXT(36160, this.frameBuffer); EXTFramebufferObject.glBindFramebufferEXT(36160, this.frameBuffer);
// TODO: stencils aren't stenciling
GL11.glEnable(2960); GL11.glEnable(2960);
GL11.glStencilFunc(519, 1, 1); GL11.glStencilFunc(519, 1, 1);
GL11.glStencilOp(7680, 7680, 7681); GL11.glStencilOp(7680, 7680, 7681);
GL11.glViewport(0, 0, 512, 512); GL11.glViewport(0, 0, 512, 512);
GL11.glMatrixMode(5889);
GL11.glLoadIdentity();
GL11.glMatrixMode(5888);
GL11.glLoadIdentity(); GL11.glLoadIdentity();
GL11.glDisable(3553); GL11.glDisable(3553);
GL11.glColor3f(1.0f, 1.0f, 1.0f); GL11.glColor3f(1.0F, 1.0F, 1.0F);
GL11.glBegin(6); GL11.glBegin(6);
GL11.glVertex2f(0.0f, 0.0f); GL11.glVertex2f(0.0F, 0.0F);
for (int oh = 0; oh <= 10; ++oh) { 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.glVertex2f((float) Math.cos(aa), (float) Math.sin(aa));
} }
GL11.glEnd(); GL11.glEnd();
GL11.glStencilFunc(514, 1, 1); GL11.glStencilFunc(514, 1, 1);
GL11.glStencilOp(7680, 7680, 7680); GL11.glStencilOp(7680, 7680, 7680);
@ -162,7 +164,7 @@ public class PortalRenderer {
} }
} }
mc.renderViewEntity.setPositionAndRotation( 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; final boolean di = mc.gameSettings.showDebugInfo;
mc.gameSettings.showDebugInfo = false; mc.gameSettings.showDebugInfo = false;
@ -187,9 +189,8 @@ public class PortalRenderer {
mc.gameSettings.fovSetting = fov; mc.gameSettings.fovSetting = fov;
mc.gameSettings.thirdPersonView = tpv; mc.gameSettings.thirdPersonView = tpv;
GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight); GL11.glViewport(0, 0, mc.displayWidth, mc.displayHeight);
//GL11.glDisable(2960); GL11.glDisable(2960);
EXTFramebufferObject.glBindFramebufferEXT(36160, prevFbo); EXTFramebufferObject.glBindFramebufferEXT(36160, prevFbo);
GL11.glPopMatrix(); GL11.glPopMatrix();
--PortalRenderer.renderRecursion;
} }
} }

View file

@ -6,7 +6,6 @@ import net.anvilcraft.arcaneseals.utils.UtilsFX;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.Tessellator; import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.texture.TextureUtil;
import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer; import net.minecraft.client.renderer.tileentity.TileEntitySpecialRenderer;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.IIcon; import net.minecraft.util.IIcon;

View file

@ -27,12 +27,16 @@ import net.minecraft.entity.passive.EntityAnimal;
import net.minecraft.entity.passive.EntityTameable; import net.minecraft.entity.passive.EntityTameable;
import net.minecraft.entity.passive.EntityVillager; import net.minecraft.entity.passive.EntityVillager;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.player.EntityPlayerMP;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.inventory.IInventory; import net.minecraft.inventory.IInventory;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.network.NetworkManager; import net.minecraft.network.NetworkManager;
import net.minecraft.network.Packet; 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.network.play.server.S35PacketUpdateTileEntity;
import net.minecraft.potion.Potion; import net.minecraft.potion.Potion;
import net.minecraft.potion.PotionEffect; import net.minecraft.potion.PotionEffect;
@ -1543,7 +1547,7 @@ public class TileSeal extends TileEntity {
if (this.delay <= 0 && p) { if (this.delay <= 0 && p) {
//this.renderTeleportDest(); //this.renderTeleportDest();
this.delay = 3; this.delay = 10;
} }
--this.delay; --this.delay;
@ -1561,7 +1565,6 @@ public class TileSeal extends TileEntity {
list = this.getEntitiesSorted(super.worldObj, 2, this.orientation, false); list = this.getEntitiesSorted(super.worldObj, 2, this.orientation, false);
for (q = 0; q < list.size(); ++q) { for (q = 0; q < list.size(); ++q) {
if (list.get(q) instanceof EntityPlayer) {
super.worldObj.playSoundEffect( super.worldObj.playSoundEffect(
(double) super.xCoord + 0.5, (double) super.xCoord + 0.5,
(double) super.yCoord + 0.5, (double) super.yCoord + 0.5,
@ -1570,8 +1573,6 @@ public class TileSeal extends TileEntity {
0.4F, 0.4F,
1.0F + super.worldObj.rand.nextFloat() * 0.2F 1.0F + super.worldObj.rand.nextFloat() * 0.2F
); );
break;
}
} }
} }
@ -1627,9 +1628,6 @@ public class TileSeal extends TileEntity {
//} //}
public boolean teleport() { public boolean teleport() {
if (this.delay > 0) {
return false;
} else {
List<Entity> list = super.worldObj.getEntitiesWithinAABB( List<Entity> list = super.worldObj.getEntitiesWithinAABB(
Entity.class, Entity.class,
AxisAlignedBB.getBoundingBox( AxisAlignedBB.getBoundingBox(
@ -1641,7 +1639,8 @@ public class TileSeal extends TileEntity {
(double) (super.zCoord + 1) (double) (super.zCoord + 1)
) )
); );
if (list.size() == 0) {
if (list.isEmpty()) {
return false; return false;
} else { } else {
Entity entity = (Entity) list.get(0); Entity entity = (Entity) list.get(0);
@ -1799,11 +1798,7 @@ public class TileSeal extends TileEntity {
// TODO: use specific aspect for flux // TODO: use specific aspect for flux
int thisAura = AuraManager.getClosestAuraWithinRange( int thisAura = AuraManager.getClosestAuraWithinRange(
this.worldObj, this.worldObj, this.xCoord, this.yCoord, this.zCoord, 512
this.xCoord,
this.yCoord,
this.zCoord,
512
); );
if (thisAura >= 0) { if (thisAura >= 0) {
@ -1830,6 +1825,40 @@ public class TileSeal extends TileEntity {
); );
} }
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; this.worked = true;
return true; return true;
} else { } else {
@ -1842,7 +1871,6 @@ public class TileSeal extends TileEntity {
} }
} }
} }
}
private void beam( private void beam(
int range, int range,