@@ -81,8 +81,9 @@ public void tick() {
81
81
}
82
82
83
83
// Rate limiting
84
- if (!entityData .get (ACTIVE )) {
85
- if (noPush ) heal (10 );
84
+ if (!getActive ()) {
85
+ tablePos = null ;
86
+ heal (10 );
86
87
return ;
87
88
}
88
89
if (autoPlayer .aiNoDelay < 2 && level ().getGameTime () - lastTickGameTime < 10 ) {
@@ -120,11 +121,7 @@ public void tick() {
120
121
if (tableFound ) break ;
121
122
}
122
123
if (!tableFound ) {
123
- if (!noPush ) {
124
- kill ();
125
- } else {
126
- entityData .set (ACTIVE , false );
127
- }
124
+ setActive (false );
128
125
return ;
129
126
}
130
127
}
@@ -134,7 +131,6 @@ public void tick() {
134
131
BlockEntity blockEntity = level ().getBlockEntity (tablePos );
135
132
if (blockEntity instanceof BlockEntityMinoTable tableEntity ) {
136
133
if (tableEntity .game != null ) {
137
- setInvulnerable (true );
138
134
heal (10 );
139
135
if (tableEntity .game .players .get (tableEntity .game .currentPlayerIndex ).equals (cardPlayer )) {
140
136
if (autoPlayer .aiNoDelay > 0 ) {
@@ -164,7 +160,6 @@ public void tick() {
164
160
isThinking = false ;
165
161
}
166
162
} else {
167
- setInvulnerable (false );
168
163
if (gameEndTime == -1L ) {
169
164
gameEndTime = level ().getGameTime () + 100 ;
170
165
} else if (level ().getGameTime () - gameEndTime <= 20 * 3 ) {
@@ -189,21 +184,6 @@ public void tick() {
189
184
}
190
185
}
191
186
192
- @ Override
193
- public boolean hurt (DamageSource source , float amount ) {
194
- if (source .getEntity () instanceof Player ) {
195
- if (!entityData .get (ACTIVE )) {
196
- entityData .set (ACTIVE , true );
197
- } else {
198
- if (((Player )source .getEntity ()).getMainHandItem ().is (net .minecraft .world .item .Items .STICK )) {
199
- entityData .set (ACTIVE , false );
200
- tablePos = null ;
201
- }
202
- }
203
- }
204
- return super .hurt (source , amount );
205
- }
206
-
207
187
@ Override
208
188
public @ NotNull InteractionResult interact (Player player , InteractionHand hand ) {
209
189
if (level ().isClientSide ) {
@@ -248,6 +228,16 @@ public void setItemSlot(EquipmentSlot slot, ItemStack stack) {
248
228
return HumanoidArm .RIGHT ;
249
229
}
250
230
231
+ @ Override
232
+ public boolean isInvulnerable () {
233
+ return true ;
234
+ }
235
+
236
+ @ Override
237
+ public boolean isInvulnerableTo (DamageSource source ) {
238
+ return true ;
239
+ }
240
+
251
241
@ Override
252
242
public void addAdditionalSaveData (CompoundTag compound ) {
253
243
super .addAdditionalSaveData (compound );
0 commit comments