Singleplayer shit

This commit is contained in:
catfoolyou 2025-03-26 16:57:33 -04:00
parent b2fde94725
commit 7307920c30
11 changed files with 928262 additions and 18984 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="CompilerConfiguration"> <component name="CompilerConfiguration">
<bytecodeTargetLevel target="17" /> <bytecodeTargetLevel target="18" />
</component> </component>
</project> </project>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<project version="4"> <project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" /> <component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="ProjectRootManager" version="2" languageLevel="JDK_17" default="true" project-jdk-name="corretto-18" project-jdk-type="JavaSDK" /> <component name="ProjectRootManager" version="2" languageLevel="JDK_18" default="true" project-jdk-name="corretto-18" project-jdk-type="JavaSDK" />
</project> </project>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -27,7 +27,7 @@ public class WorkerListenThread {
* adds this connection to the list of currently connected players * adds this connection to the list of currently connected players
*/ */
public void addPlayer(NetHandler par1NetServerHandler) { public void addPlayer(NetHandler par1NetServerHandler) {
System.out.println("[Server][ADDPLAYER][" + par1NetServerHandler.getClass().getSimpleName() + "]"); System.out.println("[SP-Server][ADDPLAYER][" + par1NetServerHandler.getClass().getSimpleName() + "]");
this.connections.add(par1NetServerHandler); this.connections.add(par1NetServerHandler);
} }
@ -40,7 +40,7 @@ public class WorkerListenThread {
} }
public boolean openChannel(String player) { public boolean openChannel(String player) {
System.out.println("[Server][OPENCHANNEL][" + player + "]"); System.out.println("[SP-Server][OPENCHANNEL][" + player + "]");
return channels.put(player, new WorkerNetworkManager(player, mcServer, this)) == null; return channels.put(player, new WorkerNetworkManager(player, mcServer, this)) == null;
} }
@ -53,7 +53,7 @@ public class WorkerListenThread {
} }
public boolean closeChannel(String player) { public boolean closeChannel(String player) {
System.out.println("[Server][CLOSECHANNEL][" + player + "]"); // called way too damn much System.out.println("[SP-Server][CLOSECHANNEL][" + player + "]"); // called way too damn much
WorkerNetworkManager channel = channels.get(player); WorkerNetworkManager channel = channels.get(player);
if(channel == null) { if(channel == null) {
return false; return false;

View File

@ -516,7 +516,7 @@ public class ChunkProviderGenerate implements IChunkProvider
} }
var6.decorate(this.worldObj, this.rand, var4, var5); var6.decorate(this.worldObj, this.rand, var4, var5);
SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var4 + 8, var5 + 8, 16, 16, this.rand); //SpawnerAnimals.performWorldGenSpawning(this.worldObj, var6, var4 + 8, var5 + 8, 16, 16, this.rand); // problem, IMPORTANT!!!
var4 += 8; var4 += 8;
var5 += 8; var5 += 8;

View File

@ -60,7 +60,6 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting
int renderDistance; int renderDistance;
private int chatVisibility; private int chatVisibility;
private boolean chatColours = true; private boolean chatColours = true;
private long field_143005_bX = 0L;
/** /**
* The currently in use window ID. Incremented every time a window is opened. * The currently in use window ID. Incremented every time a window is opened.
@ -963,9 +962,4 @@ public class EntityPlayerMP extends EntityPlayer implements ICrafting
{ {
return new ChunkCoordinates(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY + 0.5D), MathHelper.floor_double(this.posZ)); return new ChunkCoordinates(MathHelper.floor_double(this.posX), MathHelper.floor_double(this.posY + 0.5D), MathHelper.floor_double(this.posZ));
} }
public void func_143004_u()
{
this.field_143005_bX = SysUtil.steadyTimeMillis();
}
} }

View File

@ -50,14 +50,15 @@ public class NetLoginHandler extends NetHandler {
* network packets unless the timeout has occurred. * network packets unless the timeout has occurred.
*/ */
public void handlePackets() { public void handlePackets() {
System.out.println("[Server][LOGIN][HANDLE][" + clientUsername + "]"); System.out.println("[SP-Server][LOGIN][HANDLE][" + clientUsername + "]");
if (this.field_72544_i) { if (this.field_72544_i) { // FIX THIS SHIT!!!
this.initializePlayerConnection(); this.initializePlayerConnection();
return; return;
} }
if (this.loginTimer++ == 600) { if (this.loginTimer++ == 600) {
this.kickUser("Took too long to log in"); this.kickUser("Took too long to log in");
System.out.println("Bitch hurry the fuck up");
} else { } else {
this.myTCPConnection.processReadPackets(); // problem this.myTCPConnection.processReadPackets(); // problem
} }
@ -93,7 +94,7 @@ public class NetLoginHandler extends NetHandler {
} }
var2 = (var2 >> 5) + 2; var2 = (var2 >> 5) + 2;
this.viewDistance = var2; this.viewDistance = var2;
System.out.println("[Server][HANDSHAKE][" + this.clientUsername + "]"); System.out.println("[SP-Server][HANDSHAKE][" + this.clientUsername + "]");
if (!this.clientUsername.equals(StringUtils.stripControlCodes(this.clientUsername))) { if (!this.clientUsername.equals(StringUtils.stripControlCodes(this.clientUsername))) {
this.kickUser("Invalid username!"); this.kickUser("Invalid username!");

View File

@ -62,7 +62,7 @@ public class NetServerHandler extends NetHandler
/** /**
* run once each game tick * run once each game tick
*/ */
public void networkTick() public void handlePackets()
{ {
this.field_72584_h = false; this.field_72584_h = false;
++this.currentTicks; ++this.currentTicks;
@ -89,14 +89,15 @@ public class NetServerHandler extends NetHandler
public void kickPlayerFromServer(String par1Str) public void kickPlayerFromServer(String par1Str)
{ {
if (!this.connectionClosed) if (!this.connectionClosed) {
{
this.playerEntity.mountEntityAndWakeUp();
this.sendPacketToPlayer(new Packet255KickDisconnect(par1Str));
this.netManager.serverShutdown();
this.mcServer.getConfigurationManager().sendChatMsg(StatCollector.translateToLocalFormatted(EnumChatFormatting.YELLOW + "multiplayer.player.left", new Object[] {this.playerEntity.getTranslatedEntityName()}));
this.mcServer.getConfigurationManager().playerLoggedOut(this.playerEntity);
this.connectionClosed = true; this.connectionClosed = true;
this.playerEntity.mountEntityAndWakeUp();
if(par1Str != null) {
this.sendPacketToPlayer(new Packet255KickDisconnect(par1Str));
}
this.netManager.serverShutdown();
this.mcServer.getConfigurationManager().sendPacketToAllPlayers(new Packet3Chat(EnumChatFormatting.YELLOW + this.playerEntity.username + " left the game."));
this.mcServer.getConfigurationManager().playerLoggedOut(this.playerEntity);
} }
} }
@ -331,7 +332,7 @@ public class NetServerHandler extends NetHandler
public void handleBlockDig(Packet14BlockDig par1Packet14BlockDig) public void handleBlockDig(Packet14BlockDig par1Packet14BlockDig)
{ {
WorldServer var2 = this.mcServer.worldServerForDimension(this.playerEntity.dimension); WorldServer var2 = this.mcServer.worldServerForDimension(this.playerEntity.dimension);
this.playerEntity.func_143004_u(); //this.playerEntity.func_143004_u();
if (par1Packet14BlockDig.status == 4) if (par1Packet14BlockDig.status == 4)
{ {
@ -427,7 +428,7 @@ public class NetServerHandler extends NetHandler
int var6 = par1Packet15Place.getYPosition(); int var6 = par1Packet15Place.getYPosition();
int var7 = par1Packet15Place.getZPosition(); int var7 = par1Packet15Place.getZPosition();
int var8 = par1Packet15Place.getDirection(); int var8 = par1Packet15Place.getDirection();
this.playerEntity.func_143004_u(); //this.playerEntity.func_143004_u();
if (par1Packet15Place.getDirection() == 255) if (par1Packet15Place.getDirection() == 255)
{ {
@ -573,7 +574,7 @@ public class NetServerHandler extends NetHandler
if (par1Packet16BlockItemSwitch.id >= 0 && par1Packet16BlockItemSwitch.id < InventoryPlayer.getHotbarSize()) if (par1Packet16BlockItemSwitch.id >= 0 && par1Packet16BlockItemSwitch.id < InventoryPlayer.getHotbarSize())
{ {
this.playerEntity.inventory.currentItem = par1Packet16BlockItemSwitch.id; this.playerEntity.inventory.currentItem = par1Packet16BlockItemSwitch.id;
this.playerEntity.func_143004_u(); //this.playerEntity.func_143004_u();
} }
else else
{ {
@ -589,7 +590,7 @@ public class NetServerHandler extends NetHandler
} }
else else
{ {
this.playerEntity.func_143004_u(); //this.playerEntity.func_143004_u();
String var2 = par1Packet3Chat.message; String var2 = par1Packet3Chat.message;
if (var2.length() > 100) if (var2.length() > 100)
@ -644,7 +645,7 @@ public class NetServerHandler extends NetHandler
public void handleAnimation(Packet18Animation par1Packet18Animation) public void handleAnimation(Packet18Animation par1Packet18Animation)
{ {
this.playerEntity.func_143004_u(); //this.playerEntity.func_143004_u();
if (par1Packet18Animation.animate == 1) if (par1Packet18Animation.animate == 1)
{ {
@ -657,7 +658,7 @@ public class NetServerHandler extends NetHandler
*/ */
public void handleEntityAction(Packet19EntityAction par1Packet19EntityAction) public void handleEntityAction(Packet19EntityAction par1Packet19EntityAction)
{ {
this.playerEntity.func_143004_u(); //this.playerEntity.func_143004_u();
if (par1Packet19EntityAction.action == 1) if (par1Packet19EntityAction.action == 1)
{ {
@ -710,7 +711,7 @@ public class NetServerHandler extends NetHandler
{ {
WorldServer var2 = this.mcServer.worldServerForDimension(this.playerEntity.dimension); WorldServer var2 = this.mcServer.worldServerForDimension(this.playerEntity.dimension);
Entity var3 = var2.getEntityByID(par1Packet7UseEntity.targetEntity); Entity var3 = var2.getEntityByID(par1Packet7UseEntity.targetEntity);
this.playerEntity.func_143004_u(); //this.playerEntity.func_143004_u();
if (var3 != null) if (var3 != null)
{ {
@ -745,8 +746,6 @@ public class NetServerHandler extends NetHandler
public void handleClientCommand(Packet205ClientCommand par1Packet205ClientCommand) public void handleClientCommand(Packet205ClientCommand par1Packet205ClientCommand)
{ {
this.playerEntity.func_143004_u();
if (par1Packet205ClientCommand.forceRespawn == 1) if (par1Packet205ClientCommand.forceRespawn == 1)
{ {
if (this.playerEntity.playerConqueredTheEnd) if (this.playerEntity.playerConqueredTheEnd)
@ -802,7 +801,7 @@ public class NetServerHandler extends NetHandler
public void handleWindowClick(Packet102WindowClick par1Packet102WindowClick) public void handleWindowClick(Packet102WindowClick par1Packet102WindowClick)
{ {
this.playerEntity.func_143004_u(); //this.playerEntity.func_143004_u();
if (this.playerEntity.openContainer.windowId == par1Packet102WindowClick.window_Id && this.playerEntity.openContainer.isPlayerNotUsingContainer(this.playerEntity)) if (this.playerEntity.openContainer.windowId == par1Packet102WindowClick.window_Id && this.playerEntity.openContainer.isPlayerNotUsingContainer(this.playerEntity))
{ {
@ -835,7 +834,7 @@ public class NetServerHandler extends NetHandler
public void handleEnchantItem(Packet108EnchantItem par1Packet108EnchantItem) public void handleEnchantItem(Packet108EnchantItem par1Packet108EnchantItem)
{ {
this.playerEntity.func_143004_u(); //this.playerEntity.func_143004_u();
if (this.playerEntity.openContainer.windowId == par1Packet108EnchantItem.windowId && this.playerEntity.openContainer.isPlayerNotUsingContainer(this.playerEntity)) if (this.playerEntity.openContainer.windowId == par1Packet108EnchantItem.windowId && this.playerEntity.openContainer.isPlayerNotUsingContainer(this.playerEntity))
{ {
@ -898,7 +897,7 @@ public class NetServerHandler extends NetHandler
*/ */
public void handleUpdateSign(Packet130UpdateSign par1Packet130UpdateSign) public void handleUpdateSign(Packet130UpdateSign par1Packet130UpdateSign)
{ {
this.playerEntity.func_143004_u(); //this.playerEntity.func_143004_u();
WorldServer var2 = this.mcServer.worldServerForDimension(this.playerEntity.dimension); WorldServer var2 = this.mcServer.worldServerForDimension(this.playerEntity.dimension);
if (var2.blockExists(par1Packet130UpdateSign.xPosition, par1Packet130UpdateSign.yPosition, par1Packet130UpdateSign.zPosition)) if (var2.blockExists(par1Packet130UpdateSign.xPosition, par1Packet130UpdateSign.yPosition, par1Packet130UpdateSign.zPosition))

View File

@ -635,16 +635,13 @@ public abstract class ServerConfigurationManager
Iterator var2 = this.playerEntityList.iterator(); Iterator var2 = this.playerEntityList.iterator();
EntityPlayerMP var3; EntityPlayerMP var3;
do do {
{ if (!var2.hasNext()) {
if (!var2.hasNext())
{
return null; return null;
} }
var3 = (EntityPlayerMP)var2.next(); var3 = (EntityPlayerMP) var2.next();
} } while (!var3.username.equalsIgnoreCase(par1Str));
while (!var3.getCommandSenderName().equalsIgnoreCase(par1Str));
return var3; return var3;
} }

View File

@ -123,7 +123,7 @@ public class WorldServer extends World
if (this.getGameRules().getGameRuleBooleanValue("doMobSpawning")) if (this.getGameRules().getGameRuleBooleanValue("doMobSpawning"))
{ {
this.animalSpawner.findChunksForSpawning(this, this.spawnHostileMobs, this.spawnPeacefulMobs, this.worldInfo.getWorldTotalTime() % 400L == 0L); //this.animalSpawner.findChunksForSpawning(this, this.spawnHostileMobs, this.spawnPeacefulMobs, this.worldInfo.getWorldTotalTime() % 400L == 0L); // FIX THIS SHIT, IMPORTANT!!!
} }
this.chunkProvider.unloadQueuedChunks(); this.chunkProvider.unloadQueuedChunks();