Skip to content

Commit

Permalink
Super early 1.12.2 tester. @Someone plz test further.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nessiesson committed Aug 28, 2019
1 parent 2da05bc commit 4098d90
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 89 deletions.
6 changes: 3 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ apply plugin: 'net.minecraftforge.gradle.liteloader'
apply plugin: 'org.spongepowered.mixin'

minecraft {
version = "1.12"
mappings = "snapshot_20180130"
version = "1.12.2"
mappings = "stable_39"
runDir = "run"
makeObfSourceJar = false
replace '@VERSION@', project.version
Expand All @@ -46,7 +46,7 @@ litemod {
name = "Carpet Client"
displayName = "Carpet Client"
author = "Carpet Team"
mcversion = "1.12"
mcversion = "1.12.2"
description = "Carpet Client for Carpet Server"
mixinConfigs += "mixins.carpetclient.json"
mixinConfigs += "mixins.carpetclient.optifinecompat.json"
Expand Down
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ group=Xcom.CarpetClient
name=CarpetClient
version=0.1
displayName=CarpetClient
mcVersion=1.12
targetVersion=1.12
mcMappings=snapshot_20180130
mcVersion=1.12.2
targetVersion=1.12.2
mcMappings=stable_39
forgeGradleVersion=2.3-SNAPSHOT
2 changes: 1 addition & 1 deletion src/main/java/carpetclient/bugfix/PistonFix.java
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private void fixTileEntitys() {
world.loadedTileEntityList.remove(tileentity);

if (world.isBlockLoaded(tileentity.getPos())) {
world.getChunkFromBlockCoords(tileentity.getPos()).removeTileEntity(tileentity.getPos());
world.getChunk(tileentity.getPos()).removeTileEntity(tileentity.getPos());
}
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/main/java/carpetclient/mixins/MixinBlockPistonBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ public void eventReceivedMixins(World worldIn1,
BlockPos pos1, Block blockIn, int eventID, int eventParam, // from addBlockEvent
World worldIn2, BlockPos pos2, IBlockState state // from checkForMove
) {
worldIn1.addBlockEvent(pos1, this, 1, eventParam | ignoreMovingBlockMeta(worldIn1, pos1, EnumFacing.getFront(eventParam)));
worldIn1.addBlockEvent(pos1, this, 1, eventParam | ignoreMovingBlockMeta(worldIn1, pos1, EnumFacing.byHorizontalIndex(eventParam)));
}

/*
Expand All @@ -125,7 +125,7 @@ public void eventReceivedMixins(World worldIn1,
* even if the client can pull them.
*/
private int ignoreMovingBlockMeta(World worldIn, BlockPos pos, EnumFacing enumfacing) {
BlockPos blockpos = pos.add(enumfacing.getFrontOffsetX() * 2, enumfacing.getFrontOffsetY() * 2, enumfacing.getFrontOffsetZ() * 2);
BlockPos blockpos = pos.add(enumfacing.getXOffset() * 2, enumfacing.getYOffset() * 2, enumfacing.getZOffset() * 2);
IBlockState iblockstate = worldIn.getBlockState(blockpos);
Block block = iblockstate.getBlock();

Expand Down Expand Up @@ -193,17 +193,17 @@ private static boolean isPushableTileEntityBlock(Block block)
&& block != Blocks.END_PORTAL && block != Blocks.MOB_SPAWNER && block != Blocks.PISTON_EXTENSION;
}

@Inject(method = "doMove", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, target = "Ljava/util/List;size()I", ordinal = 4), locals = LocalCapture.CAPTURE_FAILHARD)
@Inject(method = "doMove", at = @At(value = "INVOKE", shift = At.Shift.BEFORE, target = "Ljava/util/List;size()I", remap = false, ordinal = 4), locals = LocalCapture.CAPTURE_FAILHARD)
private void doMoveTE(World worldIn, BlockPos pos, EnumFacing direction, boolean extending, CallbackInfoReturnable<Boolean> cir,
BlockPistonStructureHelper blockpistonstructurehelper, List<BlockPos> list, List<IBlockState> list1,
List<BlockPos> list2, int k, IBlockState[] aiblockstate, EnumFacing enumfacing, int var12) {
doMoveTE(worldIn, pos, direction, extending, cir, blockpistonstructurehelper, list, list1, list2, k, aiblockstate, var12);
List<BlockPos> list2, int k, IBlockState[] aiblockstate, EnumFacing enumfacing) {
doMoveTE(worldIn, pos, direction, extending, cir, blockpistonstructurehelper, list, list1, list2, k, aiblockstate);
}

@Surrogate // EnumFacing local var only present in recompiled Minecraft
private void doMoveTE(World worldIn, BlockPos pos, EnumFacing direction, boolean extending, CallbackInfoReturnable<Boolean> cir,
BlockPistonStructureHelper blockpistonstructurehelper, List<BlockPos> list, List<IBlockState> list1,
List<BlockPos> list2, int k, IBlockState[] aiblockstate, int var12) {
List<BlockPos> list2, int k, IBlockState[] aiblockstate) {
if (!Config.movableTileEntities)
return;

Expand Down
36 changes: 18 additions & 18 deletions src/main/java/carpetclient/mixins/MixinEntityRenderer.java
Original file line number Diff line number Diff line change
Expand Up @@ -158,16 +158,16 @@ private void rend(int pass, float partialTicks, float worldTicks, long finishTim
ParticleManager particlemanager = this.mc.effectRenderer;
boolean flag = this.isDrawBlockOutline();
GlStateManager.enableCull();
this.mc.mcProfiler.endStartSection("clear");
this.mc.profiler.endStartSection("clear");
GlStateManager.viewport(0, 0, this.mc.displayWidth, this.mc.displayHeight);
this.updateFogColor(partialTicks);
GlStateManager.clear(16640);
this.mc.mcProfiler.endStartSection("camera");
this.mc.profiler.endStartSection("camera");
this.setupCameraTransform(partialTicks, pass);
ActiveRenderInfo.updateRenderInfo(this.mc.player, this.mc.gameSettings.thirdPersonView == 2);
this.mc.mcProfiler.endStartSection("frustum");
this.mc.profiler.endStartSection("frustum");
ClippingHelperImpl.getInstance();
this.mc.mcProfiler.endStartSection("culling");
this.mc.profiler.endStartSection("culling");
ICamera icamera = new Frustum();
Entity entity = this.mc.getRenderViewEntity();
double d0 = entity.lastTickPosX + (entity.posX - entity.lastTickPosX) * (double) partialTicks;
Expand All @@ -181,7 +181,7 @@ private void rend(int pass, float partialTicks, float worldTicks, long finishTim

if (this.mc.gameSettings.renderDistanceChunks >= 4) {
this.setupFog(-1, partialTicks);
this.mc.mcProfiler.endStartSection("sky");
this.mc.profiler.endStartSection("sky");
GlStateManager.matrixMode(5889);
GlStateManager.loadIdentity();
Project.gluPerspective(this.getFOVModifier(partialTicks, true), (float) this.mc.displayWidth / (float) this.mc.displayHeight, 0.05F, this.farPlaneDistance * 2.0F);
Expand All @@ -200,19 +200,19 @@ private void rend(int pass, float partialTicks, float worldTicks, long finishTim
this.renderCloudsCheck(renderglobal, partialTicks, pass, d0, d1, d2);
}

this.mc.mcProfiler.endStartSection("prepareterrain");
this.mc.profiler.endStartSection("prepareterrain");
this.setupFog(0, partialTicks);
this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
RenderHelper.disableStandardItemLighting();
this.mc.mcProfiler.endStartSection("terrain_setup");
this.mc.profiler.endStartSection("terrain_setup");
renderglobal.setupTerrain(entity, (double) partialTicks, icamera, this.frameCount++, this.mc.player.isSpectator());

if (pass == 0 || pass == 2) {
this.mc.mcProfiler.endStartSection("updatechunks");
this.mc.profiler.endStartSection("updatechunks");
this.mc.renderGlobal.updateChunks(finishTimeNano);
}

this.mc.mcProfiler.endStartSection("terrain");
this.mc.profiler.endStartSection("terrain");
GlStateManager.matrixMode(5888);
GlStateManager.pushMatrix();
GlStateManager.disableAlpha();
Expand All @@ -230,7 +230,7 @@ private void rend(int pass, float partialTicks, float worldTicks, long finishTim
GlStateManager.popMatrix();
GlStateManager.pushMatrix();
RenderHelper.enableStandardItemLighting();
this.mc.mcProfiler.endStartSection("entities");
this.mc.profiler.endStartSection("entities");

entity.lastTickPosX = entity.posX - (entity.posX - lx) * (1.0 - partialTicks) / (1.0 - worldTicks);
entity.lastTickPosY = entity.posY - (entity.posY - ly) * (1.0 - partialTicks) / (1.0 - worldTicks);
Expand All @@ -252,7 +252,7 @@ private void rend(int pass, float partialTicks, float worldTicks, long finishTim
if (flag && this.mc.objectMouseOver != null && !entity.isInsideOfMaterial(Material.WATER)) {
EntityPlayer entityplayer = (EntityPlayer) entity;
GlStateManager.disableAlpha();
this.mc.mcProfiler.endStartSection("outline");
this.mc.profiler.endStartSection("outline");
renderglobal.drawSelectionBox(entityplayer, this.mc.objectMouseOver, 0, partialTicks);
GlStateManager.enableAlpha();
}
Expand All @@ -265,7 +265,7 @@ private void rend(int pass, float partialTicks, float worldTicks, long finishTim
this.mc.debugRenderer.renderDebug(partialTicks, finishTimeNano);
}

this.mc.mcProfiler.endStartSection("destroyProgress");
this.mc.profiler.endStartSection("destroyProgress");
GlStateManager.enableBlend();
GlStateManager.tryBlendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE, GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
this.mc.getTextureManager().getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
Expand All @@ -275,11 +275,11 @@ private void rend(int pass, float partialTicks, float worldTicks, long finishTim

if (!this.debugView) {
this.enableLightmap();
this.mc.mcProfiler.endStartSection("litParticles");
this.mc.profiler.endStartSection("litParticles");
particlemanager.renderLitParticles(entity, worldTicks);
RenderHelper.disableStandardItemLighting();
this.setupFog(0, worldTicks);
this.mc.mcProfiler.endStartSection("particles");
this.mc.profiler.endStartSection("particles");
particlemanager.renderParticles(entity, worldTicks);
this.disableLightmap();
}
Expand All @@ -290,7 +290,7 @@ private void rend(int pass, float partialTicks, float worldTicks, long finishTim

GlStateManager.depthMask(false);
GlStateManager.enableCull();
this.mc.mcProfiler.endStartSection("weather");
this.mc.profiler.endStartSection("weather");
this.renderRainSnow(worldTicks);
GlStateManager.depthMask(true);
renderglobal.renderWorldBorder(entity, partialTicks);
Expand All @@ -303,7 +303,7 @@ private void rend(int pass, float partialTicks, float worldTicks, long finishTim
GlStateManager.depthMask(false);
this.mc.getTextureManager().bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
GlStateManager.shadeModel(7425);
this.mc.mcProfiler.endStartSection("translucent");
this.mc.profiler.endStartSection("translucent");
renderglobal.renderBlockLayer(BlockRenderLayer.TRANSLUCENT, (double) partialTicks, pass, entity);
GlStateManager.shadeModel(7424);
GlStateManager.depthMask(true);
Expand All @@ -312,11 +312,11 @@ private void rend(int pass, float partialTicks, float worldTicks, long finishTim
GlStateManager.disableFog();

if (entity.posY + (double) entity.getEyeHeight() >= 128.0D) {
this.mc.mcProfiler.endStartSection("aboveClouds");
this.mc.profiler.endStartSection("aboveClouds");
this.renderCloudsCheck(renderglobal, partialTicks, pass, d0, d1, d2);
}

this.mc.mcProfiler.endStartSection("hand");
this.mc.profiler.endStartSection("hand");

if (this.renderHand) {
GlStateManager.clear(256);
Expand Down
39 changes: 0 additions & 39 deletions src/main/java/carpetclient/mixins/MixinGuiRecipeBook.java

This file was deleted.

34 changes: 17 additions & 17 deletions src/main/java/carpetclient/mixins/MixinMinecraft.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public abstract class MixinMinecraft implements IMixinMinecraft {
public WorldClient world;
@Shadow
public @Final
Profiler mcProfiler;
Profiler profiler;
@Shadow
public EntityPlayerSP player;
@Shadow
Expand All @@ -56,16 +56,16 @@ public abstract class MixinMinecraft implements IMixinMinecraft {
@Shadow
public RenderGlobal renderGlobal;
@Shadow
private SoundHandler mcSoundHandler;
private SoundHandler soundHandler;
@Shadow
private MusicTicker mcMusicTicker;
private MusicTicker musicTicker;
@Shadow
private @Final
Tutorial tutorial;
@Shadow
public ParticleManager effectRenderer;
@Shadow
private NetworkManager myNetworkManager;
private NetworkManager networkManager;
@Shadow
long systemTime;
@Shadow
Expand Down Expand Up @@ -112,7 +112,7 @@ public void redirectUpdateCameraAndRender(EntityRenderer entityRenderer,
/**
* Inject after the runTick method have looped to update world and player entities differently. Disabled when tick speeds are synched.
*/
@Inject(method = "runGameLoop", at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;mcProfiler:Lnet/minecraft/profiler/Profiler;", ordinal = 3, shift = At.Shift.BEFORE))
@Inject(method = "runGameLoop", at = @At(value = "FIELD", target = "Lnet/minecraft/client/Minecraft;profiler:Lnet/minecraft/profiler/Profiler;", ordinal = 3, shift = At.Shift.BEFORE))
public void injectPlayerWorldLoops(CallbackInfo ci) {
if (TickRate.runTickRate) {
int playerTicks = this.timer.elapsedTicks;
Expand Down Expand Up @@ -176,7 +176,7 @@ public void runTickPlayer() {
}
}

this.mcProfiler.endStartSection("gameRenderer");
this.profiler.endStartSection("gameRenderer");

if (!this.isGamePaused) {
this.entityRenderer.updateRenderer();
Expand All @@ -200,19 +200,19 @@ public void runTickWorld() {
}
}

this.mcProfiler.endStartSection("gameRenderer");
this.profiler.endStartSection("gameRenderer");

if (!this.isGamePaused) {
this.entityRenderer.updateRenderer();
}

this.mcProfiler.endStartSection("levelRenderer");
this.profiler.endStartSection("levelRenderer");

if (!this.isGamePaused) {
this.renderGlobal.updateClouds();
}

this.mcProfiler.endStartSection("level");
this.profiler.endStartSection("level");

if (!this.isGamePaused) {
if (this.world.getLastLightningBolt() > 0) {
Expand All @@ -228,8 +228,8 @@ public void runTickWorld() {
}

if (!this.isGamePaused) {
this.mcMusicTicker.update();
this.mcSoundHandler.update();
this.musicTicker.update();
this.soundHandler.update();
}

if (this.world != null) {
Expand All @@ -253,23 +253,23 @@ public void runTickWorld() {
}
}

this.mcProfiler.endStartSection("animateTick");
this.profiler.endStartSection("animateTick");

if (!this.isGamePaused && this.world != null) {
this.world.doVoidFogParticles(MathHelper.floor(this.player.posX), MathHelper.floor(this.player.posY), MathHelper.floor(this.player.posZ));
}

this.mcProfiler.endStartSection("particles");
this.profiler.endStartSection("particles");

if (!this.isGamePaused) {
this.effectRenderer.updateEffects();
}
} else if (this.myNetworkManager != null) {
this.mcProfiler.endStartSection("pendingConnection");
this.myNetworkManager.processReceivedPackets();
} else if (this.networkManager != null) {
this.profiler.endStartSection("pendingConnection");
this.networkManager.processReceivedPackets();
}

this.mcProfiler.endSection();
this.profiler.endSection();
this.systemTime = Minecraft.getSystemTime();
}
}
16 changes: 16 additions & 0 deletions src/main/java/carpetclient/mixins/MixinPlayerControllerMP.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,15 @@
import carpetclient.Hotkeys;
import net.minecraft.client.Minecraft;
import net.minecraft.client.entity.EntityPlayerSP;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.multiplayer.PlayerControllerMP;
import net.minecraft.client.multiplayer.WorldClient;
import net.minecraft.client.network.NetHandlerPlayClient;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.ClickType;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.item.crafting.IRecipe;
import net.minecraft.network.Packet;
import net.minecraft.network.play.client.CPacketPlayerTryUseItemOnBlock;
import net.minecraft.util.EnumFacing;
Expand All @@ -20,7 +24,10 @@
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.Shadow;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.Redirect;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;

/*
Injecting code for block rotation. Editing the x value when sending the package "CPacketPlayerTryUseItemOnBlock" to be decoded by carpet.
Expand Down Expand Up @@ -188,4 +195,13 @@ private boolean isGlazedTerracotta(ItemStack itemstack){
int id = Item.getIdFromItem(itemstack.getItem());
return id >= 235 && id <= 250;
}

@Inject(method = "func_194338_a", at = @At("RETURN"))
private void ups(int window, IRecipe recipe, boolean makeAll, EntityPlayer p_194338_4_, CallbackInfo ci) {
if (GuiScreen.isShiftKeyDown() && GuiScreen.isAltKeyDown() ){
this.mc.playerController.windowClick(0, 0, 1, ClickType.QUICK_MOVE, this.mc.player);
} else if(GuiScreen.isShiftKeyDown() && GuiScreen.isCtrlKeyDown() && Config.controlQCrafting) {
this.mc.playerController.windowClick(0, 0, 1, ClickType.THROW, this.mc.player);
}
}
}
Loading

0 comments on commit 4098d90

Please sign in to comment.