20w10a
- broken scarpet shapes
This commit is contained in:
1 parent
170fd9d762
commit
42f78a596a
16 files changed
+78
-48
No files matched your search
@@ -13,6 +13,7 @@ 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.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
|
||||
import java.util.List;
|
||||
@@ -21,16 +22,20 @@ import java.util.List;
|
||||
public abstract class ContainerMixin
|
||||
{
|
||||
|
||||
@Shadow public abstract ItemStack onSlotClick(int int_1, int int_2, SlotActionType slotActionType_1, PlayerEntity playerEntity_1);
|
||||
@Shadow public abstract void onSlotClick(int int_1, int int_2, SlotActionType slotActionType_1, PlayerEntity playerEntity_1);
|
||||
|
||||
@Shadow public abstract void sendContentUpdates();
|
||||
|
||||
@Shadow @Final public DefaultedList<Slot> slots;
|
||||
|
||||
@Shadow protected abstract void endQuickCraft();
|
||||
|
||||
@Shadow public abstract ItemStack method_34255();
|
||||
|
||||
@Inject( method = "internalOnSlotClick", at = @At(value = "HEAD"), cancellable = true)
|
||||
private void onThrowClick( int slotId, int clickData, SlotActionType actionType, PlayerEntity playerEntity, CallbackInfoReturnable<ItemStack> cir)
|
||||
private void onThrowClick(int slotId, int clickData, SlotActionType actionType, PlayerEntity playerEntity, CallbackInfo ci)
|
||||
{
|
||||
if (actionType == SlotActionType.THROW && CarpetSettings.ctrlQCraftingFix && playerEntity.getInventory().getCursorStack().isEmpty() && slotId >= 0)
|
||||
if (actionType == SlotActionType.THROW && CarpetSettings.ctrlQCraftingFix && this.method_34255().isEmpty() /* playerEntity.getInventory().getCursorStack().isEmpty()*/ && slotId >= 0)
|
||||
{
|
||||
ItemStack itemStack_1 = ItemStack.EMPTY;
|
||||
Slot slot_4 = slots.get(slotId);
|
||||
@@ -44,8 +49,8 @@ public abstract class ContainerMixin
|
||||
this.onSlotClick(slotId, 0, SlotActionType.THROW, playerEntity);
|
||||
}
|
||||
this.sendContentUpdates();
|
||||
cir.setReturnValue(itemStack_1);
|
||||
cir.cancel();
|
||||
this.endQuickCraft();
|
||||
ci.cancel();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,7 +19,11 @@ public class PlayerManager_scarpetEventsMixin
|
||||
PLAYER_RESPAWNS.onPlayerEvent(player);
|
||||
}
|
||||
|
||||
@Inject(method = "respawnPlayer", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;onSpawn()V"))
|
||||
@Inject(method = "respawnPlayer", at = @At(
|
||||
value = "INVOKE",
|
||||
//target = "Lnet/minecraft/server/network/ServerPlayerEntity;onSpawn()V"
|
||||
target = "Lnet/minecraft/server/network/ServerPlayerEntity;method_34225()V"
|
||||
))
|
||||
private void invalidatePreviousInstance(ServerPlayerEntity player, boolean alive, CallbackInfoReturnable<ServerPlayerEntity> cir)
|
||||
{
|
||||
((ServerPlayerEntityInterface)player).invalidateEntityObjectReference();
|
||||
|
||||
@@ -51,7 +51,7 @@ public class ServerPlayNetworkHandler_scarpetEventsMixin
|
||||
{
|
||||
@Shadow public ServerPlayerEntity player;
|
||||
|
||||
@Inject(method = "onPlayerInput", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;method_14218(FFZZ)V"))
|
||||
@Inject(method = "onPlayerInput", at = @At(value = "INVOKE", target = "Lnet/minecraft/server/network/ServerPlayerEntity;updateInput(FFZZ)V"))
|
||||
private void checkMoves(PlayerInputC2SPacket p, CallbackInfo ci)
|
||||
{
|
||||
if (PLAYER_RIDES.isNeeded() && (p.getSideways() != 0.0F || p.getForward() != 0.0F || p.isJumping() || p.isSneaking()))
|
||||
|
||||
@@ -80,7 +80,7 @@ public abstract class ServerPlayerEntity_scarpetEventMixin extends PlayerEntity
|
||||
}
|
||||
}
|
||||
|
||||
@Redirect(method = "method_14218", at = @At(
|
||||
@Redirect(method = "updateInput", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/server/network/ServerPlayerEntity;setSneaking(Z)V"
|
||||
))
|
||||
|
||||
@@ -34,7 +34,7 @@ public abstract class StructureBlockBlockEntity_limitsMixin
|
||||
method = "saveStructure(Z)Z",
|
||||
at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/structure/Structure;saveFromWorld(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/BlockPos;ZLnet/minecraft/block/Block;)V"
|
||||
target = "Lnet/minecraft/structure/Structure;saveFromWorld(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/util/math/Vec3i;ZLnet/minecraft/block/Block;)V"
|
||||
),
|
||||
index = 4
|
||||
)
|
||||
|
||||
@@ -11,6 +11,7 @@ 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.callback.CallbackInfo;
|
||||
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
|
||||
import org.spongepowered.asm.mixin.injection.callback.LocalCapture;
|
||||
|
||||
@@ -25,7 +26,7 @@ public abstract class TradeOutputSlot_scarpetEventMixin {
|
||||
@Inject(method = "onTakeItem", at = @At(value = "INVOKE",
|
||||
target = "Lnet/minecraft/village/Merchant;trade(Lnet/minecraft/village/TradeOffer;)V")
|
||||
)
|
||||
private void onTrade(PlayerEntity player, ItemStack stack, CallbackInfoReturnable<ItemStack> cir) {
|
||||
private void onTrade(PlayerEntity player, ItemStack stack, CallbackInfo ci) {
|
||||
if(PLAYER_TRADES.isNeeded() && !this.merchant.getMerchantWorld().isClient())
|
||||
{
|
||||
PLAYER_TRADES.onTrade((ServerPlayerEntity) player, merchant, merchantInventory.getTradeOffer());
|
||||
|
||||
@@ -7,6 +7,7 @@ import net.minecraft.network.PacketByteBuf;
|
||||
import net.minecraft.network.packet.c2s.play.UpdateStructureBlockC2SPacket;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.util.math.MathHelper;
|
||||
import net.minecraft.util.math.Vec3i;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.Shadow;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
@@ -18,7 +19,7 @@ public class UpdateStructureBlockC2SPacketMixin {
|
||||
@Shadow
|
||||
private BlockPos offset;
|
||||
@Shadow
|
||||
private BlockPos size;
|
||||
private Vec3i size;
|
||||
|
||||
@Inject(
|
||||
method = "<init>(Lnet/minecraft/network/PacketByteBuf;)V",
|
||||
@@ -28,7 +29,7 @@ public class UpdateStructureBlockC2SPacketMixin {
|
||||
if (buf.readableBytes() == 6*4) {
|
||||
// This will throw an exception if carpet is not installed on client
|
||||
offset = new BlockPos(MathHelper.clamp(buf.readInt(), -CarpetSettings.structureBlockLimit, CarpetSettings.structureBlockLimit), MathHelper.clamp(buf.readInt(), -CarpetSettings.structureBlockLimit, CarpetSettings.structureBlockLimit), MathHelper.clamp(buf.readInt(), -CarpetSettings.structureBlockLimit, CarpetSettings.structureBlockLimit));
|
||||
size = new BlockPos(MathHelper.clamp(buf.readInt(), 0, CarpetSettings.structureBlockLimit), MathHelper.clamp(buf.readInt(), 0, CarpetSettings.structureBlockLimit), MathHelper.clamp(buf.readInt(), 0, CarpetSettings.structureBlockLimit));
|
||||
size = new Vec3i(MathHelper.clamp(buf.readInt(), 0, CarpetSettings.structureBlockLimit), MathHelper.clamp(buf.readInt(), 0, CarpetSettings.structureBlockLimit), MathHelper.clamp(buf.readInt(), 0, CarpetSettings.structureBlockLimit));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -40,9 +40,11 @@ public class WorldRenderer_scarpetRenderMixin
|
||||
// in normal circumstances we want to render shapes at the very end so it appears correctly behind stuff.
|
||||
if (!FabricAPIHooks.WORLD_RENDER_EVENTS && CarpetClient.shapes != null && transparencyShader == null)
|
||||
{
|
||||
RenderSystem.pushMatrix();
|
||||
CarpetClient.shapes.render(camera, tickDelta);
|
||||
RenderSystem.popMatrix();
|
||||
matrices.push();
|
||||
//RenderSystem.pushMatrix(); ??
|
||||
CarpetClient.shapes.render(matrices, camera, tickDelta);
|
||||
//RenderSystem.popMatrix(); ??
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,9 +58,11 @@ public class WorldRenderer_scarpetRenderMixin
|
||||
// with fabulous graphics - stuff doesn't work this way for some reason - need to render with chunk lines.
|
||||
if (!FabricAPIHooks.WORLD_RENDER_EVENTS && CarpetClient.shapes != null && transparencyShader != null)
|
||||
{
|
||||
RenderSystem.pushMatrix();
|
||||
CarpetClient.shapes.render(camera, tickDelta);
|
||||
RenderSystem.popMatrix();
|
||||
matrices.push();
|
||||
//RenderSystem.pushMatrix();
|
||||
CarpetClient.shapes.render(matrices, camera, tickDelta);
|
||||
//RenderSystem.popMatrix();
|
||||
matrices.pop();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user