Signed-off-by: yoyosource <yoyosource@nidido.de>
Dieser Commit ist enthalten in:
Ursprung
07a1dd7195
Commit
a0c644dd1c
@ -19,20 +19,37 @@
|
|||||||
|
|
||||||
package de.steamwar.bausystem.features.simulator;
|
package de.steamwar.bausystem.features.simulator;
|
||||||
|
|
||||||
|
import net.minecraft.core.BlockPosition;
|
||||||
import net.minecraft.nbt.NBTTagCompound;
|
import net.minecraft.nbt.NBTTagCompound;
|
||||||
import net.minecraft.network.protocol.Packet;
|
import net.minecraft.network.protocol.Packet;
|
||||||
import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;
|
import net.minecraft.network.protocol.game.PacketPlayOutSpawnEntity;
|
||||||
import net.minecraft.network.syncher.DataWatcher;
|
import net.minecraft.network.syncher.DataWatcher;
|
||||||
import net.minecraft.network.syncher.DataWatcherObject;
|
import net.minecraft.network.syncher.DataWatcherObject;
|
||||||
import net.minecraft.network.syncher.DataWatcherRegistry;
|
import net.minecraft.network.syncher.DataWatcherRegistry;
|
||||||
|
import net.minecraft.tags.TagsBlock;
|
||||||
|
import net.minecraft.util.MathHelper;
|
||||||
import net.minecraft.world.damagesource.DamageSource;
|
import net.minecraft.world.damagesource.DamageSource;
|
||||||
import net.minecraft.world.entity.*;
|
import net.minecraft.world.entity.*;
|
||||||
import net.minecraft.world.entity.item.EntityTNTPrimed;
|
import net.minecraft.world.entity.item.EntityTNTPrimed;
|
||||||
import net.minecraft.world.level.Explosion;
|
import net.minecraft.world.level.Explosion;
|
||||||
import net.minecraft.world.level.ExplosionDamageCalculator;
|
import net.minecraft.world.level.ExplosionDamageCalculator;
|
||||||
|
import net.minecraft.world.level.RayTrace;
|
||||||
import net.minecraft.world.level.World;
|
import net.minecraft.world.level.World;
|
||||||
|
import net.minecraft.world.level.block.Blocks;
|
||||||
|
import net.minecraft.world.level.block.state.IBlockData;
|
||||||
|
import net.minecraft.world.level.gameevent.GameEvent;
|
||||||
|
import net.minecraft.world.phys.AxisAlignedBB;
|
||||||
|
import net.minecraft.world.phys.MovingObjectPosition;
|
||||||
|
import net.minecraft.world.phys.MovingObjectPositionBlock;
|
||||||
|
import net.minecraft.world.phys.Vec3D;
|
||||||
|
import net.minecraft.world.phys.shapes.VoxelShape;
|
||||||
|
import org.bukkit.block.Block;
|
||||||
|
import org.bukkit.block.BlockFace;
|
||||||
|
import org.bukkit.craftbukkit.v1_19_R1.SpigotTimings;
|
||||||
import org.bukkit.entity.Explosive;
|
import org.bukkit.entity.Explosive;
|
||||||
|
import org.bukkit.entity.Vehicle;
|
||||||
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
import org.bukkit.event.entity.ExplosionPrimeEvent;
|
||||||
|
import org.bukkit.event.vehicle.VehicleBlockCollisionEvent;
|
||||||
|
|
||||||
import javax.annotation.Nullable;
|
import javax.annotation.Nullable;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@ -80,6 +97,82 @@ public class FakeTNT19 extends EntityTNTPrimed {
|
|||||||
return !this.du();
|
return !this.du();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Vec3D g(Vec3D vec3d) {
|
||||||
|
AxisAlignedBB axisalignedbb = this.cz();
|
||||||
|
List<VoxelShape> list = this.s.b(this, axisalignedbb.b(vec3d));
|
||||||
|
Vec3D vec3d1 = vec3d.g() == 0.0 ? vec3d : a(this, vec3d, axisalignedbb, this.s, list);
|
||||||
|
boolean flag = vec3d.c != vec3d1.c;
|
||||||
|
boolean flag1 = vec3d.d != vec3d1.d;
|
||||||
|
boolean flag2 = vec3d.e != vec3d1.e;
|
||||||
|
boolean flag3 = this.y || flag1 && vec3d.d < 0.0;
|
||||||
|
if (this.P > 0.0F && flag3 && (flag || flag2)) {
|
||||||
|
Vec3D vec3d2 = a(this, new Vec3D(vec3d.c, (double)this.P, vec3d.e), axisalignedbb, this.s, list);
|
||||||
|
Vec3D vec3d3 = a(this, new Vec3D(0.0, (double)this.P, 0.0), axisalignedbb.b(vec3d.c, 0.0, vec3d.e), this.s, list);
|
||||||
|
if (vec3d3.d < (double)this.P) {
|
||||||
|
Vec3D vec3d4 = a(this, new Vec3D(vec3d.c, 0.0, vec3d.e), axisalignedbb.c(vec3d3), this.s, list).e(vec3d3);
|
||||||
|
if (vec3d4.i() > vec3d2.i()) {
|
||||||
|
vec3d2 = vec3d4;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (vec3d2.i() > vec3d1.i()) {
|
||||||
|
return vec3d2.e(a(this, new Vec3D(0.0, -vec3d2.d + vec3d.d, 0.0), axisalignedbb.c(vec3d2), this.s, list));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return vec3d1;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void a(EnumMoveType enummovetype, Vec3D vec3d) {
|
||||||
|
if (this.E.g() > 1.0E-7) {
|
||||||
|
vec3d = vec3d.h(this.E);
|
||||||
|
this.E = Vec3D.b;
|
||||||
|
this.f(Vec3D.b);
|
||||||
|
}
|
||||||
|
|
||||||
|
Vec3D vec3d1 = this.g(vec3d);
|
||||||
|
double d0 = vec3d1.g();
|
||||||
|
if (d0 > 1.0E-7) {
|
||||||
|
this.e(this.dg() + vec3d1.c, this.di() + vec3d1.d, this.dm() + vec3d1.e);
|
||||||
|
}
|
||||||
|
|
||||||
|
boolean flag = !MathHelper.b(vec3d.c, vec3d1.c);
|
||||||
|
boolean flag1 = !MathHelper.b(vec3d.e, vec3d1.e);
|
||||||
|
this.z = flag || flag1;
|
||||||
|
this.A = vec3d.d != vec3d1.d;
|
||||||
|
this.B = this.A && vec3d.d < 0.0;
|
||||||
|
if (this.z) {
|
||||||
|
this.C = this.b(vec3d1);
|
||||||
|
} else {
|
||||||
|
this.C = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.y = this.A && vec3d.d < 0.0;
|
||||||
|
BlockPosition blockposition = this.aA();
|
||||||
|
IBlockData iblockdata = this.s.a_(blockposition);
|
||||||
|
// this.a(vec3d1.d, this.y, iblockdata, blockposition);
|
||||||
|
if (!this.du()) {
|
||||||
|
if (this.z) {
|
||||||
|
Vec3D vec3d2 = this.de();
|
||||||
|
this.n(flag ? 0.0 : vec3d2.c, vec3d2.d, flag1 ? 0.0 : vec3d2.e);
|
||||||
|
}
|
||||||
|
|
||||||
|
net.minecraft.world.level.block.Block block = iblockdata.b();
|
||||||
|
if (vec3d.d != vec3d1.d) {
|
||||||
|
block.a(this.s, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.y) {
|
||||||
|
block.a(this.s, blockposition, iblockdata, this);
|
||||||
|
}
|
||||||
|
|
||||||
|
this.ax();
|
||||||
|
float f2 = this.aD();
|
||||||
|
this.f(this.de().d((double)f2, 1.0, (double)f2));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void k() {
|
public void k() {
|
||||||
if (!this.aN()) {
|
if (!this.aN()) {
|
||||||
|
@ -45,6 +45,7 @@ public class SimulatorPreview19 implements SimulatorPreview {
|
|||||||
|
|
||||||
AtomicInteger maxTick = new AtomicInteger(0);
|
AtomicInteger maxTick = new AtomicInteger(0);
|
||||||
Map<Integer, List<List<Pair<SimulatorPreview.SimulatorPreviewTNTData, Integer>>>> toSpawn = new HashMap<>();
|
Map<Integer, List<List<Pair<SimulatorPreview.SimulatorPreviewTNTData, Integer>>>> toSpawn = new HashMap<>();
|
||||||
|
AtomicInteger tntCount = new AtomicInteger(0);
|
||||||
result.forEach((integer, integerSetMap) -> {
|
result.forEach((integer, integerSetMap) -> {
|
||||||
List<Pair<Integer, Set<Pair<SimulatorPreview.SimulatorPreviewTNTData, Integer>>>> internal = new ArrayList<>();
|
List<Pair<Integer, Set<Pair<SimulatorPreview.SimulatorPreviewTNTData, Integer>>>> internal = new ArrayList<>();
|
||||||
integerSetMap.forEach((integer1, pairs) -> {
|
integerSetMap.forEach((integer1, pairs) -> {
|
||||||
@ -52,12 +53,17 @@ public class SimulatorPreview19 implements SimulatorPreview {
|
|||||||
});
|
});
|
||||||
internal.sort(Comparator.comparingInt(Pair::getKey));
|
internal.sort(Comparator.comparingInt(Pair::getKey));
|
||||||
|
|
||||||
toSpawn.put(integer, internal.stream().map(Pair::getValue).map(ArrayList::new).peek(Collections::shuffle).collect(Collectors.toList()));
|
toSpawn.put(integer, internal.stream().map(Pair::getValue).peek(pairs -> {
|
||||||
|
tntCount.addAndGet(pairs.stream().mapToInt(Pair::getValue).sum());
|
||||||
|
}).map(ArrayList::new).peek(Collections::shuffle).collect(Collectors.toList()));
|
||||||
|
|
||||||
if (maxTick.get() < integer) {
|
if (maxTick.get() < integer) {
|
||||||
maxTick.set(integer);
|
maxTick.set(integer);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
if (tntCount.get() > 500) {
|
||||||
|
return new Record(false);
|
||||||
|
}
|
||||||
|
|
||||||
List<FakeTNT19> fakeTNT19s = new ArrayList<>();
|
List<FakeTNT19> fakeTNT19s = new ArrayList<>();
|
||||||
Record record = new Record(false);
|
Record record = new Record(false);
|
||||||
|
@ -57,8 +57,6 @@ public class SimulatorPreviewStorage {
|
|||||||
pair.getValue().add(player);
|
pair.getValue().add(player);
|
||||||
|
|
||||||
ShowModeParameter showModeParameter = new ShowModeParameter();
|
ShowModeParameter showModeParameter = new ShowModeParameter();
|
||||||
showModeParameter.setInterpolate_XZ(true);
|
|
||||||
showModeParameter.setInterpolate_Y(true);
|
|
||||||
TraceEntityShowMode showMode = new TraceEntityShowMode(player, showModeParameter);
|
TraceEntityShowMode showMode = new TraceEntityShowMode(player, showModeParameter);
|
||||||
pair.getKey().showAll(showMode);
|
pair.getKey().showAll(showMode);
|
||||||
showModes.put(player, new Pair<>(tntSimulator, showMode));
|
showModes.put(player, new Pair<>(tntSimulator, showMode));
|
||||||
|
In neuem Issue referenzieren
Einen Benutzer sperren