Merge branch 'master' into 1.17
# Conflicts: # src/main/java/carpet/network/ClientNetworkHandler.java # src/main/resources/assets/carpet/scripts/ai_tracker.sc
This commit is contained in:
commit
8f2c935fe6
6 files changed
+93
-95
No files matched your search
@@ -0,0 +1,21 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.world.biome.source.BiomeArray;
|
||||||
|
import org.apache.logging.log4j.Logger;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.At;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Redirect;
|
||||||
|
|
||||||
|
@Mixin(BiomeArray.class)
|
||||||
|
public class BiomeArray_cleanLogsMixin
|
||||||
|
{
|
||||||
|
@Redirect(method = "<init>(Lnet/minecraft/util/collection/IndexedIterable;[I)V", at = @At(
|
||||||
|
value = "INVOKE",
|
||||||
|
target = "Lorg/apache/logging/log4j/Logger;warn(Ljava/lang/String;)V")
|
||||||
|
)
|
||||||
|
private void skipLog(Logger logger, String message)
|
||||||
|
{
|
||||||
|
if (!CarpetSettings.cleanLogs) logger.warn(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -22,7 +22,7 @@ import java.util.function.BiConsumer;
|
|||||||
|
|
||||||
public class ClientNetworkHandler
|
public class ClientNetworkHandler
|
||||||
{
|
{
|
||||||
private static Map<String, BiConsumer<ClientPlayerEntity, NbtElement>> dataHandlers = new HashMap<String, BiConsumer<ClientPlayerEntity, NbtElement>>();
|
private static final Map<String, BiConsumer<ClientPlayerEntity, NbtElement>> dataHandlers = new HashMap<String, BiConsumer<ClientPlayerEntity, NbtElement>>();
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
dataHandlers.put("Rules", (p, t) -> {
|
dataHandlers.put("Rules", (p, t) -> {
|
||||||
@@ -61,7 +61,7 @@ public class ClientNetworkHandler
|
|||||||
if (rule != null)
|
if (rule != null)
|
||||||
{
|
{
|
||||||
String value = ruleNBT.getString("Value");
|
String value = ruleNBT.getString("Value");
|
||||||
rule.set(null, value);
|
try { rule.set(null, value); } catch (Exception ignored) { }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -133,8 +133,15 @@ public class ClientNetworkHandler
|
|||||||
if (compound == null) return;
|
if (compound == null) return;
|
||||||
for (String key: compound.getKeys())
|
for (String key: compound.getKeys())
|
||||||
{
|
{
|
||||||
if (dataHandlers.containsKey(key))
|
if (dataHandlers.containsKey(key)) {
|
||||||
|
try {
|
||||||
dataHandlers.get(key).accept(player, compound.get(key));
|
dataHandlers.get(key).accept(player, compound.get(key));
|
||||||
|
}
|
||||||
|
catch (Exception exc)
|
||||||
|
{
|
||||||
|
CarpetSettings.LOG.info("Corrupt carpet data for "+key);
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
CarpetSettings.LOG.error("Unknown carpet data: "+key);
|
CarpetSettings.LOG.error("Unknown carpet data: "+key);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -37,7 +37,7 @@ public class FixedCommandSource extends ServerCommandSource
|
|||||||
public FixedCommandSource(ServerCommandSource original, Vec3d pos, Value[] error, List<Value> chatOutput)
|
public FixedCommandSource(ServerCommandSource original, Vec3d pos, Value[] error, List<Value> chatOutput)
|
||||||
{
|
{
|
||||||
super(CommandOutput.DUMMY, pos, Vec2f.ZERO, original.getWorld(), CarpetSettings.runPermissionLevel,
|
super(CommandOutput.DUMMY, pos, Vec2f.ZERO, original.getWorld(), CarpetSettings.runPermissionLevel,
|
||||||
original.getName(), original.getDisplayName(), original.getMinecraftServer(), original.getEntity(), true,
|
original.getName(), original.getDisplayName(), original.getMinecraftServer(), original.getEntity(), false,
|
||||||
(ctx, succ, res) -> { }, EntityAnchorArgumentType.EntityAnchor.FEET);
|
(ctx, succ, res) -> { }, EntityAnchorArgumentType.EntityAnchor.FEET);
|
||||||
position = pos;
|
position = pos;
|
||||||
world = original.getWorld();
|
world = original.getWorld();
|
||||||
@@ -80,11 +80,9 @@ public class FixedCommandSource extends ServerCommandSource
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
//@Override // only used in fuctions and we really don't care to track these actually, besides the basic output
|
||||||
public ServerCommandSource withSilent()
|
// also other overrides target ONLY execute command, which withSilent doesn't care bout.
|
||||||
{
|
//public ServerCommandSource withSilent() { return this; }
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ServerCommandSource withLevel(int level)
|
public ServerCommandSource withLevel(int level)
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
__command() -> '
|
_command() -> '
|
||||||
ai_tracker allows to display
|
ai_tracker allows to display
|
||||||
some extra information about
|
some extra information about
|
||||||
various entities AI activity
|
various entities AI activity
|
||||||
@@ -18,73 +18,13 @@ Current supported actions
|
|||||||
- breeding info for villagers
|
- breeding info for villagers
|
||||||
|
|
||||||
Settings you may want to change
|
Settings you may want to change
|
||||||
- toggle_boxes: hides/shows large boxes and spheres
|
- toggle boxes: hides/shows large boxes and spheres
|
||||||
- update_frequency: changes update speed
|
- update_frequency: changes update speed
|
||||||
- clear: removes all options
|
- clear: removes all options
|
||||||
- transparency: default opacity of shapes, 8 for start
|
- transparency: default opacity of shapes, 8 for start
|
||||||
';
|
';
|
||||||
|
|
||||||
|
|
||||||
global_duration = 12;
|
|
||||||
global_interval = 10;
|
|
||||||
|
|
||||||
global_opacity = 8;
|
|
||||||
|
|
||||||
global_display_boxes = true;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
global_range = 48;
|
|
||||||
|
|
||||||
// list of triples - [entity_type, feature, callback]
|
|
||||||
global_active_functions = [];
|
|
||||||
global_feature_switches = {};
|
|
||||||
global_tracker_running = false;
|
|
||||||
|
|
||||||
villager_iron_golem_spawning() -> __toggle('villager_iron_golem_spawning', null);
|
|
||||||
pathfinding() -> __toggle('pathfinding', null);
|
|
||||||
velocity() -> __toggle('velocity', null);
|
|
||||||
villager_breeding() -> __toggle('villager_breeding', null);
|
|
||||||
villager_buddy_detection() -> __toggle('villager_buddy_detection', null);
|
|
||||||
item_pickup() -> __toggle('item_pickup', null);
|
|
||||||
portal_cooldown() -> __toggle('portal_cooldown', null);
|
|
||||||
health() -> __toggle('health', null);
|
|
||||||
xpstack() -> __toggle('xpstack', null); //1.17 feature
|
|
||||||
|
|
||||||
toggle_boxes() ->
|
|
||||||
(
|
|
||||||
global_display_boxes = !global_display_boxes;
|
|
||||||
null;
|
|
||||||
);
|
|
||||||
|
|
||||||
update_frequency(ticks) ->
|
|
||||||
(
|
|
||||||
if (type(ticks) != 'number' || ticks <=0 || ticks > 100, exit('Ticks needs to be a positive number from 1 to 100'));
|
|
||||||
global_interval = ticks;
|
|
||||||
global_duration = ticks + 2;
|
|
||||||
null;
|
|
||||||
);
|
|
||||||
|
|
||||||
transparency(alpha) ->
|
|
||||||
(
|
|
||||||
if (type(alpha) != 'number' || alpha <=0 || alpha > 255, exit('Ticks needs to be a number from 0 to 255'));
|
|
||||||
global_opacity = floor(alpha);
|
|
||||||
null;
|
|
||||||
);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
villager_hostile_detection(hostile) ->
|
|
||||||
(
|
|
||||||
if (!has(global_hostile_to_villager:hostile),
|
|
||||||
print(player(), 'Unknown hostile that affects villagers, possible options are: '+keys(global_hostile_to_villager));
|
|
||||||
exit(null);
|
|
||||||
);
|
|
||||||
__toggle('villager_hostile_detection', hostile);
|
|
||||||
);
|
|
||||||
|
|
||||||
global_entity_positions = {};
|
|
||||||
|
|
||||||
global_functions = {
|
global_functions = {
|
||||||
'villager_iron_golem_spawning' -> {
|
'villager_iron_golem_spawning' -> {
|
||||||
'villager' -> [
|
'villager' -> [
|
||||||
@@ -378,6 +318,57 @@ global_functions = {
|
|||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
global_hostile_to_villager = {
|
||||||
|
'drowned' -> 8,
|
||||||
|
'evoker'-> 12,
|
||||||
|
'husk' -> 8,
|
||||||
|
'illusioner' -> 12,
|
||||||
|
'pillager' -> 15,
|
||||||
|
'ravager' -> 12,
|
||||||
|
'vex' -> 8,
|
||||||
|
'vindicator' -> 10,
|
||||||
|
'zoglin' -> 10,
|
||||||
|
'zombie' -> 8,
|
||||||
|
'zombie_villager' -> 8
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
__config() ->{
|
||||||
|
'commands'->{
|
||||||
|
''->'_command',
|
||||||
|
'clear'->'clear',
|
||||||
|
'toggle_boxes'->_()->global_display_boxes = !global_display_boxes,
|
||||||
|
'<display>'->['__toggle',null],
|
||||||
|
'villager <aspect>'->_(d)->__toggle('villager_'+d,null),
|
||||||
|
'villager hostile_detection <hostile>'->_(h)->__toggle('villager_hostile_detection',h),
|
||||||
|
'update_frequency <ticks>'->_(ticks)->(global_interval = ticks;global_duration = ticks + 2),
|
||||||
|
'transparency <alpha>'->_(alpha)->global_opacity = alpha
|
||||||
|
},
|
||||||
|
'arguments'->{
|
||||||
|
'display'->{'type'->'term','options'->['item_pickup','velocity','portal_cooldown','health','pathfinding','xpstack']},
|
||||||
|
'aspect'->{'type'->'term','options'->['iron_golem_spawning','buddy_detection','hostile_detection','breeding']},
|
||||||
|
'ticks'->{'type'->'int','min'->0,'max'->100},
|
||||||
|
'alpha'->{'type'->'int','min'->0,'max'->255},
|
||||||
|
'hostile'->{'type'->'term','options'->keys(global_hostile_to_villager)}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
global_duration = 12;
|
||||||
|
global_interval = 10;
|
||||||
|
|
||||||
|
global_opacity = 8;
|
||||||
|
|
||||||
|
global_display_boxes = true;
|
||||||
|
|
||||||
|
global_range = 48;
|
||||||
|
|
||||||
|
// list of triples - [entity_type, feature, callback]
|
||||||
|
global_active_functions = [];
|
||||||
|
global_feature_switches = {};
|
||||||
|
global_tracker_running = false;
|
||||||
|
|
||||||
|
global_entity_positions = {};
|
||||||
|
|
||||||
global_villager_food = {
|
global_villager_food = {
|
||||||
'bread' -> 4,
|
'bread' -> 4,
|
||||||
'potato' -> 1,
|
'potato' -> 1,
|
||||||
@@ -426,29 +417,12 @@ __mark_path_element(path_element, visuals) ->
|
|||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
global_hostile_to_villager = {
|
|
||||||
'drowned' -> 8,
|
|
||||||
'evoker'-> 12,
|
|
||||||
'husk' -> 8,
|
|
||||||
'illusioner' -> 12,
|
|
||||||
'pillager' -> 15,
|
|
||||||
'ravager' -> 12,
|
|
||||||
'vex' -> 8,
|
|
||||||
'vindicator' -> 10,
|
|
||||||
'zoglin' -> 10,
|
|
||||||
'zombie' -> 8,
|
|
||||||
'zombie_villager' -> 8
|
|
||||||
};
|
|
||||||
|
|
||||||
__is_hostile(v, m) ->
|
__is_hostile(v, m) ->
|
||||||
(
|
(
|
||||||
mob = m~'type';
|
mob = m~'type';
|
||||||
has(global_hostile_to_villager:mob) && (sqrt(reduce(pos(v)-pos(m), _a+_*_ , 0)) <= global_hostile_to_villager:mob)
|
has(global_hostile_to_villager:mob) && (sqrt(reduce(pos(v)-pos(m), _a+_*_ , 0)) <= global_hostile_to_villager:mob)
|
||||||
);
|
);
|
||||||
|
|
||||||
__distance(v1, v2) -> sqrt(reduce(v1-v2,_a+_*_ ,0));
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
__toggle(feature, arg) ->
|
__toggle(feature, arg) ->
|
||||||
(
|
(
|
||||||
@@ -576,5 +550,3 @@ __handle_entity(e) ->
|
|||||||
);
|
);
|
||||||
draw_shape(shapes_to_display);
|
draw_shape(shapes_to_display);
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
@@ -64,9 +64,9 @@ _create_shapes(mode, from, to) ->
|
|||||||
shapes += ['label', 'pos',to+[0,0.2,0], 'align', 'left', 'text',_round(_euclidean(from, [to:0, from:1, to:2]), 0.001)];
|
shapes += ['label', 'pos',to+[0,0.2,0], 'align', 'left', 'text',_round(_euclidean(from, [to:0, from:1, to:2]), 0.001)];
|
||||||
shapes += ['label', 'pos',to+[0,0.2,0], 'height', 1, 'align', 'right', 'indent', -1.5, 'text',format('rb Manhattan:')];
|
shapes += ['label', 'pos',to+[0,0.2,0], 'height', 1, 'align', 'right', 'indent', -1.5, 'text',format('rb Manhattan:')];
|
||||||
shapes += ['label', 'pos',to+[0,0.2,0], 'height', 1, 'align', 'left', 'text',_round(_manhattan(from,to),0.001)];
|
shapes += ['label', 'pos',to+[0,0.2,0], 'height', 1, 'align', 'left', 'text',_round(_manhattan(from,to),0.001)];
|
||||||
shapes += ['label', 'pos',to+[0,0.2,0], 'height', 2, 'align', 'right', 'indent', -1.5, 'text',format('rb Euclidian:')];
|
shapes += ['label', 'pos',to+[0,0.2,0], 'height', 2, 'align', 'right', 'indent', -1.5, 'text',format('rb Euclidean:')];
|
||||||
shapes += ['label', 'pos',to+[0,0.2,0], 'height', 2, 'align', 'left', 'text',_round(_euclidean(from,to),0.001)];
|
shapes += ['label', 'pos',to+[0,0.2,0], 'height', 2, 'align', 'left', 'text',_round(_euclidean(from,to),0.001)];
|
||||||
map(shapes, put(_, 1, [20, 'player', player()], 'extend'); _);
|
map(shapes, put(_, 1, [40, 'player', player()], 'extend'); _);
|
||||||
);
|
);
|
||||||
|
|
||||||
__mktp(pos) -> str('!/tp %.6f %.6f %.6f', pos);
|
__mktp(pos) -> str('!/tp %.6f %.6f %.6f', pos);
|
||||||
@@ -77,9 +77,8 @@ set_start(pos)->(
|
|||||||
);
|
);
|
||||||
|
|
||||||
set_mode(mode)->(
|
set_mode(mode)->(
|
||||||
if (global_display_modes ~ mode,
|
global_current_mode = mode;
|
||||||
global_current_mode = mode
|
print(player(),format('gi Set display mode to '+mode))
|
||||||
)
|
|
||||||
);
|
);
|
||||||
|
|
||||||
calculate(end)->(
|
calculate(end)->(
|
||||||
|
|||||||
@@ -220,6 +220,7 @@
|
|||||||
"DebugRenderer_scarpetRenderMixin",
|
"DebugRenderer_scarpetRenderMixin",
|
||||||
"WorldRenderer_scarpetRenderMixin",
|
"WorldRenderer_scarpetRenderMixin",
|
||||||
|
|
||||||
|
"BiomeArray_cleanLogsMixin",
|
||||||
"SoundEngineInt_cleanLogsMixin",
|
"SoundEngineInt_cleanLogsMixin",
|
||||||
"SoundSystem_cleanLogsMixin"
|
"SoundSystem_cleanLogsMixin"
|
||||||
],
|
],
|
||||||
|
|||||||
Reference in new issue
Block a user