/
Belyash5
/
Flu
Обзор
Документация
Войти
/
Belyash5
/
Flu
Код
Запросы
0
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
src/main/java/com/hbm/render/util/MissileMultipart.java
93 строки
2 KB
Bob
launch pads yeah
11 фев 2024, 21:46
11 фев 2024, 21:46
2c6d5f9
Код
Авторство
О чём код?
package com.hbm.render.util; import com.hbm.handler.MissileStruct; import com.hbm.items.weapon.ItemCustomMissilePart.PartType; import cpw.mods.fml.relauncher.Side; import cpw.mods.fml.relauncher.SideOnly; @SideOnly(Side.CLIENT) public class MissileMultipart { public MissilePart warhead; public MissilePart fuselage; public MissilePart fins; public MissilePart thruster; public double getHeight() { double height = 0; if(warhead != null && warhead.type == PartType.WARHEAD) height += warhead.height; if(fuselage != null && fuselage.type == PartType.FUSELAGE) height += fuselage.height; if(thruster != null && thruster.type == PartType.THRUSTER) height += thruster.height; return height; } public static MissileMultipart loadFromStruct(MissileStruct struct) { if(struct == null) return null; MissileMultipart multipart = new MissileMultipart(); multipart.warhead = MissilePart.getPart(struct.warhead); multipart.fuselage = MissilePart.getPart(struct.fuselage); multipart.fins = MissilePart.getPart(struct.fins); multipart.thruster = MissilePart.getPart(struct.thruster); return multipart; } /*public void writeToByteBuffer(ByteBuf buf) { if(warhead != null && warhead.type == PartType.WARHEAD) buf.writeInt(Item.getIdFromItem(warhead.part)); else buf.writeInt(0); if(fuselage != null && fuselage.type == PartType.FUSELAGE) buf.writeInt(Item.getIdFromItem(fuselage.part)); else buf.writeInt(0); if(fins != null && fins.type == PartType.FINS) buf.writeInt(Item.getIdFromItem(fins.part)); else buf.writeInt(0); if(thruster != null && thruster.type == PartType.THRUSTER) buf.writeInt(Item.getIdFromItem(thruster.part)); else buf.writeInt(0); } public static MissileMultipart readFromByteBuffer(ByteBuf buf) { MissileMultipart multipart = new MissileMultipart(); int w = buf.readInt(); int f = buf.readInt(); int s = buf.readInt(); int t = buf.readInt(); if(w != 0) multipart.warhead = MissilePart.getPart(Item.getItemById(w)); if(f != 0) multipart.fuselage = MissilePart.getPart(Item.getItemById(f)); if(s != 0) multipart.fins = MissilePart.getPart(Item.getItemById(s)); if(t != 0) multipart.thruster = MissilePart.getPart(Item.getItemById(t)); return multipart; }*/ }