Refactor to use better impl of interaction entity in REntity system

This commit is contained in:
D4rkr34lm
2026-05-30 13:29:50 +02:00
parent 17e1cf53b0
commit ea9d7ac584
3 changed files with 11 additions and 74 deletions
@@ -1,55 +0,0 @@
/*
* This file is a part of the SteamWar software.
*
* Copyright (C) 2025 SteamWar.de-Serverteam
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.steamwar.entity;
import net.minecraft.network.syncher.EntityDataAccessor;
import net.minecraft.network.syncher.EntityDataSerializers;
import org.bukkit.Location;
import org.bukkit.entity.EntityType;
import java.util.function.Consumer;
public class RInteractionEntity extends REntity {
private static final EntityDataAccessor<Float> widthWatcher = new EntityDataAccessor<>(8, EntityDataSerializers.FLOAT);
private static final EntityDataAccessor<Float> heightWatcher = new EntityDataAccessor<>(9, EntityDataSerializers.FLOAT);
private float width;
private float height;
private final REntity owner;
public RInteractionEntity(REntityServer server, Location location, float width, float height, REntity owner) {
super(server, EntityType.INTERACTION, location, 0);
this.width = width;
this.height = height;
this.owner = owner;
server.addEntity(this);
}
@Override
protected void postSpawn(Consumer<Object> packetSink) {
super.postSpawn(packetSink);
packetSink.accept(getDataWatcherPacket(widthWatcher, width, heightWatcher, height));
}
public REntity getOwner() {
return owner;
}
}