Skip to content

Commit

Permalink
Quickfix for sufrace blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
GirafiStudios committed Mar 9, 2022
1 parent 9aa11be commit bdc7374
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 214 deletions.
5 changes: 3 additions & 2 deletions src/main/java/com/teammetallurgy/atum/Atum.java
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public Atum() {
modBus.addListener(this::setupCommon);
modBus.addListener(this::setupClient);
modBus.addListener(this::interModComms);
registerDeferredRegistries(modBus);
this.registerDeferredRegistries(modBus);
MinecraftForge.EVENT_BUS.addListener(this::onCommandRegistering);
ModLoadingContext.get().registerConfig(ModConfig.Type.COMMON, AtumConfig.spec);
IntegrationHandler.INSTANCE.addSupport();
Expand Down Expand Up @@ -92,7 +92,7 @@ private void interModComms(InterModEnqueueEvent event) {
InterModComms.sendTo("curios", SlotTypeMessage.REGISTER_TYPE, () -> SlotTypePreset.BRACELET.getMessageBuilder().build());
}

public static void registerDeferredRegistries(IEventBus modBus) {
public void registerDeferredRegistries(IEventBus modBus) {
AtumBlocks.BLOCK_DEFERRED.register(modBus);
AtumItems.ITEM_DEFERRED.register(modBus);
AtumEntities.ENTITY_DEFERRED.register(modBus);
Expand All @@ -104,6 +104,7 @@ public static void registerDeferredRegistries(IEventBus modBus) {
AtumParticles.PARTICLE_DEFERRED.register(modBus);
AtumVillagerProfession.ATUM_PROFESSION_DEFERRED.register(modBus);
AtumSensorTypes.SENSOR_TYPE_DEFERRED.register(modBus);
AtumDataSerializer.DATA_SERIALIZER_DEFERRED.register(modBus);
AtumRecipeSerializers.RECIPE_SERIALIZER_DEFERRED.register(modBus);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import com.google.common.collect.ImmutableSet;
import com.teammetallurgy.atum.Atum;
import com.teammetallurgy.atum.misc.AtumHelper;
import net.minecraft.resources.ResourceLocation;
import net.minecraft.sounds.SoundEvent;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.entity.ai.village.poi.PoiType;
Expand All @@ -13,10 +13,7 @@
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistryEntry;
import net.minecraftforge.registries.IForgeRegistry;
import net.minecraftforge.registries.RegistryObject;
import net.minecraftforge.registries.*;

import javax.annotation.Nullable;
import java.util.function.Supplier;
Expand All @@ -32,7 +29,7 @@ public class AtumVillagerProfession extends ForgeRegistryEntry<AtumVillagerProfe
public static final RegistryObject<AtumVillagerProfession> BUTCHER = register("butcher", () -> PoiType.BUTCHER, SoundEvents.VILLAGER_WORK_BUTCHER);
public static final RegistryObject<AtumVillagerProfession> CARTOGRAPHER = register("cartographer", () -> PoiType.CARTOGRAPHER, SoundEvents.VILLAGER_WORK_CARTOGRAPHER);
public static final RegistryObject<AtumVillagerProfession> CURATOR = register("curator", AtumPointsOfInterest.CURATOR, SoundEvents.VILLAGER_WORK_CARTOGRAPHER);
public static final RegistryObject<AtumVillagerProfession> FARMER = register("farmer", () -> PoiType.FARMER, ImmutableSet.of(AtumItems.EMMER_EAR, AtumItems.EMMER_SEEDS, AtumItems.FLAX_SEEDS, () -> Items.WHEAT, () -> Items.WHEAT_SEEDS, () -> Items.BEETROOT_SEEDS, () -> Items.BONE_MEAL), ImmutableSet.of(AtumBlocks.FERTILE_SOIL_TILLED, () -> Blocks.FARMLAND), SoundEvents.VILLAGER_WORK_FARMER);
public static final RegistryObject<AtumVillagerProfession> FARMER = register("farmer", () -> PoiType.FARMER, ImmutableSet.of(AtumItems.EMMER_EAR, AtumItems.EMMER_SEEDS, AtumItems.FLAX_SEEDS, () -> Items.WHEAT, () -> Items.WHEAT_SEEDS, () -> Items.BEETROOT_SEEDS, () -> Items.BONE_MEAL), ImmutableSet.of(AtumBlocks.FERTILE_SOIL_TILLED, () -> Blocks.FARMLAND), SoundEvents.VILLAGER_WORK_FARMER);
public static final RegistryObject<AtumVillagerProfession> FLETCHER = register("fletcher", () -> PoiType.FLETCHER, SoundEvents.VILLAGER_WORK_FLETCHER);
public static final RegistryObject<AtumVillagerProfession> GLASSBLOWER = register("glassblower", AtumPointsOfInterest.GLASSBLOWER, SoundEvents.VILLAGER_WORK_CLERIC);
public static final RegistryObject<AtumVillagerProfession> HUNTER = register("hunter", () -> PoiType.LEATHERWORKER, SoundEvents.VILLAGER_WORK_LEATHERWORKER);
Expand All @@ -43,12 +40,12 @@ public class AtumVillagerProfession extends ForgeRegistryEntry<AtumVillagerProfe
public static final RegistryObject<AtumVillagerProfession> TOOLSMITH = register("toolsmith", () -> PoiType.TOOLSMITH, SoundEvents.VILLAGER_WORK_TOOLSMITH);
public static final RegistryObject<AtumVillagerProfession> WEAPONSMITH = register("weaponsmith", () -> PoiType.WEAPONSMITH, SoundEvents.VILLAGER_WORK_WEAPONSMITH);
private final String name;
private final Supplier<PoiType> pointOfInterest;
private final PoiType pointOfInterest;
private final ImmutableSet<Supplier<Item>> specificItems;
private final ImmutableSet<Supplier<Block>> relatedWorldBlocks;
private final SoundEvent sound;

public AtumVillagerProfession(String name, Supplier<PoiType> pointOfInterest, ImmutableSet<Supplier<Item>> specificItems, ImmutableSet<Supplier<Block>> relatedWorldBlocks, @Nullable SoundEvent sound) {
public AtumVillagerProfession(String name, PoiType pointOfInterest, ImmutableSet<Supplier<Item>> specificItems, ImmutableSet<Supplier<Block>> relatedWorldBlocks, @Nullable SoundEvent sound) {
this.name = name;
this.pointOfInterest = pointOfInterest;
this.specificItems = specificItems;
Expand All @@ -57,7 +54,7 @@ public AtumVillagerProfession(String name, Supplier<PoiType> pointOfInterest, Im
}

public PoiType getPointOfInterest() {
return this.pointOfInterest.get();
return this.pointOfInterest;
}

public ImmutableSet<Item> getSpecificItems() {
Expand All @@ -82,11 +79,11 @@ public static RegistryObject<AtumVillagerProfession> register(String name, Suppl
}

public static RegistryObject<AtumVillagerProfession> register(String name, Supplier<PoiType> pointOfInterest, ImmutableSet<Supplier<Item>> specificItems, ImmutableSet<Supplier<Block>> relatedWorldBlocks, @Nullable SoundEvent sound) {
return ATUM_PROFESSION_DEFERRED.register(name, () -> new AtumVillagerProfession(name, pointOfInterest, specificItems, relatedWorldBlocks, sound));
return ATUM_PROFESSION_DEFERRED.register(name, () -> new AtumVillagerProfession(name, pointOfInterest.get(), specificItems, relatedWorldBlocks, sound));
}

@SubscribeEvent
public static void register(RegistryEvent.NewRegistry event) {
villagerProfession = AtumVillagerProfession.ATUM_PROFESSION_DEFERRED.makeRegistry("villager_profession", () -> AtumHelper.makeRegistryNoCreate("villager_profession", AtumVillagerProfession.class));
villagerProfession = AtumVillagerProfession.ATUM_PROFESSION_DEFERRED.makeRegistry("villager_profession", () -> new RegistryBuilder<AtumVillagerProfession>().setName(new ResourceLocation(Atum.MOD_ID, "villager_profession")).setType(AtumVillagerProfession.class).setMaxID(Integer.MAX_VALUE >> 5).allowModification());
}
}
25 changes: 0 additions & 25 deletions src/main/java/com/teammetallurgy/atum/misc/AtumHelper.java

This file was deleted.

0 comments on commit bdc7374

Please sign in to comment.