Merge branch 'master' into 1.17
This commit is contained in:
commit
d0fa948a46
3 files changed
+50
-24
No files matched your search
@@ -0,0 +1,28 @@
|
||||
package carpet.mixins;
|
||||
|
||||
import carpet.patches.EntityPlayerMPFake;
|
||||
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(PlayerEntity.class)
|
||||
public abstract class PlayerEntity_fakePlayersMixin
|
||||
{
|
||||
/**
|
||||
* To make sure player attacks are able to knockback fake players
|
||||
*/
|
||||
@Redirect(
|
||||
method = "attack",
|
||||
at = @At(
|
||||
value = "FIELD",
|
||||
target = "Lnet/minecraft/entity/Entity;velocityModified:Z",
|
||||
ordinal = 0
|
||||
)
|
||||
)
|
||||
private boolean velocityModifiedAndNotCarpetFakePlayer(Entity target)
|
||||
{
|
||||
return target.velocityModified && !(target instanceof EntityPlayerMPFake);
|
||||
}
|
||||
}
|
||||
@@ -19,15 +19,14 @@ _command() ->
|
||||
print(' "/camera load <name>"');
|
||||
print(' - Store and load paths from world saves /scripts folder');
|
||||
print('');
|
||||
print(' "/camera interpolation < linear | gauss | cr | gauss_<num> >"');
|
||||
print(' "/camera interpolation < linear | gauss | catmull_rom | gauss <variance?> >"');
|
||||
print(' Select interpolation between points:');
|
||||
print(' - cr: Catmull-Rom interpolation (default).');
|
||||
print(' - catmull_rom: Catmull-Rom interpolation (default).');
|
||||
print(' smooth path that goes through all points.');
|
||||
print(' - linear: straight paths between points.');
|
||||
print(' - gauss: automatic smooth transitions.');
|
||||
print(' - gauss_<N>: custom fixed variance ');
|
||||
print(' - gauss <variance>: custom fixed variance ');
|
||||
print(' (in seconds) for special effects.');
|
||||
print(' use "_" for decimal separator, e.g. gauss_2_5');
|
||||
print(' gauss makes the smoothest path,');
|
||||
print(' but treating points as suggestions only');
|
||||
print('');
|
||||
@@ -68,13 +67,13 @@ __config() ->{
|
||||
'load <name>'->'load',
|
||||
'interpolation <interpolation>'->['__interpolation',true],
|
||||
'interpolation gauss'->['__interpolation','gauss',true],
|
||||
'interpolation gauss <float>'->_(float)->(__interpolation('gauss_'+str(float),true)),
|
||||
'interpolation gauss <seconds>'->_(float)->(__interpolation('gauss_'+str(float),true)),
|
||||
'repeat <seconds> <last_delay>'->'repeat',
|
||||
'stretch <factor>'->'stretch'
|
||||
},
|
||||
'arguments'->{
|
||||
'seconds'->{'type'->'int','suggest'->[]},
|
||||
'last_delay'->{'type'->'int','suggest'->[]},
|
||||
'seconds'->{'type'->'float', 'min' -> 0.01, 'suggest'->[]},
|
||||
'last_delay'->{'type'->'float','min' -> 0.01, 'suggest'->[]},
|
||||
'name'->{'type'->'string','suggest'->[]},
|
||||
'interpolation'->{'type'->'term','options'->['linear','catmull_rom']},
|
||||
'factor'->{'type'->'int','min'->25,'max'->400},
|
||||
@@ -138,7 +137,7 @@ __start_with(points_supplier) ->
|
||||
global_selected_point = null;
|
||||
__update();
|
||||
show();
|
||||
str('Started path at %.1f %.1f %.1f', p~'x', p~'y', p~'z');
|
||||
print(str('Started path at %.1f %.1f %.1f', p~'x', p~'y', p~'z'));
|
||||
);
|
||||
|
||||
// gets current player controlling the path, or fails
|
||||
@@ -160,7 +159,7 @@ clear() ->
|
||||
global_showing_path = false;
|
||||
global_playing_path = false;
|
||||
__update();
|
||||
'Path cleared';
|
||||
print('Path cleared');
|
||||
);
|
||||
|
||||
// camera position for the player sticks out of their eyes
|
||||
@@ -210,7 +209,7 @@ __interpolation(method, verbose) ->
|
||||
)
|
||||
);
|
||||
__update();
|
||||
if(verbose, 'Interpolation changed to '+method, '');
|
||||
if(verbose, print('Interpolation changed to '+method));
|
||||
);
|
||||
__interpolation('catmull_rom', false);
|
||||
|
||||
@@ -222,7 +221,7 @@ add(delay) ->
|
||||
// but this option could be used could be used at some point by more robust interpolators
|
||||
__add_path_segment(__camera_position(), round(60*delay), 'smooth', true);
|
||||
__update();
|
||||
__get_path_size_string();
|
||||
print(__get_path_size_string());
|
||||
);
|
||||
|
||||
// prepends the path with a new starting point, with a segment of specified delay
|
||||
@@ -231,7 +230,7 @@ prepend(delay) ->
|
||||
__assert_can_modify_path();
|
||||
__add_path_segment(__camera_position(), round(60*delay), 'smooth', false);
|
||||
__update();
|
||||
__get_path_size_string();
|
||||
print(__get_path_size_string());
|
||||
);
|
||||
|
||||
// repeats existing points seveal times, using last section delay (seconds) to join points
|
||||
@@ -248,7 +247,7 @@ repeat(times, last_section_delay) ->
|
||||
)
|
||||
);
|
||||
__update();
|
||||
__get_path_size_string();
|
||||
print(__get_path_size_string());
|
||||
);
|
||||
|
||||
//stretches or shrinks current path to X percent of what it was before
|
||||
@@ -259,11 +258,11 @@ stretch(percentage) ->
|
||||
previous_path_length = global_points:(-1):1;
|
||||
for(global_points, _:1 = _:1*ratio );
|
||||
__update();
|
||||
str('path %s from %.2f to %.2f seconds',
|
||||
print(str('path %s from %.2f to %.2f seconds',
|
||||
if(ratio<1,'shortened','extended'),
|
||||
previous_path_length/60,
|
||||
global_points:(-1):1/60
|
||||
)
|
||||
))
|
||||
);
|
||||
|
||||
// moves current selected point to player location
|
||||
@@ -294,7 +293,7 @@ duration(amount) ->
|
||||
global_points:_:1 += delta;
|
||||
);
|
||||
__update();
|
||||
__get_path_size_string();
|
||||
print(__get_path_size_string());
|
||||
);
|
||||
|
||||
// deletes current keypoint without changing the path length
|
||||
@@ -306,7 +305,7 @@ delete_point() ->
|
||||
global_points = filter(global_points, _i != global_selected_point);
|
||||
if (global_selected_point >= length(global_points), global_selected_point = null);
|
||||
__update();
|
||||
__get_path_size_string();
|
||||
print(__get_path_size_string());
|
||||
);
|
||||
|
||||
// splits current selected segment in half by adding a keypoint in between
|
||||
@@ -327,7 +326,7 @@ split_point() ->
|
||||
'insert'
|
||||
);
|
||||
__update();
|
||||
__get_path_size_string();
|
||||
print(__get_path_size_string());
|
||||
);
|
||||
|
||||
// removes all points in the path from the current point
|
||||
@@ -337,7 +336,7 @@ trim_path() ->
|
||||
global_points = slice(global_points, 0, global_selected_point);
|
||||
global_selected_point = null;
|
||||
__update();
|
||||
__get_path_size_string();
|
||||
print(__get_path_size_string());
|
||||
);
|
||||
|
||||
// moves entire camera path keeping the angles to player position being in the starting point
|
||||
@@ -349,7 +348,7 @@ transpose() ->
|
||||
shift = shift + global_player_eye_offset;
|
||||
for(global_points, _:0 = _:0 + shift);
|
||||
__update();
|
||||
__get_path_size_string();
|
||||
print(__get_path_size_string());
|
||||
);
|
||||
|
||||
// selects either a point of certain number (starting from 1), or closest point
|
||||
@@ -367,7 +366,6 @@ select(num) ->
|
||||
);
|
||||
global_selected_point = if (global_selected_point == selected_point, null, selected_point);
|
||||
global_needs_updating = true;
|
||||
|
||||
);
|
||||
|
||||
// player can also punch the mannequin to select/deselect it
|
||||
@@ -521,7 +519,6 @@ hide() ->
|
||||
(
|
||||
if (global_showing_path,
|
||||
global_showing_path = false;
|
||||
'Stopped showing path';
|
||||
);
|
||||
);
|
||||
|
||||
@@ -675,7 +672,7 @@ save_as(file) ->
|
||||
put(path_nbt:'points', point_nbt, _i);
|
||||
);
|
||||
write_file(file, 'nbt', path_nbt);
|
||||
'stored path as '+file;
|
||||
print('stored path as '+file);
|
||||
);
|
||||
|
||||
// loads path under the local file that
|
||||
@@ -688,7 +685,7 @@ load(file) ->
|
||||
exit('Incorrect data for :'+file);
|
||||
);
|
||||
__start_with(_(outer(new_points)) -> new_points);
|
||||
'loaded '+file;
|
||||
print('loaded '+file);
|
||||
);
|
||||
|
||||
// when closing - shut-down visualization and playback threads
|
||||
|
||||
@@ -62,6 +62,7 @@
|
||||
"Brain_Mixin",
|
||||
"Memory_scarpetMixin",
|
||||
|
||||
"PlayerEntity_fakePlayersMixin",
|
||||
"ServerWorld_fakePlayersMixin",
|
||||
"ThrownEnderpearlEntity_fakePlayersMixin",
|
||||
|
||||
|
||||
Reference in new issue
Block a user