Merge branch 'master' into 1.15
# Conflicts: # src/main/java/carpet/mixins/ServerPlayNetworkHandler_scarpetEventsMixin.java # src/main/java/carpet/script/CarpetExpression.java # src/main/java/carpet/script/bundled/BundledModule.java # src/main/resources/assets/carpet/scripts/camera.sc # src/main/resources/assets/carpet/scripts/event_test.sc
This commit is contained in:
commit
f32a353655
2 files changed
+7
-17
No files matched your search
@@ -1141,6 +1141,13 @@ public class CarpetExpression
|
|||||||
return (_c, _t) -> res;
|
return (_c, _t) -> res;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
this.expr.addLazyFunction("item_category", 1, (c, t, lv) ->
|
||||||
|
{
|
||||||
|
ItemStackArgument item = NBTSerializableValue.parseItem(lv.get(0).evalValue(c).getString());
|
||||||
|
Value res = new StringValue(item.getItem().getGroup().getName());
|
||||||
|
return (_c, _t) -> res;
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
this.expr.addLazyFunction("inventory_size", -1, (c, t, lv) ->
|
this.expr.addLazyFunction("inventory_size", -1, (c, t, lv) ->
|
||||||
|
|||||||
@@ -42,7 +42,6 @@ start() ->
|
|||||||
undef('global_path_precalculated');
|
undef('global_path_precalculated');
|
||||||
str('Started path at %.1f %.1f %.1f', p~'x', p~'y', p~'z')
|
str('Started path at %.1f %.1f %.1f', p~'x', p~'y', p~'z')
|
||||||
);
|
);
|
||||||
|
|
||||||
add(delay) ->
|
add(delay) ->
|
||||||
(
|
(
|
||||||
p = player();
|
p = player();
|
||||||
@@ -52,7 +51,6 @@ add(delay) ->
|
|||||||
__add_path_segment(p ~ 'location', delay, mode);
|
__add_path_segment(p ~ 'location', delay, mode);
|
||||||
str('Added point %d: %.1f %.1f %.1f', length(global_points), p~'x', p~'y', p~'z')
|
str('Added point %d: %.1f %.1f %.1f', length(global_points), p~'x', p~'y', p~'z')
|
||||||
);
|
);
|
||||||
|
|
||||||
__add_path_segment(vector, duration, mode) ->
|
__add_path_segment(vector, duration, mode) ->
|
||||||
(
|
(
|
||||||
undef('global_path_precalculated');
|
undef('global_path_precalculated');
|
||||||
@@ -62,7 +60,6 @@ __add_path_segment(vector, duration, mode) ->
|
|||||||
put(vector,-2, __adjusted_rot(get(v, -2), get(vector, -2)));
|
put(vector,-2, __adjusted_rot(get(v, -2), get(vector, -2)));
|
||||||
global_points += l(vector, end_time+duration, mode)
|
global_points += l(vector, end_time+duration, mode)
|
||||||
);
|
);
|
||||||
|
|
||||||
// adjusts current rotation so we don\'t spin around like crazy
|
// adjusts current rotation so we don\'t spin around like crazy
|
||||||
__adjusted_rot(previous_rot, current_rot) ->
|
__adjusted_rot(previous_rot, current_rot) ->
|
||||||
(
|
(
|
||||||
@@ -87,7 +84,6 @@ repeat(times, last_section_duration) ->
|
|||||||
);
|
);
|
||||||
str('Add %d points %d times', length(positions), times)
|
str('Add %d points %d times', length(positions), times)
|
||||||
);
|
);
|
||||||
|
|
||||||
speed(percentage) ->
|
speed(percentage) ->
|
||||||
(
|
(
|
||||||
undef('global_path_precalculated');
|
undef('global_path_precalculated');
|
||||||
@@ -104,7 +100,6 @@ speed(percentage) ->
|
|||||||
get(get(global_points, -1),1)
|
get(get(global_points, -1),1)
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
select_interpolation(method) ->
|
select_interpolation(method) ->
|
||||||
(
|
(
|
||||||
undef('global_path_precalculated');
|
undef('global_path_precalculated');
|
||||||
@@ -128,16 +123,13 @@ select_interpolation(method) ->
|
|||||||
);
|
);
|
||||||
'Ok'
|
'Ok'
|
||||||
);
|
);
|
||||||
|
|
||||||
select_interpolation('gauss_auto');
|
select_interpolation('gauss_auto');
|
||||||
|
|
||||||
__assert_valid_for_motion() ->
|
__assert_valid_for_motion() ->
|
||||||
(
|
(
|
||||||
if(!global_points, exit('Path not defined yet'));
|
if(!global_points, exit('Path not defined yet'));
|
||||||
if(length(global_points)<2, exit('Path not complete - add more points'));
|
if(length(global_points)<2, exit('Path not complete - add more points'));
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
__get_path_at(segment, start, index) ->
|
__get_path_at(segment, start, index) ->
|
||||||
(
|
(
|
||||||
v = get(global_path_precalculated, start+index);
|
v = get(global_path_precalculated, start+index);
|
||||||
@@ -147,9 +139,7 @@ __get_path_at(segment, start, index) ->
|
|||||||
);
|
);
|
||||||
v
|
v
|
||||||
);
|
);
|
||||||
|
|
||||||
__invalidate_points_cache() -> global_path_precalculated = map(range(get(get(global_points, -1),1)), null);
|
__invalidate_points_cache() -> global_path_precalculated = map(range(get(get(global_points, -1),1)), null);
|
||||||
|
|
||||||
show() ->
|
show() ->
|
||||||
(
|
(
|
||||||
loop(100,
|
loop(100,
|
||||||
@@ -158,7 +148,6 @@ show() ->
|
|||||||
);
|
);
|
||||||
'Done!'
|
'Done!'
|
||||||
);
|
);
|
||||||
|
|
||||||
play(fps) ->
|
play(fps) ->
|
||||||
(
|
(
|
||||||
p = player();
|
p = player();
|
||||||
@@ -187,7 +176,6 @@ play(fps) ->
|
|||||||
game_tick(1000);
|
game_tick(1000);
|
||||||
'Done!'
|
'Done!'
|
||||||
);
|
);
|
||||||
|
|
||||||
_show_path_tick(particle_type, total) ->
|
_show_path_tick(particle_type, total) ->
|
||||||
(
|
(
|
||||||
__assert_valid_for_motion();
|
__assert_valid_for_motion();
|
||||||
@@ -202,12 +190,10 @@ _show_path_tick(particle_type, total) ->
|
|||||||
);
|
);
|
||||||
null
|
null
|
||||||
);
|
);
|
||||||
|
|
||||||
__prepare_path_if_needed_generic() ->
|
__prepare_path_if_needed_generic() ->
|
||||||
(
|
(
|
||||||
if(!global_path_precalculated, __invalidate_points_cache())
|
if(!global_path_precalculated, __invalidate_points_cache())
|
||||||
);
|
);
|
||||||
|
|
||||||
__find_position_for_linear(segment, point) ->
|
__find_position_for_linear(segment, point) ->
|
||||||
(
|
(
|
||||||
l(va, start, mode_a) = get(global_points,segment);
|
l(va, start, mode_a) = get(global_points,segment);
|
||||||
@@ -216,12 +202,9 @@ __find_position_for_linear(segment, point) ->
|
|||||||
dt = point/section;
|
dt = point/section;
|
||||||
dt*vb+(1-dt)*va
|
dt*vb+(1-dt)*va
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
//(1/sqrt(2*pi*d*d))*euler^(-((x-miu)^2)/(2*d*d))
|
//(1/sqrt(2*pi*d*d))*euler^(-((x-miu)^2)/(2*d*d))
|
||||||
// but we will be normalizing anyways, so who cares
|
// but we will be normalizing anyways, so who cares
|
||||||
__norm_prob(x, miu, d) -> euler^(-((x-miu)^2)/(2*d*d));
|
__norm_prob(x, miu, d) -> euler^(-((x-miu)^2)/(2*d*d));
|
||||||
|
|
||||||
__find_position_for_gauss(from_index, point) ->
|
__find_position_for_gauss(from_index, point) ->
|
||||||
(
|
(
|
||||||
dev = global_interpol_option;
|
dev = global_interpol_option;
|
||||||
|
|||||||
Reference in new issue
Block a user