Skip to content

Commit

Permalink
Merge pull request #299 from fixrtm/macro-not-executed-by-moterman
Browse files Browse the repository at this point in the history
fix macro not executed by motorman
  • Loading branch information
anatawa12 committed Sep 2, 2021
2 parents f57ad87 + cd76f03 commit 088331a
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
1 change: 1 addition & 0 deletions .patching-mods/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ mods:
- jp.ngt.rtm.electric.TileEntityElectricalWiring
- jp.ngt.rtm.electric.TileEntitySignal
- jp.ngt.rtm.entity.ai.EntityAITravelByTrain
- jp.ngt.rtm.entity.npc.EntityMotorman
- jp.ngt.rtm.entity.npc.EntityNPC
- jp.ngt.rtm.entity.train.EntityBogie
- jp.ngt.rtm.entity.train.EntityTrainBase
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
--- a/jp/ngt/rtm/entity/npc/EntityMotorman.java
+++ b/jp/ngt/rtm/entity/npc/EntityMotorman.java
@@ -56,10 +56,17 @@
public void entityInit() {
super.entityInit();
this.getDataManager().register(HELD_ITEM, new ItemStack(Items.APPLE));
}

+ // force role to be motorman
+ public void onLivingUpdate() {
+ this.myRole = Role.MOTORMAN;
+ this.roleChanged = false;
+ super.onLivingUpdate();
+ }
+
public void writeEntityToNBT(NBTTagCompound nbt) {
super.writeEntityToNBT(nbt);
if (this.getDiagram() != null) {
NBTTagCompound nbttagcompound = new NBTTagCompound();
ItemStack itemstack = this.getDiagram();
13 changes: 13 additions & 0 deletions src/main/rtm-patches/jp/ngt/rtm/entity/npc/EntityNPC.java.patch
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
--- a/jp/ngt/rtm/entity/npc/EntityNPC.java
+++ b/jp/ngt/rtm/entity/npc/EntityNPC.java
@@ -48,11 +48,11 @@
private ResourceState<ModelSetNPC> state = new ResourceState<>(RTMResource.NPC, this);
private ScriptExecuterNPC executer = new ScriptExecuterNPC();
protected Role myRole = Role.MANNEQUIN;
private EntityDummyPlayer playerDummy;
protected int useItemCount;
- private boolean roleChanged;
+ protected boolean roleChanged;
public InventoryNPC inventory = new InventoryNPC(this);

public EntityNPC(World world) {
super(world);
this.setSize(0.6F, 1.8F);
@@ -398,6 +398,12 @@
return this.state;
}
Expand Down

0 comments on commit 088331a

Please sign in to comment.