Merge branch 'master' of https://github.com/gnembon/fabric-carpet
This commit is contained in:
commit
4c12f0bdb7
9 files changed
+80
-16
No files matched your search
@@ -177,7 +177,7 @@ Returns `true` if en entity is standing on firm ground and falling down due to t
|
|||||||
|
|
||||||
### `query(e, 'name'), query(e, 'display_name'), query(e, 'custom_name'), query(e, 'type')`
|
### `query(e, 'name'), query(e, 'display_name'), query(e, 'custom_name'), query(e, 'type')`
|
||||||
|
|
||||||
String of entity name
|
String of entity name or formatted text in the case of `display_name`
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
query(e,'name') => Leatherworker
|
query(e,'name') => Leatherworker
|
||||||
|
|||||||
@@ -187,10 +187,10 @@ other parts. In that case consecutive calls to `slice` will refer to index `0` t
|
|||||||
cannot go back nor track where they are in the sequence (see examples).
|
cannot go back nor track where they are in the sequence (see examples).
|
||||||
|
|
||||||
<pre>
|
<pre>
|
||||||
slice([0,1,2,3,4,5], 1, 3) => [1, 2, 3]
|
slice([0,1,2,3,4,5], 1, 3) => [1, 2]
|
||||||
slice('foobar', 0, 1) => 'f'
|
slice('foobar', 0, 1) => 'f'
|
||||||
slice('foobar', 3) => 'bar'
|
slice('foobar', 3) => 'bar'
|
||||||
slice(range(10), 3, 5) => [3, 4, 5]
|
slice(range(10), 3, 5) => [3, 4]
|
||||||
slice(range(10), 5) => [5, 6, 7, 8, 9]
|
slice(range(10), 5) => [5, 6, 7, 8, 9]
|
||||||
r = range(100); [slice(r, 5, 7), slice(r, 1, 3)] => [[5, 6], [8, 9]]
|
r = range(100); [slice(r, 5, 7), slice(r, 1, 3)] => [[5, 6], [8, 9]]
|
||||||
</pre>
|
</pre>
|
||||||
|
|||||||
@@ -532,6 +532,14 @@ public class CarpetSettings
|
|||||||
)
|
)
|
||||||
public static int maxEntityCollisions = 0;
|
public static int maxEntityCollisions = 0;
|
||||||
|
|
||||||
|
@Rule(
|
||||||
|
desc = "Customizable server list ping (Multiplayer menu) playerlist sample limit",
|
||||||
|
options = {"0", "12", "20", "40"},
|
||||||
|
category = CREATIVE,
|
||||||
|
strict = false,
|
||||||
|
validate = Validator.NONNEGATIVE_NUMBER.class
|
||||||
|
)
|
||||||
|
public static int pingPlayerListLimit = 12;
|
||||||
/*
|
/*
|
||||||
|
|
||||||
@Rule(
|
@Rule(
|
||||||
|
|||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.injection.Constant;
|
||||||
|
import org.spongepowered.asm.mixin.injection.ModifyConstant;
|
||||||
|
|
||||||
|
import carpet.CarpetSettings;
|
||||||
|
import net.minecraft.server.MinecraftServer;
|
||||||
|
|
||||||
|
@Mixin(MinecraftServer.class)
|
||||||
|
public abstract class MinecraftServer_pingPlayerSampleLimit
|
||||||
|
{
|
||||||
|
|
||||||
|
@ModifyConstant(method = "tick", constant = @Constant(intValue = 12), require = 0, allow = 1)
|
||||||
|
private int modifyPlayerSampleLimit(int value)
|
||||||
|
{
|
||||||
|
return CarpetSettings.pingPlayerListLimit;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -416,7 +416,7 @@ public class EntityValue extends Value
|
|||||||
put("motion_z", (e, a) -> new NumericValue(e.getVelocity().z));
|
put("motion_z", (e, a) -> new NumericValue(e.getVelocity().z));
|
||||||
put("on_ground", (e, a) -> new NumericValue(e.isOnGround()));
|
put("on_ground", (e, a) -> new NumericValue(e.isOnGround()));
|
||||||
put("name", (e, a) -> new StringValue(e.getName().getString()));
|
put("name", (e, a) -> new StringValue(e.getName().getString()));
|
||||||
put("display_name", (e, a) -> new StringValue(e.getDisplayName().getString()));
|
put("display_name", (e, a) -> new FormattedTextValue(e.getDisplayName()));
|
||||||
put("command_name", (e, a) -> new StringValue(e.getEntityName()));
|
put("command_name", (e, a) -> new StringValue(e.getEntityName()));
|
||||||
put("custom_name", (e, a) -> e.hasCustomName()?new StringValue(e.getCustomName().getString()):Value.NULL);
|
put("custom_name", (e, a) -> e.hasCustomName()?new StringValue(e.getCustomName().getString()):Value.NULL);
|
||||||
put("type", (e, a) -> new StringValue(nameFromRegistryId(Registry.ENTITY_TYPE.getId(e.getType()))));
|
put("type", (e, a) -> new StringValue(nameFromRegistryId(Registry.ENTITY_TYPE.getId(e.getType()))));
|
||||||
|
|||||||
@@ -341,7 +341,7 @@ public class ListValue extends AbstractListValue implements ContainerValueInterf
|
|||||||
int from = normalizeIndex(fromDesc, size);
|
int from = normalizeIndex(fromDesc, size);
|
||||||
if (toDesc == null)
|
if (toDesc == null)
|
||||||
return new ListValue((Collection<? extends Value>) getItems().subList(from, size));
|
return new ListValue((Collection<? extends Value>) getItems().subList(from, size));
|
||||||
int to = normalizeIndex(toDesc, size);
|
int to = normalizeIndex(toDesc, size+1);
|
||||||
if (from > to)
|
if (from > to)
|
||||||
return ListValue.of();
|
return ListValue.of();
|
||||||
return new ListValue((Collection<? extends Value>) getItems().subList(from, to));
|
return new ListValue((Collection<? extends Value>) getItems().subList(from, to));
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ public abstract class Value implements Comparable<Value>, Cloneable
|
|||||||
int size = value.length();
|
int size = value.length();
|
||||||
int from = ListValue.normalizeIndex(fromDesc, size);
|
int from = ListValue.normalizeIndex(fromDesc, size);
|
||||||
if (toDesc == null) return new StringValue(value.substring(from));
|
if (toDesc == null) return new StringValue(value.substring(from));
|
||||||
int to = ListValue.normalizeIndex(toDesc, size);
|
int to = ListValue.normalizeIndex(toDesc, size+1);
|
||||||
if (from > to) return StringValue.EMPTY;
|
if (from > to) return StringValue.EMPTY;
|
||||||
return new StringValue(value.substring(from, to));
|
return new StringValue(value.substring(from, to));
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
__command() ->
|
_command() ->
|
||||||
(
|
(
|
||||||
print('camera: scarpet app.');
|
print('camera: scarpet app.');
|
||||||
print('-------------------');
|
print('-------------------');
|
||||||
@@ -11,7 +11,7 @@ __command() ->
|
|||||||
print(' "/camera place_player - Move player to the selected point');
|
print(' "/camera place_player - Move player to the selected point');
|
||||||
print(' "/camera move" - Move the selected point to players location');
|
print(' "/camera move" - Move the selected point to players location');
|
||||||
print(' "/camera duration <X>" - Set new selected path duration');
|
print(' "/camera duration <X>" - Set new selected path duration');
|
||||||
print(' "/camera split_point>" - Split selected path in half.');
|
print(' "/camera split_point" - Split selected path in half.');
|
||||||
print(' "/camera delete_point" - Remove current key point');
|
print(' "/camera delete_point" - Remove current key point');
|
||||||
print(' "/camera trim_path" - Remove all key points from selected up');
|
print(' "/camera trim_path" - Remove all key points from selected up');
|
||||||
print('');
|
print('');
|
||||||
@@ -57,6 +57,47 @@ __command() ->
|
|||||||
print('');
|
print('');
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
__config() ->{
|
||||||
|
'commands'->{
|
||||||
|
''->'_command',
|
||||||
|
'<command>'->'_call',
|
||||||
|
'add <seconds>'->'add',
|
||||||
|
'prepend <seconds>'->'prepend',
|
||||||
|
'duration <seconds>',
|
||||||
|
'save_as <name>'->'save_as',
|
||||||
|
'load <name>'->'load',
|
||||||
|
'interpolation <interpolation>'->['__interpolation',true],
|
||||||
|
'interpolation gauss'->['__interpolation','gauss',true],
|
||||||
|
'interpolation gauss <float>'->_(float)->(__interpolation('gauss_'+str(float),true)),
|
||||||
|
'repeat <seconds> <last_delay>'->'repeat',
|
||||||
|
'stretch <factor>'->'stretch'
|
||||||
|
},
|
||||||
|
'arguments'->{
|
||||||
|
'seconds'->{'type'->'int','suggest'->[]},
|
||||||
|
'last_delay'->{'type'->'int','suggest'->[]},
|
||||||
|
'name'->{'type'->'string','suggest'->[]},
|
||||||
|
'interpolation'->{'type'->'term','options'->['linear','catmull_rom']}
|
||||||
|
'factor'->{'type'->'int','min'->25,'max'->'400'},
|
||||||
|
'command'->{'type'->'term','options'->[
|
||||||
|
'start',
|
||||||
|
'clear',
|
||||||
|
'select',
|
||||||
|
'place_player',
|
||||||
|
'move',
|
||||||
|
'split_point',
|
||||||
|
'delete_point',
|
||||||
|
'trim_path',
|
||||||
|
'transpose',
|
||||||
|
'play',
|
||||||
|
'show',
|
||||||
|
'hide',
|
||||||
|
'prefer_smooth_play',
|
||||||
|
'prefer_synced_play'
|
||||||
|
]}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
_call(command)->call(command);
|
||||||
|
|
||||||
global_points = null;
|
global_points = null;
|
||||||
global_dimension = null;
|
global_dimension = null;
|
||||||
@@ -150,7 +191,6 @@ __assert_point_selected(validator) ->
|
|||||||
);
|
);
|
||||||
|
|
||||||
//select a custom interpolation method
|
//select a custom interpolation method
|
||||||
interpolation(method) -> __interpolation(method, true);
|
|
||||||
__interpolation(method, verbose) ->
|
__interpolation(method, verbose) ->
|
||||||
(
|
(
|
||||||
__prepare_path_if_needed() -> __prepare_path_if_needed_generic();
|
__prepare_path_if_needed() -> __prepare_path_if_needed_generic();
|
||||||
@@ -159,7 +199,7 @@ __interpolation(method, verbose) ->
|
|||||||
// or optionally __prepare_path_if_needed, if path is inefficient to compute point by point
|
// or optionally __prepare_path_if_needed, if path is inefficient to compute point by point
|
||||||
global_interpolator = if (
|
global_interpolator = if (
|
||||||
method == 'linear', '__interpolator_linear',
|
method == 'linear', '__interpolator_linear',
|
||||||
method == 'cr', '__interpolator_cr',
|
method == 'catmull_rom', '__interpolator_cr',
|
||||||
method == 'gauss', _(s, p) -> __interpolator_gauB(s, p, 0),
|
method == 'gauss', _(s, p) -> __interpolator_gauB(s, p, 0),
|
||||||
method ~ '^gauss_',
|
method ~ '^gauss_',
|
||||||
(
|
(
|
||||||
@@ -167,8 +207,7 @@ __interpolation(method, verbose) ->
|
|||||||
type = replace(type,'_','.');
|
type = replace(type,'_','.');
|
||||||
variance = round(60*number(type));
|
variance = round(60*number(type));
|
||||||
_(s, p, outer(variance)) -> __interpolator_gauB(s, p, variance);
|
_(s, p, outer(variance)) -> __interpolator_gauB(s, p, variance);
|
||||||
),
|
)
|
||||||
exit('Choose one of the following methods: linear, gauss, gauss_<deviation>, cr')
|
|
||||||
);
|
);
|
||||||
__update();
|
__update();
|
||||||
if(verbose, 'Interpolation changed to '+method, '');
|
if(verbose, 'Interpolation changed to '+method, '');
|
||||||
@@ -216,9 +255,6 @@ repeat(times, last_section_delay) ->
|
|||||||
stretch(percentage) ->
|
stretch(percentage) ->
|
||||||
(
|
(
|
||||||
if (err = __is_not_valid_for_motion(), exit(err));
|
if (err = __is_not_valid_for_motion(), exit(err));
|
||||||
if (percentage < 25 || percentage > 400,
|
|
||||||
exit('path speed can only be speed, or slowed down 4 times. Re-call command for larger changes')
|
|
||||||
);
|
|
||||||
ratio = percentage/100;
|
ratio = percentage/100;
|
||||||
previous_path_length = global_points:(-1):1;
|
previous_path_length = global_points:(-1):1;
|
||||||
for(global_points, _:1 = _:1*ratio );
|
for(global_points, _:1 = _:1*ratio );
|
||||||
@@ -660,4 +696,4 @@ __on_close() ->
|
|||||||
(
|
(
|
||||||
global_playing_path = false;
|
global_playing_path = false;
|
||||||
global_showing_path = false;
|
global_showing_path = false;
|
||||||
);
|
);
|
||||||
@@ -24,6 +24,7 @@
|
|||||||
"ServerPlayNetworkHandler_interactionUpdatesMixin",
|
"ServerPlayNetworkHandler_interactionUpdatesMixin",
|
||||||
|
|
||||||
"ServerMetadata_motdMixin",
|
"ServerMetadata_motdMixin",
|
||||||
|
"MinecraftServer_pingPlayerSampleLimit",
|
||||||
|
|
||||||
"MinecraftServer_coreMixin",
|
"MinecraftServer_coreMixin",
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user