Merge branch 'master' into 1.16
This commit is contained in:
commit
0e21942df7
13 files changed
+623
-556
No files matched your search
@@ -65,5 +65,4 @@ public interface CarpetExtension
|
||||
|
||||
default Map<String, String> canHasTranslations(String lang) { return null;}
|
||||
|
||||
|
||||
}
|
||||
@@ -11,7 +11,7 @@ import carpet.helpers.TickSpeed;
|
||||
import carpet.logging.LoggerRegistry;
|
||||
import carpet.script.CarpetScriptServer;
|
||||
import carpet.settings.SettingsManager;
|
||||
import carpet.utils.HUDController;
|
||||
import carpet.logging.HUDController;
|
||||
import carpet.utils.MobAI;
|
||||
import carpet.utils.SpawnReporter;
|
||||
import com.mojang.brigadier.CommandDispatcher;
|
||||
|
||||
@@ -35,7 +35,7 @@ import static carpet.settings.RuleCategory.CLIENT;
|
||||
@SuppressWarnings("CanBeFinal")
|
||||
public class CarpetSettings
|
||||
{
|
||||
public static final String carpetVersion = "1.4.1+v200701";
|
||||
public static final String carpetVersion = "1.4.2+v200712";
|
||||
public static final Logger LOG = LogManager.getLogger();
|
||||
public static boolean skipGenerationChecks = false;
|
||||
public static boolean impendingFillSkipUpdates = false;
|
||||
|
||||
+19
-1
@@ -1,10 +1,13 @@
|
||||
package carpet.utils;
|
||||
package carpet.logging;
|
||||
|
||||
import carpet.CarpetServer;
|
||||
import carpet.helpers.HopperCounter;
|
||||
import carpet.helpers.TickSpeed;
|
||||
import carpet.logging.LoggerRegistry;
|
||||
import carpet.logging.logHelpers.PacketCounter;
|
||||
import carpet.mixins.PlayerListHeaderS2CPacketMixin;
|
||||
import carpet.utils.Messenger;
|
||||
import carpet.utils.SpawnReporter;
|
||||
import net.minecraft.entity.player.PlayerEntity;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.network.packet.s2c.play.PlayerListHeaderS2CPacket;
|
||||
@@ -22,9 +25,21 @@ import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
public class HUDController
|
||||
{
|
||||
private static List<Consumer<MinecraftServer>> HUDListeners = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* Adds listener to be called when HUD is updated for logging information
|
||||
* @param listener - a method to be called when new HUD inforation are collected
|
||||
*/
|
||||
public void register(Consumer<MinecraftServer> listener)
|
||||
{
|
||||
HUDListeners.add(listener);
|
||||
}
|
||||
|
||||
public static Map<PlayerEntity, List<BaseText>> player_huds = new HashMap<>();
|
||||
|
||||
public static void addMessage(PlayerEntity player, BaseText hudMessage)
|
||||
@@ -82,6 +97,9 @@ public class HUDController
|
||||
if (LoggerRegistry.__packets)
|
||||
LoggerRegistry.getLogger("packets").log(()-> packetCounter());
|
||||
|
||||
// extensions have time to pitch in.
|
||||
HUDListeners.forEach(l -> l.accept(server));
|
||||
|
||||
for (PlayerEntity player: player_huds.keySet())
|
||||
{
|
||||
PlayerListHeaderS2CPacket packet = new PlayerListHeaderS2CPacket();
|
||||
@@ -1,6 +1,5 @@
|
||||
package carpet.logging;
|
||||
|
||||
import carpet.utils.HUDController;
|
||||
import net.minecraft.server.network.ServerPlayerEntity;
|
||||
import net.minecraft.text.BaseText;
|
||||
|
||||
|
||||
@@ -2923,9 +2923,30 @@ public class CarpetExpression
|
||||
}
|
||||
|
||||
ArmorStandEntity armorstand = new ArmorStandEntity(EntityType.ARMOR_STAND, cc.s.getWorld());
|
||||
double yoffset;
|
||||
if (targetBlock == null && name.isEmpty())
|
||||
{
|
||||
yoffset = 0.0;
|
||||
}
|
||||
else if (!interactable && targetBlock == null)
|
||||
{
|
||||
yoffset = -0.41;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (targetBlock==null)
|
||||
{
|
||||
yoffset = -armorstand.getHeight()-0.41;
|
||||
}
|
||||
else
|
||||
{
|
||||
yoffset = -armorstand.getHeight()+0.3;
|
||||
}
|
||||
}
|
||||
armorstand.refreshPositionAndAngles(
|
||||
pointLocator.vec.x,
|
||||
pointLocator.vec.y - ((targetBlock==null)?(armorstand.getHeight()+0.41):(armorstand.getHeight()-0.3)),
|
||||
//pointLocator.vec.y - ((!interactable && targetBlock == null)?0.41f:((targetBlock==null)?(armorstand.getHeight()+0.41):(armorstand.getHeight()-0.3))),
|
||||
pointLocator.vec.y + yoffset,
|
||||
pointLocator.vec.z,
|
||||
(float)pointLocator.yaw,
|
||||
(float) pointLocator.pitch
|
||||
|
||||
@@ -44,14 +44,22 @@ public class CarpetScriptServer
|
||||
private Set<String> holyMoly;
|
||||
public CarpetEventServer events;
|
||||
|
||||
private static final List<Module> bundledModuleData = new ArrayList<Module>(){{
|
||||
add(new BundledModule("camera", false));
|
||||
add(new BundledModule("overlay", false));
|
||||
add(new BundledModule("event_test", false));
|
||||
add(new BundledModule("stats_test", false));
|
||||
add(new BundledModule("math", true));
|
||||
add(new BundledModule("chunk_display", false));
|
||||
}};
|
||||
private static final List<Module> bundledModuleData = new ArrayList<>();
|
||||
|
||||
public static void registerBuiltInScript(BundledModule app)
|
||||
{
|
||||
bundledModuleData.add(app);
|
||||
}
|
||||
|
||||
static
|
||||
{
|
||||
registerBuiltInScript(BundledModule.carpetNative("camera", false));
|
||||
registerBuiltInScript(BundledModule.carpetNative("overlay", false));
|
||||
registerBuiltInScript(BundledModule.carpetNative("event_test", false));
|
||||
registerBuiltInScript(BundledModule.carpetNative("stats_test", false));
|
||||
registerBuiltInScript(BundledModule.carpetNative("math", true));
|
||||
registerBuiltInScript(BundledModule.carpetNative("chunk_display", false));
|
||||
}
|
||||
|
||||
public CarpetScriptServer(MinecraftServer server)
|
||||
{
|
||||
|
||||
@@ -11,22 +11,29 @@ public class BundledModule extends Module
|
||||
private String name;
|
||||
private String code;
|
||||
private boolean library;
|
||||
public BundledModule(String scriptName, boolean isLibrary)
|
||||
public BundledModule(String name, String code, boolean isLibrary)
|
||||
{
|
||||
library = isLibrary;
|
||||
this.name = name;
|
||||
this.code = code;
|
||||
}
|
||||
public static BundledModule carpetNative(String scriptName, boolean isLibrary)
|
||||
{
|
||||
BundledModule module = new BundledModule(null, null, isLibrary);
|
||||
try
|
||||
{
|
||||
name = scriptName.toLowerCase(Locale.ROOT);
|
||||
code = IOUtils.toString(
|
||||
getClass().getClassLoader().getResourceAsStream("assets/carpet/scripts/"+name+(isLibrary?".scl":".sc")),
|
||||
module.name = scriptName.toLowerCase(Locale.ROOT);
|
||||
module.code = IOUtils.toString(
|
||||
BundledModule.class.getClassLoader().getResourceAsStream("assets/carpet/scripts/"+scriptName+(isLibrary?".scl":".sc")),
|
||||
StandardCharsets.UTF_8
|
||||
);
|
||||
}
|
||||
catch ( NullPointerException | IOException e)
|
||||
{
|
||||
name = null;
|
||||
code = null;
|
||||
module.name = null;
|
||||
module.code = null;
|
||||
}
|
||||
return module;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user