added despawn timer

This commit is contained in:
gnembon committed 2021-06-17 21:20:11 -03:00
1 parent 1a92531554
commit 3a83a94361
3 files changed
+39 -2

No files matched your search

@@ -30,7 +30,7 @@ public abstract class PistonBlock_movableTEMixin extends FacingBlock
private ThreadLocal<List<BlockEntity>> list1_BlockEntities = new ThreadLocal<>(); //Unneccessary ThreadLocal if client and server use different PistonBlock instances
@Inject(method = "isMovable", at = @At(value = "RETURN", ordinal = 3, shift = At.Shift.BEFORE))
@Inject(method = "isMovable", cancellable = true, at = @At(value = "RETURN", ordinal = 3, shift = At.Shift.BEFORE))
private static void movableCMD(BlockState blockState_1, World world_1, BlockPos blockPos_1,
Direction direction_1, boolean boolean_1, Direction direction_2, CallbackInfoReturnable<Boolean> cir)
{
@@ -32,6 +32,7 @@ import net.minecraft.util.StringIdentifiable;
import net.minecraft.util.dynamic.GlobalPos;
import net.minecraft.util.math.BlockBox;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Box;
import net.minecraft.util.math.ColumnPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.Vec3i;
@@ -302,6 +303,21 @@ public class ValueConversions
new StringValue(uuid.toString())
);
}
public static Value of(Box box)
{
return ListValue.of(
ListValue.fromTriple(box.minX, box.minY, box.minZ),
ListValue.fromTriple(box.maxX, box.maxY, box.maxZ)
);
}
public static Value of(BlockBox box)
{
return ListValue.of(
ListValue.fromTriple(box.minX, box.minY, box.minZ),
ListValue.fromTriple(box.maxX, box.maxY, box.maxZ)
);
}
public static Value of(StructureStart<?> structure)
{
@@ -399,6 +415,8 @@ public class ValueConversions
}
public static Value guess(ServerWorld serverWorld, Object o) {
if (o == null)
return Value.NULL;
if (o instanceof List)
return ListValue.wrap(((List<?>) o).stream().map(oo -> guess(serverWorld, oo)).collect(Collectors.toList()));
if (o instanceof BlockPos)
@@ -409,6 +427,10 @@ public class ValueConversions
return of((Vec3d)o);
if (o instanceof Vec3i)
return of(new BlockPos((Vec3i)o));
if (o instanceof Box)
return of((Box)o);
if (o instanceof BlockBox)
return of((BlockBox) o);
if (o instanceof ItemStack)
return of((ItemStack)o);
if (o instanceof Boolean)
@@ -282,6 +282,21 @@ global_functions = {
]
},
'despawn_timer' -> {
'*' -> [
_(arg) -> _(e) -> (
despawn_timer = e~'despawn_timer';
if (despawn_timer,
[[], [], [['despawn', 'despawn timer:', despawn_timer]]]
,
[[], [], []]
)
),
,
null
]
},
'health' -> {
'*' -> [
_(arg) -> _(e) -> (
@@ -370,7 +385,7 @@ __config() ->{
'transparency <alpha>'->_(alpha)->global_opacity = alpha
},
'arguments'->{
'display'->{'type'->'term','options'->['item_pickup','velocity','portal_cooldown','health','pathfinding','xpstack','drowning']},
'display'->{'type'->'term','options'->['item_pickup','velocity','portal_cooldown','despawn_timer','health','pathfinding','xpstack','drowning']},
'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},