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;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.EnumSkyBlock;
public interface IChunkLightingData {

View File

@ -1,7 +1,7 @@
package net.hoosiertransfer.Alfheim;
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.IBlockAccess;
@ -9,7 +9,8 @@ public interface ILightInfoProvider {
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);
}

View File

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

View File

@ -1,13 +1,18 @@
package net.hoosiertransfer.Alfheim;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.EnumSkyBlock;
import net.minecraft.world.IBlockAccess;
public interface ILitBlock {
int alfheim$getLightFor(final IBlockState blockState, final IBlockAccess blockAccess, final EnumSkyBlock lightType, 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);
int alfheim$getLightFor(final IBlockState blockState, final IBlockAccess blockAccess, final EnumSkyBlock lightType,
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;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
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);
}
}

View File

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

View File

@ -12,9 +12,8 @@ import net.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.entity.item.EntityArmorStand;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.Vec3;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
public class CullTask implements Runnable {
public boolean requestCull = false;
@ -29,7 +28,7 @@ public class CullTask implements Runnable {
private Vec3d lastPos = 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) {
this.culling = culling;
@ -39,87 +38,99 @@ public class CullTask implements Runnable {
@Override
public void run() {
// while (client != null) {
// try {
// Thread.sleep(Config.SleepDuration);
// try {
// Thread.sleep(Config.SleepDuration);
// if (Config.enableCulling && client.theWorld != null && client.thePlayer != null && client.thePlayer.ticksExisted > 0 && client.getRenderViewEntity() != null) {
// Vec3 cameraMC = getCameraPos();
// if (requestCull || !(cameraMC.xCoord == lastPos.x && cameraMC.yCoord == lastPos.y && cameraMC.zCoord == lastPos.z)) {
// long start = System.currentTimeMillis();
// requestCull = false;
// lastPos.set(cameraMC.xCoord, cameraMC.yCoord, cameraMC.zCoord);
// Vec3d camera = lastPos;
// culling.resetCache();
// boolean noCulling = client.thePlayer.isSpectator() || client.gameSettings.thirdPersonView != 0;
// Iterator<TileEntity> iterator = client.theWorld.loadedTileEntityList.iterator();
// TileEntity entry;
// while(iterator.hasNext()) {
// try {
// entry = iterator.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
// }
// if (unCullable.contains(entry.getBlockType().getUnlocalizedName())) {
// continue;
// }
// if (!entry.isForcedVisible()) {
// if (noCulling) {
// entry.setCulled(true);
// continue;
// }
// BlockPos pos = entry.getPos();
// if(pos.distanceSq(cameraMC.xCoord, cameraMC.yCoord, cameraMC.zCoord) < 64*64) { // 64 is the fixed max tile view distance
// aabbMin.set(pos.getX(), pos.getY(), pos.getZ());
// aabbMax.set(pos.getX()+1d, pos.getY()+1d, pos.getZ()+1d);
// boolean visible = culling.isAABBVisible(aabbMin, aabbMax, camera);
// entry.setCulled(!visible);
// }
// }
// }
// Entity entity = null;
// Iterator<Entity> iterable = client.theWorld.getLoadedEntityList().iterator();
// while(iterable.hasNext()) {
// try {
// 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
// }
// if (entity == null) {
// continue;
// }
// if (!entity.isForcedVisible()) {
// if (noCulling || isSkippableArmorstand(entity)) {
// entity.setCulled(false);
// continue;
// }
// if(entity.getPositionVector().squareDistanceTo(cameraMC) > Config.tracingDistance * Config.tracingDistance) {
// entity.setCulled(false); // If your entity view distance is larger than tracingDistance just render it
// continue;
// }
// AxisAlignedBB boundingBox = entity.getEntityBoundingBox();
// if(boundingBox.maxX - boundingBox.minX > hitboxLimit || boundingBox.maxY - boundingBox.minY > hitboxLimit || boundingBox.maxZ - boundingBox.minZ > hitboxLimit) {
// entity.setCulled(false); // To big to bother to cull
// 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();
// }
// if (Config.enableCulling && client.theWorld != null && client.thePlayer !=
// null && client.thePlayer.ticksExisted > 0 && client.getRenderViewEntity() !=
// null) {
// Vec3 cameraMC = getCameraPos();
// if (requestCull || !(cameraMC.xCoord == lastPos.x && cameraMC.yCoord ==
// lastPos.y && cameraMC.zCoord == lastPos.z)) {
// long start = System.currentTimeMillis();
// requestCull = false;
// lastPos.set(cameraMC.xCoord, cameraMC.yCoord, cameraMC.zCoord);
// Vec3d camera = lastPos;
// culling.resetCache();
// boolean noCulling = client.thePlayer.isSpectator() ||
// client.gameSettings.thirdPersonView != 0;
// Iterator<TileEntity> iterator =
// client.theWorld.loadedTileEntityList.iterator();
// TileEntity entry;
// while(iterator.hasNext()) {
// try {
// entry = iterator.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
// }
// if (unCullable.contains(entry.getBlockType().getUnlocalizedName())) {
// continue;
// }
// if (!entry.isForcedVisible()) {
// if (noCulling) {
// entry.setCulled(true);
// continue;
// }
// BlockPos pos = entry.getPos();
// if(pos.distanceSq(cameraMC.xCoord, cameraMC.yCoord, cameraMC.zCoord) < 64*64)
// { // 64 is the fixed max tile view distance
// aabbMin.set(pos.getX(), pos.getY(), pos.getZ());
// aabbMax.set(pos.getX()+1d, pos.getY()+1d, pos.getZ()+1d);
// boolean visible = culling.isAABBVisible(aabbMin, aabbMax, camera);
// entry.setCulled(!visible);
// }
// }
// }
// Entity entity = null;
// Iterator<Entity> iterable = client.theWorld.getLoadedEntityList().iterator();
// while(iterable.hasNext()) {
// try {
// 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
// }
// if (entity == null) {
// continue;
// }
// if (!entity.isForcedVisible()) {
// if (noCulling || isSkippableArmorstand(entity)) {
// entity.setCulled(false);
// continue;
// }
// if(entity.getPositionVector().squareDistanceTo(cameraMC) >
// Config.tracingDistance * Config.tracingDistance) {
// entity.setCulled(false); // If your entity view distance is larger than
// tracingDistance just render it
// continue;
// }
// AxisAlignedBB boundingBox = entity.getEntityBoundingBox();
// if(boundingBox.maxX - boundingBox.minX > hitboxLimit || boundingBox.maxY -
// boundingBox.minY > hitboxLimit || boundingBox.maxZ - boundingBox.minZ >
// hitboxLimit) {
// entity.setCulled(false); // To big to bother to cull
// 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");
}
private Vec3 getCameraPos() {
private net.minecraft.util.math.Vec3d getCameraPos() {
if (client.gameSettings.thirdPersonView == 0) {
return client.thePlayer.getPositionEyes(0);
}
@ -127,7 +138,9 @@ public class CullTask implements Runnable {
}
private boolean isSkippableArmorstand(Entity entity) {
if (!Config.skipMarkerArmorStands) return false;
return entity instanceof EntityArmorStand && ((EntityArmorStand) entity).func_181026_s(); // i think this is the marker flag
if (!Config.skipMarkerArmorStands)
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.multiplayer.WorldClient;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
public class Provider implements DataProvider {
private final Minecraft client = Minecraft.getMinecraft();

View File

@ -1,8 +1,8 @@
package net.hoosiertransfer.Sodium;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.biome.BiomeColorHelper;
import net.minecraft.util.BlockPos;
public interface SodiumBlockAccess extends IBlockAccess {
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.entity.player.EntityPlayer;
import net.minecraft.util.ITickable;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
/**
* 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.TextureMetadataSectionSerializer;
import net.minecraft.network.ServerStatusResponse;
import net.minecraft.util.ChatStyle;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.text.Style;
import net.minecraft.util.text.ITextComponent;
import net.minecraft.world.gen.ChunkProviderSettings;
/**
@ -137,8 +137,8 @@ public class JSONTypeProvider {
static {
registerType(IChatComponent.class, new IChatComponent.Serializer());
registerType(ChatStyle.class, new ChatStyle.Serializer());
registerType(ITextComponent.class, new ITextComponent.Serializer());
registerType(Style.class, new Style.Serializer());
registerType(ServerStatusResponse.class, new ServerStatusResponse.Serializer());
registerType(ServerStatusResponse.MinecraftProtocolVersionIdentifier.class,
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.particle.EntityFX;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.MathHelper;
import net.hoosiertransfer.Config;
/**
* 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
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (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)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (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
* POSSIBILITY OF SUCH DAMAGE.
*
@ -37,7 +44,7 @@ public class AcceleratedEffectRenderer implements IAcceleratedParticleEngine {
this.partialTicks = partialTicks;
InstancedParticleRenderer.begin();
Entity et = Minecraft.getMinecraft().getRenderViewEntity();
if(et != null) {
if (et != null) {
f1 = MathHelper.cos(et.rotationYaw * 0.017453292F);
f2 = MathHelper.sin(et.rotationYaw * 0.017453292F);
f3 = -f2 * MathHelper.sin(et.rotationPitch * 0.017453292F);
@ -48,44 +55,55 @@ public class AcceleratedEffectRenderer implements IAcceleratedParticleEngine {
@Override
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);
}
@Override
public void drawParticle(Entity entityIn, int particleIndexX, int particleIndexY, int lightMapData,
int texSize, float particleSize, float r, float g, float b, float a) {
if (!Config.renderParticles()) return;
float xx = (float) (entityIn.prevPosX + (entityIn.posX - entityIn.prevPosX) * (double) partialTicks - 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);
if (!Config.renderParticles())
return;
float xx = (float) (entityIn.prevPosX + (entityIn.posX - entityIn.prevPosX) * (double) partialTicks
- 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);
}
@Override
public void drawParticle(Entity entityIn, int particleIndexX, int particleIndexY, int lightMapData,
int texSize, float particleSize, int rgba) {
if (!Config.renderParticles()) return;
float xx = (float) (entityIn.prevPosX + (entityIn.posX - entityIn.prevPosX) * (double) partialTicks - 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);
if (!Config.renderParticles())
return;
float xx = (float) (entityIn.prevPosX + (entityIn.posX - entityIn.prevPosX) * (double) partialTicks
- 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);
}
@Override
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) {
if (!Config.renderParticles()) return;
if (!Config.renderParticles())
return;
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
public void drawParticle(float posX, float posY, float posZ, int particleIndexX, int particleIndexY,
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,
(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.vector.Matrix4f;
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.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.vector.Vector3f;
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

View File

@ -22,19 +22,26 @@ import net.lax1dude.eaglercraft.v1_8.vector.Matrix4f;
import net.lax1dude.eaglercraft.v1_8.vector.Vector3f;
import net.minecraft.client.Minecraft;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.MathHelper;
/**
* 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
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (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)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (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
* POSSIBILITY OF SUCH DAMAGE.
*
@ -126,7 +133,8 @@ public class CloudRenderWorker {
ByteBuffer cloudNoiseDatBuffer = EagRuntime.allocateByteBuffer(cloudNoiseDat.length);
cloudNoiseDatBuffer.put(cloudNoiseDat);
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);
cloud3DSamplesTexture = GlStateManager.generateTexture();
@ -140,14 +148,15 @@ public class CloudRenderWorker {
cloud3DSamplesTextureSizeZ, 0, GL_RED, GL_UNSIGNED_BYTE, (ByteBuffer) null);
cloud3DSamplesSlices = new IFramebufferGL[cloud3DSamplesTextureSizeZ];
for(int i = 0; i < cloud3DSamplesTextureSizeZ; ++i) {
for (int i = 0; i < cloud3DSamplesTextureSizeZ; ++i) {
cloud3DSamplesSlices[i] = _wglCreateFramebuffer();
_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);
for(int i = 0; i < 4; ++i) {
for (int i = 0; i < 4; ++i) {
cloudNoiseSampleParaboloidFramebuffer[i] = _wglCreateFramebuffer();
_wglBindFramebuffer(_GL_FRAMEBUFFER, cloudNoiseSampleParaboloidFramebuffer[i]);
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_MIN_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);
_wglFramebufferTexture2D(_GL_FRAMEBUFFER, _GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, EaglercraftGPU.getNativeTexture(cloudNoiseSampleParaboloidTexture[i]), 0);
EaglercraftGPU.createFramebufferHDR16FTexture(GL_TEXTURE_2D, 0, cloudParaboloidTextureSize,
cloudParaboloidTextureSize, GL_RGBA, true);
_wglFramebufferTexture2D(_GL_FRAMEBUFFER, _GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
EaglercraftGPU.getNativeTexture(cloudNoiseSampleParaboloidTexture[i]), 0);
GlStateManager.clear(GL_COLOR_BUFFER_BIT);
}
@ -172,7 +183,8 @@ public class CloudRenderWorker {
cloudNoiseDatBuffer = EagRuntime.allocateByteBuffer(cloudShapeTexture.length);
cloudNoiseDatBuffer.put(cloudShapeTexture);
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);
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_MIN_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);
_wglFramebufferTexture2D(_GL_FRAMEBUFFER, _GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, EaglercraftGPU.getNativeTexture(cloudOcclusionTexture), 0);
_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);
}
static void setPosition(float x, float y, float z) {
@ -208,11 +221,11 @@ public class CloudRenderWorker {
static void update() {
long millis = System.currentTimeMillis();
int cloudProgress = (int)(millis - cloudStartTimer);
int cloudProgress = (int) (millis - cloudStartTimer);
int totalCloudSteps = 32 + 32 - 1;
int currentCloudStep = cloudProgress * totalCloudSteps / cloudRenderPeriod;
boolean b = false;
if(currentCloudStep > totalCloudSteps) {
if (currentCloudStep > totalCloudSteps) {
currentCloudStep = totalCloudSteps;
b = true;
}
@ -222,11 +235,12 @@ public class CloudRenderWorker {
WorldClient wc = Minecraft.getMinecraft().theWorld;
float rain = wc.getRainStrength(0.0f);
if(cloudRenderProgress == 0) {
if (cloudRenderProgress == 0) {
shader_clouds_noise3d.useProgram();
_wglUniform2f(shader_clouds_noise3d.uniforms.u_textureSize2f, 1.0f / cloud3DSamplesTextureSizeX, 1.0f / cloud3DSamplesTextureSizeY);
float m = (float)((millis % 1200000l) * 0.00002);
_wglUniform3f(shader_clouds_noise3d.uniforms.u_cloudMovement3f, m, 0.0f, m);//2.213f, 0.0f, 2.213f);
_wglUniform2f(shader_clouds_noise3d.uniforms.u_textureSize2f, 1.0f / cloud3DSamplesTextureSizeX,
1.0f / cloud3DSamplesTextureSizeY);
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();
tmpVector1.set(renderViewX * playerCoordsNoiseMapScale, 0.0f, renderViewZ * playerCoordsNoiseMapScale);
@ -255,7 +269,8 @@ public class CloudRenderWorker {
_wglUniform1f(shader_clouds_sample.uniforms.u_cloudTimer1f, 0.0f);
_wglUniform3f(shader_clouds_sample.uniforms.u_cloudOffset3f, renderViewX, renderViewY, renderViewZ);
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.set(DeferredStateManager.currentSunLightColor);
float luma = currentSunAngle.x * 0.299f + currentSunAngle.y * 0.587f + currentSunAngle.z * 0.114f;
@ -268,17 +283,21 @@ public class CloudRenderWorker {
cloudColorB += (currentSunAngle.z - cloudColorB) * 0.1f;
_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;
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;
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);
_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.bindTexture(cloudNoiseTexture);
@ -288,14 +307,14 @@ public class CloudRenderWorker {
boolean shapeAllow = isDrawingCloudShapes;
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;
boolean drawShape = false;
if(isDrawingCloudShapes && shapeAllow) {
if(ccl >= shapePosZ && ccl < shapePosZ + shapeSizeZ) {
if (isDrawingCloudShapes && shapeAllow) {
if (ccl >= shapePosZ && ccl < shapePosZ + shapeSizeZ) {
drawShape = true;
if(!shapeInit) {
if (!shapeInit) {
shapeInit = true;
Matrix3f mat = tmpMatrix2;
mat.setIdentity();
@ -305,8 +324,8 @@ public class CloudRenderWorker {
mat.m11 = mat.m00;
mat = tmpMatrix3;
mat.setIdentity();
mat.m00 = (float)shapeSizeX * 0.5f;
mat.m11 = (float)shapeSizeY * 0.5f;
mat.m00 = (float) shapeSizeX * 0.5f;
mat.m11 = (float) shapeSizeY * 0.5f;
Matrix3f.mul(tmpMatrix2, mat, tmpMatrix2);
tmpMatrix2.m20 = shapePosX - renderViewX * playerCoordsNoiseMapScale * 128.0f;
tmpMatrix2.m21 = shapePosY - renderViewZ * playerCoordsNoiseMapScale * 128.0f;
@ -317,10 +336,10 @@ public class CloudRenderWorker {
mat = tmpMatrix2;
mat.m20 -= 1.0f;
mat.m21 -= 1.0f;
if(!checkFrustum(mat)) {
if (!checkFrustum(mat)) {
drawShape = false;
shapeAllow = false;
}else {
} else {
matrixCopyBuffer.clear();
matrixCopyBuffer.put(mat.m00);
matrixCopyBuffer.put(mat.m01);
@ -330,7 +349,8 @@ public class CloudRenderWorker {
matrixCopyBuffer.put(mat.m21);
matrixCopyBuffer.flip();
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);
_wglUniform2f(shader_clouds_shapes.uniforms.u_sampleWeights2f, 0.35f, 0.55f);
}
@ -341,15 +361,17 @@ public class CloudRenderWorker {
shader_clouds_noise3d.useProgram();
_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();
if(drawShape) {
if (drawShape) {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL_ONE, GL_SRC_ALPHA);
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);
DrawUtils.drawStandardQuad2D();
GlStateManager.disableBlend();
@ -358,14 +380,16 @@ public class CloudRenderWorker {
}
_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();
if(drawShape && ccl + 1 < shapePosZ + shapeSizeZ) {
if (drawShape && ccl + 1 < shapePosZ + shapeSizeZ) {
GlStateManager.enableBlend();
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);
DrawUtils.drawStandardQuad2D();
GlStateManager.disableBlend();
@ -373,7 +397,7 @@ public class CloudRenderWorker {
}
}
if(currentCloudStep >= 32 && currentCloudStep > cloudRenderProgress) {
if (currentCloudStep >= 32 && currentCloudStep > cloudRenderProgress) {
_wglBindFramebuffer(_GL_FRAMEBUFFER, cloudNoiseSampleParaboloidFramebuffer[cloudRenderPhase]);
GlStateManager.viewport(0, 0, cloudParaboloidTextureSize, cloudParaboloidTextureSize);
@ -386,8 +410,9 @@ public class CloudRenderWorker {
GlStateManager.enableBlend();
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) {
if(i == 0) {
for (int i = cloudRenderProgress > 32 ? cloudRenderProgress - 32 : 0,
j = currentCloudStep - 31; i < j; ++i) {
if (i == 0) {
GlStateManager.clearColor(0.0f, 0.0f, 0.0f, 1.0f);
GlStateManager.clear(GL_COLOR_BUFFER_BIT);
}
@ -402,20 +427,21 @@ public class CloudRenderWorker {
GlStateManager.disableBlend();
}
if(b) {
if (b) {
cloudRenderProgress = 0;
cloudStartTimer = System.currentTimeMillis();
cloudProgress = 0;
cloudRenderPhase = (cloudRenderPhase + 1) % 3;
}else {
} else {
cloudRenderProgress = currentCloudStep;
}
_wglBindFramebuffer(_GL_FRAMEBUFFER, cloudNoiseSampleParaboloidFramebuffer[3]);
GlStateManager.viewport(0, 0, cloudParaboloidTextureSize, cloudParaboloidTextureSize);
float fadeFactor = cloudProgress / (float)cloudRenderPeriod;
if(fadeFactor > 1.0f) fadeFactor = 1.0f;
float fadeFactor = cloudProgress / (float) cloudRenderPeriod;
if (fadeFactor > 1.0f)
fadeFactor = 1.0f;
GlStateManager.setActiveTexture(GL_TEXTURE0);
GlStateManager.bindTexture(cloudNoiseSampleParaboloidTexture[(cloudRenderPhase + 1) % 3]);
TextureCopyUtil.blitTexture();
@ -429,10 +455,10 @@ public class CloudRenderWorker {
_wglBindFramebuffer(_GL_FRAMEBUFFER, cloudOcclusionFramebuffer);
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.clear(GL_COLOR_BUFFER_BIT);
}else if(DeferredStateManager.currentSunLightAngle.y < 0.0f) {
} else if (DeferredStateManager.currentSunLightAngle.y < 0.0f) {
shader_clouds_sun_occlusion.useProgram();
GlStateManager.bindTexture(cloudNoiseSampleParaboloidTexture[3]);
matrixCopyBuffer.clear();
@ -468,71 +494,71 @@ public class CloudRenderWorker {
matrixCopyBuffer.flip();
_wglUniformMatrix4x3fv(shader_clouds_sun_occlusion.uniforms.u_sampleMatrix4x3f, false, matrixCopyBuffer);
if(rain > 0.0f) {
if (rain > 0.0f) {
GlStateManager.enableBlend();
GlStateManager.blendFunc(GL_CONSTANT_ALPHA, GL_ZERO);
GlStateManager.setBlendConstants(0.0f, 0.0f, 0.0f, 1.0f - rain);
DrawUtils.drawStandardQuad2D();
GlStateManager.disableBlend();
}else {
} else {
DrawUtils.drawStandardQuad2D();
}
}else {
} else {
GlStateManager.clearColor(1.0f, 1.0f, 1.0f, 1.0f);
GlStateManager.clear(GL_COLOR_BUFFER_BIT);
}
}
static void destroy() {
if(cloudNoiseTexture != -1) {
if (cloudNoiseTexture != -1) {
GlStateManager.deleteTexture(cloudNoiseTexture);
cloudNoiseTexture = -1;
}
for(int i = 0; i < 4; ++i) {
if(cloudNoiseSampleParaboloidFramebuffer[i] != null) {
for (int i = 0; i < 4; ++i) {
if (cloudNoiseSampleParaboloidFramebuffer[i] != null) {
_wglDeleteFramebuffer(cloudNoiseSampleParaboloidFramebuffer[i]);
cloudNoiseSampleParaboloidFramebuffer[i] = null;
}
if(cloudNoiseSampleParaboloidTexture[i] != -1) {
if (cloudNoiseSampleParaboloidTexture[i] != -1) {
GlStateManager.deleteTexture(cloudNoiseSampleParaboloidTexture[i]);
cloudNoiseSampleParaboloidTexture[i] = -1;
}
}
if(cloud3DSamplesTexture != -1) {
if (cloud3DSamplesTexture != -1) {
GlStateManager.deleteTexture(cloud3DSamplesTexture);
cloud3DSamplesTexture = -1;
}
if(cloud3DSamplesSlices != null) {
for(int i = 0; i < cloud3DSamplesSlices.length; ++i) {
if (cloud3DSamplesSlices != null) {
for (int i = 0; i < cloud3DSamplesSlices.length; ++i) {
_wglDeleteFramebuffer(cloud3DSamplesSlices[i]);
}
cloud3DSamplesSlices = null;
}
if(cloudSpecialShapeTexture != -1) {
if (cloudSpecialShapeTexture != -1) {
GlStateManager.deleteTexture(cloudSpecialShapeTexture);
cloudSpecialShapeTexture = -1;
}
if(cloudOcclusionFramebuffer != null) {
if (cloudOcclusionFramebuffer != null) {
_wglDeleteFramebuffer(cloudOcclusionFramebuffer);
cloudOcclusionFramebuffer = null;
}
if(cloudOcclusionTexture != -1) {
if (cloudOcclusionTexture != -1) {
GlStateManager.deleteTexture(cloudOcclusionTexture);
cloudOcclusionTexture = -1;
}
if(shader_clouds_noise3d != null) {
if (shader_clouds_noise3d != null) {
shader_clouds_noise3d.destroy();
shader_clouds_noise3d = null;
}
if(shader_clouds_shapes != null) {
if (shader_clouds_shapes != null) {
shader_clouds_shapes.destroy();
shader_clouds_shapes = null;
}
if(shader_clouds_sample != null) {
if (shader_clouds_sample != null) {
shader_clouds_sample.destroy();
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 = null;
}
@ -540,38 +566,42 @@ public class CloudRenderWorker {
private static void updateShape() {
long millis = System.currentTimeMillis();
float dt = (float)((millis - shapeUpdateTimer) * 0.001);
float dt = (float) ((millis - shapeUpdateTimer) * 0.001);
shapeUpdateTimer = millis;
if(millis > nextShapeAppearance) {
if (millis > nextShapeAppearance) {
float playerCoordsNoiseMapScale = 0.02f * 128.0f;
if(!isDrawingCloudShapes) {
if (!isDrawingCloudShapes) {
float shapeScaleBase = rand.nextFloat() * 3.0f + 2.0f;
shapeSizeX = (int)(32 * shapeScaleBase * (0.9f + rand.nextFloat() * 0.2f));
shapeSizeY = (int)(16 * shapeScaleBase * (0.95f + rand.nextFloat() * 0.1f));
shapeSizeZ = (int)(24 * shapeScaleBase * (0.48f + rand.nextFloat() * 0.04f));
shapeSizeX = (int) (32 * shapeScaleBase * (0.9f + rand.nextFloat() * 0.2f));
shapeSizeY = (int) (16 * shapeScaleBase * (0.95f + rand.nextFloat() * 0.1f));
shapeSizeZ = (int) (24 * shapeScaleBase * (0.48f + rand.nextFloat() * 0.04f));
do {
shapePosX = (int)(cloud3DSamplesTextureSizeX * (rand.nextFloat() * 1.5f - 0.75f));
shapePosY = (int)(cloud3DSamplesTextureSizeY * (rand.nextFloat() * 1.5f - 0.75f));
}while(shapePosX > -192 && shapePosY > -192 && shapePosX < 192 && shapePosY < 192);
shapePosX = (int) (cloud3DSamplesTextureSizeX * (rand.nextFloat() * 1.5f - 0.75f));
shapePosY = (int) (cloud3DSamplesTextureSizeY * (rand.nextFloat() * 1.5f - 0.75f));
} while (shapePosX > -192 && shapePosY > -192 && shapePosX < 192 && shapePosY < 192);
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;
shapePosX += renderViewX * playerCoordsNoiseMapScale + cloud3DSamplesTextureSizeX * 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;
}else {
} else {
float dx = MathHelper.cos(-shapeRotate * 0.0174532f);
float dy = MathHelper.sin(-shapeRotate * 0.0174532f);
shapePosX += (int)(dx * 10.0f * dt);
shapePosY -= (int)(dy * 10.0f * dt);
if(MathHelper.abs(shapePosX - renderViewX * playerCoordsNoiseMapScale - cloud3DSamplesTextureSizeX * 0.5f) > 300.0f ||
MathHelper.abs(shapePosY - renderViewZ * playerCoordsNoiseMapScale - cloud3DSamplesTextureSizeY * 0.5f) > 300.0f) {
shapePosX += (int) (dx * 10.0f * dt);
shapePosY -= (int) (dy * 10.0f * dt);
if (MathHelper
.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);
isDrawingCloudShapes = false;
}
}
}else {
} else {
isDrawingCloudShapes = false;
}
}
@ -582,25 +612,25 @@ public class CloudRenderWorker {
tmp.y = -1.0f;
tmp.z = 1.0f;
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;
}
tmp.x = 1.0f;
tmp.y = -1.0f;
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;
}
tmp.x = 1.0f;
tmp.y = 1.0f;
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;
}
tmp.x = -1.0f;
tmp.y = 1.0f;
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 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.Vector4f;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.MathHelper;
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.resources.I18n;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.MathHelper;
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.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.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.MathHelper;
/**
* 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.minecraft.client.Minecraft;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.MathHelper;
/**
* 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.Vector3f;
import net.minecraft.client.Minecraft;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.MathHelper;
/**
* 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
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (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)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (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
* POSSIBILITY OF SUCH DAMAGE.
*
*/
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 int ghostsSpriteCount = 4;
@ -72,7 +79,7 @@ public class LensFlareMeshRenderer {
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.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));
@ -158,12 +165,12 @@ public class LensFlareMeshRenderer {
streaksTexture = GlStateManager.generateTexture();
GlStateManager.bindTexture(streaksTexture);
byte[] flareTex = EagRuntime.getResourceBytes(streaksTextureLocation);
if(flareTex == null) {
if (flareTex == null) {
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);
}catch(IOException ex) {
} catch (IOException ex) {
EagRuntime.freeByteBuffer(copyBuffer);
throw new RuntimeException("Could not load: " + streaksTextureLocation, ex);
}
@ -171,12 +178,12 @@ public class LensFlareMeshRenderer {
ghostsTexture = GlStateManager.generateTexture();
GlStateManager.bindTexture(ghostsTexture);
flareTex = EagRuntime.getResourceBytes(ghostsTextureLocation);
if(flareTex == null) {
if (flareTex == null) {
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);
}catch(IOException ex) {
} catch (IOException ex) {
EagRuntime.freeByteBuffer(copyBuffer);
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);
_wglPixelStorei(GL_UNPACK_ALIGNMENT, 1);
int mip = 0;
while(dis.read() == 'E') {
while (dis.read() == 'E') {
int w = dis.readShort();
int h = dis.readShort();
copyBuffer.clear();
for(int i = 0, l = w * h; i < l; ++i) {
copyBuffer.put((byte)dis.read());
for (int i = 0, l = w * h; i < l; ++i) {
copyBuffer.put((byte) dis.read());
}
copyBuffer.flip();
_wglTexImage2D(GL_TEXTURE_2D, mip++, _GL_R8, w, h, 0, GL_RED, GL_UNSIGNED_BYTE, copyBuffer);
@ -255,16 +262,18 @@ public class LensFlareMeshRenderer {
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 + 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(scale);
copyBuffer.putFloat(0.0f);
copyBuffer.putFloat((float)sprite / ghostsSpriteCount);
copyBuffer.putFloat((float) sprite / ghostsSpriteCount);
copyBuffer.putFloat(1.0f);
copyBuffer.putFloat(1.0f / ghostsSpriteCount);
copyBuffer.putFloat(r * a);
@ -287,7 +296,7 @@ public class LensFlareMeshRenderer {
streaksProgram.useProgram();
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 size = 0.075f * fov * (1.0f + MathHelper.sqrt_float(sunScreenX * sunScreenX + sunScreenY * sunScreenY));
@ -298,7 +307,8 @@ public class LensFlareMeshRenderer {
tmpMat.m20 = sunScreenX;
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.m00 = MathHelper.cos(rotation);
@ -311,9 +321,9 @@ public class LensFlareMeshRenderer {
Vector3f v = DeferredStateManager.currentSunLightColor;
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;
if(mag < 0.0f) {
if (mag < 0.0f) {
mag = 0.0f;
}
}
@ -340,35 +350,35 @@ public class LensFlareMeshRenderer {
}
static void destroy() {
if(streaksVertexArray != null) {
if (streaksVertexArray != null) {
_wglDeleteVertexArrays(streaksVertexArray);
streaksVertexArray = null;
}
if(streaksVertexBuffer != null) {
if (streaksVertexBuffer != null) {
_wglDeleteBuffers(streaksVertexBuffer);
streaksVertexBuffer = null;
}
if(ghostsVertexArray != null) {
if (ghostsVertexArray != null) {
_wglDeleteVertexArrays(ghostsVertexArray);
ghostsVertexArray = null;
}
if(ghostsVertexBuffer != null) {
if (ghostsVertexBuffer != null) {
_wglDeleteBuffers(ghostsVertexBuffer);
ghostsVertexBuffer = null;
}
if(streaksTexture != -1) {
if (streaksTexture != -1) {
GlStateManager.deleteTexture(streaksTexture);
streaksTexture = -1;
}
if(ghostsTexture != -1) {
if (ghostsTexture != -1) {
GlStateManager.deleteTexture(ghostsTexture);
ghostsTexture = -1;
}
if(streaksProgram != null) {
if (streaksProgram != null) {
streaksProgram.destroy();
streaksProgram = null;
}
if(ghostsProgram != null) {
if (ghostsProgram != null) {
ghostsProgram.destroy();
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.minecraft.client.Minecraft;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.MathHelper;
/**
* 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
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (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)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (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
* POSSIBILITY OF SUCH DAMAGE.
*
@ -27,7 +34,8 @@ public class TextureClockPBRImpl extends EaglerTextureAtlasSpritePBR {
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()) {
Minecraft minecraft = Minecraft.getMinecraft();
double d0 = 0.0;
@ -53,7 +61,8 @@ public class TextureClockPBRImpl extends EaglerTextureAtlasSpritePBR {
this.smoothParam1 += this.smoothParam2;
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.minecraft.client.Minecraft;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
/**
* 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
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (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)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (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
* POSSIBILITY OF SUCH DAMAGE.
*
@ -29,13 +36,16 @@ public class TextureCompassPBRImpl extends EaglerTextureAtlasSpritePBR {
super(spriteName);
}
public void updateAnimationPBR(IFramebufferGL[] copyColorFramebuffer, IFramebufferGL[] copyMaterialFramebuffer, int materialOffset) {
public void updateAnimationPBR(IFramebufferGL[] copyColorFramebuffer, IFramebufferGL[] copyMaterialFramebuffer,
int materialOffset) {
Minecraft minecraft = Minecraft.getMinecraft();
if (minecraft.theWorld != null && minecraft.thePlayer != null) {
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 {
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.EaglerDeferredPipeline;
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.

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.renderer.GLAllocation;
import net.minecraft.entity.Entity;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.MathHelper;
/**
* 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.minecraft.client.particle.EffectRenderer;
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.

View File

@ -22,7 +22,7 @@ import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.item.ItemStack;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.MathHelper;
/**
* 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.GuiScreen;
import net.minecraft.client.multiplayer.GuiConnecting;
import net.minecraft.util.ChatComponentText;
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
@ -135,7 +135,7 @@ public class ConnectionHandshake {
di.read(dat);
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;
} else if (type == HandshakePacketTypes.PROTOCOL_SERVER_VERSION) {
@ -144,7 +144,7 @@ public class ConnectionHandshake {
if (serverVers != protocolV2 && serverVers != protocolV3) {
logger.info("Incompatible server version: {}", serverVers);
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;
}
@ -152,7 +152,7 @@ public class ConnectionHandshake {
if (gameVers != 47) {
logger.info("Incompatible minecraft protocol version: {}", gameVers);
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;
}
@ -197,7 +197,7 @@ public class ConnectionHandshake {
logger.error(
"Plaintext authentication was attempted but no user confirmation has been given to proceed");
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")));
return false;
}
@ -269,7 +269,7 @@ public class ConnectionHandshake {
} else {
logger.error("Unsupported authentication type: {}", authType);
mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed",
new ChatComponentText(
new TextComponentString(
EnumChatFormatting.RED + "Unsupported authentication type: " + authType + "\n\n"
+ EnumChatFormatting.GRAY + "(Use a newer version of the client)")));
return false;
@ -370,7 +370,7 @@ public class ConnectionHandshake {
di.read(dat);
String errStr = new String(dat, StandardCharsets.UTF_8);
mc.displayGuiScreen(new GuiDisconnected(ret, "connect.failed",
IChatComponent.Serializer.jsonToComponent(errStr)));
ITextComponent.Serializer.jsonToComponent(errStr)));
return false;
} else if (type == HandshakePacketTypes.PROTOCOL_SERVER_ERROR) {
showError(mc, connecting, ret, di, serverVers == protocolV2);
@ -429,18 +429,18 @@ public class ConnectionHandshake {
RateLimitTracker.registerLockOut(PlatformNetworking.getCurrentURI());
mc.displayGuiScreen(GuiDisconnected.createRateLimitKick(scr));
} 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")) {
EaglerProfile.updateUsernameCookieFromLocalStorage();
reloadPage();
}
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) {
mc.displayGuiScreen(new GuiAuthenticationScreen(connecting, scr, errStr));
} else {
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.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.ITextComponent;
/**
* Copyright (c) 2022-2024 lax1dude, hoosiertransfer, ayunami2000. All Rights
@ -85,7 +85,7 @@ public class EaglercraftNetworkManager {
@JSBody(params = {}, script = "window.onbeforeunload = null; location.reload();")
public static native void reloadPage();
public void closeChannel(IChatComponent reason) {
public void closeChannel(ITextComponent reason) {
PlatformNetworking.playDisconnect();
if (nethandler != null) {
nethandler.onDisconnect(reason);
@ -210,7 +210,7 @@ public class EaglercraftNetworkManager {
processReceivedPackets(); // catch kick message
} catch (IOException e) {
}
doClientDisconnect(new ChatComponentTranslation("disconnect.endOfStream"));
doClientDisconnect(new TextComponentTranslation("disconnect.endOfStream"));
return true;
} else {
return false;
@ -219,7 +219,7 @@ public class EaglercraftNetworkManager {
protected boolean clientDisconnected = false;
protected void doClientDisconnect(IChatComponent msg) {
protected void doClientDisconnect(ITextComponent msg) {
if (!clientDisconnected) {
clientDisconnected = true;
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.minecraft.client.Minecraft;
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.
*
* 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
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (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)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (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
* POSSIBILITY OF SUCH DAMAGE.
*
@ -38,31 +45,34 @@ public class SkullCommand {
}
public void tick() {
if(waitingForSelection && EagRuntime.fileChooserHasResult()) {
if (waitingForSelection && EagRuntime.fileChooserHasResult()) {
waitingForSelection = false;
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;
}
ImageData loaded = ImageData.loadImageFile(fr.fileData);
if(loaded == null) {
mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("command.skull.error.invalid.png"));
if (loaded == null) {
mc.ingameGUI.getChatGUI()
.printChatMessage(new TextComponentTranslation("command.skull.error.invalid.png"));
return;
}
if(loaded.width != 64 || loaded.height > 64) {
mc.ingameGUI.getChatGUI().printChatMessage(new ChatComponentTranslation("command.skull.error.invalid.skin", loaded.width, loaded.height));
if (loaded.width != 64 || loaded.height > 64) {
mc.ingameGUI.getChatGUI().printChatMessage(
new TextComponentTranslation("command.skull.error.invalid.skin", loaded.width, loaded.height));
return;
}
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;
k = loaded.pixels[i];
rawSkin[j] = (byte)(k >> 24);
rawSkin[j + 1] = (byte)(k >> 16);
rawSkin[j + 2] = (byte)(k >> 8);
rawSkin[j + 3] = (byte)(k & 0xFF);
rawSkin[j] = (byte) (k >> 24);
rawSkin[j + 1] = (byte) (k >> 16);
rawSkin[j + 2] = (byte) (k >> 8);
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.network.EnumConnectionState;
import net.minecraft.network.login.client.C00PacketLoginStart;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.text.TextComponentString;
import java.io.IOException;
@ -81,7 +81,7 @@ public class GuiScreenLANConnecting extends GuiScreen {
if (mc.currentScreen == this) {
mc.loadWorld(null);
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());
if (networkManager == null) {
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;
}

View File

@ -13,19 +13,26 @@ import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.resources.I18n;
import net.minecraft.network.EnumConnectionState;
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.
*
* 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
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (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)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (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
* POSSIBILITY OF SUCH DAMAGE.
*
@ -47,8 +54,10 @@ public class GuiScreenSingleplayerConnecting extends GuiScreen {
}
public void initGui() {
if(startStartTime == 0) this.startStartTime = System.currentTimeMillis();
this.buttonList.add(killTask = new GuiButton(0, this.width / 2 - 100, this.height / 3 + 50, I18n.format("singleplayer.busy.killTask")));
if (startStartTime == 0)
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;
}
@ -60,10 +69,12 @@ public class GuiScreenSingleplayerConnecting extends GuiScreen {
long millis = System.currentTimeMillis();
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;
if(elapsed > 3) {
if (elapsed > 3) {
this.drawCenteredString(fontRendererObj, "(" + elapsed + "s)", this.width / 2, top + 25, 0xFFFFFF);
}
@ -87,8 +98,10 @@ public class GuiScreenSingleplayerConnecting extends GuiScreen {
this.mc.getSession().setLAN();
this.mc.clearTitles();
this.networkManager.setConnectionState(EnumConnectionState.LOGIN);
this.networkManager.setNetHandler(new NetHandlerSingleplayerLogin(this.networkManager, this.mc, this.menu));
this.networkManager.sendPacket(new C00PacketLoginStart(this.mc.getSession().getProfile(), EaglerProfile.getSkinPacket(), EaglerProfile.getCapePacket()));
this.networkManager.setNetHandler(
new NetHandlerSingleplayerLogin(this.networkManager, this.mc, this.menu));
this.networkManager.sendPacket(new C00PacketLoginStart(this.mc.getSession().getProfile(),
EaglerProfile.getSkinPacket(), EaglerProfile.getCapePacket()));
}
try {
this.networkManager.processReceivedPackets();
@ -99,7 +112,8 @@ public class GuiScreenSingleplayerConnecting extends GuiScreen {
this.mc.getSession().reset();
if (mc.currentScreen == this) {
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")));
}
}
}
@ -107,15 +121,15 @@ public class GuiScreenSingleplayerConnecting extends GuiScreen {
}
long millis = System.currentTimeMillis();
if(millis - startStartTime > 6000l && SingleplayerServerController.canKillWorker()) {
if (millis - startStartTime > 6000l && SingleplayerServerController.canKillWorker()) {
killTask.enabled = true;
}
}
protected void actionPerformed(GuiButton par1GuiButton) {
if(par1GuiButton.id == 0) {
if (par1GuiButton.id == 0) {
SingleplayerServerController.killWorker();
this.mc.loadWorld((WorldClient)null);
this.mc.loadWorld((WorldClient) null);
this.mc.getSession().reset();
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.GuiTextField;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.WorldSettings;
/**
@ -162,7 +162,7 @@ public class GuiShareToLan extends GuiScreen {
if (code != null) {
SingleplayerServerController.configureLAN(WorldSettings.GameType.getByName(this.gameMode),
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)));
} else {
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.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.ITextComponent;
import java.io.IOException;
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
&& fullData[2] == (byte) 0x0E) {
logger.error("Detected a 1.5 LAN server!");
this.closeChannel(new ChatComponentTranslation("singleplayer.outdatedLANServerKick"));
this.closeChannel(new TextComponentTranslation("singleplayer.outdatedLANServerKick"));
firstPacket = false;
return;
}
@ -414,7 +414,7 @@ public class LANClientNetworkManager extends EaglercraftNetworkManager {
}
@Override
public void closeChannel(IChatComponent reason) {
public void closeChannel(ITextComponent reason) {
if (!PlatformWebRTC.clientLANClosed()) {
PlatformWebRTC.clientLANCloseConnection();
}
@ -432,7 +432,7 @@ public class LANClientNetworkManager extends EaglercraftNetworkManager {
processReceivedPackets(); // catch kick message
} catch (IOException e) {
}
doClientDisconnect(new ChatComponentTranslation("disconnect.endOfStream"));
doClientDisconnect(new TextComponentTranslation("disconnect.endOfStream"));
}
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.CommandException;
import net.minecraft.command.ICommandSender;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.text.TextComponentTranslation;
/**
* 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
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (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)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (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
* POSSIBILITY OF SUCH DAMAGE.
*
@ -49,7 +56,7 @@ public class ClientCommandDummy extends CommandBase {
@Override
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.minecraft.network.EnumConnectionState;
import net.minecraft.server.network.NetHandlerLoginServer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.ReportedException;
import net.minecraft.util.StringTranslate;
import net.minecraft.util.text.TextComponentString;
import net.minecraft.world.EnumDifficulty;
import net.minecraft.world.WorldSettings;
import net.minecraft.world.WorldSettings.GameType;
@ -114,7 +114,7 @@ public class EaglerIntegratedServerWorker {
public static void closeChannel(String channel) {
IntegratedServerPlayerNetworkManager netmanager = openChannels.remove(channel);
if (netmanager != null) {
netmanager.closeChannel(new ChatComponentText("End of stream"));
netmanager.closeChannel(new TextComponentString("End of stream"));
sendIPCPacket(new IPCPacket0CPlayerChannel(channel, false));
}
}

View File

@ -18,8 +18,8 @@ import net.minecraft.init.Items;
import net.minecraft.item.ItemStack;
import net.minecraft.network.PacketBuffer;
import net.minecraft.network.play.server.S3FPacketCustomPayload;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.nbt.NBTTagList;
import net.minecraft.nbt.NBTTagString;
@ -27,14 +27,21 @@ import net.minecraft.nbt.NBTTagString;
/**
* 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
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (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)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (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
* POSSIBILITY OF SUCH DAMAGE.
*
@ -48,11 +55,11 @@ public class IntegratedSkinService {
public static final byte[] skullNotFoundTexture = new byte[4096];
static {
for(int y = 0; y < 16; ++y) {
for(int x = 0; x < 64; ++x) {
for (int y = 0; y < 16; ++y) {
for (int x = 0; x < 64; ++x) {
int i = (y << 8) | (x << 2);
byte j = ((x + y) & 1) == 1 ? (byte)255 : 0;
skullNotFoundTexture[i] = (byte)255;
byte j = ((x + y) & 1) == 1 ? (byte) 255 : 0;
skullNotFoundTexture[i] = (byte) 255;
skullNotFoundTexture[i + 1] = j;
skullNotFoundTexture[i + 2] = 0;
skullNotFoundTexture[i + 3] = j;
@ -62,8 +69,8 @@ public class IntegratedSkinService {
public final VFile2 skullsDirectory;
public final Map<EaglercraftUUID,byte[]> playerSkins = new HashMap();
public final Map<String,CustomSkullData> customSkulls = new HashMap();
public final Map<EaglercraftUUID, byte[]> playerSkins = new HashMap();
public final Map<String, CustomSkullData> customSkulls = new HashMap();
private long lastFlush = 0l;
@ -93,32 +100,34 @@ public class IntegratedSkinService {
public void processPacketGetOtherSkin(EaglercraftUUID searchUUID, EntityPlayerMP sender) {
byte[] playerSkin = playerSkins.get(searchUUID);
if(playerSkin == null) {
if (playerSkin == null) {
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) {
urlStr = urlStr.toLowerCase();
byte[] playerSkin;
if(!urlStr.startsWith("eagler://")) {
if (!urlStr.startsWith("eagler://")) {
playerSkin = IntegratedSkinPackets.makePresetResponse(searchUUID, 0);
}else {
} else {
urlStr = urlStr.substring(9);
if(urlStr.contains(VFile2.pathSeperator)) {
if (urlStr.contains(VFile2.pathSeperator)) {
playerSkin = IntegratedSkinPackets.makePresetResponse(searchUUID, 0);
}else {
} else {
CustomSkullData sk = customSkulls.get(urlStr);
if(sk == null) {
if (sk == null) {
customSkulls.put(urlStr, sk = loadCustomSkull(urlStr));
}else {
} else {
sk.lastHit = System.currentTimeMillis();
}
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) {
@ -130,8 +139,8 @@ public class IntegratedSkinService {
}
public void processPacketInstallNewSkin(byte[] skullData, EntityPlayerMP sender) {
if(!sender.canCommandSenderUseCommand(2, "give")) {
ChatComponentTranslation cc = new ChatComponentTranslation("command.skull.nopermission");
if (!sender.canCommandSenderUseCommand(2, "give")) {
TextComponentTranslation cc = new TextComponentTranslation("command.skull.nopermission");
cc.getChatStyle().setColor(EnumChatFormatting.RED);
sender.addChatMessage(cc);
return;
@ -140,12 +149,15 @@ public class IntegratedSkinService {
NBTTagCompound rootTagCompound = new NBTTagCompound();
NBTTagCompound ownerTagCompound = new NBTTagCompound();
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();
NBTTagList texturesTagList = new NBTTagList();
NBTTagCompound texturesTagCompound = new NBTTagCompound();
String texturesProp = "{\"textures\":{\"SKIN\":{\"url\":\"" + fileName + "\",\"metadata\":{\"model\":\"default\"}}}}";
texturesTagCompound.setString("Value", Base64.encodeBase64String(texturesProp.getBytes(StandardCharsets.UTF_8)));
String texturesProp = "{\"textures\":{\"SKIN\":{\"url\":\"" + fileName
+ "\",\"metadata\":{\"model\":\"default\"}}}}";
texturesTagCompound.setString("Value",
Base64.encodeBase64String(texturesProp.getBytes(StandardCharsets.UTF_8)));
texturesTagList.appendTag(texturesTagCompound);
propertiesTagCompound.setTag("textures", texturesTagList);
ownerTagCompound.setTag("Properties", propertiesTagCompound);
@ -153,7 +165,8 @@ public class IntegratedSkinService {
NBTTagCompound displayTagCompound = new NBTTagCompound();
displayTagCompound.setString("Name", EnumChatFormatting.RESET + "Custom Eaglercraft Skull");
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);
rootTagCompound.setTag("display", displayTagCompound);
ItemStack stack = new ItemStack(Items.skull, 1, 3);
@ -165,14 +178,14 @@ public class IntegratedSkinService {
* 2.0F);
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";
public String installNewSkull(byte[] skullData) {
// set to 16384 to save a full 64x64 skin
if(skullData.length > 4096) {
if (skullData.length > 4096) {
byte[] tmp = skullData;
skullData = new byte[4096];
System.arraycopy(tmp, 0, skullData, 0, 4096);
@ -182,7 +195,7 @@ public class IntegratedSkinService {
byte[] hash = new byte[20];
sha.doFinal(hash, 0);
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) + 1] = hex.charAt(hash[i] & 0x0F);
}
@ -194,20 +207,20 @@ public class IntegratedSkinService {
private CustomSkullData loadCustomSkull(String urlStr) {
byte[] data = (new VFile2(skullsDirectory, urlStr)).getAllBytes();
if(data == null) {
if (data == null) {
return new CustomSkullData(urlStr, skullNotFoundTexture);
}else {
} else {
return new CustomSkullData(urlStr, data);
}
}
public void flushCache() {
long cur = System.currentTimeMillis();
if(cur - lastFlush > 300000l) {
if (cur - lastFlush > 300000l) {
lastFlush = cur;
Iterator<CustomSkullData> customSkullsItr = customSkulls.values().iterator();
while(customSkullsItr.hasNext()) {
if(cur - customSkullsItr.next().lastHit > 900000l) {
while (customSkullsItr.hasNext()) {
if (cur - customSkullsItr.next().lastHit > 900000l) {
customSkullsItr.remove();
}
}

View File

@ -22,9 +22,9 @@ import net.minecraft.network.EnumPacketDirection;
import net.minecraft.network.INetHandler;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ChatComponentText;
import net.minecraft.util.IChatComponent;
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;
/**
@ -94,7 +94,7 @@ public class IntegratedServerPlayerNetworkManager {
: EnumEaglerConnectionState.CLOSED;
}
public void closeChannel(IChatComponent reason) {
public void closeChannel(ITextComponent reason) {
EaglerIntegratedServerWorker.closeChannel(playerChannel);
if (nethandler != null) {
nethandler.onDisconnect(reason);
@ -141,7 +141,7 @@ public class IntegratedServerPlayerNetworkManager {
}
ServerPlatformSingleplayer
.sendPacket(new IPCPacketData(playerChannel, kickPacketBAO.toByteArray()));
closeChannel(new ChatComponentText(
closeChannel(new TextComponentString(
"Recieved unsuppoorted connection from an Eaglercraft 1.5.2 client!"));
firstPacket = false;
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.client.C00Handshake;
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.
*
* 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
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (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)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (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
* POSSIBILITY OF SUCH DAMAGE.
*
@ -26,13 +33,14 @@ public class NetHandlerHandshakeEagler implements INetHandlerHandshakeServer {
private final EaglerMinecraftServer mcServer;
private final IntegratedServerPlayerNetworkManager networkManager;
public NetHandlerHandshakeEagler(EaglerMinecraftServer parMinecraftServer, IntegratedServerPlayerNetworkManager parNetworkManager) {
public NetHandlerHandshakeEagler(EaglerMinecraftServer parMinecraftServer,
IntegratedServerPlayerNetworkManager parNetworkManager) {
this.mcServer = parMinecraftServer;
this.networkManager = parNetworkManager;
}
@Override
public void onDisconnect(IChatComponent var1) {
public void onDisconnect(ITextComponent var1) {
}

View File

@ -13,8 +13,8 @@ import net.lax1dude.eaglercraft.v1_8.sp.lan.LANServerController;
import net.minecraft.network.EnumPacketDirection;
import net.minecraft.network.Packet;
import net.minecraft.network.PacketBuffer;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.IChatComponent;
import net.minecraft.util.text.TextComponentTranslation;
import net.minecraft.util.text.ITextComponent;
/**
* Copyright (c) 2023-2024 lax1dude, hoosiertransfer, ayunami2000. All Rights
@ -62,7 +62,7 @@ public class ClientIntegratedServerNetworkManager extends EaglercraftNetworkMana
}
@Override
public void closeChannel(IChatComponent reason) {
public void closeChannel(ITextComponent reason) {
LANServerController.closeLAN();
SingleplayerServerController.closeLocalPlayerChannel();
if (nethandler != null) {
@ -169,7 +169,7 @@ public class ClientIntegratedServerNetworkManager extends EaglercraftNetworkMana
} catch (IOException e) {
}
clearRecieveQueue();
doClientDisconnect(new ChatComponentTranslation("disconnect.endOfStream"));
doClientDisconnect(new TextComponentTranslation("disconnect.endOfStream"));
return true;
} else {
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.S03PacketEnableCompression;
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.
*
* 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
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (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)
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED.
* IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY
* DIRECT,
* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (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
* POSSIBILITY OF SUCH DAMAGE.
*
@ -38,14 +45,15 @@ public class NetHandlerSingleplayerLogin implements INetHandlerLoginClient {
private final GuiScreen previousGuiScreen;
private final EaglercraftNetworkManager networkManager;
public NetHandlerSingleplayerLogin(EaglercraftNetworkManager parNetworkManager, Minecraft mcIn, GuiScreen parGuiScreen) {
public NetHandlerSingleplayerLogin(EaglercraftNetworkManager parNetworkManager, Minecraft mcIn,
GuiScreen parGuiScreen) {
this.networkManager = parNetworkManager;
this.mc = mcIn;
this.previousGuiScreen = parGuiScreen;
}
@Override
public void onDisconnect(IChatComponent var1) {
public void onDisconnect(ITextComponent var1) {
this.mc.displayGuiScreen(new GuiDisconnected(this.previousGuiScreen, "connect.failed", var1));
}
@ -57,10 +65,12 @@ public class NetHandlerSingleplayerLogin implements INetHandlerLoginClient {
@Override
public void handleLoginSuccess(S02PacketLoginSuccess var1) {
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();
if(b != null) {
this.networkManager.sendPacket(new C17PacketCustomPayload("EAG|MyUpdCert-1.8", new PacketBuffer(Unpooled.buffer(b, b.length).writerIndex(b.length))));
if (b != null) {
this.networkManager.sendPacket(new C17PacketCustomPayload("EAG|MyUpdCert-1.8",
new PacketBuffer(Unpooled.buffer(b, b.length).writerIndex(b.length))));
}
}

View File

@ -17,8 +17,8 @@ import net.minecraft.client.gui.GuiButton;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.resources.I18n;
import net.minecraft.util.EnumChatFormatting;
import net.minecraft.util.MathHelper;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
/**
* 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.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.MovingObjectPosition;
import net.minecraft.util.ObjectIntIdentityMap;
import net.minecraft.util.RegistryNamespacedDefaultedByKey;
import net.minecraft.util.ResourceLocation;
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.Explosion;
import net.minecraft.world.IBlockAccess;
@ -693,16 +693,16 @@ public class Block implements ILitBlock {
* Ray traces through the blocks collision from start vector to
* 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);
vec3 = vec3.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);
Vec3 vec33 = vec3.getIntermediateWithXValue(vec31, this.maxX);
Vec3 vec34 = vec3.getIntermediateWithYValue(vec31, this.minY);
Vec3 vec35 = vec3.getIntermediateWithYValue(vec31, this.maxY);
Vec3 vec36 = vec3.getIntermediateWithZValue(vec31, this.minZ);
Vec3 vec37 = vec3.getIntermediateWithZValue(vec31, this.maxZ);
Vec3d vec32 = vec3.getIntermediateWithXValue(vec31, this.minX);
Vec3d vec33 = vec3.getIntermediateWithXValue(vec31, this.maxX);
Vec3d vec34 = vec3.getIntermediateWithYValue(vec31, this.minY);
Vec3d vec35 = vec3.getIntermediateWithYValue(vec31, this.maxY);
Vec3d vec36 = vec3.getIntermediateWithZValue(vec31, this.minZ);
Vec3d vec37 = vec3.getIntermediateWithZValue(vec31, this.maxZ);
if (!this.isVecInsideYZBounds(vec32)) {
vec32 = null;
}
@ -727,7 +727,7 @@ public class Block implements ILitBlock {
vec37 = null;
}
Vec3 vec38 = null;
Vec3d vec38 = null;
if (vec32 != null && (vec38 == null || vec3.squareDistanceTo(vec32) < vec3.squareDistanceTo(vec38))) {
vec38 = vec32;
}
@ -780,7 +780,7 @@ public class Block implements ILitBlock {
enumfacing = EnumFacing.SOUTH;
}
return new MovingObjectPosition(
return new RayTraceResult(
vec38.addVector((double) blockpos.getX(), (double) blockpos.getY(), (double) blockpos.getZ()),
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.
*/
private boolean isVecInsideYZBounds(Vec3 point) {
private boolean isVecInsideYZBounds(Vec3d point) {
return point == null ? false
: point.yCoord >= this.minY && point.yCoord <= this.maxY && point.zCoord >= this.minZ
&& 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.
*/
private boolean isVecInsideXZBounds(Vec3 point) {
private boolean isVecInsideXZBounds(Vec3d point) {
return point == null ? false
: point.xCoord >= this.minX && point.xCoord <= this.maxX && point.zCoord >= this.minZ
&& 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.
*/
private boolean isVecInsideXYBounds(Vec3 point) {
private boolean isVecInsideXYBounds(Vec3d point) {
return point == null ? false
: point.xCoord >= this.minX && point.xCoord <= this.maxX && point.yCoord >= this.minY
&& point.yCoord <= this.maxY;
@ -868,7 +868,7 @@ public class Block implements ILitBlock {
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;
}

View File

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

View File

@ -18,10 +18,10 @@ import net.minecraft.inventory.Container;
import net.minecraft.inventory.ContainerRepair;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentTranslation;
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.IInteractionObject;
import net.minecraft.world.World;
@ -194,8 +194,8 @@ public class BlockAnvil extends BlockFalling {
return false;
}
public IChatComponent getDisplayName() {
return new ChatComponentTranslation(Blocks.anvil.getUnlocalizedName() + ".name", new Object[0]);
public ITextComponent getDisplayName() {
return new TextComponentTranslation(Blocks.anvil.getUnlocalizedName() + ".name", new Object[0]);
}
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.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityBanner;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
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.World;

View File

@ -2,7 +2,7 @@ package net.minecraft.block;
import net.minecraft.block.material.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
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.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
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.World;

View File

@ -11,9 +11,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityBeacon;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraft.world.WorldServer;
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.item.Item;
import net.minecraft.server.MinecraftServer;
import net.minecraft.util.BlockPos;
import net.minecraft.util.ChatComponentTranslation;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
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.World;
import net.minecraft.world.biome.BiomeGenBase;
@ -92,7 +92,7 @@ public class BlockBed extends BlockDirectional {
blockpos1 = blockpos.up();
}
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()) {
return true;
}
@ -102,7 +102,7 @@ public class BlockBed extends BlockDirectional {
EntityPlayer entityplayer1 = this.getPlayerInBed(world, blockpos);
if (entityplayer1 != null) {
entityplayer
.addChatComponentMessage(new ChatComponentTranslation("tile.bed.occupied", new Object[0]));
.addChatComponentMessage(new TextComponentTranslation("tile.bed.occupied", new Object[0]));
return true;
}
@ -118,10 +118,10 @@ public class BlockBed extends BlockDirectional {
} else {
if (entityplayer$enumstatus == EntityPlayer.EnumStatus.NOT_POSSIBLE_NOW) {
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) {
entityplayer
.addChatComponentMessage(new ChatComponentTranslation("tile.bed.notSafe", new Object[0]));
.addChatComponentMessage(new TextComponentTranslation("tile.bed.notSafe", new Object[0]));
}
return true;

View File

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

View File

@ -21,12 +21,12 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityBrewingStand;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.StatCollector;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
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.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
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.player.EntityPlayer;
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.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
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.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.DamageSource;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
@ -122,18 +122,17 @@ public class BlockCactus extends Block {
}
public boolean canBlockStay(World worldIn, BlockPos pos) {
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL)
{
Material material = worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getMaterial();
for (EnumFacing enumfacing : EnumFacing.Plane.HORIZONTAL) {
Material material = worldIn.getBlockState(pos.offset(enumfacing)).getBlock().getMaterial();
if (material.isSolid() || material == Material.lava)
{
return false;
}
}
if (material.isSolid() || material == Material.lava) {
return false;
}
}
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.item.Item;
import net.minecraft.stats.StatList;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
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.World;

View File

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

View File

@ -20,10 +20,10 @@ import net.minecraft.item.ItemBanner;
import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntityBanner;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
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;
/**
@ -141,20 +141,16 @@ public class BlockCauldron extends Block {
return true;
} else if (item == Items.bucket) {
if (i == 3 && !world.isRemote)
{
if (!entityplayer.capabilities.isCreativeMode)
{
if (i == 3 && !world.isRemote) {
if (!entityplayer.capabilities.isCreativeMode) {
ItemStack heldItem = entityplayer.inventory.getCurrentItem();
--heldItem.stackSize;
if (heldItem.stackSize == 0)
{
if (heldItem.stackSize == 0) {
entityplayer.inventory.setInventorySlotContents(entityplayer.inventory.currentItem,
new ItemStack(Items.water_bucket));
}
else if (!entityplayer.inventory.addItemStackToInventory(new ItemStack(Items.water_bucket)))
{
new ItemStack(Items.water_bucket));
} else if (!entityplayer.inventory
.addItemStackToInventory(new ItemStack(Items.water_bucket))) {
entityplayer.dropPlayerItemWithRandomChoice(new ItemStack(Items.water_bucket), false);
}
}

View File

@ -20,10 +20,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityChest;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
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.ILockableContainer;
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.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
public class BlockChorusFlower extends Block {

View File

@ -15,10 +15,10 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
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.World;

View File

@ -13,10 +13,10 @@ import net.minecraft.init.Items;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
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.World;

View File

@ -18,9 +18,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityCommandBlock;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.StringUtils;
import net.minecraft.util.math.BlockPos;
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.Material;
import net.minecraft.block.state.IBlockState;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
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.state.IBlockState;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**

View File

@ -11,8 +11,8 @@ import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
/**
@ -80,28 +80,24 @@ public class BlockCrops extends BlockBush implements IGrowable {
}
public IBlockState withAge(int age)
{
return this.getDefaultState().withProperty(AGE, Integer.valueOf(age));
}
public IBlockState withAge(int age) {
return this.getDefaultState().withProperty(AGE, Integer.valueOf(age));
}
protected int getAge(IBlockState state)
{
return ((Integer)state.getValue(AGE)).intValue();
}
protected int getAge(IBlockState state) {
return ((Integer) state.getValue(AGE)).intValue();
}
public void grow(World worldIn, BlockPos pos, IBlockState state)
{
int i = this.getAge(state) + this.getBonemealAgeIncrease(worldIn);
int j = this.getMaxAge();
public void grow(World worldIn, BlockPos pos, IBlockState state) {
int i = this.getAge(state) + this.getBonemealAgeIncrease(worldIn);
int j = this.getMaxAge();
if (i > j)
{
i = j;
}
if (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) {
float f = 1.0F;
@ -162,10 +158,9 @@ public class BlockCrops extends BlockBush implements IGrowable {
return Items.wheat;
}
public int getMaxAge()
{
return 7;
}
public int getMaxAge() {
return 7;
}
/**
* +
@ -211,19 +206,17 @@ public class BlockCrops extends BlockBush implements IGrowable {
return true;
}
protected int getBonemealAgeIncrease(World worldIn)
{
return MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5);
}
protected int getBonemealAgeIncrease(World worldIn) {
return MathHelper.getRandomIntegerInRange(worldIn.rand, 2, 5);
}
public void grow(World world, EaglercraftRandom var2, BlockPos blockpos, IBlockState iblockstate) {
this.grow(world, blockpos, iblockstate);
}
public boolean isMaxAge(IBlockState state)
{
return ((Integer)state.getValue(AGE)).intValue() >= this.getMaxAge();
}
public boolean isMaxAge(IBlockState state) {
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.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityDaylightDetector;
import net.minecraft.util.BlockPos;
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.IBlockAccess;
import net.minecraft.world.World;
@ -74,34 +74,29 @@ public class BlockDaylightDetector extends BlockContainer {
return ((Integer) iblockstate.getValue(POWER)).intValue();
}
public void updatePower(World worldIn, BlockPos pos)
{
if (!worldIn.provider.getHasNoSky())
{
IBlockState iblockstate = worldIn.getBlockState(pos);
int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted();
float f = worldIn.getCelestialAngleRadians(1.0F);
public void updatePower(World worldIn, BlockPos pos) {
if (!worldIn.provider.getHasNoSky()) {
IBlockState iblockstate = worldIn.getBlockState(pos);
int i = worldIn.getLightFor(EnumSkyBlock.SKY, pos) - worldIn.getSkylightSubtracted();
float f = worldIn.getCelestialAngleRadians(1.0F);
if (this.inverted)
{
i = 15 - i;
}
if (this.inverted) {
i = 15 - i;
}
if (i > 0 && !this.inverted)
{
float f1 = f < (float)Math.PI ? 0.0F : ((float)Math.PI * 2F);
f = f + (f1 - f) * 0.2F;
i = Math.round((float)i * MathHelper.cos(f));
}
if (i > 0 && !this.inverted) {
float f1 = f < (float) Math.PI ? 0.0F : ((float) Math.PI * 2F);
f = f + (f1 - f) * 0.2F;
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)
{
worldIn.setBlockState(pos, iblockstate.withProperty(POWER, Integer.valueOf(i)), 3);
}
}
}
if (((Integer) iblockstate.getValue(POWER)).intValue() != i) {
worldIn.setBlockState(pos, iblockstate.withProperty(POWER, Integer.valueOf(i)), 3);
}
}
}
public boolean onBlockActivated(World world, BlockPos blockpos, IBlockState iblockstate, EntityPlayer entityplayer,
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.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**
@ -86,12 +86,11 @@ public class BlockDeadBush extends BlockBush {
}
/**
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(EaglercraftRandom random)
{
return random.nextInt(3);
}
* Returns the quantity of items to drop on block destruction.
*/
public int quantityDropped(EaglercraftRandom random) {
return random.nextInt(3);
}
public void harvestBlock(World world, EntityPlayer entityplayer, BlockPos blockpos, IBlockState iblockstate,
TileEntity tileentity) {

View File

@ -13,8 +13,8 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
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.TileEntityDispenser;
import net.minecraft.tileentity.TileEntityDropper;
import net.minecraft.util.BlockPos;
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;
/**

View File

@ -13,14 +13,14 @@ import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.init.Items;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.MovingObjectPosition;
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.World;
@ -254,7 +254,7 @@ public class BlockDoor extends Block {
* Ray traces through the blocks collision from start vector to
* 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);
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.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
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.player.EntityPlayer;
import net.minecraft.item.Item;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
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.TileEntityDropper;
import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
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.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**

View File

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

View File

@ -10,10 +10,10 @@ import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityEndPortal;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
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.World;

View File

@ -13,9 +13,9 @@ import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
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.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
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.World;
@ -96,13 +96,11 @@ public class BlockEndRod extends Block {
double d3 = (double) (0.4F - (rand.nextFloat() + rand.nextFloat()) * 0.4F);
if (rand.nextInt(5) == 0) {
worldIn.spawnParticle(EnumParticleTypes.END_ROD, d0 + (double)
enumfacing.getFrontOffsetX() * d3,
d1 + (double) enumfacing.getFrontOffsetY() * d3, d2 + (double)
enumfacing.getFrontOffsetZ() * d3,
rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D,
rand.nextGaussian() * 0.005D,
new int[0]);
worldIn.spawnParticle(EnumParticleTypes.END_ROD, d0 + (double) enumfacing.getFrontOffsetX() * d3,
d1 + (double) enumfacing.getFrontOffsetY() * d3, d2 + (double) enumfacing.getFrontOffsetZ() * d3,
rand.nextGaussian() * 0.005D, rand.nextGaussian() * 0.005D,
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.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityEnderChest;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
/**

View File

@ -1,6 +1,6 @@
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.entity.item.EntityFallingBlock;
import net.minecraft.init.Blocks;
import net.minecraft.util.BlockPos;
import net.minecraft.util.math.BlockPos;
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.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
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.World;
@ -92,17 +92,17 @@ public class BlockFarmland extends Block {
}
/**
* Block's chance to react to a living entity falling on it.
*/
public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
{
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)
{
worldIn.setBlockState(pos, Blocks.dirt.getDefaultState());
}
* Block's chance to react to a living entity falling on it.
*/
public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) {
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) {
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) {
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.init.Blocks;
import net.minecraft.item.ItemLead;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
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.World;

View File

@ -9,9 +9,9 @@ import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
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.World;

View File

@ -13,11 +13,11 @@ import net.minecraft.block.properties.PropertyInteger;
import net.minecraft.block.state.BlockState;
import net.minecraft.block.state.IBlockState;
import net.minecraft.init.Blocks;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
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.World;
import net.minecraft.world.WorldProviderEnd;

View File

@ -17,11 +17,11 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFlowerPot;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.StatCollector;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
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.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.BlockPos;
import net.minecraft.util.MathHelper;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.MathHelper;
import net.minecraft.world.World;
public class BlockFrostedIce extends BlockIce {

View File

@ -17,9 +17,9 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityFurnace;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumParticleTypes;
import net.minecraft.util.math.BlockPos;
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.init.Items;
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.init.Blocks;
import net.minecraft.item.Item;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumWorldBlockLayer;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.ColorizerGrass;
import net.minecraft.world.IBlockAccess;
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.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
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.World;

View File

@ -10,8 +10,8 @@ import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
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.
*/
public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance)
{
entityIn.fall(fallDistance, 0.2F);
}
* Block's chance to react to a living entity falling on it.
*/
public void onFallenUpon(World worldIn, BlockPos pos, Entity entityIn, float fallDistance) {
entityIn.fall(fallDistance, 0.2F);
}
}

View File

@ -21,10 +21,10 @@ import net.minecraft.item.ItemStack;
import net.minecraft.stats.StatList;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityHopper;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
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.World;

View File

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

View File

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

View File

@ -14,8 +14,8 @@ import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.nbt.NBTTagCompound;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.math.BlockPos;
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.creativetab.CreativeTabs;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.util.AxisAlignedBB;
import net.minecraft.util.BlockPos;
import net.minecraft.util.EnumFacing;
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.World;

View File

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

View File

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

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