-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
49 additions
and
15 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
src/main/java/io/wdsj/hybridfix/mixin/fix/capability/CBRespawnFixLogic.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package io.wdsj.hybridfix.mixin.fix.capability; | ||
|
||
import net.minecraft.entity.Entity; | ||
import net.minecraft.entity.player.EntityPlayerMP; | ||
|
||
import static net.minecraft.entity.Entity.*; | ||
|
||
public class CBRespawnFixLogic { | ||
private CBRespawnFixLogic() { | ||
} | ||
public static void fixRespawn(EntityPlayerMP playerIn) { | ||
try { | ||
playerIn.getDataManager().lock.writeLock().lock(); | ||
playerIn.getDataManager().entries.clear(); | ||
} finally { | ||
playerIn.getDataManager().lock.writeLock().unlock(); | ||
} | ||
playerIn.getDataManager().empty = true; | ||
// Entity data params | ||
playerIn.getDataManager().register(FLAGS, Byte.valueOf((byte)0)); | ||
playerIn.getDataManager().register(AIR, Integer.valueOf(300)); | ||
playerIn.getDataManager().register(CUSTOM_NAME_VISIBLE, Boolean.valueOf(false)); | ||
playerIn.getDataManager().register(CUSTOM_NAME, ""); | ||
playerIn.getDataManager().register(SILENT, Boolean.valueOf(false)); | ||
playerIn.getDataManager().register(NO_GRAVITY, Boolean.valueOf(false)); | ||
|
||
playerIn.entityInit(); | ||
|
||
net.minecraftforge.common.MinecraftForge.EVENT_BUS.post(new net.minecraftforge.event.entity.EntityEvent.EntityConstructing(playerIn)); | ||
((EntityCapabilityAccessor) (Entity) playerIn).setCapabilities(net.minecraftforge.event.ForgeEventFactory.gatherCapabilities(playerIn)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,16 @@ | ||
public net.minecraft.world.Explosion field_77283_e # exploder | ||
public net.minecraft.world.Explosion field_77280_f # size | ||
public net.minecraft.network.datasync.EntityDataManager field_187234_c # entries | ||
public net.minecraft.network.datasync.EntityDataManager field_187234_c # entries | ||
public net.minecraft.network.datasync.EntityDataManager field_187236_e # empty | ||
public net.minecraft.network.datasync.EntityDataManager field_187235_d # lock | ||
|
||
# Entity data keys | ||
public net.minecraft.entity.Entity field_184240_ax # FLAGS | ||
public net.minecraft.entity.Entity field_184241_ay # AIR | ||
public net.minecraft.entity.Entity field_184242_az # CUSTOM_NAME | ||
public net.minecraft.entity.Entity field_184233_aA # CUSTOM_NAME_VISIBLE | ||
public net.minecraft.entity.Entity field_184234_aB # SILENT | ||
public net.minecraft.entity.Entity field_189655_aD # NO_GRAVITY | ||
|
||
# EntityPlayer method | ||
public net.minecraft.entity.player.EntityPlayer func_70088_a()V # entityInit |