This commit is contained in:
HoosierTransfer 2024-07-09 15:17:00 -04:00
parent af93e51d29
commit ec2dc742aa
783 changed files with 3317 additions and 3162 deletions

View File

@ -1,6 +1,6 @@
package net.hoosiertransfer.Alfheim; package net.hoosiertransfer.Alfheim;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.EnumSkyBlock;
public interface IChunkLightingData { public interface IChunkLightingData {

View File

@ -1,7 +1,7 @@
package net.hoosiertransfer.Alfheim; package net.hoosiertransfer.Alfheim;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
@ -9,7 +9,8 @@ public interface ILightInfoProvider {
int alfheim$getLightFor(final IBlockAccess iBlockAccess, final EnumSkyBlock lightType, final BlockPos blockPos); int alfheim$getLightFor(final IBlockAccess iBlockAccess, final EnumSkyBlock lightType, final BlockPos blockPos);
boolean alfheim$useNeighborBrightness(final EnumFacing facing, final IBlockAccess blockAccess, final BlockPos blockPos); boolean alfheim$useNeighborBrightness(final EnumFacing facing, final IBlockAccess blockAccess,
final BlockPos blockPos);
int alfheim$getLightOpacity(final EnumFacing facing, final IBlockAccess blockAccess, final BlockPos blockPos); int alfheim$getLightOpacity(final EnumFacing facing, final IBlockAccess blockAccess, final BlockPos blockPos);
} }

View File

@ -1,6 +1,6 @@
package net.hoosiertransfer.Alfheim; package net.hoosiertransfer.Alfheim;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.EnumSkyBlock;
/** /**

View File

@ -1,13 +1,18 @@
package net.hoosiertransfer.Alfheim; package net.hoosiertransfer.Alfheim;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
public interface ILitBlock { public interface ILitBlock {
int alfheim$getLightFor(final IBlockState blockState, final IBlockAccess blockAccess, final EnumSkyBlock lightType, final BlockPos blockPos); int alfheim$getLightFor(final IBlockState blockState, final IBlockAccess blockAccess, final EnumSkyBlock lightType,
boolean alfheim$useNeighborBrightness(final IBlockState blockState, final EnumFacing facing, final IBlockAccess blockAccess, final BlockPos blockPos); final BlockPos blockPos);
int alfheim$getLightOpacity(final IBlockState blockState, final EnumFacing facing, final IBlockAccess blockAccess, final BlockPos blockPos);
boolean alfheim$useNeighborBrightness(final IBlockState blockState, final EnumFacing facing,
final IBlockAccess blockAccess, final BlockPos blockPos);
int alfheim$getLightOpacity(final IBlockState blockState, final EnumFacing facing, final IBlockAccess blockAccess,
final BlockPos blockPos);
} }

View File

@ -1,11 +1,12 @@
package net.hoosiertransfer.Alfheim.lighting; package net.hoosiertransfer.Alfheim.lighting;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
public class LightUtil { public class LightUtil {
public static int getLightValueForState(final IBlockState blockState, final IBlockAccess blockAccess, final BlockPos blockPos) { public static int getLightValueForState(final IBlockState blockState, final IBlockAccess blockAccess,
final BlockPos blockPos) {
return blockState.getLightValue(blockAccess, blockPos); return blockState.getLightValue(blockAccess, blockPos);
} }
} }

View File

@ -5,10 +5,10 @@ import net.hoosiertransfer.Alfheim.util.DeduplicatedLongQueue;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.profiler.Profiler; import net.minecraft.profiler.Profiler;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.Vec3i; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.BlockPos.MutableBlockPos; import net.minecraft.util.math.Vec3i;
import net.minecraft.util.math.BlockPos.MutableBlockPos;
import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;

View File

@ -12,13 +12,12 @@ import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityArmorStand; import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.Vec3;
public class CullTask implements Runnable { public class CullTask implements Runnable {
public boolean requestCull = false; public boolean requestCull = false;
private final OcclusionCullingInstance culling; private final OcclusionCullingInstance culling;
private final Set<String> unCullable; private final Set<String> unCullable;
private final Minecraft client = Minecraft.getMinecraft(); private final Minecraft client = Minecraft.getMinecraft();
@ -29,7 +28,7 @@ public class CullTask implements Runnable {
private Vec3d lastPos = new Vec3d(0, 0, 0); private Vec3d lastPos = new Vec3d(0, 0, 0);
private Vec3d aabbMin = new Vec3d(0, 0, 0); private Vec3d aabbMin = new Vec3d(0, 0, 0);
private Vec3d aabbMax = new Vec3d(0, 0, 0); private Vec3d aabbMax = new Vec3d(0, 0, 0);
public CullTask(OcclusionCullingInstance culling, Set<String> unCullable) { public CullTask(OcclusionCullingInstance culling, Set<String> unCullable) {
this.culling = culling; this.culling = culling;
@ -39,87 +38,99 @@ public class CullTask implements Runnable {
@Override @Override
public void run() { public void run() {
// while (client != null) { // while (client != null) {
// try { // try {
// Thread.sleep(Config.SleepDuration); // Thread.sleep(Config.SleepDuration);
// if (Config.enableCulling && client.theWorld != null && client.thePlayer != null && client.thePlayer.ticksExisted > 0 && client.getRenderViewEntity() != null) { // if (Config.enableCulling && client.theWorld != null && client.thePlayer !=
// Vec3 cameraMC = getCameraPos(); // null && client.thePlayer.ticksExisted > 0 && client.getRenderViewEntity() !=
// if (requestCull || !(cameraMC.xCoord == lastPos.x && cameraMC.yCoord == lastPos.y && cameraMC.zCoord == lastPos.z)) { // null) {
// long start = System.currentTimeMillis(); // Vec3 cameraMC = getCameraPos();
// requestCull = false; // if (requestCull || !(cameraMC.xCoord == lastPos.x && cameraMC.yCoord ==
// lastPos.set(cameraMC.xCoord, cameraMC.yCoord, cameraMC.zCoord); // lastPos.y && cameraMC.zCoord == lastPos.z)) {
// Vec3d camera = lastPos; // long start = System.currentTimeMillis();
// culling.resetCache(); // requestCull = false;
// boolean noCulling = client.thePlayer.isSpectator() || client.gameSettings.thirdPersonView != 0; // lastPos.set(cameraMC.xCoord, cameraMC.yCoord, cameraMC.zCoord);
// Iterator<TileEntity> iterator = client.theWorld.loadedTileEntityList.iterator(); // Vec3d camera = lastPos;
// TileEntity entry; // culling.resetCache();
// while(iterator.hasNext()) { // boolean noCulling = client.thePlayer.isSpectator() ||
// try { // client.gameSettings.thirdPersonView != 0;
// entry = iterator.next(); // Iterator<TileEntity> iterator =
// } catch(NullPointerException | ConcurrentModificationException ex) { // client.theWorld.loadedTileEntityList.iterator();
// break; // We are not synced to the main thread, so NPE's/CME are allowed here and way less // TileEntity entry;
// // overhead probably than trying to sync stuff up for no really good reason // while(iterator.hasNext()) {
// } // try {
// if (unCullable.contains(entry.getBlockType().getUnlocalizedName())) { // entry = iterator.next();
// continue; // } catch(NullPointerException | ConcurrentModificationException ex) {
// } // break; // We are not synced to the main thread, so NPE's/CME are allowed here
// if (!entry.isForcedVisible()) { // and way less
// if (noCulling) { // // overhead probably than trying to sync stuff up for no really good reason
// entry.setCulled(true); // }
// continue; // if (unCullable.contains(entry.getBlockType().getUnlocalizedName())) {
// } // continue;
// BlockPos pos = entry.getPos(); // }
// if(pos.distanceSq(cameraMC.xCoord, cameraMC.yCoord, cameraMC.zCoord) < 64*64) { // 64 is the fixed max tile view distance // if (!entry.isForcedVisible()) {
// aabbMin.set(pos.getX(), pos.getY(), pos.getZ()); // if (noCulling) {
// aabbMax.set(pos.getX()+1d, pos.getY()+1d, pos.getZ()+1d); // entry.setCulled(true);
// boolean visible = culling.isAABBVisible(aabbMin, aabbMax, camera); // continue;
// entry.setCulled(!visible); // }
// } // BlockPos pos = entry.getPos();
// } // if(pos.distanceSq(cameraMC.xCoord, cameraMC.yCoord, cameraMC.zCoord) < 64*64)
// } // { // 64 is the fixed max tile view distance
// Entity entity = null; // aabbMin.set(pos.getX(), pos.getY(), pos.getZ());
// Iterator<Entity> iterable = client.theWorld.getLoadedEntityList().iterator(); // aabbMax.set(pos.getX()+1d, pos.getY()+1d, pos.getZ()+1d);
// while(iterable.hasNext()) { // boolean visible = culling.isAABBVisible(aabbMin, aabbMax, camera);
// try { // entry.setCulled(!visible);
// entity = iterable.next(); // }
// } catch(NullPointerException | ConcurrentModificationException ex) { // }
// break; // We are not synced to the main thread, so NPE's/CME are allowed here and way less // }
// // overhead probably than trying to sync stuff up for no really good reason // Entity entity = null;
// } // Iterator<Entity> iterable = client.theWorld.getLoadedEntityList().iterator();
// if (entity == null) { // while(iterable.hasNext()) {
// continue; // try {
// } // entity = iterable.next();
// if (!entity.isForcedVisible()) { // } catch(NullPointerException | ConcurrentModificationException ex) {
// if (noCulling || isSkippableArmorstand(entity)) { // break; // We are not synced to the main thread, so NPE's/CME are allowed here
// entity.setCulled(false); // and way less
// continue; // // overhead probably than trying to sync stuff up for no really good reason
// } // }
// if(entity.getPositionVector().squareDistanceTo(cameraMC) > Config.tracingDistance * Config.tracingDistance) { // if (entity == null) {
// entity.setCulled(false); // If your entity view distance is larger than tracingDistance just render it // continue;
// continue; // }
// } // if (!entity.isForcedVisible()) {
// AxisAlignedBB boundingBox = entity.getEntityBoundingBox(); // if (noCulling || isSkippableArmorstand(entity)) {
// if(boundingBox.maxX - boundingBox.minX > hitboxLimit || boundingBox.maxY - boundingBox.minY > hitboxLimit || boundingBox.maxZ - boundingBox.minZ > hitboxLimit) { // entity.setCulled(false);
// entity.setCulled(false); // To big to bother to cull // continue;
// continue; // }
// } // if(entity.getPositionVector().squareDistanceTo(cameraMC) >
// aabbMin.set(boundingBox.minX, boundingBox.minY, boundingBox.minZ); // Config.tracingDistance * Config.tracingDistance) {
// aabbMax.set(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ); // entity.setCulled(false); // If your entity view distance is larger than
// boolean visible = culling.isAABBVisible(aabbMin, aabbMax, camera); // tracingDistance just render it
// entity.setCulled(!visible); // continue;
// } // }
// } // AxisAlignedBB boundingBox = entity.getEntityBoundingBox();
// lastTime = (System.currentTimeMillis()-start); // if(boundingBox.maxX - boundingBox.minX > hitboxLimit || boundingBox.maxY -
// } // boundingBox.minY > hitboxLimit || boundingBox.maxZ - boundingBox.minZ >
// } // hitboxLimit) {
// } catch (Exception e) { // entity.setCulled(false); // To big to bother to cull
// e.printStackTrace(); // continue;
// } // }
// aabbMin.set(boundingBox.minX, boundingBox.minY, boundingBox.minZ);
// aabbMax.set(boundingBox.maxX, boundingBox.maxY, boundingBox.maxZ);
// boolean visible = culling.isAABBVisible(aabbMin, aabbMax, camera);
// entity.setCulled(!visible);
// }
// }
// lastTime = (System.currentTimeMillis()-start);
// }
// }
// } catch (Exception e) {
// e.printStackTrace();
// }
// } // }
// System.out.println("Culling thread stopped"); // System.out.println("Culling thread stopped");
} }
private Vec3 getCameraPos() { private net.minecraft.util.math.Vec3d getCameraPos() {
if (client.gameSettings.thirdPersonView == 0) { if (client.gameSettings.thirdPersonView == 0) {
return client.thePlayer.getPositionEyes(0); return client.thePlayer.getPositionEyes(0);
} }
@ -127,7 +138,9 @@ public class CullTask implements Runnable {
} }
private boolean isSkippableArmorstand(Entity entity) { private boolean isSkippableArmorstand(Entity entity) {
if (!Config.skipMarkerArmorStands) return false; if (!Config.skipMarkerArmorStands)
return entity instanceof EntityArmorStand && ((EntityArmorStand) entity).func_181026_s(); // i think this is the marker flag return false;
return entity instanceof EntityArmorStand && ((EntityArmorStand) entity).func_181026_s(); // i think this is the
// marker flag
} }
} }

View File

@ -4,7 +4,7 @@ import com.logisticscraft.occlusionculling.DataProvider;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
public class Provider implements DataProvider { public class Provider implements DataProvider {
private final Minecraft client = Minecraft.getMinecraft(); private final Minecraft client = Minecraft.getMinecraft();

View File

@ -1,8 +1,8 @@
package net.hoosiertransfer.Sodium; package net.hoosiertransfer.Sodium;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.biome.BiomeColorHelper; import net.minecraft.world.biome.BiomeColorHelper;
import net.minecraft.util.BlockPos;
public interface SodiumBlockAccess extends IBlockAccess { public interface SodiumBlockAccess extends IBlockAccess {
int getBlockTint(BlockPos pos, BiomeColorHelper.ColorResolver resolver); int getBlockTint(BlockPos pos, BiomeColorHelper.ColorResolver resolver);

View File

@ -21,8 +21,8 @@ import net.minecraft.client.audio.SoundPoolEntry;
import net.minecraft.client.settings.GameSettings; import net.minecraft.client.settings.GameSettings;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.ITickable; import net.minecraft.util.ITickable;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
/** /**
* Copyright (c) 2022-2023 lax1dude, hoosiertransfer, ayunami2000. All Rights * Copyright (c) 2022-2023 lax1dude, hoosiertransfer, ayunami2000. All Rights

View File

@ -34,8 +34,8 @@ import net.minecraft.client.resources.data.PackMetadataSectionSerializer;
import net.minecraft.client.resources.data.TextureMetadataSection; import net.minecraft.client.resources.data.TextureMetadataSection;
import net.minecraft.client.resources.data.TextureMetadataSectionSerializer; import net.minecraft.client.resources.data.TextureMetadataSectionSerializer;
import net.minecraft.network.ServerStatusResponse; import net.minecraft.network.ServerStatusResponse;
import net.minecraft.util.ChatStyle; import net.minecraft.util.text.Style;
import net.minecraft.util.IChatComponent; import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.gen.ChunkProviderSettings; import net.minecraft.world.gen.ChunkProviderSettings;
/** /**
@ -137,8 +137,8 @@ public class JSONTypeProvider {
static { static {
registerType(IChatComponent.class, new IChatComponent.Serializer()); registerType(ITextComponent.class, new ITextComponent.Serializer());
registerType(ChatStyle.class, new ChatStyle.Serializer()); registerType(Style.class, new Style.Serializer());
registerType(ServerStatusResponse.class, new ServerStatusResponse.Serializer()); registerType(ServerStatusResponse.class, new ServerStatusResponse.Serializer());
registerType(ServerStatusResponse.MinecraftProtocolVersionIdentifier.class, registerType(ServerStatusResponse.MinecraftProtocolVersionIdentifier.class,
new ServerStatusResponse.MinecraftProtocolVersionIdentifier.Serializer()); new ServerStatusResponse.MinecraftProtocolVersionIdentifier.Serializer());

View File

@ -4,20 +4,27 @@ import net.lax1dude.eaglercraft.v1_8.opengl.InstancedParticleRenderer;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.particle.EntityFX; import net.minecraft.client.particle.EntityFX;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
import net.hoosiertransfer.Config; import net.hoosiertransfer.Config;
/** /**
* Copyright (c) 2022 lax1dude. All Rights Reserved. * Copyright (c) 2022 lax1dude. All Rights Reserved.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * DISCLAIMED.
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * DIRECT,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
@ -37,7 +44,7 @@ public class AcceleratedEffectRenderer implements IAcceleratedParticleEngine {
this.partialTicks = partialTicks; this.partialTicks = partialTicks;
InstancedParticleRenderer.begin(); InstancedParticleRenderer.begin();
Entity et = Minecraft.getMinecraft().getRenderViewEntity(); Entity et = Minecraft.getMinecraft().getRenderViewEntity();
if(et != null) { if (et != null) {
f1 = MathHelper.cos(et.rotationYaw * 0.017453292F); f1 = MathHelper.cos(et.rotationYaw * 0.017453292F);
f2 = MathHelper.sin(et.rotationYaw * 0.017453292F); f2 = MathHelper.sin(et.rotationYaw * 0.017453292F);
f3 = -f2 * MathHelper.sin(et.rotationPitch * 0.017453292F); f3 = -f2 * MathHelper.sin(et.rotationPitch * 0.017453292F);
@ -48,44 +55,55 @@ public class AcceleratedEffectRenderer implements IAcceleratedParticleEngine {
@Override @Override
public void draw(float texCoordWidth, float texCoordHeight) { public void draw(float texCoordWidth, float texCoordHeight) {
if (!Config.renderParticles()) return; if (!Config.renderParticles())
return;
InstancedParticleRenderer.render(texCoordWidth, texCoordHeight, 0.0625f, f1, f5, f2, f3, f4); InstancedParticleRenderer.render(texCoordWidth, texCoordHeight, 0.0625f, f1, f5, f2, f3, f4);
} }
@Override @Override
public void drawParticle(Entity entityIn, int particleIndexX, int particleIndexY, int lightMapData, public void drawParticle(Entity entityIn, int particleIndexX, int particleIndexY, int lightMapData,
int texSize, float particleSize, float r, float g, float b, float a) { int texSize, float particleSize, float r, float g, float b, float a) {
if (!Config.renderParticles()) return; if (!Config.renderParticles())
float xx = (float) (entityIn.prevPosX + (entityIn.posX - entityIn.prevPosX) * (double) partialTicks - EntityFX.interpPosX); return;
float yy = (float) (entityIn.prevPosY + (entityIn.posY - entityIn.prevPosY) * (double) partialTicks - EntityFX.interpPosY); float xx = (float) (entityIn.prevPosX + (entityIn.posX - entityIn.prevPosX) * (double) partialTicks
float zz = (float) (entityIn.prevPosZ + (entityIn.posZ - entityIn.prevPosZ) * (double) partialTicks - EntityFX.interpPosZ); - EntityFX.interpPosX);
float yy = (float) (entityIn.prevPosY + (entityIn.posY - entityIn.prevPosY) * (double) partialTicks
- EntityFX.interpPosY);
float zz = (float) (entityIn.prevPosZ + (entityIn.posZ - entityIn.prevPosZ) * (double) partialTicks
- EntityFX.interpPosZ);
drawParticle(xx, yy, zz, particleIndexX, particleIndexY, lightMapData, texSize, particleSize, r, g, b, a); drawParticle(xx, yy, zz, particleIndexX, particleIndexY, lightMapData, texSize, particleSize, r, g, b, a);
} }
@Override @Override
public void drawParticle(Entity entityIn, int particleIndexX, int particleIndexY, int lightMapData, public void drawParticle(Entity entityIn, int particleIndexX, int particleIndexY, int lightMapData,
int texSize, float particleSize, int rgba) { int texSize, float particleSize, int rgba) {
if (!Config.renderParticles()) return; if (!Config.renderParticles())
float xx = (float) (entityIn.prevPosX + (entityIn.posX - entityIn.prevPosX) * (double) partialTicks - EntityFX.interpPosX); return;
float yy = (float) (entityIn.prevPosY + (entityIn.posY - entityIn.prevPosY) * (double) partialTicks - EntityFX.interpPosY); float xx = (float) (entityIn.prevPosX + (entityIn.posX - entityIn.prevPosX) * (double) partialTicks
float zz = (float) (entityIn.prevPosZ + (entityIn.posZ - entityIn.prevPosZ) * (double) partialTicks - EntityFX.interpPosZ); - EntityFX.interpPosX);
float yy = (float) (entityIn.prevPosY + (entityIn.posY - entityIn.prevPosY) * (double) partialTicks
- EntityFX.interpPosY);
float zz = (float) (entityIn.prevPosZ + (entityIn.posZ - entityIn.prevPosZ) * (double) partialTicks
- EntityFX.interpPosZ);
drawParticle(xx, yy, zz, particleIndexX, particleIndexY, lightMapData, texSize, particleSize, rgba); drawParticle(xx, yy, zz, particleIndexX, particleIndexY, lightMapData, texSize, particleSize, rgba);
} }
@Override @Override
public void drawParticle(float posX, float posY, float posZ, int particleIndexX, int particleIndexY, public void drawParticle(float posX, float posY, float posZ, int particleIndexX, int particleIndexY,
int lightMapData, int texSize, float particleSize, float r, float g, float b, float a) { int lightMapData, int texSize, float particleSize, float r, float g, float b, float a) {
if (!Config.renderParticles()) return; if (!Config.renderParticles())
return;
InstancedParticleRenderer.appendParticle(posX, posY, posZ, particleIndexX, particleIndexY, lightMapData & 0xFF, InstancedParticleRenderer.appendParticle(posX, posY, posZ, particleIndexX, particleIndexY, lightMapData & 0xFF,
(lightMapData >> 16) & 0xFF, (int)(particleSize * 16.0f), texSize, r, g, b, a); (lightMapData >> 16) & 0xFF, (int) (particleSize * 16.0f), texSize, r, g, b, a);
} }
@Override @Override
public void drawParticle(float posX, float posY, float posZ, int particleIndexX, int particleIndexY, public void drawParticle(float posX, float posY, float posZ, int particleIndexX, int particleIndexY,
int lightMapData, int texSize, float particleSize, int rgba) { int lightMapData, int texSize, float particleSize, int rgba) {
if (!Config.renderParticles()) return; if (!Config.renderParticles())
return;
InstancedParticleRenderer.appendParticle(posX, posY, posZ, particleIndexX, particleIndexY, lightMapData & 0xFF, InstancedParticleRenderer.appendParticle(posX, posY, posZ, particleIndexX, particleIndexY, lightMapData & 0xFF,
(lightMapData >> 16) & 0xFF, (int)(particleSize * 16.0f), texSize, rgba); (lightMapData >> 16) & 0xFF, (int) (particleSize * 16.0f), texSize, rgba);
} }
} }

View File

@ -22,7 +22,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.StreamBuffer.StreamBufferInstance;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager; import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.DynamicLightsStateManager;
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f; import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
import net.lax1dude.eaglercraft.v1_8.vector.Vector4f; import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
import static net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionShader.FixedFunctionState.*; import static net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionShader.FixedFunctionState.*;
import static net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionShader.FixedFunctionConstants.*; import static net.lax1dude.eaglercraft.v1_8.opengl.FixedFunctionShader.FixedFunctionConstants.*;

View File

@ -12,7 +12,7 @@ import net.lax1dude.eaglercraft.v1_8.internal.PlatformBufferFunctions;
import net.lax1dude.eaglercraft.v1_8.log4j.LogManager; import net.lax1dude.eaglercraft.v1_8.log4j.LogManager;
import net.lax1dude.eaglercraft.v1_8.vector.Vector3f; import net.lax1dude.eaglercraft.v1_8.vector.Vector3f;
import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
/** /**
* Copyright (c) 2022-2023 lax1dude, hoosiertransfer, ayunami2000. All Rights * Copyright (c) 2022-2023 lax1dude, hoosiertransfer, ayunami2000. All Rights

View File

@ -22,19 +22,26 @@ import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
import net.lax1dude.eaglercraft.v1_8.vector.Vector3f; import net.lax1dude.eaglercraft.v1_8.vector.Vector3f;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient; import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
/** /**
* Copyright (c) 2023 lax1dude. All Rights Reserved. * Copyright (c) 2023 lax1dude. All Rights Reserved.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * DISCLAIMED.
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * DIRECT,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
@ -126,7 +133,8 @@ public class CloudRenderWorker {
ByteBuffer cloudNoiseDatBuffer = EagRuntime.allocateByteBuffer(cloudNoiseDat.length); ByteBuffer cloudNoiseDatBuffer = EagRuntime.allocateByteBuffer(cloudNoiseDat.length);
cloudNoiseDatBuffer.put(cloudNoiseDat); cloudNoiseDatBuffer.put(cloudNoiseDat);
cloudNoiseDatBuffer.flip(); cloudNoiseDatBuffer.flip();
_wglTexImage2D(GL_TEXTURE_2D, 0, _GL_R8, cloudNoiseW, cloudNoiseH, 0, GL_RED, GL_UNSIGNED_BYTE, cloudNoiseDatBuffer); _wglTexImage2D(GL_TEXTURE_2D, 0, _GL_R8, cloudNoiseW, cloudNoiseH, 0, GL_RED, GL_UNSIGNED_BYTE,
cloudNoiseDatBuffer);
EagRuntime.freeByteBuffer(cloudNoiseDatBuffer); EagRuntime.freeByteBuffer(cloudNoiseDatBuffer);
cloud3DSamplesTexture = GlStateManager.generateTexture(); cloud3DSamplesTexture = GlStateManager.generateTexture();
@ -140,14 +148,15 @@ public class CloudRenderWorker {
cloud3DSamplesTextureSizeZ, 0, GL_RED, GL_UNSIGNED_BYTE, (ByteBuffer) null); cloud3DSamplesTextureSizeZ, 0, GL_RED, GL_UNSIGNED_BYTE, (ByteBuffer) null);
cloud3DSamplesSlices = new IFramebufferGL[cloud3DSamplesTextureSizeZ]; cloud3DSamplesSlices = new IFramebufferGL[cloud3DSamplesTextureSizeZ];
for(int i = 0; i < cloud3DSamplesTextureSizeZ; ++i) { for (int i = 0; i < cloud3DSamplesTextureSizeZ; ++i) {
cloud3DSamplesSlices[i] = _wglCreateFramebuffer(); cloud3DSamplesSlices[i] = _wglCreateFramebuffer();
_wglBindFramebuffer(_GL_FRAMEBUFFER, cloud3DSamplesSlices[i]); _wglBindFramebuffer(_GL_FRAMEBUFFER, cloud3DSamplesSlices[i]);
_wglFramebufferTextureLayer(_GL_FRAMEBUFFER, _GL_COLOR_ATTACHMENT0, EaglercraftGPU.getNativeTexture(cloud3DSamplesTexture), 0, i); _wglFramebufferTextureLayer(_GL_FRAMEBUFFER, _GL_COLOR_ATTACHMENT0,
EaglercraftGPU.getNativeTexture(cloud3DSamplesTexture), 0, i);
} }
GlStateManager.clearColor(0.0f, 0.0f, 0.0f, 1.0f); GlStateManager.clearColor(0.0f, 0.0f, 0.0f, 1.0f);
for(int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
cloudNoiseSampleParaboloidFramebuffer[i] = _wglCreateFramebuffer(); cloudNoiseSampleParaboloidFramebuffer[i] = _wglCreateFramebuffer();
_wglBindFramebuffer(_GL_FRAMEBUFFER, cloudNoiseSampleParaboloidFramebuffer[i]); _wglBindFramebuffer(_GL_FRAMEBUFFER, cloudNoiseSampleParaboloidFramebuffer[i]);
cloudNoiseSampleParaboloidTexture[i] = GlStateManager.generateTexture(); cloudNoiseSampleParaboloidTexture[i] = GlStateManager.generateTexture();
@ -156,8 +165,10 @@ public class CloudRenderWorker {
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); _wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, i == 3 ? GL_LINEAR : GL_NEAREST); _wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, i == 3 ? GL_LINEAR : GL_NEAREST);
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, i == 3 ? GL_LINEAR : GL_NEAREST); _wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, i == 3 ? GL_LINEAR : GL_NEAREST);
EaglercraftGPU.createFramebufferHDR16FTexture(GL_TEXTURE_2D, 0, cloudParaboloidTextureSize, cloudParaboloidTextureSize, GL_RGBA, true); EaglercraftGPU.createFramebufferHDR16FTexture(GL_TEXTURE_2D, 0, cloudParaboloidTextureSize,
_wglFramebufferTexture2D(_GL_FRAMEBUFFER, _GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, EaglercraftGPU.getNativeTexture(cloudNoiseSampleParaboloidTexture[i]), 0); cloudParaboloidTextureSize, GL_RGBA, true);
_wglFramebufferTexture2D(_GL_FRAMEBUFFER, _GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
EaglercraftGPU.getNativeTexture(cloudNoiseSampleParaboloidTexture[i]), 0);
GlStateManager.clear(GL_COLOR_BUFFER_BIT); GlStateManager.clear(GL_COLOR_BUFFER_BIT);
} }
@ -172,7 +183,8 @@ public class CloudRenderWorker {
cloudNoiseDatBuffer = EagRuntime.allocateByteBuffer(cloudShapeTexture.length); cloudNoiseDatBuffer = EagRuntime.allocateByteBuffer(cloudShapeTexture.length);
cloudNoiseDatBuffer.put(cloudShapeTexture); cloudNoiseDatBuffer.put(cloudShapeTexture);
cloudNoiseDatBuffer.flip(); cloudNoiseDatBuffer.flip();
_wglTexImage3D(GL_TEXTURE_3D, 0, _GL_R8, 32, 16, 24, 0, GL_RED, GL_UNSIGNED_BYTE, (ByteBuffer) cloudNoiseDatBuffer); _wglTexImage3D(GL_TEXTURE_3D, 0, _GL_R8, 32, 16, 24, 0, GL_RED, GL_UNSIGNED_BYTE,
(ByteBuffer) cloudNoiseDatBuffer);
EagRuntime.freeByteBuffer(cloudNoiseDatBuffer); EagRuntime.freeByteBuffer(cloudNoiseDatBuffer);
shader_clouds_noise3d = PipelineShaderCloudsNoise3D.compile(); shader_clouds_noise3d = PipelineShaderCloudsNoise3D.compile();
@ -192,8 +204,9 @@ public class CloudRenderWorker {
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); _wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT);
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); _wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); _wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
_wglTexImage2D(GL_TEXTURE_2D, 0, _GL_R8, 1, 1, 0, GL_RED, GL_UNSIGNED_BYTE, (ByteBuffer)null); _wglTexImage2D(GL_TEXTURE_2D, 0, _GL_R8, 1, 1, 0, GL_RED, GL_UNSIGNED_BYTE, (ByteBuffer) null);
_wglFramebufferTexture2D(_GL_FRAMEBUFFER, _GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, EaglercraftGPU.getNativeTexture(cloudOcclusionTexture), 0); _wglFramebufferTexture2D(_GL_FRAMEBUFFER, _GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
EaglercraftGPU.getNativeTexture(cloudOcclusionTexture), 0);
} }
static void setPosition(float x, float y, float z) { static void setPosition(float x, float y, float z) {
@ -208,11 +221,11 @@ public class CloudRenderWorker {
static void update() { static void update() {
long millis = System.currentTimeMillis(); long millis = System.currentTimeMillis();
int cloudProgress = (int)(millis - cloudStartTimer); int cloudProgress = (int) (millis - cloudStartTimer);
int totalCloudSteps = 32 + 32 - 1; int totalCloudSteps = 32 + 32 - 1;
int currentCloudStep = cloudProgress * totalCloudSteps / cloudRenderPeriod; int currentCloudStep = cloudProgress * totalCloudSteps / cloudRenderPeriod;
boolean b = false; boolean b = false;
if(currentCloudStep > totalCloudSteps) { if (currentCloudStep > totalCloudSteps) {
currentCloudStep = totalCloudSteps; currentCloudStep = totalCloudSteps;
b = true; b = true;
} }
@ -222,12 +235,13 @@ public class CloudRenderWorker {
WorldClient wc = Minecraft.getMinecraft().theWorld; WorldClient wc = Minecraft.getMinecraft().theWorld;
float rain = wc.getRainStrength(0.0f); float rain = wc.getRainStrength(0.0f);
if(cloudRenderProgress == 0) { if (cloudRenderProgress == 0) {
shader_clouds_noise3d.useProgram(); shader_clouds_noise3d.useProgram();
_wglUniform2f(shader_clouds_noise3d.uniforms.u_textureSize2f, 1.0f / cloud3DSamplesTextureSizeX, 1.0f / cloud3DSamplesTextureSizeY); _wglUniform2f(shader_clouds_noise3d.uniforms.u_textureSize2f, 1.0f / cloud3DSamplesTextureSizeX,
float m = (float)((millis % 1200000l) * 0.00002); 1.0f / cloud3DSamplesTextureSizeY);
_wglUniform3f(shader_clouds_noise3d.uniforms.u_cloudMovement3f, m, 0.0f, m);//2.213f, 0.0f, 2.213f); float m = (float) ((millis % 1200000l) * 0.00002);
_wglUniform3f(shader_clouds_noise3d.uniforms.u_cloudMovement3f, m, 0.0f, m);// 2.213f, 0.0f, 2.213f);
tmpMatrix1.setIdentity(); tmpMatrix1.setIdentity();
tmpVector1.set(renderViewX * playerCoordsNoiseMapScale, 0.0f, renderViewZ * playerCoordsNoiseMapScale); tmpVector1.set(renderViewX * playerCoordsNoiseMapScale, 0.0f, renderViewZ * playerCoordsNoiseMapScale);
Matrix4f.translate(tmpVector1, tmpMatrix1, tmpMatrix1); Matrix4f.translate(tmpVector1, tmpMatrix1, tmpMatrix1);
@ -249,13 +263,14 @@ public class CloudRenderWorker {
matrixCopyBuffer.put(tmpMatrix1.m32); matrixCopyBuffer.put(tmpMatrix1.m32);
matrixCopyBuffer.flip(); matrixCopyBuffer.flip();
_wglUniformMatrix4x3fv(shader_clouds_noise3d.uniforms.u_sampleOffsetMatrix4f, false, matrixCopyBuffer); _wglUniformMatrix4x3fv(shader_clouds_noise3d.uniforms.u_sampleOffsetMatrix4f, false, matrixCopyBuffer);
shader_clouds_sample.useProgram(); shader_clouds_sample.useProgram();
_wglUniform1f(shader_clouds_sample.uniforms.u_rainStrength1f, 0.0f); _wglUniform1f(shader_clouds_sample.uniforms.u_rainStrength1f, 0.0f);
_wglUniform1f(shader_clouds_sample.uniforms.u_cloudTimer1f, 0.0f); _wglUniform1f(shader_clouds_sample.uniforms.u_cloudTimer1f, 0.0f);
_wglUniform3f(shader_clouds_sample.uniforms.u_cloudOffset3f, renderViewX, renderViewY, renderViewZ); _wglUniform3f(shader_clouds_sample.uniforms.u_cloudOffset3f, renderViewX, renderViewY, renderViewZ);
Vector3f currentSunAngle = DeferredStateManager.currentSunLightAngle; Vector3f currentSunAngle = DeferredStateManager.currentSunLightAngle;
_wglUniform3f(shader_clouds_sample.uniforms.u_sunDirection3f, -currentSunAngle.x, -currentSunAngle.y, -currentSunAngle.z); _wglUniform3f(shader_clouds_sample.uniforms.u_sunDirection3f, -currentSunAngle.x, -currentSunAngle.y,
-currentSunAngle.z);
currentSunAngle = tmpVector1; currentSunAngle = tmpVector1;
currentSunAngle.set(DeferredStateManager.currentSunLightColor); currentSunAngle.set(DeferredStateManager.currentSunLightColor);
float luma = currentSunAngle.x * 0.299f + currentSunAngle.y * 0.587f + currentSunAngle.z * 0.114f; float luma = currentSunAngle.x * 0.299f + currentSunAngle.y * 0.587f + currentSunAngle.z * 0.114f;
@ -267,35 +282,39 @@ public class CloudRenderWorker {
cloudColorG += (currentSunAngle.y - cloudColorG) * 0.1f; cloudColorG += (currentSunAngle.y - cloudColorG) * 0.1f;
cloudColorB += (currentSunAngle.z - cloudColorB) * 0.1f; cloudColorB += (currentSunAngle.z - cloudColorB) * 0.1f;
_wglUniform3f(shader_clouds_sample.uniforms.u_sunColor3f, cloudColorR, cloudColorG, cloudColorB); _wglUniform3f(shader_clouds_sample.uniforms.u_sunColor3f, cloudColorR, cloudColorG, cloudColorB);
float cloudDensityTimer = (float)((System.currentTimeMillis() % 10000000l) * 0.001); float cloudDensityTimer = (float) ((System.currentTimeMillis() % 10000000l) * 0.001);
cloudDensityTimer += MathHelper.sin(cloudDensityTimer * 1.5f) * 1.5f; cloudDensityTimer += MathHelper.sin(cloudDensityTimer * 1.5f) * 1.5f;
float x = cloudDensityTimer * 0.004f; float x = cloudDensityTimer * 0.004f;
float f1 = MathHelper.sin(x + 0.322f) * 0.544f + MathHelper.sin(x * 4.5f + 1.843f) * 0.69f + MathHelper.sin(x * 3.4f + 0.8f) * 0.6f + MathHelper.sin(x * 6.1f + 1.72f) * 0.7f; float f1 = MathHelper.sin(x + 0.322f) * 0.544f + MathHelper.sin(x * 4.5f + 1.843f) * 0.69f
+ MathHelper.sin(x * 3.4f + 0.8f) * 0.6f + MathHelper.sin(x * 6.1f + 1.72f) * 0.7f;
x = cloudDensityTimer * 0.002f; x = cloudDensityTimer * 0.002f;
float f2 = MathHelper.cos(x + 2.7f) + MathHelper.cos(x * 1.28f + 1.3f) * 0.4f + MathHelper.cos(x * 4.0f + 2.5f) * 0.3f + MathHelper.cos(x * 2.3f + 1.07f); float f2 = MathHelper.cos(x + 2.7f) + MathHelper.cos(x * 1.28f + 1.3f) * 0.4f
+ MathHelper.cos(x * 4.0f + 2.5f) * 0.3f + MathHelper.cos(x * 2.3f + 1.07f);
float rain2 = rain + wc.getThunderStrength(0.0f); float rain2 = rain + wc.getThunderStrength(0.0f);
_wglUniform4f(shader_clouds_sample.uniforms.u_densityModifier4f, 0.015f + f1 * 0.0021f * (1.0f - rain2 * 0.35f) + rain2 * 0.00023f, 0.0325f, -0.0172f + f2 * 0.00168f * (1.0f - rain2 * 0.35f) + rain * 0.0015f, 0.0f); _wglUniform4f(shader_clouds_sample.uniforms.u_densityModifier4f,
0.015f + f1 * 0.0021f * (1.0f - rain2 * 0.35f) + rain2 * 0.00023f, 0.0325f,
-0.0172f + f2 * 0.00168f * (1.0f - rain2 * 0.35f) + rain * 0.0015f, 0.0f);
} }
if(cloudRenderProgress < 32 && currentCloudStep > cloudRenderProgress) { if (cloudRenderProgress < 32 && currentCloudStep > cloudRenderProgress) {
GlStateManager.setActiveTexture(GL_TEXTURE0); GlStateManager.setActiveTexture(GL_TEXTURE0);
GlStateManager.bindTexture(cloudNoiseTexture); GlStateManager.bindTexture(cloudNoiseTexture);
GlStateManager.viewport(0, 0, cloud3DSamplesTextureSizeX, cloud3DSamplesTextureSizeY); GlStateManager.viewport(0, 0, cloud3DSamplesTextureSizeX, cloud3DSamplesTextureSizeY);
updateShape(); updateShape();
boolean shapeAllow = isDrawingCloudShapes; boolean shapeAllow = isDrawingCloudShapes;
boolean shapeInit = false; boolean shapeInit = false;
for(int i = cloudRenderProgress, j = currentCloudStep < 32 ? currentCloudStep : 32; i < j; ++i) { for (int i = cloudRenderProgress, j = currentCloudStep < 32 ? currentCloudStep : 32; i < j; ++i) {
int ccl = i * 2; int ccl = i * 2;
boolean drawShape = false; boolean drawShape = false;
if(isDrawingCloudShapes && shapeAllow) { if (isDrawingCloudShapes && shapeAllow) {
if(ccl >= shapePosZ && ccl < shapePosZ + shapeSizeZ) { if (ccl >= shapePosZ && ccl < shapePosZ + shapeSizeZ) {
drawShape = true; drawShape = true;
if(!shapeInit) { if (!shapeInit) {
shapeInit = true; shapeInit = true;
Matrix3f mat = tmpMatrix2; Matrix3f mat = tmpMatrix2;
mat.setIdentity(); mat.setIdentity();
@ -305,8 +324,8 @@ public class CloudRenderWorker {
mat.m11 = mat.m00; mat.m11 = mat.m00;
mat = tmpMatrix3; mat = tmpMatrix3;
mat.setIdentity(); mat.setIdentity();
mat.m00 = (float)shapeSizeX * 0.5f; mat.m00 = (float) shapeSizeX * 0.5f;
mat.m11 = (float)shapeSizeY * 0.5f; mat.m11 = (float) shapeSizeY * 0.5f;
Matrix3f.mul(tmpMatrix2, mat, tmpMatrix2); Matrix3f.mul(tmpMatrix2, mat, tmpMatrix2);
tmpMatrix2.m20 = shapePosX - renderViewX * playerCoordsNoiseMapScale * 128.0f; tmpMatrix2.m20 = shapePosX - renderViewX * playerCoordsNoiseMapScale * 128.0f;
tmpMatrix2.m21 = shapePosY - renderViewZ * playerCoordsNoiseMapScale * 128.0f; tmpMatrix2.m21 = shapePosY - renderViewZ * playerCoordsNoiseMapScale * 128.0f;
@ -317,10 +336,10 @@ public class CloudRenderWorker {
mat = tmpMatrix2; mat = tmpMatrix2;
mat.m20 -= 1.0f; mat.m20 -= 1.0f;
mat.m21 -= 1.0f; mat.m21 -= 1.0f;
if(!checkFrustum(mat)) { if (!checkFrustum(mat)) {
drawShape = false; drawShape = false;
shapeAllow = false; shapeAllow = false;
}else { } else {
matrixCopyBuffer.clear(); matrixCopyBuffer.clear();
matrixCopyBuffer.put(mat.m00); matrixCopyBuffer.put(mat.m00);
matrixCopyBuffer.put(mat.m01); matrixCopyBuffer.put(mat.m01);
@ -330,50 +349,55 @@ public class CloudRenderWorker {
matrixCopyBuffer.put(mat.m21); matrixCopyBuffer.put(mat.m21);
matrixCopyBuffer.flip(); matrixCopyBuffer.flip();
shader_clouds_shapes.useProgram(); shader_clouds_shapes.useProgram();
_wglUniformMatrix3x2fv(shader_clouds_shapes.uniforms.u_transformMatrix3x2f, false, matrixCopyBuffer); _wglUniformMatrix3x2fv(shader_clouds_shapes.uniforms.u_transformMatrix3x2f, false,
matrixCopyBuffer);
_wglUniform1f(shader_clouds_shapes.uniforms.u_textureLod1f, 0.0f); _wglUniform1f(shader_clouds_shapes.uniforms.u_textureLod1f, 0.0f);
_wglUniform2f(shader_clouds_shapes.uniforms.u_sampleWeights2f, 0.35f, 0.55f); _wglUniform2f(shader_clouds_shapes.uniforms.u_sampleWeights2f, 0.35f, 0.55f);
} }
} }
} }
} }
shader_clouds_noise3d.useProgram(); shader_clouds_noise3d.useProgram();
_wglBindFramebuffer(_GL_FRAMEBUFFER, cloud3DSamplesSlices[ccl]); _wglBindFramebuffer(_GL_FRAMEBUFFER, cloud3DSamplesSlices[ccl]);
_wglUniform1f(shader_clouds_noise3d.uniforms.u_textureSlice1f, (float)(ccl / (float)cloud3DSamplesTextureSizeZ)); _wglUniform1f(shader_clouds_noise3d.uniforms.u_textureSlice1f,
(float) (ccl / (float) cloud3DSamplesTextureSizeZ));
DrawUtils.drawStandardQuad2D(); DrawUtils.drawStandardQuad2D();
if(drawShape) { if (drawShape) {
GlStateManager.enableBlend(); GlStateManager.enableBlend();
GlStateManager.blendFunc(GL_ONE, GL_SRC_ALPHA); GlStateManager.blendFunc(GL_ONE, GL_SRC_ALPHA);
shader_clouds_shapes.useProgram(); shader_clouds_shapes.useProgram();
_wglUniform1f(shader_clouds_shapes.uniforms.u_textureLevel1f, (float)(ccl - shapePosZ + 0.5f) / (float)shapeSizeZ); _wglUniform1f(shader_clouds_shapes.uniforms.u_textureLevel1f,
(float) (ccl - shapePosZ + 0.5f) / (float) shapeSizeZ);
GlStateManager.bindTexture3D(cloudSpecialShapeTexture); GlStateManager.bindTexture3D(cloudSpecialShapeTexture);
DrawUtils.drawStandardQuad2D(); DrawUtils.drawStandardQuad2D();
GlStateManager.disableBlend(); GlStateManager.disableBlend();
shader_clouds_noise3d.useProgram(); shader_clouds_noise3d.useProgram();
GlStateManager.bindTexture(cloudNoiseTexture); GlStateManager.bindTexture(cloudNoiseTexture);
} }
_wglBindFramebuffer(_GL_FRAMEBUFFER, cloud3DSamplesSlices[ccl + 1]); _wglBindFramebuffer(_GL_FRAMEBUFFER, cloud3DSamplesSlices[ccl + 1]);
_wglUniform1f(shader_clouds_noise3d.uniforms.u_textureSlice1f, (float)((ccl + 1) / (float)cloud3DSamplesTextureSizeZ)); _wglUniform1f(shader_clouds_noise3d.uniforms.u_textureSlice1f,
(float) ((ccl + 1) / (float) cloud3DSamplesTextureSizeZ));
DrawUtils.drawStandardQuad2D(); DrawUtils.drawStandardQuad2D();
if(drawShape && ccl + 1 < shapePosZ + shapeSizeZ) { if (drawShape && ccl + 1 < shapePosZ + shapeSizeZ) {
GlStateManager.enableBlend(); GlStateManager.enableBlend();
shader_clouds_shapes.useProgram(); shader_clouds_shapes.useProgram();
_wglUniform1f(shader_clouds_shapes.uniforms.u_textureLevel1f, (float)((ccl + 1) - shapePosZ + 0.5f) / (float)shapeSizeZ); _wglUniform1f(shader_clouds_shapes.uniforms.u_textureLevel1f,
(float) ((ccl + 1) - shapePosZ + 0.5f) / (float) shapeSizeZ);
GlStateManager.bindTexture3D(cloudSpecialShapeTexture); GlStateManager.bindTexture3D(cloudSpecialShapeTexture);
DrawUtils.drawStandardQuad2D(); DrawUtils.drawStandardQuad2D();
GlStateManager.disableBlend(); GlStateManager.disableBlend();
} }
} }
} }
if(currentCloudStep >= 32 && currentCloudStep > cloudRenderProgress) { if (currentCloudStep >= 32 && currentCloudStep > cloudRenderProgress) {
_wglBindFramebuffer(_GL_FRAMEBUFFER, cloudNoiseSampleParaboloidFramebuffer[cloudRenderPhase]); _wglBindFramebuffer(_GL_FRAMEBUFFER, cloudNoiseSampleParaboloidFramebuffer[cloudRenderPhase]);
GlStateManager.viewport(0, 0, cloudParaboloidTextureSize, cloudParaboloidTextureSize); GlStateManager.viewport(0, 0, cloudParaboloidTextureSize, cloudParaboloidTextureSize);
@ -382,61 +406,63 @@ public class CloudRenderWorker {
GlStateManager.setActiveTexture(GL_TEXTURE0); GlStateManager.setActiveTexture(GL_TEXTURE0);
GlStateManager.bindTexture3D(cloud3DSamplesTexture); GlStateManager.bindTexture3D(cloud3DSamplesTexture);
shader_clouds_sample.useProgram(); shader_clouds_sample.useProgram();
GlStateManager.enableBlend(); GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GL_DST_ALPHA, GL_ONE, GL_DST_ALPHA, GL_ZERO); GlStateManager.tryBlendFuncSeparate(GL_DST_ALPHA, GL_ONE, GL_DST_ALPHA, GL_ZERO);
for(int i = cloudRenderProgress > 32 ? cloudRenderProgress - 32 : 0, j = currentCloudStep - 31; i < j; ++i) { for (int i = cloudRenderProgress > 32 ? cloudRenderProgress - 32 : 0,
if(i == 0) { j = currentCloudStep - 31; i < j; ++i) {
if (i == 0) {
GlStateManager.clearColor(0.0f, 0.0f, 0.0f, 1.0f); GlStateManager.clearColor(0.0f, 0.0f, 0.0f, 1.0f);
GlStateManager.clear(GL_COLOR_BUFFER_BIT); GlStateManager.clear(GL_COLOR_BUFFER_BIT);
} }
_wglUniform1f(shader_clouds_sample.uniforms.u_sampleStep1f, i * 2); _wglUniform1f(shader_clouds_sample.uniforms.u_sampleStep1f, i * 2);
DrawUtils.drawStandardQuad2D(); DrawUtils.drawStandardQuad2D();
_wglUniform1f(shader_clouds_sample.uniforms.u_sampleStep1f, i * 2 + 1); _wglUniform1f(shader_clouds_sample.uniforms.u_sampleStep1f, i * 2 + 1);
DrawUtils.drawStandardQuad2D(); DrawUtils.drawStandardQuad2D();
} }
GlStateManager.disableBlend(); GlStateManager.disableBlend();
} }
if(b) { if (b) {
cloudRenderProgress = 0; cloudRenderProgress = 0;
cloudStartTimer = System.currentTimeMillis(); cloudStartTimer = System.currentTimeMillis();
cloudProgress = 0; cloudProgress = 0;
cloudRenderPhase = (cloudRenderPhase + 1) % 3; cloudRenderPhase = (cloudRenderPhase + 1) % 3;
}else { } else {
cloudRenderProgress = currentCloudStep; cloudRenderProgress = currentCloudStep;
} }
_wglBindFramebuffer(_GL_FRAMEBUFFER, cloudNoiseSampleParaboloidFramebuffer[3]); _wglBindFramebuffer(_GL_FRAMEBUFFER, cloudNoiseSampleParaboloidFramebuffer[3]);
GlStateManager.viewport(0, 0, cloudParaboloidTextureSize, cloudParaboloidTextureSize); GlStateManager.viewport(0, 0, cloudParaboloidTextureSize, cloudParaboloidTextureSize);
float fadeFactor = cloudProgress / (float)cloudRenderPeriod; float fadeFactor = cloudProgress / (float) cloudRenderPeriod;
if(fadeFactor > 1.0f) fadeFactor = 1.0f; if (fadeFactor > 1.0f)
fadeFactor = 1.0f;
GlStateManager.setActiveTexture(GL_TEXTURE0); GlStateManager.setActiveTexture(GL_TEXTURE0);
GlStateManager.bindTexture(cloudNoiseSampleParaboloidTexture[(cloudRenderPhase + 1) % 3]); GlStateManager.bindTexture(cloudNoiseSampleParaboloidTexture[(cloudRenderPhase + 1) % 3]);
TextureCopyUtil.blitTexture(); TextureCopyUtil.blitTexture();
GlStateManager.enableBlend(); GlStateManager.enableBlend();
GlStateManager.blendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA); GlStateManager.blendFunc(GL_CONSTANT_ALPHA, GL_ONE_MINUS_CONSTANT_ALPHA);
GlStateManager.setBlendConstants(0.0f, 0.0f, 0.0f, fadeFactor); GlStateManager.setBlendConstants(0.0f, 0.0f, 0.0f, fadeFactor);
GlStateManager.bindTexture(cloudNoiseSampleParaboloidTexture[(cloudRenderPhase + 2) % 3]); GlStateManager.bindTexture(cloudNoiseSampleParaboloidTexture[(cloudRenderPhase + 2) % 3]);
TextureCopyUtil.blitTexture(); TextureCopyUtil.blitTexture();
GlStateManager.disableBlend(); GlStateManager.disableBlend();
_wglBindFramebuffer(_GL_FRAMEBUFFER, cloudOcclusionFramebuffer); _wglBindFramebuffer(_GL_FRAMEBUFFER, cloudOcclusionFramebuffer);
GlStateManager.viewport(0, 0, 1, 1); GlStateManager.viewport(0, 0, 1, 1);
if(rain >= 1.0f) { if (rain >= 1.0f) {
GlStateManager.clearColor(0.0f, 0.0f, 0.0f, 0.0f); GlStateManager.clearColor(0.0f, 0.0f, 0.0f, 0.0f);
GlStateManager.clear(GL_COLOR_BUFFER_BIT); GlStateManager.clear(GL_COLOR_BUFFER_BIT);
}else if(DeferredStateManager.currentSunLightAngle.y < 0.0f) { } else if (DeferredStateManager.currentSunLightAngle.y < 0.0f) {
shader_clouds_sun_occlusion.useProgram(); shader_clouds_sun_occlusion.useProgram();
GlStateManager.bindTexture(cloudNoiseSampleParaboloidTexture[3]); GlStateManager.bindTexture(cloudNoiseSampleParaboloidTexture[3]);
matrixCopyBuffer.clear(); matrixCopyBuffer.clear();
tmpVector1.set(0.0f, 1.0f, 0.0f); tmpVector1.set(0.0f, 1.0f, 0.0f);
Vector3f vec33 = tmpVector3; Vector3f vec33 = tmpVector3;
vec33.set(DeferredStateManager.currentSunLightAngle); vec33.set(DeferredStateManager.currentSunLightAngle);
@ -445,94 +471,94 @@ public class CloudRenderWorker {
vec33.z = -vec33.z; vec33.z = -vec33.z;
Vector3f.cross(tmpVector1, vec33, tmpVector1); Vector3f.cross(tmpVector1, vec33, tmpVector1);
Vector3f.cross(vec33, tmpVector1, tmpVector2); Vector3f.cross(vec33, tmpVector1, tmpVector2);
float rad = 0.1f; float rad = 0.1f;
matrixCopyBuffer.put(tmpVector1.x * rad); matrixCopyBuffer.put(tmpVector1.x * rad);
matrixCopyBuffer.put(tmpVector2.x * rad); matrixCopyBuffer.put(tmpVector2.x * rad);
matrixCopyBuffer.put(vec33.x * rad); matrixCopyBuffer.put(vec33.x * rad);
matrixCopyBuffer.put(tmpVector1.y * rad); matrixCopyBuffer.put(tmpVector1.y * rad);
matrixCopyBuffer.put(tmpVector2.y * rad); matrixCopyBuffer.put(tmpVector2.y * rad);
matrixCopyBuffer.put(vec33.y * rad); matrixCopyBuffer.put(vec33.y * rad);
matrixCopyBuffer.put(tmpVector1.z * rad); matrixCopyBuffer.put(tmpVector1.z * rad);
matrixCopyBuffer.put(tmpVector2.z * rad); matrixCopyBuffer.put(tmpVector2.z * rad);
matrixCopyBuffer.put(vec33.z * rad); matrixCopyBuffer.put(vec33.z * rad);
rad = 1.0f - rad; rad = 1.0f - rad;
matrixCopyBuffer.put(vec33.x * rad); matrixCopyBuffer.put(vec33.x * rad);
matrixCopyBuffer.put(vec33.y * rad); matrixCopyBuffer.put(vec33.y * rad);
matrixCopyBuffer.put(vec33.z * rad); matrixCopyBuffer.put(vec33.z * rad);
matrixCopyBuffer.flip(); matrixCopyBuffer.flip();
_wglUniformMatrix4x3fv(shader_clouds_sun_occlusion.uniforms.u_sampleMatrix4x3f, false, matrixCopyBuffer); _wglUniformMatrix4x3fv(shader_clouds_sun_occlusion.uniforms.u_sampleMatrix4x3f, false, matrixCopyBuffer);
if(rain > 0.0f) { if (rain > 0.0f) {
GlStateManager.enableBlend(); GlStateManager.enableBlend();
GlStateManager.blendFunc(GL_CONSTANT_ALPHA, GL_ZERO); GlStateManager.blendFunc(GL_CONSTANT_ALPHA, GL_ZERO);
GlStateManager.setBlendConstants(0.0f, 0.0f, 0.0f, 1.0f - rain); GlStateManager.setBlendConstants(0.0f, 0.0f, 0.0f, 1.0f - rain);
DrawUtils.drawStandardQuad2D(); DrawUtils.drawStandardQuad2D();
GlStateManager.disableBlend(); GlStateManager.disableBlend();
}else { } else {
DrawUtils.drawStandardQuad2D(); DrawUtils.drawStandardQuad2D();
} }
}else { } else {
GlStateManager.clearColor(1.0f, 1.0f, 1.0f, 1.0f); GlStateManager.clearColor(1.0f, 1.0f, 1.0f, 1.0f);
GlStateManager.clear(GL_COLOR_BUFFER_BIT); GlStateManager.clear(GL_COLOR_BUFFER_BIT);
} }
} }
static void destroy() { static void destroy() {
if(cloudNoiseTexture != -1) { if (cloudNoiseTexture != -1) {
GlStateManager.deleteTexture(cloudNoiseTexture); GlStateManager.deleteTexture(cloudNoiseTexture);
cloudNoiseTexture = -1; cloudNoiseTexture = -1;
} }
for(int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
if(cloudNoiseSampleParaboloidFramebuffer[i] != null) { if (cloudNoiseSampleParaboloidFramebuffer[i] != null) {
_wglDeleteFramebuffer(cloudNoiseSampleParaboloidFramebuffer[i]); _wglDeleteFramebuffer(cloudNoiseSampleParaboloidFramebuffer[i]);
cloudNoiseSampleParaboloidFramebuffer[i] = null; cloudNoiseSampleParaboloidFramebuffer[i] = null;
} }
if(cloudNoiseSampleParaboloidTexture[i] != -1) { if (cloudNoiseSampleParaboloidTexture[i] != -1) {
GlStateManager.deleteTexture(cloudNoiseSampleParaboloidTexture[i]); GlStateManager.deleteTexture(cloudNoiseSampleParaboloidTexture[i]);
cloudNoiseSampleParaboloidTexture[i] = -1; cloudNoiseSampleParaboloidTexture[i] = -1;
} }
} }
if(cloud3DSamplesTexture != -1) { if (cloud3DSamplesTexture != -1) {
GlStateManager.deleteTexture(cloud3DSamplesTexture); GlStateManager.deleteTexture(cloud3DSamplesTexture);
cloud3DSamplesTexture = -1; cloud3DSamplesTexture = -1;
} }
if(cloud3DSamplesSlices != null) { if (cloud3DSamplesSlices != null) {
for(int i = 0; i < cloud3DSamplesSlices.length; ++i) { for (int i = 0; i < cloud3DSamplesSlices.length; ++i) {
_wglDeleteFramebuffer(cloud3DSamplesSlices[i]); _wglDeleteFramebuffer(cloud3DSamplesSlices[i]);
} }
cloud3DSamplesSlices = null; cloud3DSamplesSlices = null;
} }
if(cloudSpecialShapeTexture != -1) { if (cloudSpecialShapeTexture != -1) {
GlStateManager.deleteTexture(cloudSpecialShapeTexture); GlStateManager.deleteTexture(cloudSpecialShapeTexture);
cloudSpecialShapeTexture = -1; cloudSpecialShapeTexture = -1;
} }
if(cloudOcclusionFramebuffer != null) { if (cloudOcclusionFramebuffer != null) {
_wglDeleteFramebuffer(cloudOcclusionFramebuffer); _wglDeleteFramebuffer(cloudOcclusionFramebuffer);
cloudOcclusionFramebuffer = null; cloudOcclusionFramebuffer = null;
} }
if(cloudOcclusionTexture != -1) { if (cloudOcclusionTexture != -1) {
GlStateManager.deleteTexture(cloudOcclusionTexture); GlStateManager.deleteTexture(cloudOcclusionTexture);
cloudOcclusionTexture = -1; cloudOcclusionTexture = -1;
} }
if(shader_clouds_noise3d != null) { if (shader_clouds_noise3d != null) {
shader_clouds_noise3d.destroy(); shader_clouds_noise3d.destroy();
shader_clouds_noise3d = null; shader_clouds_noise3d = null;
} }
if(shader_clouds_shapes != null) { if (shader_clouds_shapes != null) {
shader_clouds_shapes.destroy(); shader_clouds_shapes.destroy();
shader_clouds_shapes = null; shader_clouds_shapes = null;
} }
if(shader_clouds_sample != null) { if (shader_clouds_sample != null) {
shader_clouds_sample.destroy(); shader_clouds_sample.destroy();
shader_clouds_sample = null; shader_clouds_sample = null;
} }
if(shader_clouds_sun_occlusion != null) { if (shader_clouds_sun_occlusion != null) {
shader_clouds_sun_occlusion.destroy(); shader_clouds_sun_occlusion.destroy();
shader_clouds_sun_occlusion = null; shader_clouds_sun_occlusion = null;
} }
@ -540,38 +566,42 @@ public class CloudRenderWorker {
private static void updateShape() { private static void updateShape() {
long millis = System.currentTimeMillis(); long millis = System.currentTimeMillis();
float dt = (float)((millis - shapeUpdateTimer) * 0.001); float dt = (float) ((millis - shapeUpdateTimer) * 0.001);
shapeUpdateTimer = millis; shapeUpdateTimer = millis;
if(millis > nextShapeAppearance) { if (millis > nextShapeAppearance) {
float playerCoordsNoiseMapScale = 0.02f * 128.0f; float playerCoordsNoiseMapScale = 0.02f * 128.0f;
if(!isDrawingCloudShapes) { if (!isDrawingCloudShapes) {
float shapeScaleBase = rand.nextFloat() * 3.0f + 2.0f; float shapeScaleBase = rand.nextFloat() * 3.0f + 2.0f;
shapeSizeX = (int)(32 * shapeScaleBase * (0.9f + rand.nextFloat() * 0.2f)); shapeSizeX = (int) (32 * shapeScaleBase * (0.9f + rand.nextFloat() * 0.2f));
shapeSizeY = (int)(16 * shapeScaleBase * (0.95f + rand.nextFloat() * 0.1f)); shapeSizeY = (int) (16 * shapeScaleBase * (0.95f + rand.nextFloat() * 0.1f));
shapeSizeZ = (int)(24 * shapeScaleBase * (0.48f + rand.nextFloat() * 0.04f)); shapeSizeZ = (int) (24 * shapeScaleBase * (0.48f + rand.nextFloat() * 0.04f));
do { do {
shapePosX = (int)(cloud3DSamplesTextureSizeX * (rand.nextFloat() * 1.5f - 0.75f)); shapePosX = (int) (cloud3DSamplesTextureSizeX * (rand.nextFloat() * 1.5f - 0.75f));
shapePosY = (int)(cloud3DSamplesTextureSizeY * (rand.nextFloat() * 1.5f - 0.75f)); shapePosY = (int) (cloud3DSamplesTextureSizeY * (rand.nextFloat() * 1.5f - 0.75f));
}while(shapePosX > -192 && shapePosY > -192 && shapePosX < 192 && shapePosY < 192); } while (shapePosX > -192 && shapePosY > -192 && shapePosX < 192 && shapePosY < 192);
float l = -MathHelper.sqrt_float(shapePosX * shapePosX + shapePosY * shapePosY); float l = -MathHelper.sqrt_float(shapePosX * shapePosX + shapePosY * shapePosY);
shapeRotate = (float)Math.atan2(shapePosY / l, shapePosX / l) / 0.0174532f; shapeRotate = (float) Math.atan2(shapePosY / l, shapePosX / l) / 0.0174532f;
shapeRotate += (rand.nextFloat() - 0.5f) * 90.0f; shapeRotate += (rand.nextFloat() - 0.5f) * 90.0f;
shapePosX += renderViewX * playerCoordsNoiseMapScale + cloud3DSamplesTextureSizeX * 0.5f; shapePosX += renderViewX * playerCoordsNoiseMapScale + cloud3DSamplesTextureSizeX * 0.5f;
shapePosY += renderViewZ * playerCoordsNoiseMapScale + cloud3DSamplesTextureSizeY * 0.5f; shapePosY += renderViewZ * playerCoordsNoiseMapScale + cloud3DSamplesTextureSizeY * 0.5f;
shapePosZ = (int)((cloud3DSamplesTextureSizeZ - shapeSizeZ) * (rand.nextFloat() * 0.5f + 0.25f)); shapePosZ = (int) ((cloud3DSamplesTextureSizeZ - shapeSizeZ) * (rand.nextFloat() * 0.5f + 0.25f));
isDrawingCloudShapes = true; isDrawingCloudShapes = true;
}else { } else {
float dx = MathHelper.cos(-shapeRotate * 0.0174532f); float dx = MathHelper.cos(-shapeRotate * 0.0174532f);
float dy = MathHelper.sin(-shapeRotate * 0.0174532f); float dy = MathHelper.sin(-shapeRotate * 0.0174532f);
shapePosX += (int)(dx * 10.0f * dt); shapePosX += (int) (dx * 10.0f * dt);
shapePosY -= (int)(dy * 10.0f * dt); shapePosY -= (int) (dy * 10.0f * dt);
if(MathHelper.abs(shapePosX - renderViewX * playerCoordsNoiseMapScale - cloud3DSamplesTextureSizeX * 0.5f) > 300.0f || if (MathHelper
MathHelper.abs(shapePosY - renderViewZ * playerCoordsNoiseMapScale - cloud3DSamplesTextureSizeY * 0.5f) > 300.0f) { .abs(shapePosX - renderViewX * playerCoordsNoiseMapScale
- cloud3DSamplesTextureSizeX * 0.5f) > 300.0f
||
MathHelper.abs(shapePosY - renderViewZ * playerCoordsNoiseMapScale
- cloud3DSamplesTextureSizeY * 0.5f) > 300.0f) {
nextShapeAppearance = millis + 300000l + rand.nextInt(1500000); nextShapeAppearance = millis + 300000l + rand.nextInt(1500000);
isDrawingCloudShapes = false; isDrawingCloudShapes = false;
} }
} }
}else { } else {
isDrawingCloudShapes = false; isDrawingCloudShapes = false;
} }
} }
@ -582,25 +612,25 @@ public class CloudRenderWorker {
tmp.y = -1.0f; tmp.y = -1.0f;
tmp.z = 1.0f; tmp.z = 1.0f;
Matrix3f.transform(mat, tmp, tmp); Matrix3f.transform(mat, tmp, tmp);
if(tmp.x >= -1.0f && tmp.x <= 1.0f && tmp.y >= -1.0f && tmp.y <= 1.0f) { if (tmp.x >= -1.0f && tmp.x <= 1.0f && tmp.y >= -1.0f && tmp.y <= 1.0f) {
return true; return true;
} }
tmp.x = 1.0f; tmp.x = 1.0f;
tmp.y = -1.0f; tmp.y = -1.0f;
Matrix3f.transform(mat, tmp, tmp); Matrix3f.transform(mat, tmp, tmp);
if(tmp.x >= -1.0f && tmp.x <= 1.0f && tmp.y >= -1.0f && tmp.y <= 1.0f) { if (tmp.x >= -1.0f && tmp.x <= 1.0f && tmp.y >= -1.0f && tmp.y <= 1.0f) {
return true; return true;
} }
tmp.x = 1.0f; tmp.x = 1.0f;
tmp.y = 1.0f; tmp.y = 1.0f;
Matrix3f.transform(mat, tmp, tmp); Matrix3f.transform(mat, tmp, tmp);
if(tmp.x >= -1.0f && tmp.x <= 1.0f && tmp.y >= -1.0f && tmp.y <= 1.0f) { if (tmp.x >= -1.0f && tmp.x <= 1.0f && tmp.y >= -1.0f && tmp.y <= 1.0f) {
return true; return true;
} }
tmp.x = -1.0f; tmp.x = -1.0f;
tmp.y = 1.0f; tmp.y = 1.0f;
Matrix3f.transform(mat, tmp, tmp); Matrix3f.transform(mat, tmp, tmp);
if(tmp.x >= -1.0f && tmp.x <= 1.0f && tmp.y >= -1.0f && tmp.y <= 1.0f) { if (tmp.x >= -1.0f && tmp.x <= 1.0f && tmp.y >= -1.0f && tmp.y <= 1.0f) {
return true; return true;
} }
return false; return false;

View File

@ -5,8 +5,8 @@ import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
import net.lax1dude.eaglercraft.v1_8.vector.Vector3f; import net.lax1dude.eaglercraft.v1_8.vector.Vector3f;
import net.lax1dude.eaglercraft.v1_8.vector.Vector4f; import net.lax1dude.eaglercraft.v1_8.vector.Vector4f;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*; import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;

View File

@ -56,9 +56,9 @@ import net.minecraft.client.renderer.texture.TextureManager;
import net.minecraft.client.renderer.texture.TextureMap; import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper;
import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*; import static net.lax1dude.eaglercraft.v1_8.opengl.RealOpenGLEnums.*;
import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*; import static net.lax1dude.eaglercraft.v1_8.internal.PlatformOpenGL.*;

View File

@ -15,7 +15,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.PipelineShaderA
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f; import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
/** /**
* Copyright (c) 2023 lax1dude. All Rights Reserved. * Copyright (c) 2023 lax1dude. All Rights Reserved.

View File

@ -15,7 +15,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.PipelineShaderA
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f; import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
/** /**
* Copyright (c) 2023 lax1dude. All Rights Reserved. * Copyright (c) 2023 lax1dude. All Rights Reserved.

View File

@ -19,26 +19,33 @@ import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.program.PipelineShaderL
import net.lax1dude.eaglercraft.v1_8.vector.Matrix3f; import net.lax1dude.eaglercraft.v1_8.vector.Matrix3f;
import net.lax1dude.eaglercraft.v1_8.vector.Vector3f; import net.lax1dude.eaglercraft.v1_8.vector.Vector3f;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
/** /**
* Copyright (c) 2023 lax1dude. All Rights Reserved. * Copyright (c) 2023 lax1dude. All Rights Reserved.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * DISCLAIMED.
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * DIRECT,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
*/ */
public class LensFlareMeshRenderer { public class LensFlareMeshRenderer {
public static final String streaksTextureLocation ="assets/eagler/glsl/deferred/lens_streaks.bmp"; public static final String streaksTextureLocation = "assets/eagler/glsl/deferred/lens_streaks.bmp";
public static final String ghostsTextureLocation = "assets/eagler/glsl/deferred/lens_ghosts.bmp"; public static final String ghostsTextureLocation = "assets/eagler/glsl/deferred/lens_ghosts.bmp";
public static final int ghostsSpriteCount = 4; public static final int ghostsSpriteCount = 4;
@ -63,16 +70,16 @@ public class LensFlareMeshRenderer {
static void initialize() { static void initialize() {
destroy(); destroy();
streaksProgram = PipelineShaderLensFlares.compileStreaks(); streaksProgram = PipelineShaderLensFlares.compileStreaks();
streaksProgram.loadUniforms(); streaksProgram.loadUniforms();
ghostsProgram = PipelineShaderLensFlares.compileGhosts(); ghostsProgram = PipelineShaderLensFlares.compileGhosts();
ghostsProgram.loadUniforms(); ghostsProgram.loadUniforms();
ByteBuffer copyBuffer = EagRuntime.allocateByteBuffer(16384); ByteBuffer copyBuffer = EagRuntime.allocateByteBuffer(16384);
for(int i = 0; i < 4; ++i) { for (int i = 0; i < 4; ++i) {
pushStreakQuad(copyBuffer, 0.0f, 0.0f, 1.0f, 10.0f, 0.0f, 0.0f, 1.0f, 1.0f, (i * 3.14159f / 4.0f)); pushStreakQuad(copyBuffer, 0.0f, 0.0f, 1.0f, 10.0f, 0.0f, 0.0f, 1.0f, 1.0f, (i * 3.14159f / 4.0f));
pushStreakQuad(copyBuffer, 0.0f, 0.0f, 1.5f, 5.0f, 0.0f, 0.0f, 1.0f, 1.0f, ((i + 0.25f) * 3.14159f / 4.0f)); pushStreakQuad(copyBuffer, 0.0f, 0.0f, 1.5f, 5.0f, 0.0f, 0.0f, 1.0f, 1.0f, ((i + 0.25f) * 3.14159f / 4.0f));
pushStreakQuad(copyBuffer, 0.0f, 0.0f, 0.5f, 7.0f, 0.0f, 0.0f, 1.0f, 1.0f, ((i + 0.5f) * 3.14159f / 4.0f)); pushStreakQuad(copyBuffer, 0.0f, 0.0f, 0.5f, 7.0f, 0.0f, 0.0f, 1.0f, 1.0f, ((i + 0.5f) * 3.14159f / 4.0f));
@ -158,12 +165,12 @@ public class LensFlareMeshRenderer {
streaksTexture = GlStateManager.generateTexture(); streaksTexture = GlStateManager.generateTexture();
GlStateManager.bindTexture(streaksTexture); GlStateManager.bindTexture(streaksTexture);
byte[] flareTex = EagRuntime.getResourceBytes(streaksTextureLocation); byte[] flareTex = EagRuntime.getResourceBytes(streaksTextureLocation);
if(flareTex == null) { if (flareTex == null) {
throw new RuntimeException("Could not locate: " + streaksTextureLocation); throw new RuntimeException("Could not locate: " + streaksTextureLocation);
} }
try(DataInputStream dis = new DataInputStream(new EaglerInputStream(flareTex))) { try (DataInputStream dis = new DataInputStream(new EaglerInputStream(flareTex))) {
loadFlareTexture(copyBuffer, dis); loadFlareTexture(copyBuffer, dis);
}catch(IOException ex) { } catch (IOException ex) {
EagRuntime.freeByteBuffer(copyBuffer); EagRuntime.freeByteBuffer(copyBuffer);
throw new RuntimeException("Could not load: " + streaksTextureLocation, ex); throw new RuntimeException("Could not load: " + streaksTextureLocation, ex);
} }
@ -171,12 +178,12 @@ public class LensFlareMeshRenderer {
ghostsTexture = GlStateManager.generateTexture(); ghostsTexture = GlStateManager.generateTexture();
GlStateManager.bindTexture(ghostsTexture); GlStateManager.bindTexture(ghostsTexture);
flareTex = EagRuntime.getResourceBytes(ghostsTextureLocation); flareTex = EagRuntime.getResourceBytes(ghostsTextureLocation);
if(flareTex == null) { if (flareTex == null) {
throw new RuntimeException("Could not locate: " + ghostsTextureLocation); throw new RuntimeException("Could not locate: " + ghostsTextureLocation);
} }
try(DataInputStream dis = new DataInputStream(new EaglerInputStream(flareTex))) { try (DataInputStream dis = new DataInputStream(new EaglerInputStream(flareTex))) {
loadFlareTexture(copyBuffer, dis); loadFlareTexture(copyBuffer, dis);
}catch(IOException ex) { } catch (IOException ex) {
EagRuntime.freeByteBuffer(copyBuffer); EagRuntime.freeByteBuffer(copyBuffer);
throw new RuntimeException("Could not load: " + ghostsTextureLocation, ex); throw new RuntimeException("Could not load: " + ghostsTextureLocation, ex);
} }
@ -191,12 +198,12 @@ public class LensFlareMeshRenderer {
_wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); _wglTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
_wglPixelStorei(GL_UNPACK_ALIGNMENT, 1); _wglPixelStorei(GL_UNPACK_ALIGNMENT, 1);
int mip = 0; int mip = 0;
while(dis.read() == 'E') { while (dis.read() == 'E') {
int w = dis.readShort(); int w = dis.readShort();
int h = dis.readShort(); int h = dis.readShort();
copyBuffer.clear(); copyBuffer.clear();
for(int i = 0, l = w * h; i < l; ++i) { for (int i = 0, l = w * h; i < l; ++i) {
copyBuffer.put((byte)dis.read()); copyBuffer.put((byte) dis.read());
} }
copyBuffer.flip(); copyBuffer.flip();
_wglTexImage2D(GL_TEXTURE_2D, mip++, _GL_R8, w, h, 0, GL_RED, GL_UNSIGNED_BYTE, copyBuffer); _wglTexImage2D(GL_TEXTURE_2D, mip++, _GL_R8, w, h, 0, GL_RED, GL_UNSIGNED_BYTE, copyBuffer);
@ -213,58 +220,60 @@ public class LensFlareMeshRenderer {
tmpMat.m11 = tmpMat.m00; tmpMat.m11 = tmpMat.m00;
tmpMat.m20 = x; tmpMat.m20 = x;
tmpMat.m21 = y; tmpMat.m21 = y;
tmpVec.x = -w; tmpVec.x = -w;
tmpVec.y = -h; tmpVec.y = -h;
tmpVec.z = 1.0f; tmpVec.z = 1.0f;
Matrix3f.transform(tmpMat, tmpVec, tmpVec); Matrix3f.transform(tmpMat, tmpVec, tmpVec);
copyBuffer.putFloat(tmpVec.x); copyBuffer.putFloat(tmpVec.x);
copyBuffer.putFloat(tmpVec.y); copyBuffer.putFloat(tmpVec.y);
copyBuffer.putFloat(tx); copyBuffer.putFloat(tx);
copyBuffer.putFloat(ty); copyBuffer.putFloat(ty);
tmpVec.x = w; tmpVec.x = w;
tmpVec.y = -h; tmpVec.y = -h;
tmpVec.z = 1.0f; tmpVec.z = 1.0f;
Matrix3f.transform(tmpMat, tmpVec, tmpVec); Matrix3f.transform(tmpMat, tmpVec, tmpVec);
copyBuffer.putFloat(tmpVec.x); copyBuffer.putFloat(tmpVec.x);
copyBuffer.putFloat(tmpVec.y); copyBuffer.putFloat(tmpVec.y);
copyBuffer.putFloat(tx + tw); copyBuffer.putFloat(tx + tw);
copyBuffer.putFloat(ty); copyBuffer.putFloat(ty);
tmpVec.x = w; tmpVec.x = w;
tmpVec.y = h; tmpVec.y = h;
tmpVec.z = 1.0f; tmpVec.z = 1.0f;
Matrix3f.transform(tmpMat, tmpVec, tmpVec); Matrix3f.transform(tmpMat, tmpVec, tmpVec);
copyBuffer.putFloat(tmpVec.x); copyBuffer.putFloat(tmpVec.x);
copyBuffer.putFloat(tmpVec.y); copyBuffer.putFloat(tmpVec.y);
copyBuffer.putFloat(tx + tw); copyBuffer.putFloat(tx + tw);
copyBuffer.putFloat(ty + th); copyBuffer.putFloat(ty + th);
tmpVec.x = -w; tmpVec.x = -w;
tmpVec.y = h; tmpVec.y = h;
tmpVec.z = 1.0f; tmpVec.z = 1.0f;
Matrix3f.transform(tmpMat, tmpVec, tmpVec); Matrix3f.transform(tmpMat, tmpVec, tmpVec);
copyBuffer.putFloat(tmpVec.x); copyBuffer.putFloat(tmpVec.x);
copyBuffer.putFloat(tmpVec.y); copyBuffer.putFloat(tmpVec.y);
copyBuffer.putFloat(tx); copyBuffer.putFloat(tx);
copyBuffer.putFloat(ty + th); copyBuffer.putFloat(ty + th);
} }
static void pushGhostQuadAbberated(ByteBuffer copyBuffer, float offset, float scale, int sprite, float r, float g, float b, float a) { static void pushGhostQuadAbberated(ByteBuffer copyBuffer, float offset, float scale, int sprite, float r, float g,
float b, float a) {
pushGhostQuad(copyBuffer, offset, scale, sprite, 0.0f, g, b, a); pushGhostQuad(copyBuffer, offset, scale, sprite, 0.0f, g, b, a);
pushGhostQuad(copyBuffer, offset + 0.005f, scale, sprite, r, 0.0f, 0.0f, a); pushGhostQuad(copyBuffer, offset + 0.005f, scale, sprite, r, 0.0f, 0.0f, a);
} }
static void pushGhostQuad(ByteBuffer copyBuffer, float offset, float scale, int sprite, float r, float g, float b, float a) { static void pushGhostQuad(ByteBuffer copyBuffer, float offset, float scale, int sprite, float r, float g, float b,
float a) {
copyBuffer.putFloat(offset); copyBuffer.putFloat(offset);
copyBuffer.putFloat(scale); copyBuffer.putFloat(scale);
copyBuffer.putFloat(0.0f); copyBuffer.putFloat(0.0f);
copyBuffer.putFloat((float)sprite / ghostsSpriteCount); copyBuffer.putFloat((float) sprite / ghostsSpriteCount);
copyBuffer.putFloat(1.0f); copyBuffer.putFloat(1.0f);
copyBuffer.putFloat(1.0f / ghostsSpriteCount); copyBuffer.putFloat(1.0f / ghostsSpriteCount);
copyBuffer.putFloat(r * a); copyBuffer.putFloat(r * a);
@ -287,7 +296,7 @@ public class LensFlareMeshRenderer {
streaksProgram.useProgram(); streaksProgram.useProgram();
Minecraft mc = Minecraft.getMinecraft(); Minecraft mc = Minecraft.getMinecraft();
float aspectRatio = (float)mc.displayHeight / (float)mc.displayWidth; float aspectRatio = (float) mc.displayHeight / (float) mc.displayWidth;
float fov = 90.0f / mc.entityRenderer.getFOVModifier(EaglerDeferredPipeline.instance.getPartialTicks(), true); float fov = 90.0f / mc.entityRenderer.getFOVModifier(EaglerDeferredPipeline.instance.getPartialTicks(), true);
float size = 0.075f * fov * (1.0f + MathHelper.sqrt_float(sunScreenX * sunScreenX + sunScreenY * sunScreenY)); float size = 0.075f * fov * (1.0f + MathHelper.sqrt_float(sunScreenX * sunScreenX + sunScreenY * sunScreenY));
@ -298,7 +307,8 @@ public class LensFlareMeshRenderer {
tmpMat.m20 = sunScreenX; tmpMat.m20 = sunScreenX;
tmpMat.m21 = sunScreenY; tmpMat.m21 = sunScreenY;
float rotation = sunScreenX * sunScreenX * Math.signum(sunScreenX) + sunScreenY * sunScreenY * Math.signum(sunScreenY); float rotation = sunScreenX * sunScreenX * Math.signum(sunScreenX)
+ sunScreenY * sunScreenY * Math.signum(sunScreenY);
tmpMat2.setIdentity(); tmpMat2.setIdentity();
tmpMat2.m00 = MathHelper.cos(rotation); tmpMat2.m00 = MathHelper.cos(rotation);
@ -311,9 +321,9 @@ public class LensFlareMeshRenderer {
Vector3f v = DeferredStateManager.currentSunLightColor; Vector3f v = DeferredStateManager.currentSunLightColor;
float mag = 1.0f + DeferredStateManager.currentSunAngle.y * 0.8f; float mag = 1.0f + DeferredStateManager.currentSunAngle.y * 0.8f;
if(mag > 1.0f) { if (mag > 1.0f) {
mag = 1.0f - (mag - 1.0f) * 20.0f; mag = 1.0f - (mag - 1.0f) * 20.0f;
if(mag < 0.0f) { if (mag < 0.0f) {
mag = 0.0f; mag = 0.0f;
} }
} }
@ -340,35 +350,35 @@ public class LensFlareMeshRenderer {
} }
static void destroy() { static void destroy() {
if(streaksVertexArray != null) { if (streaksVertexArray != null) {
_wglDeleteVertexArrays(streaksVertexArray); _wglDeleteVertexArrays(streaksVertexArray);
streaksVertexArray = null; streaksVertexArray = null;
} }
if(streaksVertexBuffer != null) { if (streaksVertexBuffer != null) {
_wglDeleteBuffers(streaksVertexBuffer); _wglDeleteBuffers(streaksVertexBuffer);
streaksVertexBuffer = null; streaksVertexBuffer = null;
} }
if(ghostsVertexArray != null) { if (ghostsVertexArray != null) {
_wglDeleteVertexArrays(ghostsVertexArray); _wglDeleteVertexArrays(ghostsVertexArray);
ghostsVertexArray = null; ghostsVertexArray = null;
} }
if(ghostsVertexBuffer != null) { if (ghostsVertexBuffer != null) {
_wglDeleteBuffers(ghostsVertexBuffer); _wglDeleteBuffers(ghostsVertexBuffer);
ghostsVertexBuffer = null; ghostsVertexBuffer = null;
} }
if(streaksTexture != -1) { if (streaksTexture != -1) {
GlStateManager.deleteTexture(streaksTexture); GlStateManager.deleteTexture(streaksTexture);
streaksTexture = -1; streaksTexture = -1;
} }
if(ghostsTexture != -1) { if (ghostsTexture != -1) {
GlStateManager.deleteTexture(ghostsTexture); GlStateManager.deleteTexture(ghostsTexture);
ghostsTexture = -1; ghostsTexture = -1;
} }
if(streaksProgram != null) { if (streaksProgram != null) {
streaksProgram.destroy(); streaksProgram.destroy();
streaksProgram = null; streaksProgram = null;
} }
if(ghostsProgram != null) { if (ghostsProgram != null) {
ghostsProgram.destroy(); ghostsProgram.destroy();
ghostsProgram = null; ghostsProgram = null;
} }

View File

@ -2,19 +2,26 @@ package net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.texture;
import net.lax1dude.eaglercraft.v1_8.internal.IFramebufferGL; import net.lax1dude.eaglercraft.v1_8.internal.IFramebufferGL;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
/** /**
* Copyright (c) 2023 lax1dude. All Rights Reserved. * Copyright (c) 2023 lax1dude. All Rights Reserved.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * DISCLAIMED.
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * DIRECT,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
@ -27,7 +34,8 @@ public class TextureClockPBRImpl extends EaglerTextureAtlasSpritePBR {
super(spriteName); super(spriteName);
} }
public void updateAnimationPBR(IFramebufferGL[] copyColorFramebuffer, IFramebufferGL[] copyMaterialFramebuffer, int materialTexOffset) { public void updateAnimationPBR(IFramebufferGL[] copyColorFramebuffer, IFramebufferGL[] copyMaterialFramebuffer,
int materialTexOffset) {
if (!this.frameTextureDataPBR[0].isEmpty()) { if (!this.frameTextureDataPBR[0].isEmpty()) {
Minecraft minecraft = Minecraft.getMinecraft(); Minecraft minecraft = Minecraft.getMinecraft();
double d0 = 0.0; double d0 = 0.0;
@ -53,7 +61,8 @@ public class TextureClockPBRImpl extends EaglerTextureAtlasSpritePBR {
this.smoothParam1 += this.smoothParam2; this.smoothParam1 += this.smoothParam2;
int i, frameCount = this.frameTextureDataPBR[0].size(); int i, frameCount = this.frameTextureDataPBR[0].size();
for (i = (int) ((this.smoothParam1 + 1.0) * frameCount) % frameCount; i < 0; i = (i + frameCount) % frameCount) { for (i = (int) ((this.smoothParam1 + 1.0) * frameCount) % frameCount; i < 0; i = (i + frameCount)
% frameCount) {
; ;
} }

View File

@ -2,21 +2,28 @@ package net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.texture;
import net.lax1dude.eaglercraft.v1_8.internal.IFramebufferGL; import net.lax1dude.eaglercraft.v1_8.internal.IFramebufferGL;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**
* Copyright (c) 2023 lax1dude. All Rights Reserved. * Copyright (c) 2023 lax1dude. All Rights Reserved.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * DISCLAIMED.
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * DIRECT,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
@ -29,13 +36,16 @@ public class TextureCompassPBRImpl extends EaglerTextureAtlasSpritePBR {
super(spriteName); super(spriteName);
} }
public void updateAnimationPBR(IFramebufferGL[] copyColorFramebuffer, IFramebufferGL[] copyMaterialFramebuffer, int materialOffset) { public void updateAnimationPBR(IFramebufferGL[] copyColorFramebuffer, IFramebufferGL[] copyMaterialFramebuffer,
int materialOffset) {
Minecraft minecraft = Minecraft.getMinecraft(); Minecraft minecraft = Minecraft.getMinecraft();
if (minecraft.theWorld != null && minecraft.thePlayer != null) { if (minecraft.theWorld != null && minecraft.thePlayer != null) {
this.updateCompassPBR(minecraft.theWorld, minecraft.thePlayer.posX, minecraft.thePlayer.posZ, this.updateCompassPBR(minecraft.theWorld, minecraft.thePlayer.posX, minecraft.thePlayer.posZ,
(double) minecraft.thePlayer.rotationYaw, false, copyColorFramebuffer, copyMaterialFramebuffer, materialOffset); (double) minecraft.thePlayer.rotationYaw, false, copyColorFramebuffer, copyMaterialFramebuffer,
materialOffset);
} else { } else {
this.updateCompassPBR((World) null, 0.0, 0.0, 0.0, true, copyColorFramebuffer, copyMaterialFramebuffer, materialOffset); this.updateCompassPBR((World) null, 0.0, 0.0, 0.0, true, copyColorFramebuffer, copyMaterialFramebuffer,
materialOffset);
} }
} }

View File

@ -14,7 +14,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.EaglercraftGPU;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ArrayListSerial; import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ArrayListSerial;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.EaglerDeferredPipeline; import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.EaglerDeferredPipeline;
import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ListSerial; import net.lax1dude.eaglercraft.v1_8.opengl.ext.deferred.ListSerial;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
/** /**
* Copyright (c) 2023-2024 lax1dude. All Rights Reserved. * Copyright (c) 2023-2024 lax1dude. All Rights Reserved.

View File

@ -18,7 +18,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.ext.dynamiclights.program.DynamicLig
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.GLAllocation; import net.minecraft.client.renderer.GLAllocation;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
/** /**
* Copyright (c) 2024 lax1dude. All Rights Reserved. * Copyright (c) 2024 lax1dude. All Rights Reserved.

View File

@ -10,7 +10,7 @@ import net.lax1dude.eaglercraft.v1_8.opengl.GlStateManager;
import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f; import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
import net.minecraft.client.particle.EffectRenderer; import net.minecraft.client.particle.EffectRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher; import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
/** /**
* Copyright (c) 2024 lax1dude. All Rights Reserved. * Copyright (c) 2024 lax1dude. All Rights Reserved.

View File

@ -22,7 +22,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock; import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
/** /**
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved. * Copyright (c) 2022-2024 lax1dude. All Rights Reserved.

View File

@ -23,9 +23,9 @@ import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiDisconnected; import net.minecraft.client.gui.GuiDisconnected;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.multiplayer.GuiConnecting; import net.minecraft.client.multiplayer.GuiConnecting;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.IChatComponent; import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.ITextComponent;
/** /**
* Copyright (c) 2022-2023 lax1dude, hoosiertransfer, ayunami2000. All Rights * Copyright (c) 2022-2023 lax1dude, hoosiertransfer, ayunami2000. All Rights
@ -135,7 +135,7 @@ public class ConnectionHandshake {
di.read(dat); di.read(dat);
String msg = new String(dat, StandardCharsets.UTF_8); String msg = new String(dat, StandardCharsets.UTF_8);
mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed", new ChatComponentText(msg))); mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed", new TextComponentString(msg)));
return false; return false;
} else if (type == HandshakePacketTypes.PROTOCOL_SERVER_VERSION) { } else if (type == HandshakePacketTypes.PROTOCOL_SERVER_VERSION) {
@ -144,7 +144,7 @@ public class ConnectionHandshake {
if (serverVers != protocolV2 && serverVers != protocolV3) { if (serverVers != protocolV2 && serverVers != protocolV3) {
logger.info("Incompatible server version: {}", serverVers); logger.info("Incompatible server version: {}", serverVers);
mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed", mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed",
new ChatComponentText(serverVers < protocolV2 ? "Outdated Server" : "Outdated Client"))); new TextComponentString(serverVers < protocolV2 ? "Outdated Server" : "Outdated Client")));
return false; return false;
} }
@ -152,7 +152,7 @@ public class ConnectionHandshake {
if (gameVers != 47) { if (gameVers != 47) {
logger.info("Incompatible minecraft protocol version: {}", gameVers); logger.info("Incompatible minecraft protocol version: {}", gameVers);
mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed", mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed",
new ChatComponentText("This server does not support 1.8!"))); new TextComponentString("This server does not support 1.8!")));
return false; return false;
} }
@ -197,7 +197,7 @@ public class ConnectionHandshake {
logger.error( logger.error(
"Plaintext authentication was attempted but no user confirmation has been given to proceed"); "Plaintext authentication was attempted but no user confirmation has been given to proceed");
mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed", mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed",
new ChatComponentText(EnumChatFormatting.RED new TextComponentString(EnumChatFormatting.RED
+ "Plaintext authentication was attempted but no user confirmation has been given to proceed"))); + "Plaintext authentication was attempted but no user confirmation has been given to proceed")));
return false; return false;
} }
@ -269,7 +269,7 @@ public class ConnectionHandshake {
} else { } else {
logger.error("Unsupported authentication type: {}", authType); logger.error("Unsupported authentication type: {}", authType);
mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed", mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed",
new ChatComponentText( new TextComponentString(
EnumChatFormatting.RED + "Unsupported authentication type: " + authType + "\n\n" EnumChatFormatting.RED + "Unsupported authentication type: " + authType + "\n\n"
+ EnumChatFormatting.GRAY + "(Use a newer version of the client)"))); + EnumChatFormatting.GRAY + "(Use a newer version of the client)")));
return false; return false;
@ -370,7 +370,7 @@ public class ConnectionHandshake {
di.read(dat); di.read(dat);
String errStr = new String(dat, StandardCharsets.UTF_8); String errStr = new String(dat, StandardCharsets.UTF_8);
mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed", mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed",
IChatComponent.Serializer.jsonToComponent(errStr))); ITextComponent.Serializer.jsonToComponent(errStr)));
return false; return false;
} else if (type == HandshakePacketTypes.PROTOCOL_SERVER_ERROR) { } else if (type == HandshakePacketTypes.PROTOCOL_SERVER_ERROR) {
showError(mc, connecting, ret, di, serverVers == protocolV2); showError(mc, connecting, ret, di, serverVers == protocolV2);
@ -429,18 +429,18 @@ public class ConnectionHandshake {
RateLimitTracker.registerLockOut(PlatformNetworking.getCurrentURI()); RateLimitTracker.registerLockOut(PlatformNetworking.getCurrentURI());
mc.displayGuiScreen(GuiDisconnected.createRateLimitKick(scr)); mc.displayGuiScreen(GuiDisconnected.createRateLimitKick(scr));
} else if (errorCode == HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE) { } else if (errorCode == HandshakePacketTypes.SERVER_ERROR_CUSTOM_MESSAGE) {
if (IChatComponent.Serializer.jsonToComponent(errStr).getUnformattedText().toLowerCase() if (ITextComponent.Serializer.jsonToComponent(errStr).getUnformattedText().toLowerCase()
.contains("reload page")) { .contains("reload page")) {
EaglerProfile.updateUsernameCookieFromLocalStorage(); EaglerProfile.updateUsernameCookieFromLocalStorage();
reloadPage(); reloadPage();
} }
mc.displayGuiScreen( mc.displayGuiScreen(
new GuiDisconnected(scr, "connect.failed", IChatComponent.Serializer.jsonToComponent(errStr))); new GuiDisconnected(scr, "connect.failed", ITextComponent.Serializer.jsonToComponent(errStr)));
} else if (connecting != null && errorCode == HandshakePacketTypes.SERVER_ERROR_AUTHENTICATION_REQUIRED) { } else if (connecting != null && errorCode == HandshakePacketTypes.SERVER_ERROR_AUTHENTICATION_REQUIRED) {
mc.displayGuiScreen(new GuiAuthenticationScreen(connecting, scr, errStr)); mc.displayGuiScreen(new GuiAuthenticationScreen(connecting, scr, errStr));
} else { } else {
mc.displayGuiScreen(new GuiDisconnected(scr, "connect.failed", mc.displayGuiScreen(new GuiDisconnected(scr, "connect.failed",
new ChatComponentText("Server Error Code " + errorCode + "\n" + errStr))); new TextComponentString("Server Error Code " + errorCode + "\n" + errStr)));
} }
} }

View File

@ -17,8 +17,8 @@ import net.minecraft.network.EnumPacketDirection;
import net.minecraft.network.INetHandler; import net.minecraft.network.INetHandler;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.IChatComponent; import net.minecraft.util.text.ITextComponent;
/** /**
* Copyright (c) 2022-2024 lax1dude, hoosiertransfer, ayunami2000. All Rights * Copyright (c) 2022-2024 lax1dude, hoosiertransfer, ayunami2000. All Rights
@ -85,7 +85,7 @@ public class EaglercraftNetworkManager {
@JSBody(params = {}, script = "window.onbeforeunload = null; location.reload();") @JSBody(params = {}, script = "window.onbeforeunload = null; location.reload();")
public static native void reloadPage(); public static native void reloadPage();
public void closeChannel(IChatComponent reason) { public void closeChannel(ITextComponent reason) {
PlatformNetworking.playDisconnect(); PlatformNetworking.playDisconnect();
if (nethandler != null) { if (nethandler != null) {
nethandler.onDisconnect(reason); nethandler.onDisconnect(reason);
@ -210,7 +210,7 @@ public class EaglercraftNetworkManager {
processReceivedPackets(); // catch kick message processReceivedPackets(); // catch kick message
} catch (IOException e) { } catch (IOException e) {
} }
doClientDisconnect(new ChatComponentTranslation("disconnect.endOfStream")); doClientDisconnect(new TextComponentTranslation("disconnect.endOfStream"));
return true; return true;
} else { } else {
return false; return false;
@ -219,7 +219,7 @@ public class EaglercraftNetworkManager {
protected boolean clientDisconnected = false; protected boolean clientDisconnected = false;
protected void doClientDisconnect(IChatComponent msg) { protected void doClientDisconnect(ITextComponent msg) {
if (!clientDisconnected) { if (!clientDisconnected) {
clientDisconnected = true; clientDisconnected = true;
if (nethandler != null) { if (nethandler != null) {

View File

@ -6,19 +6,26 @@ import net.lax1dude.eaglercraft.v1_8.opengl.ImageData;
import net.lax1dude.eaglercraft.v1_8.profile.SkinPackets; import net.lax1dude.eaglercraft.v1_8.profile.SkinPackets;
import net.minecraft.client.Minecraft; import net.minecraft.client.Minecraft;
import net.minecraft.network.play.client.C17PacketCustomPayload; import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.text.TextComponentTranslation;
/** /**
* Copyright (c) 2024 lax1dude. All Rights Reserved. * Copyright (c) 2024 lax1dude. All Rights Reserved.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * DISCLAIMED.
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * DIRECT,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
@ -38,31 +45,34 @@ public class SkullCommand {
} }
public void tick() { public void tick() {
if(waitingForSelection && EagRuntime.fileChooserHasResult()) { if (waitingForSelection && EagRuntime.fileChooserHasResult()) {
waitingForSelection = false; waitingForSelection = false;
FileChooserResult fr = EagRuntime.getFileChooserResult(); FileChooserResult fr = EagRuntime.getFileChooserResult();
if(fr == null || mc.thePlayer == null || mc.thePlayer.sendQueue == null) { if (fr == null || mc.thePlayer == null || mc.thePlayer.sendQueue == null) {
return; return;
} }
ImageData loaded = ImageData.loadImageFile(fr.fileData); ImageData loaded = ImageData.loadImageFile(fr.fileData);
if(loaded == null) { if (loaded == null) {
mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("command.skull.error.invalid.png")); mc.ingameGUI.getChatGUI()
.printChatMessage(new TextComponentTranslation("command.skull.error.invalid.png"));
return; return;
} }
if(loaded.width != 64 || loaded.height > 64) { if (loaded.width != 64 || loaded.height > 64) {
mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("command.skull.error.invalid.skin", loaded.width, loaded.height)); mc.ingameGUI.getChatGUI().printChatMessage(
new TextComponentTranslation("command.skull.error.invalid.skin", loaded.width, loaded.height));
return; return;
} }
byte[] rawSkin = new byte[loaded.pixels.length << 2]; byte[] rawSkin = new byte[loaded.pixels.length << 2];
for(int i = 0, j, k; i < 4096; ++i) { for (int i = 0, j, k; i < 4096; ++i) {
j = i << 2; j = i << 2;
k = loaded.pixels[i]; k = loaded.pixels[i];
rawSkin[j] = (byte)(k >> 24); rawSkin[j] = (byte) (k >> 24);
rawSkin[j + 1] = (byte)(k >> 16); rawSkin[j + 1] = (byte) (k >> 16);
rawSkin[j + 2] = (byte)(k >> 8); rawSkin[j + 2] = (byte) (k >> 8);
rawSkin[j + 3] = (byte)(k & 0xFF); rawSkin[j + 3] = (byte) (k & 0xFF);
} }
mc.thePlayer.sendQueue.addToSendQueue(new C17PacketCustomPayload("EAG|Skins-1.8", SkinPackets.writeCreateCustomSkull(rawSkin))); mc.thePlayer.sendQueue.addToSendQueue(
new C17PacketCustomPayload("EAG|Skins-1.8", SkinPackets.writeCreateCustomSkull(rawSkin)));
} }
} }

View File

@ -13,7 +13,7 @@ import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.network.EnumConnectionState; import net.minecraft.network.EnumConnectionState;
import net.minecraft.network.login.client.C00PacketLoginStart; import net.minecraft.network.login.client.C00PacketLoginStart;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.text.TextComponentString;
import java.io.IOException; import java.io.IOException;
@ -81,7 +81,7 @@ public class GuiScreenLANConnecting extends GuiScreen {
if (mc.currentScreen == this) { if (mc.currentScreen == this) {
mc.loadWorld(null); mc.loadWorld(null);
mc.displayGuiScreen(new GuiDisconnected(parent, "connect.failed", mc.displayGuiScreen(new GuiDisconnected(parent, "connect.failed",
new ChatComponentText("LAN Connection Refused"))); new TextComponentString("LAN Connection Refused")));
} }
} }
} }
@ -122,7 +122,7 @@ public class GuiScreenLANConnecting extends GuiScreen {
networkManager = LANClientNetworkManager.connectToWorld(sock, code, sock.getURI()); networkManager = LANClientNetworkManager.connectToWorld(sock, code, sock.getURI());
if (networkManager == null) { if (networkManager == null) {
this.mc.displayGuiScreen(new GuiDisconnected(parent, "connect.failed", this.mc.displayGuiScreen(new GuiDisconnected(parent, "connect.failed",
new ChatComponentText(I18n.format("noRelay.worldFail").replace("$code$", code)))); new TextComponentString(I18n.format("noRelay.worldFail").replace("$code$", code))));
return; return;
} }

View File

@ -13,19 +13,26 @@ import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.network.EnumConnectionState; import net.minecraft.network.EnumConnectionState;
import net.minecraft.network.login.client.C00PacketLoginStart; import net.minecraft.network.login.client.C00PacketLoginStart;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.text.TextComponentString;
/** /**
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved. * Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * DISCLAIMED.
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * DIRECT,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
@ -37,43 +44,47 @@ public class GuiScreenSingleplayerConnecting extends GuiScreen {
private GuiButton killTask; private GuiButton killTask;
private ClientIntegratedServerNetworkManager networkManager = null; private ClientIntegratedServerNetworkManager networkManager = null;
private int timer = 0; private int timer = 0;
private long startStartTime; private long startStartTime;
private boolean hasOpened = false; private boolean hasOpened = false;
public GuiScreenSingleplayerConnecting(GuiScreen menu, String message) { public GuiScreenSingleplayerConnecting(GuiScreen menu, String message) {
this.menu = menu; this.menu = menu;
this.message = message; this.message = message;
} }
public void initGui() { public void initGui() {
if(startStartTime == 0) this.startStartTime = System.currentTimeMillis(); if (startStartTime == 0)
this.buttonList.add(killTask = new GuiButton(0, this.width / 2 - 100, this.height / 3 + 50, I18n.format("singleplayer.busy.killTask"))); this.startStartTime = System.currentTimeMillis();
this.buttonList.add(killTask = new GuiButton(0, this.width / 2 - 100, this.height / 3 + 50,
I18n.format("singleplayer.busy.killTask")));
killTask.enabled = false; killTask.enabled = false;
} }
public void drawScreen(int par1, int par2, float par3) { public void drawScreen(int par1, int par2, float par3) {
this.drawDefaultBackground(); this.drawDefaultBackground();
float f = 2.0f; float f = 2.0f;
int top = this.height / 3; int top = this.height / 3;
long millis = System.currentTimeMillis(); long millis = System.currentTimeMillis();
long dots = (millis / 500l) % 4l; long dots = (millis / 500l) % 4l;
this.drawString(fontRendererObj, message + (dots > 0 ? "." : "") + (dots > 1 ? "." : "") + (dots > 2 ? "." : ""), (this.width - this.fontRendererObj.getStringWidth(message)) / 2, top + 10, 0xFFFFFF); this.drawString(fontRendererObj,
message + (dots > 0 ? "." : "") + (dots > 1 ? "." : "") + (dots > 2 ? "." : ""),
(this.width - this.fontRendererObj.getStringWidth(message)) / 2, top + 10, 0xFFFFFF);
long elapsed = (millis - startStartTime) / 1000l; long elapsed = (millis - startStartTime) / 1000l;
if(elapsed > 3) { if (elapsed > 3) {
this.drawCenteredString(fontRendererObj, "(" + elapsed + "s)", this.width / 2, top + 25, 0xFFFFFF); this.drawCenteredString(fontRendererObj, "(" + elapsed + "s)", this.width / 2, top + 25, 0xFFFFFF);
} }
super.drawScreen(par1, par2, par3); super.drawScreen(par1, par2, par3);
} }
public boolean doesGuiPauseGame() { public boolean doesGuiPauseGame() {
return false; return false;
} }
public void updateScreen() { public void updateScreen() {
++timer; ++timer;
if (timer > 1) { if (timer > 1) {
@ -87,8 +98,10 @@ public class GuiScreenSingleplayerConnecting extends GuiScreen {
this.mc.getSession().setLAN(); this.mc.getSession().setLAN();
this.mc.clearTitles(); this.mc.clearTitles();
this.networkManager.setConnectionState(EnumConnectionState.LOGIN); this.networkManager.setConnectionState(EnumConnectionState.LOGIN);
this.networkManager.setNetHandler(new NetHandlerSingleplayerLogin(this.networkManager, this.mc, this.menu)); this.networkManager.setNetHandler(
this.networkManager.sendPacket(new C00PacketLoginStart(this.mc.getSession().getProfile(), EaglerProfile.getSkinPacket(), EaglerProfile.getCapePacket())); new NetHandlerSingleplayerLogin(this.networkManager, this.mc, this.menu));
this.networkManager.sendPacket(new C00PacketLoginStart(this.mc.getSession().getProfile(),
EaglerProfile.getSkinPacket(), EaglerProfile.getCapePacket()));
} }
try { try {
this.networkManager.processReceivedPackets(); this.networkManager.processReceivedPackets();
@ -99,23 +112,24 @@ public class GuiScreenSingleplayerConnecting extends GuiScreen {
this.mc.getSession().reset(); this.mc.getSession().reset();
if (mc.currentScreen == this) { if (mc.currentScreen == this) {
mc.loadWorld(null); mc.loadWorld(null);
mc.displayGuiScreen(new GuiDisconnected(menu, "connect.failed", new ChatComponentText("Worker Connection Refused"))); mc.displayGuiScreen(new GuiDisconnected(menu, "connect.failed",
new TextComponentString("Worker Connection Refused")));
} }
} }
} }
} }
} }
long millis = System.currentTimeMillis(); long millis = System.currentTimeMillis();
if(millis - startStartTime > 6000l && SingleplayerServerController.canKillWorker()) { if (millis - startStartTime > 6000l && SingleplayerServerController.canKillWorker()) {
killTask.enabled = true; killTask.enabled = true;
} }
} }
protected void actionPerformed(GuiButton par1GuiButton) { protected void actionPerformed(GuiButton par1GuiButton) {
if(par1GuiButton.id == 0) { if (par1GuiButton.id == 0) {
SingleplayerServerController.killWorker(); SingleplayerServerController.killWorker();
this.mc.loadWorld((WorldClient)null); this.mc.loadWorld((WorldClient) null);
this.mc.getSession().reset(); this.mc.getSession().reset();
this.mc.displayGuiScreen(menu); this.mc.displayGuiScreen(menu);
} }

View File

@ -8,7 +8,7 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.GuiTextField; import net.minecraft.client.gui.GuiTextField;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.util.ChatComponentText; import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.WorldSettings; import net.minecraft.world.WorldSettings;
/** /**
@ -162,7 +162,7 @@ public class GuiShareToLan extends GuiScreen {
if (code != null) { if (code != null) {
SingleplayerServerController.configureLAN(WorldSettings.GameType.getByName(this.gameMode), SingleplayerServerController.configureLAN(WorldSettings.GameType.getByName(this.gameMode),
this.allowCommands); this.allowCommands);
this.mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentText(I18n.format("lanServer.opened") this.mc.ingameGUI.getChatGUI().printChatMessage(new TextComponentString(I18n.format("lanServer.opened")
.replace("$relay$", LANServerController.getCurrentURI()).replace("$code$", code))); .replace("$relay$", LANServerController.getCurrentURI()).replace("$code$", code)));
} else { } else {
this.mc.displayGuiScreen(new GuiScreenNoRelays(this, "noRelay.titleFail")); this.mc.displayGuiScreen(new GuiScreenNoRelays(this, "noRelay.titleFail"));

View File

@ -16,8 +16,8 @@ import net.lax1dude.eaglercraft.v1_8.sp.relay.pkt.*;
import net.minecraft.network.EnumPacketDirection; import net.minecraft.network.EnumPacketDirection;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.IChatComponent; import net.minecraft.util.text.ITextComponent;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
@ -372,7 +372,7 @@ public class LANClientNetworkManager extends EaglercraftNetworkManager {
if (fullData.length == 31 && fullData[0] == (byte) 0xFF && fullData[1] == (byte) 0x00 if (fullData.length == 31 && fullData[0] == (byte) 0xFF && fullData[1] == (byte) 0x00
&& fullData[2] == (byte) 0x0E) { && fullData[2] == (byte) 0x0E) {
logger.error("Detected a 1.5 LAN server!"); logger.error("Detected a 1.5 LAN server!");
this.closeChannel(new ChatComponentTranslation("singleplayer.outdatedLANServerKick")); this.closeChannel(new TextComponentTranslation("singleplayer.outdatedLANServerKick"));
firstPacket = false; firstPacket = false;
return; return;
} }
@ -414,7 +414,7 @@ public class LANClientNetworkManager extends EaglercraftNetworkManager {
} }
@Override @Override
public void closeChannel(IChatComponent reason) { public void closeChannel(ITextComponent reason) {
if (!PlatformWebRTC.clientLANClosed()) { if (!PlatformWebRTC.clientLANClosed()) {
PlatformWebRTC.clientLANCloseConnection(); PlatformWebRTC.clientLANCloseConnection();
} }
@ -432,7 +432,7 @@ public class LANClientNetworkManager extends EaglercraftNetworkManager {
processReceivedPackets(); // catch kick message processReceivedPackets(); // catch kick message
} catch (IOException e) { } catch (IOException e) {
} }
doClientDisconnect(new ChatComponentTranslation("disconnect.endOfStream")); doClientDisconnect(new TextComponentTranslation("disconnect.endOfStream"));
} }
return clientDisconnected; return clientDisconnected;
} }

View File

@ -3,19 +3,26 @@ package net.lax1dude.eaglercraft.v1_8.sp.server;
import net.minecraft.command.CommandBase; import net.minecraft.command.CommandBase;
import net.minecraft.command.CommandException; import net.minecraft.command.CommandException;
import net.minecraft.command.ICommandSender; import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.text.TextComponentTranslation;
/** /**
* Copyright (c) 2024 lax1dude. All Rights Reserved. * Copyright (c) 2024 lax1dude. All Rights Reserved.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * DISCLAIMED.
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * DIRECT,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
@ -49,7 +56,7 @@ public class ClientCommandDummy extends CommandBase {
@Override @Override
public void processCommand(ICommandSender var1, String[] var2) throws CommandException { public void processCommand(ICommandSender var1, String[] var2) throws CommandException {
var1.addChatMessage(new ChatComponentTranslation("command.clientStub")); var1.addChatMessage(new TextComponentTranslation("command.clientStub"));
} }
} }

View File

@ -20,9 +20,9 @@ import net.lax1dude.eaglercraft.v1_8.sp.SingleplayerServerController;
import net.lax1dude.eaglercraft.v1_8.sp.ipc.*; import net.lax1dude.eaglercraft.v1_8.sp.ipc.*;
import net.minecraft.network.EnumConnectionState; import net.minecraft.network.EnumConnectionState;
import net.minecraft.server.network.NetHandlerLoginServer; import net.minecraft.server.network.NetHandlerLoginServer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ReportedException; import net.minecraft.util.ReportedException;
import net.minecraft.util.StringTranslate; import net.minecraft.util.StringTranslate;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.EnumDifficulty; import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.WorldSettings; import net.minecraft.world.WorldSettings;
import net.minecraft.world.WorldSettings.GameType; import net.minecraft.world.WorldSettings.GameType;
@ -114,7 +114,7 @@ public class EaglerIntegratedServerWorker {
public static void closeChannel(String channel) { public static void closeChannel(String channel) {
IntegratedServerPlayerNetworkManager netmanager = openChannels.remove(channel); IntegratedServerPlayerNetworkManager netmanager = openChannels.remove(channel);
if (netmanager != null) { if (netmanager != null) {
netmanager.closeChannel(new ChatComponentText("End of stream")); netmanager.closeChannel(new TextComponentString("End of stream"));
sendIPCPacket(new IPCPacket0CPlayerChannel(channel, false)); sendIPCPacket(new IPCPacket0CPlayerChannel(channel, false));
} }
} }

View File

@ -18,8 +18,8 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.server.S3FPacketCustomPayload; import net.minecraft.network.play.server.S3FPacketCustomPayload;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList; import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString; import net.minecraft.nbt.NBTTagString;
@ -27,14 +27,21 @@ import net.minecraft.nbt.NBTTagString;
/** /**
* Copyright (c) 2022-2024 lax1dude. All Rights Reserved. * Copyright (c) 2022-2024 lax1dude. All Rights Reserved.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * DISCLAIMED.
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * DIRECT,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
@ -48,11 +55,11 @@ public class IntegratedSkinService {
public static final byte[] skullNotFoundTexture = new byte[4096]; public static final byte[] skullNotFoundTexture = new byte[4096];
static { static {
for(int y = 0; y < 16; ++y) { for (int y = 0; y < 16; ++y) {
for(int x = 0; x < 64; ++x) { for (int x = 0; x < 64; ++x) {
int i = (y << 8) | (x << 2); int i = (y << 8) | (x << 2);
byte j = ((x + y) & 1) == 1 ? (byte)255 : 0; byte j = ((x + y) & 1) == 1 ? (byte) 255 : 0;
skullNotFoundTexture[i] = (byte)255; skullNotFoundTexture[i] = (byte) 255;
skullNotFoundTexture[i + 1] = j; skullNotFoundTexture[i + 1] = j;
skullNotFoundTexture[i + 2] = 0; skullNotFoundTexture[i + 2] = 0;
skullNotFoundTexture[i + 3] = j; skullNotFoundTexture[i + 3] = j;
@ -62,8 +69,8 @@ public class IntegratedSkinService {
public final VFile2 skullsDirectory; public final VFile2 skullsDirectory;
public final Map<EaglercraftUUID,byte[]> playerSkins = new HashMap(); public final Map<EaglercraftUUID, byte[]> playerSkins = new HashMap();
public final Map<String,CustomSkullData> customSkulls = new HashMap(); public final Map<String, CustomSkullData> customSkulls = new HashMap();
private long lastFlush = 0l; private long lastFlush = 0l;
@ -93,32 +100,34 @@ public class IntegratedSkinService {
public void processPacketGetOtherSkin(EaglercraftUUID searchUUID, EntityPlayerMP sender) { public void processPacketGetOtherSkin(EaglercraftUUID searchUUID, EntityPlayerMP sender) {
byte[] playerSkin = playerSkins.get(searchUUID); byte[] playerSkin = playerSkins.get(searchUUID);
if(playerSkin == null) { if (playerSkin == null) {
playerSkin = IntegratedSkinPackets.makePresetResponse(searchUUID); playerSkin = IntegratedSkinPackets.makePresetResponse(searchUUID);
} }
sender.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload(CHANNEL, new PacketBuffer(Unpooled.buffer(playerSkin, playerSkin.length).writerIndex(playerSkin.length)))); sender.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload(CHANNEL,
new PacketBuffer(Unpooled.buffer(playerSkin, playerSkin.length).writerIndex(playerSkin.length))));
} }
public void processPacketGetOtherSkin(EaglercraftUUID searchUUID, String urlStr, EntityPlayerMP sender) { public void processPacketGetOtherSkin(EaglercraftUUID searchUUID, String urlStr, EntityPlayerMP sender) {
urlStr = urlStr.toLowerCase(); urlStr = urlStr.toLowerCase();
byte[] playerSkin; byte[] playerSkin;
if(!urlStr.startsWith("eagler://")) { if (!urlStr.startsWith("eagler://")) {
playerSkin = IntegratedSkinPackets.makePresetResponse(searchUUID, 0); playerSkin = IntegratedSkinPackets.makePresetResponse(searchUUID, 0);
}else { } else {
urlStr = urlStr.substring(9); urlStr = urlStr.substring(9);
if(urlStr.contains(VFile2.pathSeperator)) { if (urlStr.contains(VFile2.pathSeperator)) {
playerSkin = IntegratedSkinPackets.makePresetResponse(searchUUID, 0); playerSkin = IntegratedSkinPackets.makePresetResponse(searchUUID, 0);
}else { } else {
CustomSkullData sk = customSkulls.get(urlStr); CustomSkullData sk = customSkulls.get(urlStr);
if(sk == null) { if (sk == null) {
customSkulls.put(urlStr, sk = loadCustomSkull(urlStr)); customSkulls.put(urlStr, sk = loadCustomSkull(urlStr));
}else { } else {
sk.lastHit = System.currentTimeMillis(); sk.lastHit = System.currentTimeMillis();
} }
playerSkin = IntegratedSkinPackets.makeCustomResponse(searchUUID, 0, sk.getFullSkin()); playerSkin = IntegratedSkinPackets.makeCustomResponse(searchUUID, 0, sk.getFullSkin());
} }
} }
sender.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload(CHANNEL, new PacketBuffer(Unpooled.buffer(playerSkin, playerSkin.length).writerIndex(playerSkin.length)))); sender.playerNetServerHandler.sendPacket(new S3FPacketCustomPayload(CHANNEL,
new PacketBuffer(Unpooled.buffer(playerSkin, playerSkin.length).writerIndex(playerSkin.length))));
} }
public void processPacketPlayerSkin(EaglercraftUUID clientUUID, byte[] generatedPacket, int skinModel) { public void processPacketPlayerSkin(EaglercraftUUID clientUUID, byte[] generatedPacket, int skinModel) {
@ -130,8 +139,8 @@ public class IntegratedSkinService {
} }
public void processPacketInstallNewSkin(byte[] skullData, EntityPlayerMP sender) { public void processPacketInstallNewSkin(byte[] skullData, EntityPlayerMP sender) {
if(!sender.canCommandSenderUseCommand(2, "give")) { if (!sender.canCommandSenderUseCommand(2, "give")) {
ChatComponentTranslation cc = new ChatComponentTranslation("command.skull.nopermission"); TextComponentTranslation cc = new TextComponentTranslation("command.skull.nopermission");
cc.getChatStyle().setColor(EnumChatFormatting.RED); cc.getChatStyle().setColor(EnumChatFormatting.RED);
sender.addChatMessage(cc); sender.addChatMessage(cc);
return; return;
@ -140,12 +149,15 @@ public class IntegratedSkinService {
NBTTagCompound rootTagCompound = new NBTTagCompound(); NBTTagCompound rootTagCompound = new NBTTagCompound();
NBTTagCompound ownerTagCompound = new NBTTagCompound(); NBTTagCompound ownerTagCompound = new NBTTagCompound();
ownerTagCompound.setString("Name", "Eagler"); ownerTagCompound.setString("Name", "Eagler");
ownerTagCompound.setString("Id", EaglercraftUUID.nameUUIDFromBytes((("EaglerSkullUUID:" + fileName).getBytes(StandardCharsets.UTF_8))).toString()); ownerTagCompound.setString("Id", EaglercraftUUID
.nameUUIDFromBytes((("EaglerSkullUUID:" + fileName).getBytes(StandardCharsets.UTF_8))).toString());
NBTTagCompound propertiesTagCompound = new NBTTagCompound(); NBTTagCompound propertiesTagCompound = new NBTTagCompound();
NBTTagList texturesTagList = new NBTTagList(); NBTTagList texturesTagList = new NBTTagList();
NBTTagCompound texturesTagCompound = new NBTTagCompound(); NBTTagCompound texturesTagCompound = new NBTTagCompound();
String texturesProp = "{\"textures\":{\"SKIN\":{\"url\":\"" + fileName + "\",\"metadata\":{\"model\":\"default\"}}}}"; String texturesProp = "{\"textures\":{\"SKIN\":{\"url\":\"" + fileName
texturesTagCompound.setString("Value", Base64.encodeBase64String(texturesProp.getBytes(StandardCharsets.UTF_8))); + "\",\"metadata\":{\"model\":\"default\"}}}}";
texturesTagCompound.setString("Value",
Base64.encodeBase64String(texturesProp.getBytes(StandardCharsets.UTF_8)));
texturesTagList.appendTag(texturesTagCompound); texturesTagList.appendTag(texturesTagCompound);
propertiesTagCompound.setTag("textures", texturesTagList); propertiesTagCompound.setTag("textures", texturesTagList);
ownerTagCompound.setTag("Properties", propertiesTagCompound); ownerTagCompound.setTag("Properties", propertiesTagCompound);
@ -153,7 +165,8 @@ public class IntegratedSkinService {
NBTTagCompound displayTagCompound = new NBTTagCompound(); NBTTagCompound displayTagCompound = new NBTTagCompound();
displayTagCompound.setString("Name", EnumChatFormatting.RESET + "Custom Eaglercraft Skull"); displayTagCompound.setString("Name", EnumChatFormatting.RESET + "Custom Eaglercraft Skull");
NBTTagList loreList = new NBTTagList(); NBTTagList loreList = new NBTTagList();
loreList.appendTag(new NBTTagString(EnumChatFormatting.GRAY + (fileName.length() > 24 ? (fileName.substring(0, 22) + "...") : fileName))); loreList.appendTag(new NBTTagString(
EnumChatFormatting.GRAY + (fileName.length() > 24 ? (fileName.substring(0, 22) + "...") : fileName)));
displayTagCompound.setTag("Lore", loreList); displayTagCompound.setTag("Lore", loreList);
rootTagCompound.setTag("display", displayTagCompound); rootTagCompound.setTag("display", displayTagCompound);
ItemStack stack = new ItemStack(Items.skull, 1, 3); ItemStack stack = new ItemStack(Items.skull, 1, 3);
@ -165,14 +178,14 @@ public class IntegratedSkinService {
* 2.0F); * 2.0F);
sender.inventoryContainer.detectAndSendChanges(); sender.inventoryContainer.detectAndSendChanges();
} }
sender.addChatMessage(new ChatComponentTranslation("command.skull.feedback", fileName)); sender.addChatMessage(new TextComponentTranslation("command.skull.feedback", fileName));
} }
private static final String hex = "0123456789abcdef"; private static final String hex = "0123456789abcdef";
public String installNewSkull(byte[] skullData) { public String installNewSkull(byte[] skullData) {
// set to 16384 to save a full 64x64 skin // set to 16384 to save a full 64x64 skin
if(skullData.length > 4096) { if (skullData.length > 4096) {
byte[] tmp = skullData; byte[] tmp = skullData;
skullData = new byte[4096]; skullData = new byte[4096];
System.arraycopy(tmp, 0, skullData, 0, 4096); System.arraycopy(tmp, 0, skullData, 0, 4096);
@ -182,7 +195,7 @@ public class IntegratedSkinService {
byte[] hash = new byte[20]; byte[] hash = new byte[20];
sha.doFinal(hash, 0); sha.doFinal(hash, 0);
char[] hashText = new char[40]; char[] hashText = new char[40];
for(int i = 0; i < 20; ++i) { for (int i = 0; i < 20; ++i) {
hashText[i << 1] = hex.charAt((hash[i] & 0xF0) >> 4); hashText[i << 1] = hex.charAt((hash[i] & 0xF0) >> 4);
hashText[(i << 1) + 1] = hex.charAt(hash[i] & 0x0F); hashText[(i << 1) + 1] = hex.charAt(hash[i] & 0x0F);
} }
@ -194,20 +207,20 @@ public class IntegratedSkinService {
private CustomSkullData loadCustomSkull(String urlStr) { private CustomSkullData loadCustomSkull(String urlStr) {
byte[] data = (new VFile2(skullsDirectory, urlStr)).getAllBytes(); byte[] data = (new VFile2(skullsDirectory, urlStr)).getAllBytes();
if(data == null) { if (data == null) {
return new CustomSkullData(urlStr, skullNotFoundTexture); return new CustomSkullData(urlStr, skullNotFoundTexture);
}else { } else {
return new CustomSkullData(urlStr, data); return new CustomSkullData(urlStr, data);
} }
} }
public void flushCache() { public void flushCache() {
long cur = System.currentTimeMillis(); long cur = System.currentTimeMillis();
if(cur - lastFlush > 300000l) { if (cur - lastFlush > 300000l) {
lastFlush = cur; lastFlush = cur;
Iterator<CustomSkullData> customSkullsItr = customSkulls.values().iterator(); Iterator<CustomSkullData> customSkullsItr = customSkulls.values().iterator();
while(customSkullsItr.hasNext()) { while (customSkullsItr.hasNext()) {
if(cur - customSkullsItr.next().lastHit > 900000l) { if (cur - customSkullsItr.next().lastHit > 900000l) {
customSkullsItr.remove(); customSkullsItr.remove();
} }
} }

View File

@ -22,9 +22,9 @@ import net.minecraft.network.EnumPacketDirection;
import net.minecraft.network.INetHandler; import net.minecraft.network.INetHandler;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.ITickable; import net.minecraft.util.ITickable;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.util.text.ITextComponent;
import net.lax1dude.eaglercraft.v1_8.sp.server.internal.ServerPlatformSingleplayer; import net.lax1dude.eaglercraft.v1_8.sp.server.internal.ServerPlatformSingleplayer;
/** /**
@ -94,7 +94,7 @@ public class IntegratedServerPlayerNetworkManager {
: EnumEaglerConnectionState.CLOSED; : EnumEaglerConnectionState.CLOSED;
} }
public void closeChannel(IChatComponent reason) { public void closeChannel(ITextComponent reason) {
EaglerIntegratedServerWorker.closeChannel(playerChannel); EaglerIntegratedServerWorker.closeChannel(playerChannel);
if (nethandler != null) { if (nethandler != null) {
nethandler.onDisconnect(reason); nethandler.onDisconnect(reason);
@ -141,7 +141,7 @@ public class IntegratedServerPlayerNetworkManager {
} }
ServerPlatformSingleplayer ServerPlatformSingleplayer
.sendPacket(new IPCPacketData(playerChannel, kickPacketBAO.toByteArray())); .sendPacket(new IPCPacketData(playerChannel, kickPacketBAO.toByteArray()));
closeChannel(new ChatComponentText( closeChannel(new TextComponentString(
"Recieved unsuppoorted connection from an Eaglercraft 1.5.2 client!")); "Recieved unsuppoorted connection from an Eaglercraft 1.5.2 client!"));
firstPacket = false; firstPacket = false;
recievedPacketBufferCounter = 0; recievedPacketBufferCounter = 0;

View File

@ -4,19 +4,26 @@ import net.lax1dude.eaglercraft.v1_8.sp.server.EaglerMinecraftServer;
import net.minecraft.network.handshake.INetHandlerHandshakeServer; import net.minecraft.network.handshake.INetHandlerHandshakeServer;
import net.minecraft.network.handshake.client.C00Handshake; import net.minecraft.network.handshake.client.C00Handshake;
import net.minecraft.server.network.NetHandlerLoginServer; import net.minecraft.server.network.NetHandlerLoginServer;
import net.minecraft.util.IChatComponent; import net.minecraft.util.text.ITextComponent;
/** /**
* Copyright (c) 2023-2024 lax1dude. All Rights Reserved. * Copyright (c) 2023-2024 lax1dude. All Rights Reserved.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * DISCLAIMED.
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * DIRECT,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
@ -26,14 +33,15 @@ public class NetHandlerHandshakeEagler implements INetHandlerHandshakeServer {
private final EaglerMinecraftServer mcServer; private final EaglerMinecraftServer mcServer;
private final IntegratedServerPlayerNetworkManager networkManager; private final IntegratedServerPlayerNetworkManager networkManager;
public NetHandlerHandshakeEagler(EaglerMinecraftServer parMinecraftServer, IntegratedServerPlayerNetworkManager parNetworkManager) { public NetHandlerHandshakeEagler(EaglerMinecraftServer parMinecraftServer,
IntegratedServerPlayerNetworkManager parNetworkManager) {
this.mcServer = parMinecraftServer; this.mcServer = parMinecraftServer;
this.networkManager = parNetworkManager; this.networkManager = parNetworkManager;
} }
@Override @Override
public void onDisconnect(IChatComponent var1) { public void onDisconnect(ITextComponent var1) {
} }
@Override @Override

View File

@ -13,8 +13,8 @@ import net.lax1dude.eaglercraft.v1_8.sp.lan.LANServerController;
import net.minecraft.network.EnumPacketDirection; import net.minecraft.network.EnumPacketDirection;
import net.minecraft.network.Packet; import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ChatComponentTranslation; import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.IChatComponent; import net.minecraft.util.text.ITextComponent;
/** /**
* Copyright (c) 2023-2024 lax1dude, hoosiertransfer, ayunami2000. All Rights * Copyright (c) 2023-2024 lax1dude, hoosiertransfer, ayunami2000. All Rights
@ -62,7 +62,7 @@ public class ClientIntegratedServerNetworkManager extends EaglercraftNetworkMana
} }
@Override @Override
public void closeChannel(IChatComponent reason) { public void closeChannel(ITextComponent reason) {
LANServerController.closeLAN(); LANServerController.closeLAN();
SingleplayerServerController.closeLocalPlayerChannel(); SingleplayerServerController.closeLocalPlayerChannel();
if (nethandler != null) { if (nethandler != null) {
@ -169,7 +169,7 @@ public class ClientIntegratedServerNetworkManager extends EaglercraftNetworkMana
} catch (IOException e) { } catch (IOException e) {
} }
clearRecieveQueue(); clearRecieveQueue();
doClientDisconnect(new ChatComponentTranslation("disconnect.endOfStream")); doClientDisconnect(new TextComponentTranslation("disconnect.endOfStream"));
return true; return true;
} else { } else {
return false; return false;

View File

@ -15,19 +15,26 @@ import net.minecraft.network.login.server.S01PacketEncryptionRequest;
import net.minecraft.network.login.server.S02PacketLoginSuccess; import net.minecraft.network.login.server.S02PacketLoginSuccess;
import net.minecraft.network.login.server.S03PacketEnableCompression; import net.minecraft.network.login.server.S03PacketEnableCompression;
import net.minecraft.network.play.client.C17PacketCustomPayload; import net.minecraft.network.play.client.C17PacketCustomPayload;
import net.minecraft.util.IChatComponent; import net.minecraft.util.text.ITextComponent;
/** /**
* Copyright (c) 2023-2024 lax1dude. All Rights Reserved. * Copyright (c) 2023-2024 lax1dude. All Rights Reserved.
* *
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, * DISCLAIMED.
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT * IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR * DIRECT,
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) * (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR
* PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
* LIABILITY,
* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
* OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE. * POSSIBILITY OF SUCH DAMAGE.
* *
@ -38,29 +45,32 @@ public class NetHandlerSingleplayerLogin implements INetHandlerLoginClient {
private final GuiScreen previousGuiScreen; private final GuiScreen previousGuiScreen;
private final EaglercraftNetworkManager networkManager; private final EaglercraftNetworkManager networkManager;
public NetHandlerSingleplayerLogin(EaglercraftNetworkManager parNetworkManager, Minecraft mcIn, GuiScreen parGuiScreen) { public NetHandlerSingleplayerLogin(EaglercraftNetworkManager parNetworkManager, Minecraft mcIn,
GuiScreen parGuiScreen) {
this.networkManager = parNetworkManager; this.networkManager = parNetworkManager;
this.mc = mcIn; this.mc = mcIn;
this.previousGuiScreen = parGuiScreen; this.previousGuiScreen = parGuiScreen;
} }
@Override @Override
public void onDisconnect(IChatComponent var1) { public void onDisconnect(ITextComponent var1) {
this.mc.displayGuiScreen(new GuiDisconnected(this.previousGuiScreen, "connect.failed", var1)); this.mc.displayGuiScreen(new GuiDisconnected(this.previousGuiScreen, "connect.failed", var1));
} }
@Override @Override
public void handleEncryptionRequest(S01PacketEncryptionRequest var1) { public void handleEncryptionRequest(S01PacketEncryptionRequest var1) {
} }
@Override @Override
public void handleLoginSuccess(S02PacketLoginSuccess var1) { public void handleLoginSuccess(S02PacketLoginSuccess var1) {
this.networkManager.setConnectionState(EnumConnectionState.PLAY); this.networkManager.setConnectionState(EnumConnectionState.PLAY);
this.networkManager.setNetHandler(new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, var1.getProfile())); this.networkManager.setNetHandler(
new NetHandlerPlayClient(this.mc, this.previousGuiScreen, this.networkManager, var1.getProfile()));
byte[] b = UpdateService.getClientSignatureData(); byte[] b = UpdateService.getClientSignatureData();
if(b != null) { if (b != null) {
this.networkManager.sendPacket(new C17PacketCustomPayload("EAG|MyUpdCert-1.8", new PacketBuffer(Unpooled.buffer(b, b.length).writerIndex(b.length)))); this.networkManager.sendPacket(new C17PacketCustomPayload("EAG|MyUpdCert-1.8",
new PacketBuffer(Unpooled.buffer(b, b.length).writerIndex(b.length))));
} }
} }
@ -71,7 +81,7 @@ public class NetHandlerSingleplayerLogin implements INetHandlerLoginClient {
@Override @Override
public void handleEnableCompression(S03PacketEnableCompression var1) { public void handleEnableCompression(S03PacketEnableCompression var1) {
} }
} }

View File

@ -17,8 +17,8 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen; import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n; import net.minecraft.client.resources.I18n;
import net.minecraft.util.EnumChatFormatting; import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
/** /**
* Copyright (c) 2022-2024 lax1dude, hoosiertransfer, ayunami2000. All Rights * Copyright (c) 2022-2024 lax1dude, hoosiertransfer, ayunami2000. All Rights

View File

@ -29,16 +29,16 @@ import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList; import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ObjectIntIdentityMap; import net.minecraft.util.ObjectIntIdentityMap;
import net.minecraft.util.RegistryNamespacedDefaultedByKey;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.registry.RegistryNamespacedDefaultedByKey;
import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.Explosion; import net.minecraft.world.Explosion;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
@ -693,16 +693,16 @@ public class Block implements ILitBlock {
* Ray traces through the blocks collision from start vector to * Ray traces through the blocks collision from start vector to
* end vector returning a ray trace hit. * end vector returning a ray trace hit.
*/ */
public MovingObjectPosition collisionRayTrace(World world, BlockPos blockpos, Vec3 vec3, Vec3 vec31) { public RayTraceResult collisionRayTrace(World world, BlockPos blockpos, Vec3d vec3, Vec3d vec31) {
this.setBlockBoundsBasedOnState(world, blockpos); this.setBlockBoundsBasedOnState(world, blockpos);
vec3 = vec3.addVector((double) (-blockpos.getX()), (double) (-blockpos.getY()), (double) (-blockpos.getZ())); vec3 = vec3.addVector((double) (-blockpos.getX()), (double) (-blockpos.getY()), (double) (-blockpos.getZ()));
vec31 = vec31.addVector((double) (-blockpos.getX()), (double) (-blockpos.getY()), (double) (-blockpos.getZ())); vec31 = vec31.addVector((double) (-blockpos.getX()), (double) (-blockpos.getY()), (double) (-blockpos.getZ()));
Vec3 vec32 = vec3.getIntermediateWithXValue(vec31, this.minX); Vec3d vec32 = vec3.getIntermediateWithXValue(vec31, this.minX);
Vec3 vec33 = vec3.getIntermediateWithXValue(vec31, this.maxX); Vec3d vec33 = vec3.getIntermediateWithXValue(vec31, this.maxX);
Vec3 vec34 = vec3.getIntermediateWithYValue(vec31, this.minY); Vec3d vec34 = vec3.getIntermediateWithYValue(vec31, this.minY);
Vec3 vec35 = vec3.getIntermediateWithYValue(vec31, this.maxY); Vec3d vec35 = vec3.getIntermediateWithYValue(vec31, this.maxY);
Vec3 vec36 = vec3.getIntermediateWithZValue(vec31, this.minZ); Vec3d vec36 = vec3.getIntermediateWithZValue(vec31, this.minZ);
Vec3 vec37 = vec3.getIntermediateWithZValue(vec31, this.maxZ); Vec3d vec37 = vec3.getIntermediateWithZValue(vec31, this.maxZ);
if (!this.isVecInsideYZBounds(vec32)) { if (!this.isVecInsideYZBounds(vec32)) {
vec32 = null; vec32 = null;
} }
@ -727,7 +727,7 @@ public class Block implements ILitBlock {
vec37 = null; vec37 = null;
} }
Vec3 vec38 = null; Vec3d vec38 = null;
if (vec32 != null && (vec38 == null || vec3.squareDistanceTo(vec32) < vec3.squareDistanceTo(vec38))) { if (vec32 != null && (vec38 == null || vec3.squareDistanceTo(vec32) < vec3.squareDistanceTo(vec38))) {
vec38 = vec32; vec38 = vec32;
} }
@ -780,7 +780,7 @@ public class Block implements ILitBlock {
enumfacing = EnumFacing.SOUTH; enumfacing = EnumFacing.SOUTH;
} }
return new MovingObjectPosition( return new RayTraceResult(
vec38.addVector((double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ()), vec38.addVector((double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ()),
enumfacing, blockpos); enumfacing, blockpos);
} }
@ -790,7 +790,7 @@ public class Block implements ILitBlock {
* + * +
* Checks if a vector is within the Y and Z bounds of the block. * Checks if a vector is within the Y and Z bounds of the block.
*/ */
private boolean isVecInsideYZBounds(Vec3 point) { private boolean isVecInsideYZBounds(Vec3d point) {
return point == null ? false return point == null ? false
: point.yCoord >= this.minY && point.yCoord <= this.maxY && point.zCoord >= this.minZ : point.yCoord >= this.minY && point.yCoord <= this.maxY && point.zCoord >= this.minZ
&& point.zCoord <= this.maxZ; && point.zCoord <= this.maxZ;
@ -800,7 +800,7 @@ public class Block implements ILitBlock {
* + * +
* Checks if a vector is within the X and Z bounds of the block. * Checks if a vector is within the X and Z bounds of the block.
*/ */
private boolean isVecInsideXZBounds(Vec3 point) { private boolean isVecInsideXZBounds(Vec3d point) {
return point == null ? false return point == null ? false
: point.xCoord >= this.minX && point.xCoord <= this.maxX && point.zCoord >= this.minZ : point.xCoord >= this.minX && point.xCoord <= this.maxX && point.zCoord >= this.minZ
&& point.zCoord <= this.maxZ; && point.zCoord <= this.maxZ;
@ -810,7 +810,7 @@ public class Block implements ILitBlock {
* + * +
* Checks if a vector is within the X and Y bounds of the block. * Checks if a vector is within the X and Y bounds of the block.
*/ */
private boolean isVecInsideXYBounds(Vec3 point) { private boolean isVecInsideXYBounds(Vec3d point) {
return point == null ? false return point == null ? false
: point.xCoord >= this.minX && point.xCoord <= this.maxX && point.yCoord >= this.minY : point.xCoord >= this.minX && point.xCoord <= this.maxX && point.yCoord >= this.minY
&& point.yCoord <= this.maxY; && point.yCoord <= this.maxY;
@ -868,7 +868,7 @@ public class Block implements ILitBlock {
public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) { public void onBlockClicked(World worldIn, BlockPos pos, EntityPlayer playerIn) {
} }
public Vec3 modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3 motion) { public Vec3d modifyAcceleration(World worldIn, BlockPos pos, Entity entityIn, Vec3d motion) {
return motion; return motion;
} }

View File

@ -2,8 +2,8 @@ package net.minecraft.block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.util.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -18,10 +18,10 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerRepair; import net.minecraft.inventory.ContainerRepair;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.IChatComponent; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.IInteractionObject; import net.minecraft.world.IInteractionObject;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -194,8 +194,8 @@ public class BlockAnvil extends BlockFalling {
return false; return false;
} }
public IChatComponent getDisplayName() { public ITextComponent getDisplayName() {
return new ChatComponentTranslation(Blocks.anvil.getUnlocalizedName() + ".name", new Object[0]); return new TextComponentTranslation(Blocks.anvil.getUnlocalizedName() + ".name", new Object[0]);
} }
public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) { public Container createContainer(InventoryPlayer playerInventory, EntityPlayer playerIn) {

View File

@ -15,10 +15,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityBanner; import net.minecraft.tileentity.TileEntityBanner;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -2,7 +2,7 @@ package net.minecraft.block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -7,9 +7,9 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -11,9 +11,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList; import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityBeacon; import net.minecraft.tileentity.TileEntityBeacon;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldServer; import net.minecraft.world.WorldServer;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;

View File

@ -15,11 +15,11 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeGenBase; import net.minecraft.world.biome.BiomeGenBase;
@ -92,7 +92,7 @@ public class BlockBed extends BlockDirectional {
blockpos1 = blockpos.up(); blockpos1 = blockpos.up();
} }
entityplayer.setSpawnPoint(blockpos1.add(0.5F, 0.1F, 0.5F), false); entityplayer.setSpawnPoint(blockpos1.add(0.5F, 0.1F, 0.5F), false);
entityplayer.addChatComponentMessage(new ChatComponentTranslation("tile.bed.setspawn")); entityplayer.addChatComponentMessage(new TextComponentTranslation("tile.bed.setspawn"));
if (entityplayer.isSneaking()) { if (entityplayer.isSneaking()) {
return true; return true;
} }
@ -102,7 +102,7 @@ public class BlockBed extends BlockDirectional {
EntityPlayer entityplayer1 = this.getPlayerInBed(world, blockpos); EntityPlayer entityplayer1 = this.getPlayerInBed(world, blockpos);
if (entityplayer1 != null) { if (entityplayer1 != null) {
entityplayer entityplayer
.addChatComponentMessage(new ChatComponentTranslation("tile.bed.occupied", new Object[0])); .addChatComponentMessage(new TextComponentTranslation("tile.bed.occupied", new Object[0]));
return true; return true;
} }
@ -118,10 +118,10 @@ public class BlockBed extends BlockDirectional {
} else { } else {
if (entityplayer$enumstatus == EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW) { if (entityplayer$enumstatus == EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW) {
entityplayer entityplayer
.addChatComponentMessage(new ChatComponentTranslation("tile.bed.noSleep", new Object[0])); .addChatComponentMessage(new TextComponentTranslation("tile.bed.noSleep", new Object[0]));
} else if (entityplayer$enumstatus == EntityPlayer.EnumStatus.NOT_SAFE) { } else if (entityplayer$enumstatus == EntityPlayer.EnumStatus.NOT_SAFE) {
entityplayer entityplayer
.addChatComponentMessage(new ChatComponentTranslation("tile.bed.notSafe", new Object[0])); .addChatComponentMessage(new TextComponentTranslation("tile.bed.notSafe", new Object[0]));
} }
return true; return true;

View File

@ -6,7 +6,7 @@ import net.hoosiertransfer.EaglerItems;
import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom; import net.lax1dude.eaglercraft.v1_8.EaglercraftRandom;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockBeetroot extends BlockCrops { public class BlockBeetroot extends BlockCrops {
@ -14,20 +14,15 @@ public class BlockBeetroot extends BlockCrops {
return 3; return 3;
} }
public void updateTick(World worldIn, BlockPos pos, IBlockState state, EaglercraftRandom rand) public void updateTick(World worldIn, BlockPos pos, IBlockState state, EaglercraftRandom rand) {
{ if (rand.nextInt(3) == 0) {
if (rand.nextInt(3) == 0)
{
this.checkAndDropBlock(worldIn, pos, state); this.checkAndDropBlock(worldIn, pos, state);
} } else {
else
{
super.updateTick(worldIn, pos, state, rand); super.updateTick(worldIn, pos, state, rand);
} }
} }
protected int getBonemealAgeIncrease(World worldIn) protected int getBonemealAgeIncrease(World worldIn) {
{
return super.getBonemealAgeIncrease(worldIn) / 3; return super.getBonemealAgeIncrease(worldIn) / 3;
} }

View File

@ -4,8 +4,8 @@ import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
/** /**

View File

@ -21,12 +21,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList; import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityBrewingStand; import net.minecraft.tileentity.TileEntityBrewingStand;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -7,9 +7,9 @@ import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -13,9 +13,9 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.entity.projectile.EntityArrow; import net.minecraft.entity.projectile.EntityArrow;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -10,11 +10,11 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource; import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**
@ -122,18 +122,17 @@ public class BlockCactus extends Block {
} }
public boolean canBlockStay(World worldIn, BlockPos pos) { public boolean canBlockStay(World worldIn, BlockPos pos) {
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) {
{ Material material = worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getMaterial();
Material material = worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getMaterial();
if (material.isSolid() || material == Material.lava) if (material.isSolid() || material == Material.lava) {
{ return false;
return false; }
} }
}
Block block = worldIn.getBlockState(pos.down()).getBlock(); Block block = worldIn.getBlockState(pos.down()).getBlock();
return block == Blocks.cactus || block == Blocks.sand && !worldIn.getBlockState(pos.up()).getBlock().getMaterial().isLiquid(); return block == Blocks.cactus
|| block == Blocks.sand && !worldIn.getBlockState(pos.up()).getBlock().getMaterial().isLiquid();
} }
/** /**

View File

@ -11,10 +11,10 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.stats.StatList; import net.minecraft.stats.StatList;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -15,8 +15,8 @@ import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -20,10 +20,10 @@ import net.minecraft.item.ItemBanner;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList; import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntityBanner; import net.minecraft.tileentity.TileEntityBanner;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**
@ -141,28 +141,24 @@ public class BlockCauldron extends Block {
return true; return true;
} else if (item == Items.bucket) { } else if (item == Items.bucket) {
if (i == 3 && !world.isRemote) if (i == 3 && !world.isRemote) {
{ if (!entityplayer.capabilities.isCreativeMode) {
if (!entityplayer.capabilities.isCreativeMode)
{
ItemStack heldItem = entityplayer.inventory.getCurrentItem(); ItemStack heldItem = entityplayer.inventory.getCurrentItem();
--heldItem.stackSize; --heldItem.stackSize;
if (heldItem.stackSize == 0) if (heldItem.stackSize == 0) {
{
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem, entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,
new ItemStack(Items.water_bucket)); new ItemStack(Items.water_bucket));
} } else if (!entityplayer.inventory
else if (!entityplayer.inventory.addItemStackToInventory(new ItemStack(Items.water_bucket))) .addItemStackToInventory(new ItemStack(Items.water_bucket))) {
{
entityplayer.dropPlayerItemWithRandomChoice(new ItemStack(Items.water_bucket), false); entityplayer.dropPlayerItemWithRandomChoice(new ItemStack(Items.water_bucket), false);
} }
} }
entityplayer.addStat(StatList.CAULDRON_USED, 1); entityplayer.addStat(StatList.CAULDRON_USED, 1);
this.setWaterLevel(world, blockpos, iblockstate, 0); this.setWaterLevel(world, blockpos, iblockstate, 0);
} }
return true; return true;
} else if (item == Items.glass_bottle) { } else if (item == Items.glass_bottle) {
if (i > 0) { if (i > 0) {

View File

@ -20,10 +20,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList; import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest; import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.ILockableContainer; import net.minecraft.world.ILockableContainer;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -17,9 +17,9 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockChorusFlower extends Block { public class BlockChorusFlower extends Block {

View File

@ -15,10 +15,10 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -13,10 +13,10 @@ import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor; import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -18,9 +18,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityCommandBlock; import net.minecraft.tileentity.TileEntityCommandBlock;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.StringUtils; import net.minecraft.util.StringUtils;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -3,8 +3,8 @@ package net.minecraft.block;
import net.minecraft.block.material.MapColor; import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
/** /**

View File

@ -4,8 +4,8 @@ import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -11,8 +11,8 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**
@ -80,28 +80,24 @@ public class BlockCrops extends BlockBush implements IGrowable {
} }
public IBlockState withAge(int age) public IBlockState withAge(int age) {
{ return this.getDefaultState().withProperty(AGE, Integer.valueOf(age));
return this.getDefaultState().withProperty(AGE, Integer.valueOf(age)); }
}
protected int getAge(IBlockState state) protected int getAge(IBlockState state) {
{ return ((Integer) state.getValue(AGE)).intValue();
return ((Integer)state.getValue(AGE)).intValue(); }
}
public void grow(World worldIn, BlockPos pos, IBlockState state) public void grow(World worldIn, BlockPos pos, IBlockState state) {
{ int i = this.getAge(state) + this.getBonemealAgeIncrease(worldIn);
int i = this.getAge(state) + this.getBonemealAgeIncrease(worldIn); int j = this.getMaxAge();
int j = this.getMaxAge();
if (i > j) if (i > j) {
{ i = j;
i = j; }
}
worldIn.setBlockState(pos, this.withAge(i), 2); worldIn.setBlockState(pos, this.withAge(i), 2);
} }
protected static float getGrowthChance(Block blockIn, World worldIn, BlockPos pos) { protected static float getGrowthChance(Block blockIn, World worldIn, BlockPos pos) {
float f = 1.0F; float f = 1.0F;
@ -162,10 +158,9 @@ public class BlockCrops extends BlockBush implements IGrowable {
return Items.wheat; return Items.wheat;
} }
public int getMaxAge() public int getMaxAge() {
{ return 7;
return 7; }
}
/** /**
* + * +
@ -211,19 +206,17 @@ public class BlockCrops extends BlockBush implements IGrowable {
return true; return true;
} }
protected int getBonemealAgeIncrease(World worldIn) protected int getBonemealAgeIncrease(World worldIn) {
{ return MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5);
return MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5); }
}
public void grow(World world, EaglercraftRandom var2, BlockPos blockpos, IBlockState iblockstate) { public void grow(World world, EaglercraftRandom var2, BlockPos blockpos, IBlockState iblockstate) {
this.grow(world, blockpos, iblockstate); this.grow(world, blockpos, iblockstate);
} }
public boolean isMaxAge(IBlockState state) public boolean isMaxAge(IBlockState state) {
{ return ((Integer) state.getValue(AGE)).intValue() >= this.getMaxAge();
return ((Integer)state.getValue(AGE)).intValue() >= this.getMaxAge(); }
}
/** /**
* + * +

View File

@ -15,9 +15,9 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityDaylightDetector; import net.minecraft.tileentity.TileEntityDaylightDetector;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -74,34 +74,29 @@ public class BlockDaylightDetector extends BlockContainer {
return ((Integer) iblockstate.getValue(POWER)).intValue(); return ((Integer) iblockstate.getValue(POWER)).intValue();
} }
public void updatePower(World worldIn, BlockPos pos) public void updatePower(World worldIn, BlockPos pos) {
{ if (!worldIn.provider.getHasNoSky()) {
if (!worldIn.provider.getHasNoSky()) IBlockState iblockstate = worldIn.getBlockState(pos);
{ int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted();
IBlockState iblockstate = worldIn.getBlockState(pos); float f = worldIn.getCelestialAngleRadians(1.0F);
int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted();
float f = worldIn.getCelestialAngleRadians(1.0F);
if (this.inverted) if (this.inverted) {
{ i = 15 - i;
i = 15 - i; }
}
if (i > 0 && !this.inverted) if (i > 0 && !this.inverted) {
{ float f1 = f < (float) Math.PI ? 0.0F : ((float) Math.PI * 2F);
float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F); f = f + (f1 - f) * 0.2F;
f = f + (f1 - f) * 0.2F; i = Math.round((float) i * MathHelper.cos(f));
i = Math.round((float)i * MathHelper.cos(f)); }
}
i = MathHelper.clamp_int(i, 0, 15); i = MathHelper.clamp_int(i, 0, 15);
if (((Integer)iblockstate.getValue(POWER)).intValue() != i) if (((Integer) iblockstate.getValue(POWER)).intValue() != i) {
{ worldIn.setBlockState(pos, iblockstate.withProperty(POWER, Integer.valueOf(i)), 3);
worldIn.setBlockState(pos, iblockstate.withProperty(POWER, Integer.valueOf(i)), 3); }
} }
} }
}
public boolean onBlockActivated(World world, BlockPos blockpos, IBlockState iblockstate, EntityPlayer entityplayer, public boolean onBlockActivated(World world, BlockPos blockpos, IBlockState iblockstate, EntityPlayer entityplayer,
EnumFacing enumfacing, float f, float f1, float f2) { EnumFacing enumfacing, float f, float f1, float f2) {

View File

@ -12,7 +12,7 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList; import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**
@ -86,12 +86,11 @@ public class BlockDeadBush extends BlockBush {
} }
/** /**
* Returns the quantity of items to drop on block destruction. * Returns the quantity of items to drop on block destruction.
*/ */
public int quantityDropped(EaglercraftRandom random) public int quantityDropped(EaglercraftRandom random) {
{ return random.nextInt(3);
return random.nextInt(3); }
}
public void harvestBlock(World world, EntityPlayer entityplayer, BlockPos blockpos, IBlockState iblockstate, public void harvestBlock(World world, EntityPlayer entityplayer, BlockPos blockpos, IBlockState iblockstate,
TileEntity tileentity) { TileEntity tileentity) {

View File

@ -13,8 +13,8 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -24,9 +24,9 @@ import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityDispenser; import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.tileentity.TileEntityDropper; import net.minecraft.tileentity.TileEntityDropper;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.RegistryDefaulted; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.registry.RegistryDefaulted;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -13,14 +13,14 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.util.Vec3; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -254,7 +254,7 @@ public class BlockDoor extends Block {
* Ray traces through the blocks collision from start vector to * Ray traces through the blocks collision from start vector to
* end vector returning a ray trace hit. * end vector returning a ray trace hit.
*/ */
public MovingObjectPosition collisionRayTrace(World world, BlockPos blockpos, Vec3 vec3, Vec3 vec31) { public RayTraceResult collisionRayTrace(World world, BlockPos blockpos, Vec3d vec3, Vec3d vec31) {
this.setBlockBoundsBasedOnState(world, blockpos); this.setBlockBoundsBasedOnState(world, blockpos);
return super.collisionRayTrace(world, blockpos, vec3, vec31); return super.collisionRayTrace(world, blockpos, vec3, vec31);
} }

View File

@ -17,9 +17,9 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList; import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.biome.BiomeColorHelper; import net.minecraft.world.biome.BiomeColorHelper;

View File

@ -8,9 +8,9 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.item.EntityFallingBlock; import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -8,8 +8,8 @@ import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityDispenser; import net.minecraft.tileentity.TileEntityDispenser;
import net.minecraft.tileentity.TileEntityDropper; import net.minecraft.tileentity.TileEntityDropper;
import net.minecraft.tileentity.TileEntityHopper; import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -7,8 +7,8 @@ import java.util.Set;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -12,9 +12,9 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityEnchantmentTable; import net.minecraft.tileentity.TileEntityEnchantmentTable;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -10,10 +10,10 @@ import net.minecraft.entity.Entity;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityEndPortal; import net.minecraft.tileentity.TileEntityEndPortal;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -13,9 +13,9 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity; import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -9,11 +9,11 @@ import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -96,13 +96,11 @@ public class BlockEndRod extends Block {
double d3 = (double) (0.4F - (rand.nextFloat() + rand.nextFloat()) * 0.4F); double d3 = (double) (0.4F - (rand.nextFloat() + rand.nextFloat()) * 0.4F);
if (rand.nextInt(5) == 0) { if (rand.nextInt(5) == 0) {
worldIn.spawnParticle(EnumParticleTypes.END_ROD, d0 + (double) worldIn.spawnParticle(EnumParticleTypes.END_ROD, d0 + (double) enumfacing.getFrontOffsetX() * d3,
enumfacing.getFrontOffsetX() * d3, d1 + (double) enumfacing.getFrontOffsetY() * d3, d2 + (double) enumfacing.getFrontOffsetZ() * d3,
d1 + (double) enumfacing.getFrontOffsetY() * d3, d2 + (double) rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D,
enumfacing.getFrontOffsetZ() * d3, rand.nextGaussian() * 0.005D,
rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D, new int[0]);
rand.nextGaussian() * 0.005D,
new int[0]);
} }
} }

View File

@ -17,9 +17,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList; import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityEnderChest; import net.minecraft.tileentity.TileEntityEnderChest;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -1,6 +1,6 @@
package net.minecraft.block; package net.minecraft.block;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
/** /**
* + * +

View File

@ -6,7 +6,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.item.EntityFallingBlock; import net.minecraft.entity.item.EntityFallingBlock;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -13,9 +13,9 @@ import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
@ -92,17 +92,17 @@ public class BlockFarmland extends Block {
} }
/** /**
* Block's chance to react to a living entity falling on it. * Block's chance to react to a living entity falling on it.
*/ */
public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) {
{ if (!worldIn.isRemote && worldIn.rand.nextFloat() < fallDistance - 0.5F && entityIn instanceof EntityLivingBase
if (!worldIn.isRemote && worldIn.rand.nextFloat() < fallDistance - 0.5F && entityIn instanceof EntityLivingBase && (entityIn instanceof EntityPlayer || worldIn.getGameRules().getBoolean("mobGriefing")) && entityIn.width * entityIn.width * entityIn.height > 0.512F) && (entityIn instanceof EntityPlayer || worldIn.getGameRules().getBoolean("mobGriefing"))
{ && entityIn.width * entityIn.width * entityIn.height > 0.512F) {
worldIn.setBlockState(pos, Blocks.dirt.getDefaultState()); worldIn.setBlockState(pos, Blocks.dirt.getDefaultState());
} }
super.onFallenUpon(worldIn, pos, entityIn, fallDistance); super.onFallenUpon(worldIn, pos, entityIn, fallDistance);
} }
private boolean hasCrops(World worldIn, BlockPos pos) { private boolean hasCrops(World worldIn, BlockPos pos) {
Block block = worldIn.getBlockState(pos.up()).getBlock(); Block block = worldIn.getBlockState(pos.up()).getBlock();

View File

@ -13,9 +13,9 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.ItemLead; import net.minecraft.item.ItemLead;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -9,9 +9,9 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -13,11 +13,11 @@ import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockState; import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.WorldProviderEnd; import net.minecraft.world.WorldProviderEnd;

View File

@ -17,11 +17,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList; import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFlowerPot; import net.minecraft.tileentity.TileEntityFlowerPot;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.StatCollector; import net.minecraft.util.StatCollector;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -9,8 +9,8 @@ import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World; import net.minecraft.world.World;
public class BlockFrostedIce extends BlockIce { public class BlockFrostedIce extends BlockIce {

View File

@ -17,9 +17,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList; import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace; import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -8,7 +8,7 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Items; import net.minecraft.init.Items;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.MathHelper; import net.minecraft.util.math.MathHelper;
/** /**
* + * +

View File

@ -10,8 +10,8 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ColorizerGrass; import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -9,9 +9,9 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -10,8 +10,8 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**
@ -103,10 +103,9 @@ public class BlockHay extends BlockRotatedPillar {
} }
/** /**
* Block's chance to react to a living entity falling on it. * Block's chance to react to a living entity falling on it.
*/ */
public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) {
{ entityIn.fall(fallDistance, 0.2F);
entityIn.fall(fallDistance, 0.2F); }
}
} }

View File

@ -21,10 +21,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList; import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityHopper; import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -10,9 +10,9 @@ import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable; import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -11,8 +11,8 @@ import net.minecraft.init.Blocks;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList; import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.EnumSkyBlock; import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -14,8 +14,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound; import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World; import net.minecraft.world.World;
/** /**

View File

@ -7,10 +7,10 @@ import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState; import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs; import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase; import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -10,9 +10,9 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks; import net.minecraft.init.Blocks;
import net.minecraft.item.Item; import net.minecraft.item.Item;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumParticleTypes; import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.EnumWorldBlockLayer; import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ColorizerFoliage; import net.minecraft.world.ColorizerFoliage;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; import net.minecraft.world.World;

View File

@ -1,8 +1,8 @@
package net.minecraft.block; package net.minecraft.block;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing; import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
/** /**

Some files were not shown because too many files have changed in this diff Show More