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;
|
package carpet;
|
||||||
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Random;
|
import java.util.Random;
|
||||||
@@ -39,8 +38,11 @@ import net.minecraft.server.MinecraftServer;
|
|||||||
import net.minecraft.server.dedicated.command.PerfCommand;
|
import net.minecraft.server.dedicated.command.PerfCommand;
|
||||||
import net.minecraft.server.network.ServerPlayerEntity;
|
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 final Random rand = new Random();
|
||||||
public static MinecraftServer minecraft_server;
|
public static MinecraftServer minecraft_server;
|
||||||
private static CommandDispatcher<ServerCommandSource> currentCommandDispatcher;
|
private static CommandDispatcher<ServerCommandSource> currentCommandDispatcher;
|
||||||
@@ -48,17 +50,6 @@ public class CarpetServer implements ClientModInitializer,DedicatedServerModInit
|
|||||||
public static SettingsManager settingsManager;
|
public static SettingsManager settingsManager;
|
||||||
public static final List<CarpetExtension> extensions = new ArrayList<>();
|
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
|
// Separate from onServerLoaded, because a server can be loaded multiple times in singleplayer
|
||||||
/**
|
/**
|
||||||
* Registers a {@link CarpetExtension} to be managed by Carpet.<br>
|
* 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)
|
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;
|
return false;
|
||||||
}
|
}
|
||||||
if (appConfig.get(StringValue.of("commands")) != null)
|
if (appConfig.get(StringValue.of("commands")) != null)
|
||||||
@@ -743,11 +743,8 @@ public class CarpetScriptHost extends ScriptHost
|
|||||||
{
|
{
|
||||||
case VARIABLE:
|
case VARIABLE:
|
||||||
LazyValue var = getGlobalVariable(tok.surface);
|
LazyValue var = getGlobalVariable(tok.surface);
|
||||||
if (var != null)
|
if (var != null) argv.add(var);
|
||||||
{
|
break;
|
||||||
argv.add(var);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case STRINGPARAM:
|
case STRINGPARAM:
|
||||||
argv.add((c, t) -> new StringValue(tok.surface));
|
argv.add((c, t) -> new StringValue(tok.surface));
|
||||||
sign = "";
|
sign = "";
|
||||||
|
|||||||
@@ -852,6 +852,7 @@ public class Expression
|
|||||||
{
|
{
|
||||||
outputQueue.add(stack.pop());
|
outputQueue.add(stack.pop());
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
case MARKER:
|
case MARKER:
|
||||||
if ("$".equals(token.surface))
|
if ("$".equals(token.surface))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -436,8 +436,9 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
|
|||||||
@Override
|
@Override
|
||||||
public Value get(Value value)
|
public Value get(Value value)
|
||||||
{
|
{
|
||||||
long index = NumericValue.asNumber(value, "'address' to a list index").getLong();
|
int size = items.size();
|
||||||
return items.get(normalizeIndex(index, items.size()));
|
if (size == 0) return Value.NULL;
|
||||||
|
return items.get(normalizeIndex(NumericValue.asNumber(value, "'address' to a list index").getLong(), size));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -209,7 +209,8 @@
|
|||||||
"PistonBlockEntity_playerHandlingMixin",
|
"PistonBlockEntity_playerHandlingMixin",
|
||||||
"BlockItem_creativeNoClipMixin",
|
"BlockItem_creativeNoClipMixin",
|
||||||
"WallStandingBlockItem_creativeNoClipMixin",
|
"WallStandingBlockItem_creativeNoClipMixin",
|
||||||
"LivingEntity_creativeFlyMixin",
|
"ShulkerBoxBlockEntity_creativeNoClipMixin",
|
||||||
|
"LivingEntity_creativeFlyMixin"
|
||||||
|
|
||||||
"VeryBiasedToBottomHeightProvider_cleanLogsMixin",
|
"VeryBiasedToBottomHeightProvider_cleanLogsMixin",
|
||||||
"TrapezoidHeightProvider_cleanLogsMixin"
|
"TrapezoidHeightProvider_cleanLogsMixin"
|
||||||
|
|||||||
@@ -20,10 +20,10 @@
|
|||||||
"environment": "*",
|
"environment": "*",
|
||||||
"entrypoints": {
|
"entrypoints": {
|
||||||
"client": [
|
"client": [
|
||||||
"carpet.CarpetServer"
|
"carpet.CarpetServer::CLIENT_INITIALIZER"
|
||||||
],
|
],
|
||||||
"server": [
|
"server": [
|
||||||
"carpet.CarpetServer"
|
"carpet.CarpetServer::SERVER_INITIALIZER"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"mixins": [
|
"mixins": [
|
||||||
|
|||||||
Reference in new issue
Block a user