Skip to content

Commit

Permalink
Fixed startup crashes
Browse files Browse the repository at this point in the history
Various other changes and fixes
  • Loading branch information
GirafiStudios committed Aug 6, 2020
1 parent b810c68 commit c6d9e07
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 14 deletions.
4 changes: 4 additions & 0 deletions src/main/java/com/teammetallurgy/aquaculture/Aquaculture.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package com.teammetallurgy.aquaculture;

import com.teammetallurgy.aquaculture.api.AquacultureAPI;
import com.teammetallurgy.aquaculture.block.WormFarmBlock;
import com.teammetallurgy.aquaculture.client.ClientHandler;
import com.teammetallurgy.aquaculture.init.AquaEntities;
import com.teammetallurgy.aquaculture.init.AquaItems;
Expand Down Expand Up @@ -49,6 +51,7 @@ public Aquaculture() {
modBus.addListener(this::setupCommon);
modBus.addListener(this::setupClient);
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, AquaConfig.spec);
AquacultureAPI.Tags.init();
}

private void setupCommon(FMLCommonSetupEvent event) {
Expand All @@ -57,6 +60,7 @@ private void setupCommon(FMLCommonSetupEvent event) {
AquaEntities.setSpawnPlacement();
AquaEntities.addEntitySpawns();
FishReadFromJson.addFishSpawns();
WormFarmBlock.addCompostables();
if (AquaConfig.BASIC_OPTIONS.aqFishToBreedCats.get()) {
FishRegistry.addCatBreeding();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
import net.minecraft.tags.ITag;
import net.minecraft.tags.ItemTags;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.fml.common.Mod;

import javax.annotation.Nonnull;

Expand All @@ -32,7 +31,6 @@ public static Item registerFishMount(@Nonnull String name) {
return FishRegistry.registerFishMount(name);
}

@Mod.EventBusSubscriber(modid = Aquaculture.MOD_ID) //Statically load, cause reasons
public static class Tags {
public static final ITag.INamedTag<Item> FILLET_KNIFE = tag("forge", "fillet_knife");
public static final ITag.INamedTag<Item> FISHING_LINE = tag(Aquaculture.MOD_ID, "fishing_line");
Expand All @@ -44,5 +42,8 @@ public static class Tags {
public static ITag.INamedTag<Item> tag(String modID, String name) {
return ItemTags.makeWrapperTag(new ResourceLocation(modID, name).toString());
}

public static void init() {
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public void func_230430_a_(@Nonnull MatrixStack matrixStack, int mouseX, int mou

@Override
protected void func_230451_b_(@Nonnull MatrixStack matrixStack, int mouseX, int mouseY) {
this.field_230712_o_.func_238407_a_(matrixStack, this.field_230704_d_, 100.0F, 6.0F, 4210752);
this.field_230712_o_.func_238407_a_(matrixStack, this.playerInventory.getDisplayName(), 8.0F, (float) (this.ySize - 96 + 4), 4210752);
this.field_230712_o_.func_238422_b_(matrixStack, this.field_230704_d_, 100.0F, 6.0F, 4210752);
this.field_230712_o_.func_238422_b_(matrixStack, this.playerInventory.getDisplayName(), 8.0F, (float) (this.ySize - 96 + 4), 4210752);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,7 @@ protected void catchingFish(BlockPos pos) { //Copied from vanilla. Only changed
} else {
Vector3d motion = this.getMotion();
this.setMotion(motion.x, (-0.4F * MathHelper.nextFloat(this.rand, 0.6F, 1.0F)), motion.z);
double boundingBox = this.getBoundingBox().minY + 0.5D; //TODO check, might need to remove bounding box Y
double boundingBox = this.getBoundingBox().minY + 0.5D;
if (serverworld.getFluidState(this.func_233580_cy_()).isTagged(FluidTags.WATER)) { //Water check added
this.playSound(SoundEvents.ENTITY_FISHING_BOBBER_SPLASH, 0.25F, 1.0F + (this.rand.nextFloat() - this.rand.nextFloat()) * 0.4F);
serverworld.spawnParticle(ParticleTypes.BUBBLE, this.getPosX(), boundingBox, this.getPosZ(), (int) (1.0F + this.getWidth() * 20.0F), this.getWidth(), 0.0D, this.getWidth(), 0.2D);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
import javax.annotation.Nullable;

public class TurtleLandEntity extends AnimalEntity {
private static final Ingredient TURTLE_EDIBLE = Ingredient.fromTag(AquacultureAPI.Tags.TURTLE_EDIBLE);

public TurtleLandEntity(EntityType<? extends AnimalEntity> entityType, World world) {
super(entityType, world);
Expand All @@ -35,7 +34,7 @@ protected void registerGoals() {
this.goalSelector.addGoal(0, new TurtleLandSwimGoal());
this.goalSelector.addGoal(1, new PanicGoal(this, 1.2D));
this.goalSelector.addGoal(2, new BreedGoal(this, 1.05D));
this.goalSelector.addGoal(3, new TemptGoal(this, 1.15D, false, TURTLE_EDIBLE));
this.goalSelector.addGoal(3, new TemptGoal(this, 1.15D, false, this.getTurtleEdible()));
this.goalSelector.addGoal(4, new FollowParentGoal(this, 1.1D));
this.goalSelector.addGoal(5, new GetOutOfWaterGoal(this));
this.goalSelector.addGoal(6, new RandomWalkingGoal(this, 1.0D));
Expand All @@ -50,7 +49,11 @@ public static AttributeModifierMap.MutableAttribute getAttributes() {

@Override
public boolean isBreedingItem(@Nonnull ItemStack stack) {
return TURTLE_EDIBLE.test(stack);
return this.getTurtleEdible().test(stack);
}

public Ingredient getTurtleEdible() {
return Ingredient.fromTag(AquacultureAPI.Tags.TURTLE_EDIBLE);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,9 @@

import com.teammetallurgy.aquaculture.Aquaculture;
import com.teammetallurgy.aquaculture.misc.AquaConfig;
import net.minecraft.loot.LootEntry;
import net.minecraft.loot.LootPool;
import net.minecraft.loot.LootTables;
import net.minecraft.loot.TableLootEntry;
import net.minecraft.advancements.criterion.EntityPredicate;
import net.minecraft.loot.*;
import net.minecraft.loot.conditions.EntityHasProperty;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.LootTableLoadEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
Expand Down Expand Up @@ -44,7 +43,8 @@ public static void onLootTableLoad(LootTableLoadEvent event) {
addEntry(pool, getInjectEntry(FISH, 85, -1));
addEntry(pool, getInjectEntry(JUNK, 10, -2));
if (AquaConfig.NEPTUNIUM_OPTIONS.addNeptunesBountyToLoot.get()) {
addEntry(pool, getInjectEntry(NEPTUNIUM, 1, 2));
LootEntry neptuniumEntry = TableLootEntry.builder(NEPTUNIUM).weight(1).quality(2).acceptCondition(EntityHasProperty.builder(LootContext.EntityTarget.THIS, EntityPredicate.Builder.create().func_234580_a_(FishingPredicate.func_234640_a_(true)))).build();
addEntry(pool, neptuniumEntry);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,10 @@
import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntitySpawnPlacementRegistry;
import net.minecraft.entity.EntityType;
import net.minecraft.entity.ai.attributes.GlobalEntityTypeAttributes;
import net.minecraft.entity.passive.CatEntity;
import net.minecraft.entity.passive.OcelotEntity;
import net.minecraft.entity.passive.fish.AbstractFishEntity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemStack;
import net.minecraft.util.ResourceLocation;
Expand Down Expand Up @@ -78,6 +80,7 @@ public static void registerFishies(RegistryEvent.Register<EntityType<?>> event)
for (EntityType<AquaFishEntity> entityType : fishEntities) {
event.getRegistry().register(entityType);
EntitySpawnPlacementRegistry.register(entityType, EntitySpawnPlacementRegistry.PlacementType.IN_WATER, Heightmap.Type.MOTION_BLOCKING_NO_LEAVES, AquaFishEntity::canSpawnHere);
GlobalEntityTypeAttributes.put(entityType, AbstractFishEntity.func_234176_m_().func_233813_a_());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public ActionResult<ItemStack> onItemRightClick(World world, PlayerEntity player

if (player instanceof ServerPlayerEntity) {
TranslationTextComponent chatMessage = new TranslationTextComponent(message);
player.sendMessage(chatMessage, Util.field_240973_b_); //TODO Test
player.sendMessage(chatMessage, Util.field_240973_b_);
}

heldStack.shrink(1);
Expand Down

0 comments on commit c6d9e07

Please sign in to comment.