EntityObjects wip (3)

This commit is contained in:
bixilon 2020-06-13 00:34:33 +02:00
parent f6508ff891
commit 81e550d71e
No known key found for this signature in database
GPG Key ID: 5CAD791931B09AC4
7 changed files with 388 additions and 1 deletions

View File

@ -31,7 +31,14 @@ public enum Objects implements EntityEnumInterface {
WITHER_SKULL(new Identifier("wither_skull"), 66, WitherSkull.class),
FALLING_BLOCK(new Identifier("falling_block"), 70, FallingBlock.class),
ITEM_FRAME(new Identifier("item_frame"), 71, ItemFrame.class),
;
EYE_OF_ENDER(new Identifier("eye_of_ender"), 72, EyeOfEnder.class),
THROWN_POTION(new Identifier("thrown_potion"), 73, ThrownPotion.class),
FALLING_DRAGON_EGG(new Identifier("falling_dragon_eg"), 74, FallingDragonEgg.class),
THROWN_EXP_BOTTLE(null, 75, ThrownExpBottle.class),
FIREWORK(new Identifier("firework"), 76, Firework.class),
LEASH_KNOT(new Identifier("firework"), 77, LeashKnot.class),
FISHING_FLOAT(null, 90, FishingFloat.class);
//ToDo: identifier
final Identifier identifier;
final int type;

View File

@ -0,0 +1,62 @@
/*
* Codename Minosoft
* Copyright (C) 2020 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.game.datatypes.entities.objects;
import de.bixilon.minosoft.game.datatypes.entities.EntityObject;
import de.bixilon.minosoft.game.datatypes.entities.Location;
import de.bixilon.minosoft.game.datatypes.entities.ObjectInterface;
import de.bixilon.minosoft.game.datatypes.entities.Objects;
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class FallingDragonEgg extends EntityObject implements ObjectInterface {
EntityMetaData metaData;
public FallingDragonEgg(int id, Location location, int yaw, int pitch, int additionalInt, ProtocolVersion v) {
super(id, location, yaw, pitch, null);
// objects do not spawn with metadata... reading additional info from the following int
// tnt does not have any additional info
}
@Override
public Objects getEntityType() {
return Objects.FALLING_DRAGON_EGG;
}
@Override
public EntityMetaData getMetaData() {
return metaData;
}
@Override
public void setMetaData(EntityMetaData metaData) {
this.metaData = metaData;
}
@Override
public float getWidth() {
return 0.98F;
}
@Override
public float getHeight() {
return 0.98F;
}
@Override
public Class<? extends EntityMetaData> getMetaDataClass() {
return EntityMetaData.class;
}
}

View File

@ -0,0 +1,63 @@
/*
* Codename Minosoft
* Copyright (C) 2020 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.game.datatypes.entities.objects;
import de.bixilon.minosoft.game.datatypes.entities.EntityObject;
import de.bixilon.minosoft.game.datatypes.entities.Location;
import de.bixilon.minosoft.game.datatypes.entities.ObjectInterface;
import de.bixilon.minosoft.game.datatypes.entities.Objects;
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
import de.bixilon.minosoft.game.datatypes.entities.meta.FireworkMetaData;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class Firework extends EntityObject implements ObjectInterface {
FireworkMetaData metaData;
public Firework(int id, Location location, int yaw, int pitch, int additionalInt, ProtocolVersion v) {
super(id, location, yaw, pitch, null);
// objects do not spawn with metadata... reading additional info from the following int
// tnt does not have any additional info
}
@Override
public Objects getEntityType() {
return Objects.FIREWORK;
}
@Override
public FireworkMetaData getMetaData() {
return metaData;
}
@Override
public void setMetaData(EntityMetaData metaData) {
this.metaData = (FireworkMetaData) metaData;
}
@Override
public float getWidth() {
return 0.25F;
}
@Override
public float getHeight() {
return 0.25F;
}
@Override
public Class<? extends EntityMetaData> getMetaDataClass() {
return FireworkMetaData.class;
}
}

View File

@ -0,0 +1,67 @@
/*
* Codename Minosoft
* Copyright (C) 2020 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.game.datatypes.entities.objects;
import de.bixilon.minosoft.game.datatypes.entities.EntityObject;
import de.bixilon.minosoft.game.datatypes.entities.Location;
import de.bixilon.minosoft.game.datatypes.entities.ObjectInterface;
import de.bixilon.minosoft.game.datatypes.entities.Objects;
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class FishingFloat extends EntityObject implements ObjectInterface {
EntityMetaData metaData;
int owner;
public FishingFloat(int id, Location location, int yaw, int pitch, int additionalInt, ProtocolVersion v) {
super(id, location, yaw, pitch, null);
// objects do not spawn with metadata... reading additional info from the following int
// tnt does not have any additional info
this.owner = additionalInt;
}
@Override
public Objects getEntityType() {
return Objects.FISHING_FLOAT;
}
@Override
public EntityMetaData getMetaData() {
return metaData;
}
@Override
public void setMetaData(EntityMetaData metaData) {
this.metaData = metaData;
}
@Override
public float getWidth() {
return 0.25F;
}
@Override
public float getHeight() {
return 0.25F;
}
@Override
public Class<? extends EntityMetaData> getMetaDataClass() {
return EntityMetaData.class;
}
public int getOwner() {
return owner;
}
}

View File

@ -0,0 +1,62 @@
/*
* Codename Minosoft
* Copyright (C) 2020 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.game.datatypes.entities.objects;
import de.bixilon.minosoft.game.datatypes.entities.EntityObject;
import de.bixilon.minosoft.game.datatypes.entities.Location;
import de.bixilon.minosoft.game.datatypes.entities.ObjectInterface;
import de.bixilon.minosoft.game.datatypes.entities.Objects;
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class LeashKnot extends EntityObject implements ObjectInterface {
EntityMetaData metaData;
public LeashKnot(int id, Location location, int yaw, int pitch, int additionalInt, ProtocolVersion v) {
super(id, location, yaw, pitch, null);
// objects do not spawn with metadata... reading additional info from the following int
// tnt does not have any additional info
}
@Override
public Objects getEntityType() {
return Objects.LEASH_KNOT;
}
@Override
public EntityMetaData getMetaData() {
return metaData;
}
@Override
public void setMetaData(EntityMetaData metaData) {
this.metaData = metaData;
}
@Override
public float getWidth() {
return 0.5F;
}
@Override
public float getHeight() {
return 0.5F;
}
@Override
public Class<? extends EntityMetaData> getMetaDataClass() {
return EntityMetaData.class;
}
}

View File

@ -0,0 +1,62 @@
/*
* Codename Minosoft
* Copyright (C) 2020 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.game.datatypes.entities.objects;
import de.bixilon.minosoft.game.datatypes.entities.EntityObject;
import de.bixilon.minosoft.game.datatypes.entities.Location;
import de.bixilon.minosoft.game.datatypes.entities.ObjectInterface;
import de.bixilon.minosoft.game.datatypes.entities.Objects;
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class ThrownExpBottle extends EntityObject implements ObjectInterface {
EntityMetaData metaData;
public ThrownExpBottle(int id, Location location, int yaw, int pitch, int additionalInt, ProtocolVersion v) {
super(id, location, yaw, pitch, null);
// objects do not spawn with metadata... reading additional info from the following int
// tnt does not have any additional info
}
@Override
public Objects getEntityType() {
return Objects.THROWN_EXP_BOTTLE;
}
@Override
public EntityMetaData getMetaData() {
return metaData;
}
@Override
public void setMetaData(EntityMetaData metaData) {
this.metaData = metaData;
}
@Override
public float getWidth() {
return 0.25F;
}
@Override
public float getHeight() {
return 0.25F;
}
@Override
public Class<? extends EntityMetaData> getMetaDataClass() {
return EntityMetaData.class;
}
}

View File

@ -0,0 +1,64 @@
/*
* Codename Minosoft
* Copyright (C) 2020 Moritz Zwerger
*
* This program is free software: you can redistribute it and/or modify it under the terms of the GNU 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
*
* This software is not affiliated with Mojang AB, the original developer of Minecraft.
*/
package de.bixilon.minosoft.game.datatypes.entities.objects;
import de.bixilon.minosoft.game.datatypes.entities.EntityObject;
import de.bixilon.minosoft.game.datatypes.entities.Location;
import de.bixilon.minosoft.game.datatypes.entities.ObjectInterface;
import de.bixilon.minosoft.game.datatypes.entities.Objects;
import de.bixilon.minosoft.game.datatypes.entities.meta.EntityMetaData;
import de.bixilon.minosoft.protocol.protocol.ProtocolVersion;
public class ThrownPotion extends EntityObject implements ObjectInterface {
EntityMetaData metaData;
int potion; //ToDo
public ThrownPotion(int id, Location location, int yaw, int pitch, int additionalInt, ProtocolVersion v) {
super(id, location, yaw, pitch, null);
// objects do not spawn with metadata... reading additsional info from the following int
// tnt does not have any additional info
this.potion = additionalInt;
}
@Override
public Objects getEntityType() {
return Objects.THROWN_POTION;
}
@Override
public EntityMetaData getMetaData() {
return metaData;
}
@Override
public void setMetaData(EntityMetaData metaData) {
this.metaData = metaData;
}
@Override
public float getWidth() {
return 0.25F;
}
@Override
public float getHeight() {
return 0.25F;
}
@Override
public Class<? extends EntityMetaData> getMetaDataClass() {
return EntityMetaData.class;
}
}