Merge branch 'master' into 1.17

# Conflicts:
#	src/main/resources/carpet.mixins.json
This commit is contained in:
gnembon committed 2021-06-22 01:28:32 -03:00
commit 241537b172
5 files changed
+38 -9

No files matched your search

+7
View File
@@ -10,6 +10,8 @@ import carpet.utils.Messenger;
import carpet.utils.SpawnChunks; import carpet.utils.SpawnChunks;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.Blocks; import net.minecraft.block.Blocks;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.command.ServerCommandSource; import net.minecraft.server.command.ServerCommandSource;
import net.minecraft.server.dedicated.DedicatedServer; import net.minecraft.server.dedicated.DedicatedServer;
@@ -828,6 +830,11 @@ public class CarpetSettings
category = {CREATIVE, CLIENT} category = {CREATIVE, CLIENT}
) )
public static boolean creativeNoClip = false; public static boolean creativeNoClip = false;
public static boolean isCreativeFlying(Entity entity)
{
// #todo replace after merger to 1.17
return CarpetSettings.creativeNoClip && entity instanceof PlayerEntity && (((PlayerEntity) entity).isCreative()) && ((PlayerEntity) entity).abilities.flying;
}
@Rule( @Rule(
+7 -3
View File
@@ -108,9 +108,13 @@ public class TickSpeed
{ {
tick_warp_callback = null; tick_warp_callback = null;
if (source != tick_warp_sender) tick_warp_sender = null; if (source != tick_warp_sender) tick_warp_sender = null;
finish_time_warp(); if (time_bias > 0)
tick_warp_sender = null; {
return Messenger.c("gi Warp interrupted"); finish_time_warp();
tick_warp_sender = null;
return Messenger.c("gi Warp interrupted");
}
return Messenger.c("ri No warp in progress");
} }
if (time_bias > 0) if (time_bias > 0)
{ {
@@ -0,0 +1,19 @@
package carpet.mixins;
import carpet.CarpetSettings;
import net.minecraft.block.entity.EndGatewayBlockEntity;
import net.minecraft.entity.Entity;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
@Mixin(EndGatewayBlockEntity.class)
public class EndGatewayBlockEntity_creativeNoClipMixin
{
@Inject(method = "method_30276", cancellable = true, at = @At("HEAD"))
private static void checkFlyingCreative(Entity entity, CallbackInfoReturnable<Boolean> cir)
{
if (CarpetSettings.isCreativeFlying(entity)) cir.setReturnValue(false);
}
}
@@ -48,7 +48,7 @@ public class EquipmentInventory implements Inventory
catch (IndexOutOfBoundsException ignored) catch (IndexOutOfBoundsException ignored)
{ {
//going out of the index should be really exceptional //going out of the index should be really exceptional
return null; return ItemStack.EMPTY;
} }
return mob.getEquippedStack(slotSlot); return mob.getEquippedStack(slotSlot);
} }
@@ -64,11 +64,9 @@ public class EquipmentInventory implements Inventory
catch (IndexOutOfBoundsException ignored) catch (IndexOutOfBoundsException ignored)
{ {
//going out of the index should be really exceptional //going out of the index should be really exceptional
return null; return ItemStack.EMPTY;
} }
ItemStack stack = mob.getEquippedStack(slotSlot); return mob.getEquippedStack(slotSlot).split(amount);
stack.decrement(amount);
return stack;
} }
@Override @Override
@@ -82,7 +80,7 @@ public class EquipmentInventory implements Inventory
catch (IndexOutOfBoundsException ignored) catch (IndexOutOfBoundsException ignored)
{ {
//going out of the index should be really exceptional //going out of the index should be really exceptional
return null; return ItemStack.EMPTY;
} }
ItemStack previous = mob.getEquippedStack(slotSlot); ItemStack previous = mob.getEquippedStack(slotSlot);
mob.equipStack(slotSlot, ItemStack.EMPTY); mob.equipStack(slotSlot, ItemStack.EMPTY);
+1
View File
@@ -210,6 +210,7 @@
"BlockItem_creativeNoClipMixin", "BlockItem_creativeNoClipMixin",
"WallStandingBlockItem_creativeNoClipMixin", "WallStandingBlockItem_creativeNoClipMixin",
"ShulkerBoxBlockEntity_creativeNoClipMixin", "ShulkerBoxBlockEntity_creativeNoClipMixin",
"EndGatewayBlockEntity_creativeNoClipMixin",
"LivingEntity_creativeFlyMixin", "LivingEntity_creativeFlyMixin",
"VeryBiasedToBottomHeightProvider_cleanLogsMixin", "VeryBiasedToBottomHeightProvider_cleanLogsMixin",