Merge branch 'master' into 1.15
# Conflicts: # src/main/java/carpet/script/CarpetExpression.java
This commit is contained in:
commit
3e6f83905c
21 files changed
+1019
-296
No files matched your search
@@ -26,26 +26,20 @@ public abstract class ContainerMixin
|
||||
@Shadow public abstract void sendContentUpdates();
|
||||
|
||||
@Inject( method = "onSlotClick", at = @At(value = "HEAD"), cancellable = true)
|
||||
private void onThrowClick(
|
||||
int int_1,
|
||||
int int_2,
|
||||
SlotActionType slotActionType_1,
|
||||
PlayerEntity playerEntity_1,
|
||||
CallbackInfoReturnable<ItemStack> cir
|
||||
)
|
||||
private void onThrowClick( int slotId, int clickData, SlotActionType actionType, PlayerEntity playerEntity, CallbackInfoReturnable<ItemStack> cir)
|
||||
{
|
||||
if (slotActionType_1 == SlotActionType.THROW && CarpetSettings.ctrlQCraftingFix && playerEntity_1.inventory.getCursorStack().isEmpty() && int_1 >= 0)
|
||||
if (actionType == SlotActionType.THROW && CarpetSettings.ctrlQCraftingFix && playerEntity.inventory.getCursorStack().isEmpty() && slotId >= 0)
|
||||
{
|
||||
ItemStack itemStack_1 = ItemStack.EMPTY;
|
||||
Slot slot_4 = slotList.get(int_1);
|
||||
if (slot_4 != null && slot_4.hasStack() && slot_4.canTakeItems(playerEntity_1))
|
||||
Slot slot_4 = slotList.get(slotId);
|
||||
if (slot_4 != null && slot_4.hasStack() && slot_4.canTakeItems(playerEntity))
|
||||
{
|
||||
if(int_1 == 0 && int_2 == 1)
|
||||
if(slotId == 0 && clickData == 1)
|
||||
{
|
||||
Item craftedItem = slot_4.getStack().getItem();
|
||||
while(slot_4.hasStack() && slot_4.getStack().getItem() == craftedItem)
|
||||
{
|
||||
this.onSlotClick(int_1, 0, SlotActionType.THROW, playerEntity_1);
|
||||
this.onSlotClick(slotId, 0, SlotActionType.THROW, playerEntity);
|
||||
}
|
||||
this.sendContentUpdates();
|
||||
cir.setReturnValue(itemStack_1);
|
||||
|
||||
@@ -4,14 +4,18 @@ import com.mojang.authlib.GameProfile;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.stat.Stat;
|
||||
import net.minecraft.util.Hand;
|
||||
import net.minecraft.world.World;
|
||||
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 static carpet.script.CarpetEventServer.Event.PLAYER_FINISHED_USING_ITEM;
|
||||
import static carpet.script.CarpetEventServer.Event.STATISTICS;
|
||||
|
||||
@Mixin(ServerPlayerEntity.class)
|
||||
public abstract class ServerPlayerEntity_scarpetEventMixin extends PlayerEntity
|
||||
@@ -43,4 +47,10 @@ public abstract class ServerPlayerEntity_scarpetEventMixin extends PlayerEntity
|
||||
super.consumeItem();
|
||||
}
|
||||
}
|
||||
|
||||
@Inject(method = "increaseStat", at = @At("HEAD"))
|
||||
private void grabStat(Stat<?> stat, int amount, CallbackInfo ci)
|
||||
{
|
||||
STATISTICS.onPlayerStatistic((ServerPlayerEntity) (Object)this, stat, amount);
|
||||
}
|
||||
}
|
||||
@@ -21,14 +21,4 @@ public class WorldChunk_fillUpdatesMixin
|
||||
if (!CarpetSettings.impendingFillSkipUpdates)
|
||||
blockState.onBlockAdded(world_1, blockPos_1, blockState_1, boolean_1);
|
||||
}
|
||||
|
||||
@Redirect(method = "setBlockState", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/block/BlockState;onBlockRemoved(Lnet/minecraft/world/World;Lnet/minecraft/util/math/BlockPos;Lnet/minecraft/block/BlockState;Z)V"
|
||||
))
|
||||
private void onRemoved(BlockState blockState, World world_1, BlockPos blockPos_1, BlockState blockState_1, boolean boolean_1)
|
||||
{
|
||||
if (!CarpetSettings.impendingFillSkipUpdates)
|
||||
blockState.onBlockRemoved(world_1, blockPos_1, blockState_1, boolean_1);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user