restored timer on the villager
This commit is contained in:
1 parent
3b90bd5d3a
commit
6fad107c6b
4 files changed
+48
-8
No files matched your search
@@ -0,0 +1,12 @@
|
|||||||
|
package carpet.fakes;
|
||||||
|
|
||||||
|
import net.minecraft.entity.ai.brain.Memory;
|
||||||
|
import net.minecraft.entity.ai.brain.MemoryModuleType;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
public interface BrainInterface
|
||||||
|
{
|
||||||
|
Map<MemoryModuleType<?>, Optional<? extends Memory<?>>> getMobMemories();
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.fakes.BrainInterface;
|
||||||
|
import net.minecraft.entity.ai.brain.Brain;
|
||||||
|
import net.minecraft.entity.ai.brain.Memory;
|
||||||
|
import net.minecraft.entity.ai.brain.MemoryModuleType;
|
||||||
|
import org.spongepowered.asm.mixin.Final;
|
||||||
|
import org.spongepowered.asm.mixin.Mixin;
|
||||||
|
import org.spongepowered.asm.mixin.Shadow;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Mixin(Brain.class)
|
||||||
|
public class Brain_Mixin implements BrainInterface
|
||||||
|
{
|
||||||
|
|
||||||
|
@Shadow @Final private Map<MemoryModuleType<?>, Optional<? extends Memory<?>>> memories;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<MemoryModuleType<?>, Optional<? extends Memory<?>>> getMobMemories()
|
||||||
|
{
|
||||||
|
return memories;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,12 +1,12 @@
|
|||||||
package carpet.mixins;
|
package carpet.mixins;
|
||||||
|
|
||||||
|
import carpet.fakes.BrainInterface;
|
||||||
import carpet.helpers.ParticleDisplay;
|
import carpet.helpers.ParticleDisplay;
|
||||||
import carpet.utils.Messenger;
|
import carpet.utils.Messenger;
|
||||||
import carpet.utils.MobAI;
|
import carpet.utils.MobAI;
|
||||||
import net.minecraft.entity.Entity;
|
|
||||||
import net.minecraft.entity.EntityInteraction;
|
|
||||||
import net.minecraft.entity.EntityType;
|
import net.minecraft.entity.EntityType;
|
||||||
import net.minecraft.entity.ai.brain.Activity;
|
import net.minecraft.entity.ai.brain.Activity;
|
||||||
|
import net.minecraft.entity.ai.brain.Memory;
|
||||||
import net.minecraft.entity.ai.brain.MemoryModuleType;
|
import net.minecraft.entity.ai.brain.MemoryModuleType;
|
||||||
import net.minecraft.entity.ai.pathing.Path;
|
import net.minecraft.entity.ai.pathing.Path;
|
||||||
import net.minecraft.entity.passive.AbstractTraderEntity;
|
import net.minecraft.entity.passive.AbstractTraderEntity;
|
||||||
@@ -62,13 +62,15 @@ public abstract class VillagerEntity_aiMixin extends AbstractTraderEntity
|
|||||||
if (MobAI.isTracking(this, MobAI.TrackingType.IRON_GOLEM_SPAWNING))
|
if (MobAI.isTracking(this, MobAI.TrackingType.IRON_GOLEM_SPAWNING))
|
||||||
{
|
{
|
||||||
long time;
|
long time;
|
||||||
Optional<Boolean> optional_1 = this.brain.getOptionalMemory(MemoryModuleType.GOLEM_DETECTED_RECENTLY);
|
Optional<? extends Memory<?>> last_seen = ((BrainInterface)this.brain).getMobMemories().get(MemoryModuleType.GOLEM_DETECTED_RECENTLY);
|
||||||
if (!optional_1.isPresent()) {
|
if (!last_seen.isPresent())
|
||||||
|
{
|
||||||
time = 0;
|
time = 0;
|
||||||
} else {
|
}
|
||||||
//Long long_2 = optional_1.get(); #TODO fixme need last seen golem time.
|
else
|
||||||
//time = long_2+600 - getEntityWorld().getTime();
|
{
|
||||||
time = 600;
|
String serialized = last_seen.get().toString();
|
||||||
|
time = Integer.parseInt(serialized.substring(11, serialized.length()-1));
|
||||||
}
|
}
|
||||||
boolean recentlySeen = time > 0;
|
boolean recentlySeen = time > 0;
|
||||||
Optional<Long> optional_11 = this.brain.getOptionalMemory(MemoryModuleType.LAST_SLEPT);
|
Optional<Long> optional_11 = this.brain.getOptionalMemory(MemoryModuleType.LAST_SLEPT);
|
||||||
|
|||||||
@@ -55,6 +55,7 @@
|
|||||||
"EntityTrackerEntry_leashFixMixin",
|
"EntityTrackerEntry_leashFixMixin",
|
||||||
|
|
||||||
"VillagerEntity_aiMixin",
|
"VillagerEntity_aiMixin",
|
||||||
|
"Brain_Mixin",
|
||||||
|
|
||||||
"ServerWorld_fakePlayersMixin",
|
"ServerWorld_fakePlayersMixin",
|
||||||
"ThrownEnderpearlEntity_fakePlayersMixin",
|
"ThrownEnderpearlEntity_fakePlayersMixin",
|
||||||
|
|||||||
Reference in new issue
Block a user