Merge branch 'master' into 1.17
# Conflicts: # src/main/resources/carpet.mixins.json
This commit is contained in:
commit
dc38cd272f
7 files changed
+40
-24
No files matched your search
@@ -1,6 +1,5 @@
|
||||
package carpet;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
@@ -39,8 +38,11 @@ import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.dedicated.command.PerfCommand;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
|
||||
public class CarpetServer implements ClientModInitializer,DedicatedServerModInitializer // static for now - easier to handle all around the code, its one anyways
|
||||
public class CarpetServer // static for now - easier to handle all around the code, its one anyways
|
||||
{
|
||||
public static final ClientModInitializer CLIENT_INITIALIZER = CarpetServer::onGameStarted;
|
||||
public static final DedicatedServerModInitializer SERVER_INITIALIZER = CarpetServer::onGameStarted;
|
||||
|
||||
public static final Random rand = new Random();
|
||||
public static MinecraftServer minecraft_server;
|
||||
private static CommandDispatcher<ServerCommandSource> currentCommandDispatcher;
|
||||
@@ -48,17 +50,6 @@ public class CarpetServer implements ClientModInitializer,DedicatedServerModInit
|
||||
public static SettingsManager settingsManager;
|
||||
public static final List<CarpetExtension> extensions = new ArrayList<>();
|
||||
|
||||
@Override
|
||||
public void onInitializeClient()
|
||||
{
|
||||
CarpetServer.onGameStarted();
|
||||
}
|
||||
@Override
|
||||
public void onInitializeServer()
|
||||
{
|
||||
CarpetServer.onGameStarted();
|
||||
}
|
||||
|
||||
// Separate from onServerLoaded, because a server can be loaded multiple times in singleplayer
|
||||
/**
|
||||
* Registers a {@link CarpetExtension} to be managed by Carpet.<br>
|
||||
|
||||
@@ -0,0 +1,25 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.CarpetSettings;
|
||||
import net.minecraft.block.entity.ShulkerBoxBlockEntity;
|
||||
import net.minecraft.block.piston.PistonBehavior;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import org.spongepowered.asm.mixin.Mixin;
|
||||
import org.spongepowered.asm.mixin.injection.At;
|
||||
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||
|
||||
@Mixin(ShulkerBoxBlockEntity.class)
|
||||
public class ShulkerBoxBlockEntity_creativeNoClipMixin
|
||||
{
|
||||
@Redirect(method = "pushEntities", at = @At(
|
||||
value = "INVOKE",
|
||||
target = "Lnet/minecraft/entity/Entity;getPistonBehavior()Lnet/minecraft/block/piston/PistonBehavior;"
|
||||
))
|
||||
private PistonBehavior getPistonBehaviourOfNoClipPlayers(Entity entity)
|
||||
{
|
||||
if (CarpetSettings.creativeNoClip && entity instanceof PlayerEntity && (((PlayerEntity) entity).isCreative()) && ((PlayerEntity) entity).abilities.flying)
|
||||
return PistonBehavior.IGNORE;
|
||||
return entity.getPistonBehavior();
|
||||
}
|
||||
}
|
||||
@@ -378,7 +378,7 @@ public class CarpetScriptHost extends ScriptHost
|
||||
}
|
||||
catch (CommandSyntaxException e)
|
||||
{
|
||||
notifier.accept(Messenger.c("Error when handling of setting up custom argument types: "+e.getMessage()));
|
||||
notifier.accept(Messenger.c("r Error when handling of setting up custom argument types: "+e.getMessage()));
|
||||
return false;
|
||||
}
|
||||
if (appConfig.get(StringValue.of("commands")) != null)
|
||||
@@ -743,11 +743,8 @@ public class CarpetScriptHost extends ScriptHost
|
||||
{
|
||||
case VARIABLE:
|
||||
LazyValue var = getGlobalVariable(tok.surface);
|
||||
if (var != null)
|
||||
{
|
||||
argv.add(var);
|
||||
break;
|
||||
}
|
||||
if (var != null) argv.add(var);
|
||||
break;
|
||||
case STRINGPARAM:
|
||||
argv.add((c, t) -> new StringValue(tok.surface));
|
||||
sign = "";
|
||||
|
||||
@@ -852,6 +852,7 @@ public class Expression
|
||||
{
|
||||
outputQueue.add(stack.pop());
|
||||
}
|
||||
break;
|
||||
case MARKER:
|
||||
if ("$".equals(token.surface))
|
||||
{
|
||||
|
||||
@@ -436,8 +436,9 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
|
||||
@Override
|
||||
public Value get(Value value)
|
||||
{
|
||||
long index = NumericValue.asNumber(value, "'address' to a list index").getLong();
|
||||
return items.get(normalizeIndex(index, items.size()));
|
||||
int size = items.size();
|
||||
if (size == 0) return Value.NULL;
|
||||
return items.get(normalizeIndex(NumericValue.asNumber(value, "'address' to a list index").getLong(), size));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user