fixed mob spawner, fixed beacon

This commit is contained in:
LAX1DUDE 2022-01-24 16:19:55 -08:00
parent 6b91ac0576
commit 79ba9f2580
8 changed files with 54 additions and 14 deletions

Binary file not shown.

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -4,7 +4,7 @@ public class ConfigConstants {
public static boolean profanity = false;
public static final String version = "22w03c";
public static final String version = "22w04a";
public static final String mainMenuString = "eaglercraft " + version;
public static final String forkMe = "https://github.com/LAX1DUDE/eaglercraft";

View File

@ -48,15 +48,18 @@ public class EntityList {
*/
public static Entity createEntityByName(String par0Str, World par1World) {
Entity var2 = null;
Class var3 = (Class) stringToClassMapping.get(par0Str);
try {
Class var3 = (Class) stringToClassMapping.get(par0Str);
if (var3 != null) {
if (var3 != null) {
try {
var2 = (Entity) var3.getConstructor(new Class[] { World.class }).newInstance(new Object[] { par1World });
} catch (Exception var4) {
try {
var2 = (Entity) var3.getConstructor(new Class[0]).newInstance(new Object[0]);
} catch (Exception e) {
e.printStackTrace();
}
}
} catch (Exception var4) {
var4.printStackTrace();
}
return var2;

View File

@ -4,6 +4,7 @@ import net.lax1dude.eaglercraft.EaglerAdapter;
import net.lax1dude.eaglercraft.TextureLocation;
import net.lax1dude.eaglercraft.adapter.Tessellator;
import net.minecraft.client.Minecraft;
public class TileEntityBeaconRenderer extends TileEntitySpecialRenderer {
@ -14,7 +15,7 @@ public class TileEntityBeaconRenderer extends TileEntitySpecialRenderer {
*/
public void renderTileEntityBeaconAt(TileEntityBeacon par1TileEntityBeacon, double par2, double par4, double par6, float par8) {
float var9 = par1TileEntityBeacon.func_82125_v_();
if (var9 > 0.0F) {
Tessellator var10 = Tessellator.instance;
tex_beam.bindTexture();
@ -23,9 +24,10 @@ public class TileEntityBeaconRenderer extends TileEntitySpecialRenderer {
EaglerAdapter.glDisable(EaglerAdapter.GL_LIGHTING);
EaglerAdapter.glDisable(EaglerAdapter.GL_CULL_FACE);
EaglerAdapter.glDisable(EaglerAdapter.GL_BLEND);
EaglerAdapter.glDisable(EaglerAdapter.GL_ALPHA_TEST);
EaglerAdapter.glDepthMask(true);
EaglerAdapter.glBlendFunc(EaglerAdapter.GL_SRC_ALPHA, EaglerAdapter.GL_ONE);
float var11 = (float) par1TileEntityBeacon.getWorldObj().getTotalWorldTime() + par8;
float var11 = ((System.currentTimeMillis() % 200000) / 50.0f);//par1TileEntityBeacon.getWorldObj().getWorldTime() + par8;
float var12 = -var11 * 0.2F - (float) MathHelper.floor_float(-var11 * 0.1F);
byte var13 = 1;
double var14 = (double) var11 * 0.025D * (1.0D - (double) (var13 & 1) * 2.5D);
@ -99,6 +101,7 @@ public class TileEntityBeaconRenderer extends TileEntitySpecialRenderer {
var10.draw();
EaglerAdapter.glEnable(EaglerAdapter.GL_LIGHTING);
EaglerAdapter.glEnable(EaglerAdapter.GL_TEXTURE_2D);
EaglerAdapter.glEnable(EaglerAdapter.GL_ALPHA_TEST);
EaglerAdapter.glDepthMask(true);
}
}

View File

@ -1,11 +1,17 @@
package net.minecraft.src;
public class TileEntityMobSpawner extends TileEntity {
public String mobID = "Pig";
public Entity mobObject = null;
public int rotateTicks = 0;
/**
* Reads a tile entity from NBT.
*/
public void readFromNBT(NBTTagCompound par1NBTTagCompound) {
this.mobID = par1NBTTagCompound.getString("EntityId");
this.mobObject = null;
super.readFromNBT(par1NBTTagCompound);
}
@ -21,16 +27,15 @@ public class TileEntityMobSpawner extends TileEntity {
worldObj.spawnParticle("flame", this.xCoord + worldObj.rand.nextFloat(), this.yCoord + worldObj.rand.nextFloat(), this.zCoord + worldObj.rand.nextFloat(), 0.0D, 0.0D, 0.0D);
worldObj.spawnParticle("flame", this.xCoord + worldObj.rand.nextFloat(), this.yCoord + worldObj.rand.nextFloat(), this.zCoord + worldObj.rand.nextFloat(), 0.0D, 0.0D, 0.0D);
}
++rotateTicks;
}
/**
* Overriden in a sign to provide the text.
*/
public Packet getDescriptionPacket() {
NBTTagCompound var1 = new NBTTagCompound();
this.writeToNBT(var1);
var1.removeTag("SpawnPotentials");
return new Packet132TileEntityData(this.xCoord, this.yCoord, this.zCoord, 1, var1);
return null;
}
}

View File

@ -0,0 +1,28 @@
package net.minecraft.src;
import net.lax1dude.eaglercraft.EaglerAdapter;
public class TileEntityMobSpawnerRenderer extends TileEntitySpecialRenderer {
@Override
public void renderTileEntityAt(TileEntity var1, double var2, double var4, double var6, float var8) {
TileEntityMobSpawner spawner = (TileEntityMobSpawner) var1;
if(spawner.mobObject == null) {
spawner.mobObject = EntityList.createEntityByName(spawner.mobID, spawner.worldObj);
spawner.mobObject.setWorld(spawner.worldObj);
}
if(spawner.mobObject != null) {
EaglerAdapter.glPushMatrix();
EaglerAdapter.glTranslatef((float)var2 + 0.5F, (float)var4 + 0.4f, (float)var6 + 0.5F);
EaglerAdapter.glRotatef((spawner.rotateTicks + var8) * 50.0f, 0.0f, 1.0f, 0.0f);
EaglerAdapter.glRotatef(-30.0f, 1.0f, 0.0f, 0.0f);
EaglerAdapter.glTranslatef(0.0f, -0.4f, 0.0f);
float var9 = 0.4375F;
EaglerAdapter.glScalef(var9, var9, var9);
spawner.mobObject.setLocationAndAngles(var2, var4, var6, 0.0f, 0.0f);
RenderManager.instance.renderEntityWithPosYaw(spawner.mobObject, 0.0D, 0.0D, 0.0D, 0.0F, var8);
EaglerAdapter.glPopMatrix();
}
}
}

View File

@ -54,6 +54,7 @@ public class TileEntityRenderer {
this.specialRendererMap.put(TileEntityEndPortal.class, new RenderEndPortal());
this.specialRendererMap.put(TileEntityBeacon.class, new TileEntityBeaconRenderer());
this.specialRendererMap.put(TileEntitySkull.class, new TileEntitySkullRenderer());
this.specialRendererMap.put(TileEntityMobSpawner.class, new TileEntityMobSpawnerRenderer());
Iterator var1 = this.specialRendererMap.values().iterator();
while (var1.hasNext()) {

File diff suppressed because one or more lines are too long