Skip to content

Commit

Permalink
Updated to 0.5.3
Browse files Browse the repository at this point in the history
The 1.16 port has been scrapped and a new one will be forked from this branch
  • Loading branch information
Alex-MacLean committed Oct 30, 2020
1 parent f54685c commit 3b6fb3d
Show file tree
Hide file tree
Showing 8 changed files with 38 additions and 23 deletions.
6 changes: 3 additions & 3 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

modVersion = 0.5.2
modVersion = 0.5.3
modMinecraftVersion = 1.15.2
modForgeVersion = 31.2.36
modForgeVersion = 31.2.45
mappingsChannel = snapshot
mappingsVersion = 20200805-1.15.1
mappingsVersion = 20201029-1.15.1
modId = herobrine
modGroup = com.herobrine.mod
modFileName = LegendOfHerobrine
Expand Down
15 changes: 4 additions & 11 deletions src/main/java/com/herobrine/mod/HerobrineMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,14 +42,11 @@
import net.minecraftforge.fml.network.simple.SimpleChannel;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.glfw.GLFWVidMode;

import java.util.function.BiConsumer;
import java.util.function.Function;
import java.util.function.Supplier;

import static org.lwjgl.glfw.GLFW.glfwGetVideoMode;

@Mod(HerobrineMod.MODID)
@Mod.EventBusSubscriber(modid = HerobrineMod.MODID, bus = Mod.EventBusSubscriber.Bus.MOD)
public class HerobrineMod {
Expand Down Expand Up @@ -168,18 +165,14 @@ public static void registerBiomes(@NotNull final RegistryEvent.Register<Biome> e

@SubscribeEvent
public void onPlayerLoggedIn(PlayerEvent.@NotNull PlayerLoggedInEvent event) {
if (!event.getPlayer().world.isRemote) {
WorldSavedData saveData = Variables.SaveData.get(event.getPlayer().world);
HerobrineMod.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) event.getPlayer()), new Variables.WorldSavedDataSyncMessage(saveData));
}
WorldSavedData saveData = Variables.SaveData.get(event.getPlayer().world);
HerobrineMod.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) event.getPlayer()), new Variables.WorldSavedDataSyncMessage(saveData));
}

@SubscribeEvent
public void onPlayerChangedDimension(PlayerEvent.@NotNull PlayerChangedDimensionEvent event) {
if (!event.getPlayer().world.isRemote) {
WorldSavedData saveData = Variables.SaveData.get(event.getPlayer().world);
HerobrineMod.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) event.getPlayer()), new Variables.WorldSavedDataSyncMessage(saveData));
}
WorldSavedData saveData = Variables.SaveData.get(event.getPlayer().world);
HerobrineMod.PACKET_HANDLER.send(PacketDistributor.PLAYER.with(() -> (ServerPlayerEntity) event.getPlayer()), new Variables.WorldSavedDataSyncMessage(saveData));
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public boolean attackEntityFrom(@NotNull DamageSource source, float amount) {
@Override
public void baseTick() {
Variables.SaveData.get(world).syncData(world);
if (!Variables.SaveData.get(world).Spawn && !Config.COMMON.HerobrineAlwaysSpawns.get()) {
if (!Variables.SaveData.get(world).Spawn && !Config.COMMON.HerobrineAlwaysSpawns.get() && !world.isRemote) {
this.remove();
}
this.clearActivePotions();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public void handleStatusUpdate(byte id) {
@Override
public void baseTick() {
Variables.SaveData.get(world).syncData(world);
if (!Variables.SaveData.get(world).Spawn && !Config.COMMON.HerobrineAlwaysSpawns.get()) {
if (!Variables.SaveData.get(world).Spawn && !Config.COMMON.HerobrineAlwaysSpawns.get() && !world.isRemote) {
this.remove();
}
super.baseTick();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,7 @@
import net.minecraft.entity.item.ExperienceOrbEntity;
import net.minecraft.entity.merchant.IMerchant;
import net.minecraft.entity.merchant.villager.AbstractVillagerEntity;
import net.minecraft.entity.monster.AbstractIllagerEntity;
import net.minecraft.entity.monster.AbstractRaiderEntity;
import net.minecraft.entity.monster.IMob;
import net.minecraft.entity.monster.MonsterEntity;
import net.minecraft.entity.monster.*;
import net.minecraft.entity.passive.GolemEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.inventory.EquipmentSlotType;
Expand All @@ -24,16 +21,18 @@
import net.minecraft.util.DamageSource;
import net.minecraft.util.Hand;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.DifficultyInstance;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import org.jetbrains.annotations.NotNull;

import javax.annotation.Nullable;
import java.util.List;
import java.util.Set;

public class AbstractSurvivorEntity extends CreatureEntity implements IMob, IMerchant, INPC {
public class AbstractSurvivorEntity extends CreatureEntity implements IMerchant, INPC {
protected AbstractSurvivorEntity(EntityType<? extends AbstractSurvivorEntity> type, World world) {
super(type, world);
this.experienceValue = 5;
Expand Down Expand Up @@ -69,6 +68,7 @@ protected void registerGoals() {
this.goalSelector.addGoal(0, new SwimGoal(this));
this.goalSelector.addGoal(1, new MeleeAttackGoal(this, 1.2D, true));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, MonsterEntity.class, true));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, SlimeEntity.class, true));
this.targetSelector.addGoal(2, new NearestAttackableTargetGoal<>(this, InfectedLlamaEntity.class, true));
this.targetSelector.addGoal(3, new NearestAttackableTargetGoal<>(this, AbstractHerobrineEntity.class, true));
this.targetSelector.addGoal(4, new NearestAttackableTargetGoal<>(this, AbstractIllagerEntity.class, true));
Expand All @@ -78,6 +78,7 @@ protected void registerGoals() {
this.goalSelector.addGoal(8, new LookAtGoal(this, PlayerEntity.class, 64.0F));
this.goalSelector.addGoal(9, new LookAtGoal(this, AbstractSurvivorEntity.class, 64.0F));
this.goalSelector.addGoal(10, new LookAtGoal(this, MonsterEntity.class, 64.0F));
this.goalSelector.addGoal(10, new LookAtGoal(this, SlimeEntity.class, 64.0F));
this.goalSelector.addGoal(10, new LookAtGoal(this, InfectedLlamaEntity.class, 64.0F));
this.goalSelector.addGoal(11, new LookAtGoal(this, AbstractHerobrineEntity.class, 64.0F));
this.goalSelector.addGoal(12, new LookAtGoal(this, GolemEntity.class, 64.0F));
Expand Down Expand Up @@ -209,6 +210,25 @@ public void livingTick() {
--this.healTimer;
this.updateAITasks();
}

AxisAlignedBB axisalignedbb = this.getBoundingBox().grow(64.0D, 64.0D, 64.0D);
List<LivingEntity> list = this.world.getEntitiesWithinAABB(LivingEntity.class, axisalignedbb);
if (!list.isEmpty()) {
for (LivingEntity entity : list) {
if (entity instanceof MonsterEntity && ((MonsterEntity) entity).getAttackTarget() == null && !(entity instanceof EndermanEntity)) {
((MonsterEntity) entity).setAttackTarget(this);
}
if (entity instanceof SlimeEntity && ((SlimeEntity) entity).getAttackTarget() == null) {
((SlimeEntity) entity).setAttackTarget(this);
}
if (entity instanceof AbstractIllagerEntity && ((AbstractIllagerEntity) entity).getAttackTarget() == null) {
((AbstractIllagerEntity) entity).setAttackTarget(this);
}
if (entity instanceof AbstractRaiderEntity && ((AbstractRaiderEntity) entity).getAttackTarget() == null) {
((AbstractRaiderEntity) entity).setAttackTarget(this);
}
}
}
}

public boolean hasNoCustomer() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ protected void registerGoals() {
this.goalSelector.addGoal(0, new SwimGoal(this));
this.goalSelector.addGoal(1, new LookAtGoal(this, PlayerEntity.class, 1024.0F));
this.goalSelector.addGoal(2, new AvoidEntityGoal<>(this, PlayerEntity.class, Config.COMMON.HerobrineSpyObservationDistance.get(), 0.7D, 1.0D));
this.goalSelector.addGoal(3, new LookAtGoal(this, PlayerEntity.class, 1024.0F));
this.goalSelector.addGoal(4, new AvoidEntityGoal<>(this, PlayerEntity.class, Config.COMMON.HerobrineSpyObservationDistance.get(), 0.7D, 1.0D));
}

@Override
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/META-INF/mods.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ loaderVersion="[31.2,)" #mandatory
issueTrackerURL="https://github.com/Alex-MacLean/TheLegendOfHerobrine/issues" #optional
[[mods]] #mandatory
modId="herobrine" #mandatory
version="0.5.2" #mandatory
version="0.5.3" #mandatory
displayName="The Legend of Herobrine" #mandatory
updateJSONURL="https://raw.githubusercontent.com/Alex-MacLean/TheLegendOfHerobrine/master/update.json" #optional
displayURL="https://www.curseforge.com/minecraft/mc-mods/the-legend-of-herobrine" #optional
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/mcmod.info
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"modid": "herobrine",
"name": "The Legend of Herobrine",
"description": "Adds Herobrine to Minecraft, and other herobrine related things",
"version": "0.5.2",
"version": "0.5.3",
"mcversion": "1.15.2",
"logoFile": "Logo.png",
"url": "https://www.curseforge.com/minecraft/mc-mods/the-legend-of-herobrine",
Expand Down

0 comments on commit 3b6fb3d

Please sign in to comment.