forked from SteamWar/SteamWar
Merge pull request 'feat(BauSystem): use display entity to render trace' (#397) from BauSystem/use-display-entities-for-trace-render into main
Reviewed-on: SteamWar/SteamWar#397 Reviewed-by: Chaoscaot <max@chaoscaot.de>
This commit is contained in:
+18
-4
@@ -24,13 +24,16 @@ import de.steamwar.bausystem.configplayer.Config;
|
|||||||
import de.steamwar.bausystem.features.tracer.TNTPoint;
|
import de.steamwar.bausystem.features.tracer.TNTPoint;
|
||||||
import de.steamwar.bausystem.features.tracer.Trace;
|
import de.steamwar.bausystem.features.tracer.Trace;
|
||||||
import de.steamwar.bausystem.features.tracer.TraceManager;
|
import de.steamwar.bausystem.features.tracer.TraceManager;
|
||||||
|
import de.steamwar.entity.RBlockDisplay;
|
||||||
import de.steamwar.entity.REntityServer;
|
import de.steamwar.entity.REntityServer;
|
||||||
import de.steamwar.entity.RFallingBlockEntity;
|
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import net.md_5.bungee.api.chat.ClickEvent;
|
import net.md_5.bungee.api.chat.ClickEvent;
|
||||||
import org.bukkit.Location;
|
import org.bukkit.Location;
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
|
import org.bukkit.util.Transformation;
|
||||||
|
import org.joml.Quaternionf;
|
||||||
|
import org.joml.Vector3f;
|
||||||
import yapion.hierarchy.types.YAPIONValue;
|
import yapion.hierarchy.types.YAPIONValue;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -41,7 +44,16 @@ import static de.steamwar.bausystem.features.util.TNTClickListener.TNT_CLICK_DET
|
|||||||
/**
|
/**
|
||||||
* Wrapper for the rendering of a record bundle
|
* Wrapper for the rendering of a record bundle
|
||||||
*/
|
*/
|
||||||
public class TraceEntity extends RFallingBlockEntity {
|
public class TraceEntity extends RBlockDisplay {
|
||||||
|
|
||||||
|
private static final float TNT_VISUAL_SCALE = 0.98F;
|
||||||
|
private static final float TNT_VISUAL_OFFSET = -TNT_VISUAL_SCALE / 2.0F;
|
||||||
|
private static final Transformation TNT_VISUAL_TRANSFORM = new Transformation(
|
||||||
|
new Vector3f(TNT_VISUAL_OFFSET, 0.0F, TNT_VISUAL_OFFSET),
|
||||||
|
new Quaternionf(0, 0, 0, 1),
|
||||||
|
new Vector3f(TNT_VISUAL_SCALE, TNT_VISUAL_SCALE, TNT_VISUAL_SCALE),
|
||||||
|
new Quaternionf(0, 0, 0, 1)
|
||||||
|
);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The records represented by this REntity
|
* The records represented by this REntity
|
||||||
@@ -57,11 +69,13 @@ public class TraceEntity extends RFallingBlockEntity {
|
|||||||
private final Trace trace;
|
private final Trace trace;
|
||||||
|
|
||||||
public TraceEntity(REntityServer server, Location location, boolean isExplosion, List<TNTPoint> records, Trace trace) {
|
public TraceEntity(REntityServer server, Location location, boolean isExplosion, List<TNTPoint> records, Trace trace) {
|
||||||
super(server, location, isExplosion ? Material.RED_STAINED_GLASS : Material.TNT);
|
super(server, location);
|
||||||
|
Material material = isExplosion ? Material.RED_STAINED_GLASS : Material.TNT;
|
||||||
this.records = records;
|
this.records = records;
|
||||||
this.trace = trace;
|
this.trace = trace;
|
||||||
uniqueTntIdsString = records.stream().map(TNTPoint::getTntId).distinct().map(Object::toString).collect(Collectors.joining(" "));
|
uniqueTntIdsString = records.stream().map(TNTPoint::getTntId).distinct().map(Object::toString).collect(Collectors.joining(" "));
|
||||||
setNoGravity(true);
|
setTransform(TNT_VISUAL_TRANSFORM);
|
||||||
|
setBlock(material.createBlockData());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user