Skip to content

Commit

Permalink
Fixed crash on world creation
Browse files Browse the repository at this point in the history
  • Loading branch information
GirafiStudios committed Oct 6, 2020
1 parent 6cdae69 commit c927361
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,6 @@ protected void registerGoals() {
@Nullable
public ILivingEntityData onInitialSpawn(@Nonnull IServerWorld world, @Nonnull DifficultyInstance difficulty, @Nonnull SpawnReason spawnReason, @Nullable ILivingEntityData livingdata, @Nullable CompoundNBT nbt) {
livingdata = super.onInitialSpawn(world, difficulty, spawnReason, livingdata, nbt);
this.getAttributeManager().createInstanceIfAbsent(JUMP_STRENGTH);
this.getAttribute(Attributes.MOVEMENT_SPEED).setBaseValue(0.4D);
this.getAttribute(Attributes.MAX_HEALTH).setBaseValue(this.getWolfMaxHealth());
this.getAttributeManager().createInstanceIfAbsent(Attributes.ATTACK_DAMAGE).setBaseValue(this.getWolfAttack());

Expand All @@ -146,6 +144,10 @@ public ILivingEntityData onInitialSpawn(@Nonnull IServerWorld world, @Nonnull Di
return livingdata;
}

public static AttributeModifierMap.MutableAttribute getAttributes() { //TODO, needs fixing
return MobEntity.func_233666_p_().createMutableAttribute(Attributes.MAX_HEALTH, 20.0F).createMutableAttribute(Attributes.MOVEMENT_SPEED, 0.4D).createMutableAttribute(Attributes.ATTACK_DAMAGE, 8.0D).createMutableAttribute(JUMP_STRENGTH);
}

@Override
public void setAttackTarget(@Nullable LivingEntity livingBase) {
super.setAttackTarget(livingBase);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static void registerSpawnPlacement() {
GlobalEntityTypeAttributes.put(BONESTORM, BonestormEntity.getAttributes().create());
GlobalEntityTypeAttributes.put(BRIGAND, BrigandEntity.getAttributes().create());
GlobalEntityTypeAttributes.put(CAMEL, CamelEntity.getAttributes().create());
//GlobalEntityTypeAttributes.put(DESERT_WOLF, DesertWolfEntity.getAttributes().create()); //TODO Look into
GlobalEntityTypeAttributes.put(DESERT_WOLF, DesertWolfEntity.getAttributes().create());
GlobalEntityTypeAttributes.put(FORSAKEN, ForsakenEntity.getAttributes().create());
GlobalEntityTypeAttributes.put(MUMMY, MummyEntity.getAttributes().create());
GlobalEntityTypeAttributes.put(NOMAD, NomadEntity.getAttributes().create());
Expand Down
10 changes: 5 additions & 5 deletions src/main/java/com/teammetallurgy/atum/init/AtumFeatures.java
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ public static void registerFeature(RegistryEvent.Register<Feature<?>> event) {
@SubscribeEvent
public static void registerStructure(RegistryEvent.Register<Structure<?>> event) {
for (Structure<?> feature : STRUCTURES) {
event.getRegistry().register(feature);
//event.getRegistry().register(feature); //TODO Fix Crash when pressing singleplayer
}
}

Expand Down Expand Up @@ -221,18 +221,18 @@ public static void addDeadwoodTrees(BiomeGenerationSettings.Builder builder, int
}

public static void addTomb(BiomeGenerationSettings.Builder builder) {
builder.withStructure(AtumFeatures.TOMB_FEATURE);
//builder.withStructure(AtumFeatures.TOMB_FEATURE); //TODO
}

public static void addPyramid(BiomeGenerationSettings.Builder builder) {
if (AtumConfig.WORLD_GEN.pyramidEnabled.get()) {
builder.withStructure(AtumFeatures.PYRAMID_FEATURE);
//builder.withStructure(AtumFeatures.PYRAMID_FEATURE); //TODO
}
}

public static void addRuins(BiomeGenerationSettings.Builder builder) {
if (AtumConfig.WORLD_GEN.ruinsEnabled.get()) {
builder.withStructure(AtumFeatures.RUIN_FEATURE);
//builder.withStructure(AtumFeatures.RUIN_FEATURE); //TODO
}
}

Expand All @@ -246,7 +246,7 @@ public static void addMineshaft(BiomeGenerationSettings.Builder builder, boolean
type = isSurface ? AtumMineshaftStructure.Type.DEADWOOD_SURFACE : AtumMineshaftStructure.Type.DEADWOOD;
}
AtumMineshaftConfig config = new AtumMineshaftConfig(AtumConfig.WORLD_GEN.mineshaftProbability.get().floatValue(), type);
builder.withStructure(AtumFeatures.MINESHAFT_FEATURE.field_236268_b_.func_236391_a_(config)); //TODO Test
//builder.withStructure(AtumFeatures.MINESHAFT_FEATURE.field_236268_b_.func_236391_a_(config)); //TODO Test
}
}
}
Expand Down

0 comments on commit c927361

Please sign in to comment.