feat: 修复实体加速器模型和纹理

This commit is contained in:
C-H716 2025-09-11 16:47:51 +08:00
parent 0b50dfc66c
commit 3af3b62cac
8 changed files with 35 additions and 20 deletions

View File

@ -15,8 +15,8 @@ import appeng.core.definitions.AEItems;
import appeng.items.parts.PartModels; import appeng.items.parts.PartModels;
import appeng.menu.MenuOpener; import appeng.menu.MenuOpener;
import appeng.menu.locator.MenuLocators; import appeng.menu.locator.MenuLocators;
import appeng.parts.PartModel;
import appeng.parts.automation.UpgradeablePart; import appeng.parts.automation.UpgradeablePart;
import appeng.parts.p2p.P2PModels;
import com.extendedae_plus.ExtendedAEPlus; import com.extendedae_plus.ExtendedAEPlus;
import com.extendedae_plus.init.ModMenuTypes; import com.extendedae_plus.init.ModMenuTypes;
import com.extendedae_plus.menu.EntitySpeedTickerMenu; import com.extendedae_plus.menu.EntitySpeedTickerMenu;
@ -36,8 +36,6 @@ import net.minecraft.world.phys.Vec3;
import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable; import org.jetbrains.annotations.Nullable;
import java.util.List;
/** /**
* EntitySpeedTickerPart 是一个可升级的 AE2 部件<p> * EntitySpeedTickerPart 是一个可升级的 AE2 部件<p>
* 该部件可以加速目标方块实体的 tick 速率消耗 AE 网络能量并支持加速卡升级<p> * 该部件可以加速目标方块实体的 tick 速率消耗 AE 网络能量并支持加速卡升级<p>
@ -47,19 +45,22 @@ public class EntitySpeedTickerPart extends UpgradeablePart implements IGridTicka
// 当前打开的菜单实例如果有 // 当前打开的菜单实例如果有
public EntitySpeedTickerMenu menu; public EntitySpeedTickerMenu menu;
// P2P 模型用于渲染部件的外观 public static final ResourceLocation MODEL_BASE = new ResourceLocation(
private static final P2PModels MODELS = new P2PModels( ExtendedAEPlus.MODID, "part/entity_speed_ticker_part");
new ResourceLocation(ExtendedAEPlus.MODID, "part/entity_speed_ticker_part"));
/**
* 获取该部件的所有模型用于渲染
* @return 模型列表
*/
@PartModels @PartModels
public static List<IPartModel> getModels() { public static final PartModel MODELS_OFF;
return MODELS.getModels(); @PartModels
public static final PartModel MODELS_ON;
@PartModels
public static final PartModel MODELS_HAS_CHANNEL;
static {
MODELS_OFF = new PartModel(MODEL_BASE, new ResourceLocation(ExtendedAEPlus.MODID, "part/entity_speed_ticker_off"));
MODELS_ON = new PartModel(MODEL_BASE, new ResourceLocation(ExtendedAEPlus.MODID, "part/entity_speed_ticker_on"));
MODELS_HAS_CHANNEL = new PartModel(MODEL_BASE, new ResourceLocation(ExtendedAEPlus.MODID, "part/entity_speed_ticker_has_channel"));
} }
/** /**
* 构造函数初始化部件并设置网络节点属性 * 构造函数初始化部件并设置网络节点属性
* @param partItem 部件物品 * @param partItem 部件物品
@ -78,7 +79,13 @@ public class EntitySpeedTickerPart extends UpgradeablePart implements IGridTicka
* @return 当前状态的模型 * @return 当前状态的模型
*/ */
public IPartModel getStaticModels() { public IPartModel getStaticModels() {
return MODELS.getModel(this.isPowered(), this.isActive()); if (this.isActive() && this.isPowered()) {
return MODELS_HAS_CHANNEL;
} else if (this.isPowered()) {
return MODELS_ON;
} else {
return MODELS_OFF;
}
} }
/** /**
@ -103,9 +110,8 @@ public class EntitySpeedTickerPart extends UpgradeablePart implements IGridTicka
*/ */
@Override @Override
public void getBoxes(IPartCollisionHelper bch) { public void getBoxes(IPartCollisionHelper bch) {
bch.addBox(5, 5, 12, 11, 11, 13);
bch.addBox(3, 3, 13, 13, 13, 14);
bch.addBox(2, 2, 14, 14, 14, 16); bch.addBox(2, 2, 14, 14, 14, 16);
bch.addBox(5, 5, 12, 11, 11, 14);
} }
/** /**

View File

@ -1,6 +1,6 @@
{ {
"parent": "ae2:item/p2p_tunnel_base", "parent": "ae2:item/cable_interface",
"textures": { "textures": {
"type": "extendedae_plus:part/entity_speed_ticker" "front": "extendedae_plus:part/entity_speed_ticker_font"
} }
} }

View File

@ -0,0 +1,3 @@
{
"parent": "ae2:part/interface_has_channel"
}

View File

@ -0,0 +1,3 @@
{
"parent": "ae2:part/interface_off"
}

View File

@ -0,0 +1,3 @@
{
"parent": "ae2:part/interface_on"
}

View File

@ -1,6 +1,6 @@
{ {
"parent": "ae2:part/p2p/p2p_tunnel_base", "parent": "ae2:part/interface_base",
"textures": { "textures": {
"type": "extendedae_plus:part/entity_speed_ticker" "front": "extendedae_plus:part/entity_speed_ticker_font"
} }
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB