diff --git a/src/main/java/org/violetmoon/zeta/advancement/AdvancementModifierRegistry.java b/src/main/java/org/violetmoon/zeta/advancement/AdvancementModifierRegistry.java index 8c63bff..3fa3bec 100644 --- a/src/main/java/org/violetmoon/zeta/advancement/AdvancementModifierRegistry.java +++ b/src/main/java/org/violetmoon/zeta/advancement/AdvancementModifierRegistry.java @@ -4,6 +4,7 @@ import java.util.Set; import java.util.function.BooleanSupplier; +import net.minecraft.advancements.AdvancementHolder; import org.violetmoon.zeta.Zeta; import org.violetmoon.zeta.advancement.modifier.ASeedyPlaceModifier; import org.violetmoon.zeta.advancement.modifier.AdventuringTimeModifier; @@ -50,7 +51,7 @@ public AdvancementModifierRegistry(Zeta zeta) { public ManualTrigger registerManualTrigger(String resloc) { ResourceLocation id = zeta.registry.newResourceLocation(resloc); ManualTrigger trigger = new ManualTrigger(id); - CriteriaTriggers.register(trigger); + CriteriaTriggers.register(id.toString(), trigger); return trigger; } @@ -85,21 +86,21 @@ public IAdvancementModifierDelegate getDelegate() { private void onAdvancementsLoaded(ServerAdvancementManager manager) { for(ResourceLocation res : modifiers.keySet()) { - Advancement adv = manager.getAdvancement(res); + AdvancementHolder advHolder = manager.get(res); - if(adv != null) { + if(advHolder != null) { Collection found = modifiers.get(res); if(!found.isEmpty()) { int modifications = 0; - MutableAdvancement mutable = new MutableAdvancement(adv); + MutableAdvancement mutable = new MutableAdvancement(advHolder.value()); for(IAdvancementModifier mod : found) if(mod.isActive() && mod.apply(res, mutable)) modifications++; if(modifications > 0) { - zeta.log.info("Modified advancement {} with {} patches", adv.getId(), modifications); + zeta.log.info("Modified advancement {} with {} patches", advHolder.id(), modifications); mutable.commit(); } } diff --git a/src/main/java/org/violetmoon/zeta/advancement/MutableAdvancement.java b/src/main/java/org/violetmoon/zeta/advancement/MutableAdvancement.java index 17d1405..d9da821 100644 --- a/src/main/java/org/violetmoon/zeta/advancement/MutableAdvancement.java +++ b/src/main/java/org/violetmoon/zeta/advancement/MutableAdvancement.java @@ -55,7 +55,7 @@ private void mutabilize() { } public void commit() { - advancement.criteria = ImmutableMap.copyOf(criteria); + advancement.criteria() = ImmutableMap.copyOf(criteria); List requirementArrays = new ArrayList<>(); for(List list : requirements) { diff --git a/src/main/java/org/violetmoon/zeta/advancement/modifier/ASeedyPlaceModifier.java b/src/main/java/org/violetmoon/zeta/advancement/modifier/ASeedyPlaceModifier.java index 9abaf53..da8e673 100644 --- a/src/main/java/org/violetmoon/zeta/advancement/modifier/ASeedyPlaceModifier.java +++ b/src/main/java/org/violetmoon/zeta/advancement/modifier/ASeedyPlaceModifier.java @@ -16,7 +16,7 @@ public class ASeedyPlaceModifier extends AdvancementModifier { - private static final ResourceLocation TARGET = new ResourceLocation("husbandry/plant_seed"); + private static final ResourceLocation TARGET = ResourceLocation.withDefaultNamespace("husbandry/plant_seed"); final Set seeds; @@ -34,7 +34,7 @@ public Set getTargets() { @Override public boolean apply(ResourceLocation res, IMutableAdvancement adv) { for(var block : seeds) { - Criterion criterion = new Criterion(EnterBlockTrigger.TriggerInstance.entersBlock(block)); + Criterion criterion = EnterBlockTrigger.TriggerInstance.entersBlock(block); String name = BuiltInRegistries.BLOCK.getKey(block).toString(); adv.addOrCriterion(name, criterion); diff --git a/src/main/java/org/violetmoon/zeta/advancement/modifier/AdventuringTimeModifier.java b/src/main/java/org/violetmoon/zeta/advancement/modifier/AdventuringTimeModifier.java index 25ab3b4..ad114bd 100644 --- a/src/main/java/org/violetmoon/zeta/advancement/modifier/AdventuringTimeModifier.java +++ b/src/main/java/org/violetmoon/zeta/advancement/modifier/AdventuringTimeModifier.java @@ -17,7 +17,7 @@ public class AdventuringTimeModifier extends AdvancementModifier { - private static final ResourceLocation TARGET = new ResourceLocation("adventure/adventuring_time"); + private static final ResourceLocation TARGET = ResourceLocation.withDefaultNamespace("adventure/adventuring_time"); private final Set> locations; @@ -37,7 +37,7 @@ public boolean apply(ResourceLocation res, IMutableAdvancement adv) { String name = key.location().toString(); Criterion criterion = new Criterion(PlayerTrigger.TriggerInstance.located( - LocationPredicate.inBiome(key))); + LocationPredicate.inBiome(key))); //todo: I dunno how to do codec adv.addRequiredCriterion(name, criterion); } diff --git a/src/main/java/org/violetmoon/zeta/advancement/modifier/BalancedDietModifier.java b/src/main/java/org/violetmoon/zeta/advancement/modifier/BalancedDietModifier.java index dfc54bf..0dd63dd 100644 --- a/src/main/java/org/violetmoon/zeta/advancement/modifier/BalancedDietModifier.java +++ b/src/main/java/org/violetmoon/zeta/advancement/modifier/BalancedDietModifier.java @@ -18,7 +18,7 @@ public class BalancedDietModifier extends AdvancementModifier { - private static final ResourceLocation TARGET = new ResourceLocation("husbandry/balanced_diet"); + private static final ResourceLocation TARGET = ResourceLocation.withDefaultNamespace("husbandry/balanced_diet"); private final Set items; @@ -26,7 +26,6 @@ public BalancedDietModifier(ZetaModule module, Set items) { super(module); this.items = items; Preconditions.checkArgument(!items.isEmpty(), "Advancement modifier list cant be empty"); - } @Override @@ -37,14 +36,9 @@ public Set getTargets() { @Override public boolean apply(ResourceLocation res, IMutableAdvancement adv) { ItemLike[] array = items.toArray(ItemLike[]::new); - - Criterion criterion = new Criterion(ConsumeItemTrigger.TriggerInstance.usedItem( - ItemPredicate.Builder.item().of(array).build())); - + Criterion criterion = ConsumeItemTrigger.TriggerInstance.usedItem(ItemPredicate.Builder.item().of(array)); String name = BuiltInRegistries.ITEM.getKey(array[0].asItem()).toString(); - adv.addRequiredCriterion(name, criterion); - return true; } diff --git a/src/main/java/org/violetmoon/zeta/advancement/modifier/FishyBusinessModifier.java b/src/main/java/org/violetmoon/zeta/advancement/modifier/FishyBusinessModifier.java index f890036..16ae53c 100644 --- a/src/main/java/org/violetmoon/zeta/advancement/modifier/FishyBusinessModifier.java +++ b/src/main/java/org/violetmoon/zeta/advancement/modifier/FishyBusinessModifier.java @@ -1,5 +1,6 @@ package org.violetmoon.zeta.advancement.modifier; +import java.util.Optional; import java.util.Set; import org.violetmoon.zeta.advancement.AdvancementModifier; @@ -19,7 +20,7 @@ public class FishyBusinessModifier extends AdvancementModifier { - private static final ResourceLocation TARGET = new ResourceLocation("husbandry/fishy_business"); + private static final ResourceLocation TARGET = ResourceLocation.withDefaultNamespace("husbandry/fishy_business"); final Set fishes; @@ -38,11 +39,9 @@ public Set getTargets() { public boolean apply(ResourceLocation res, IMutableAdvancement adv) { ItemLike[] array = fishes.toArray(ItemLike[]::new); - Criterion criterion = new Criterion(FishingRodHookedTrigger. + Criterion criterion = FishingRodHookedTrigger. TriggerInstance.fishedItem( - ItemPredicate.ANY, - EntityPredicate.ANY, - ItemPredicate.Builder.item().of(array).build())); + Optional.empty(), Optional.empty(), Optional.of(ItemPredicate.Builder.item().of(array).build())); String name = BuiltInRegistries.ITEM.getKey(array[0].asItem()).toString(); adv.addOrCriterion(name, criterion); diff --git a/src/main/java/org/violetmoon/zeta/advancement/modifier/FuriousCocktailModifier.java b/src/main/java/org/violetmoon/zeta/advancement/modifier/FuriousCocktailModifier.java index 63130ba..97dccfb 100644 --- a/src/main/java/org/violetmoon/zeta/advancement/modifier/FuriousCocktailModifier.java +++ b/src/main/java/org/violetmoon/zeta/advancement/modifier/FuriousCocktailModifier.java @@ -16,8 +16,8 @@ public class FuriousCocktailModifier extends AdvancementModifier { - private static final ResourceLocation TARGET_AP = new ResourceLocation("nether/all_potions"); - private static final ResourceLocation TARGET_AE = new ResourceLocation("nether/all_effects"); + private static final ResourceLocation TARGET_AP = ResourceLocation.withDefaultNamespace("nether/all_potions"); + private static final ResourceLocation TARGET_AE = ResourceLocation.withDefaultNamespace("nether/all_effects"); final BooleanSupplier isPotion; final Set effects; @@ -40,9 +40,11 @@ public boolean apply(ResourceLocation res, IMutableAdvancement adv) { return false; Criterion crit = adv.getCriterion("all_effects"); - if(crit != null && crit.getTrigger() instanceof EffectsChangedTrigger.TriggerInstance ect) { + if(crit != null && crit.triggerInstance() instanceof EffectsChangedTrigger.TriggerInstance ect) { + for(MobEffect e : effects) - ect.effects.and(e); + ect.effects().and(e); + return true; } diff --git a/src/main/java/org/violetmoon/zeta/advancement/modifier/GlowAndBeholdModifier.java b/src/main/java/org/violetmoon/zeta/advancement/modifier/GlowAndBeholdModifier.java index e9c4fbf..4a959e1 100644 --- a/src/main/java/org/violetmoon/zeta/advancement/modifier/GlowAndBeholdModifier.java +++ b/src/main/java/org/violetmoon/zeta/advancement/modifier/GlowAndBeholdModifier.java @@ -21,7 +21,7 @@ public class GlowAndBeholdModifier extends AdvancementModifier { - private static final ResourceLocation TARGET = new ResourceLocation("husbandry/make_a_sign_glow"); + private static final ResourceLocation TARGET = ResourceLocation.withDefaultNamespace("husbandry/make_a_sign_glow"); final Set blocks; @@ -40,12 +40,11 @@ public Set getTargets() { public boolean apply(ResourceLocation res, IMutableAdvancement adv) { Block[] array = blocks.toArray(Block[]::new); - Criterion criterion = new Criterion(ItemUsedOnLocationTrigger. - TriggerInstance.itemUsedOnBlock( - LocationPredicate.Builder.location().setBlock( - BlockPredicate.Builder.block() - .of(array).build()), - ItemPredicate.Builder.item().of(Items.GLOW_INK_SAC))); + Criterion criterion = ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( + LocationPredicate.Builder.location().setBlock( + BlockPredicate.Builder.block() + .of(array)), + ItemPredicate.Builder.item().of(Items.GLOW_INK_SAC)); String name = BuiltInRegistries.BLOCK.getKey(array[0]).toString(); adv.addOrCriterion(name, criterion); diff --git a/src/main/java/org/violetmoon/zeta/advancement/modifier/MonsterHunterModifier.java b/src/main/java/org/violetmoon/zeta/advancement/modifier/MonsterHunterModifier.java index 3448e3a..2263760 100644 --- a/src/main/java/org/violetmoon/zeta/advancement/modifier/MonsterHunterModifier.java +++ b/src/main/java/org/violetmoon/zeta/advancement/modifier/MonsterHunterModifier.java @@ -18,8 +18,8 @@ public class MonsterHunterModifier extends AdvancementModifier { - private static final ResourceLocation TARGET_ONE = new ResourceLocation("adventure/kill_a_mob"); - private static final ResourceLocation TARGET_ALL = new ResourceLocation("adventure/kill_all_mobs"); + private static final ResourceLocation TARGET_ONE = ResourceLocation.withDefaultNamespace("adventure/kill_a_mob"); + private static final ResourceLocation TARGET_ALL = ResourceLocation.withDefaultNamespace("adventure/kill_all_mobs"); final Set> entityTypes; @@ -39,7 +39,7 @@ public boolean apply(ResourceLocation res, IMutableAdvancement adv) { boolean all = res.equals(TARGET_ALL); for(EntityType type : entityTypes) { - Criterion criterion = new Criterion(KilledTrigger.TriggerInstance.playerKilledEntity(EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(type)))); + Criterion criterion = KilledTrigger.TriggerInstance.playerKilledEntity(EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(type))); String name = BuiltInRegistries.ENTITY_TYPE.getKey(type).toString(); if(all) diff --git a/src/main/java/org/violetmoon/zeta/advancement/modifier/TacticalFishingModifier.java b/src/main/java/org/violetmoon/zeta/advancement/modifier/TacticalFishingModifier.java index 2b8390a..0760514 100644 --- a/src/main/java/org/violetmoon/zeta/advancement/modifier/TacticalFishingModifier.java +++ b/src/main/java/org/violetmoon/zeta/advancement/modifier/TacticalFishingModifier.java @@ -19,7 +19,7 @@ public class TacticalFishingModifier extends AdvancementModifier { - private static final ResourceLocation TARGET = new ResourceLocation("husbandry/tactical_fishing"); + private static final ResourceLocation TARGET = ResourceLocation.withDefaultNamespace("husbandry/tactical_fishing"); final Set bucketItems; @@ -38,9 +38,8 @@ public Set getTargets() { public boolean apply(ResourceLocation res, IMutableAdvancement adv) { ItemLike[] array = bucketItems.toArray(ItemLike[]::new); - Criterion criterion = new Criterion(FilledBucketTrigger. - TriggerInstance.filledBucket(ItemPredicate.Builder.item() - .of(array).build())); + Criterion criterion = FilledBucketTrigger.TriggerInstance.filledBucket( + ItemPredicate.Builder.item().of(array)); String name = BuiltInRegistries.ITEM.getKey(array[0].asItem()).toString(); adv.addOrCriterion(name, criterion); diff --git a/src/main/java/org/violetmoon/zeta/advancement/modifier/TwoByTwoModifier.java b/src/main/java/org/violetmoon/zeta/advancement/modifier/TwoByTwoModifier.java index 42551d4..307698a 100644 --- a/src/main/java/org/violetmoon/zeta/advancement/modifier/TwoByTwoModifier.java +++ b/src/main/java/org/violetmoon/zeta/advancement/modifier/TwoByTwoModifier.java @@ -19,7 +19,7 @@ public class TwoByTwoModifier extends AdvancementModifier { - private static final ResourceLocation TARGET = new ResourceLocation("husbandry/bred_all_animals"); + private static final ResourceLocation TARGET = ResourceLocation.withDefaultNamespace("husbandry/bred_all_animals"); final Set> entityTypes; @@ -39,8 +39,8 @@ public Set getTargets() { @Override public boolean apply(ResourceLocation res, IMutableAdvancement adv) { for(EntityType type : entityTypes) { - Criterion criterion = new Criterion(BredAnimalsTrigger.TriggerInstance - .bredAnimals(EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(type)))); + Criterion criterion = BredAnimalsTrigger.TriggerInstance + .bredAnimals(EntityPredicate.Builder.entity().entityType(EntityTypePredicate.of(type))); String name = BuiltInRegistries.ENTITY_TYPE.getKey(type).toString(); adv.addRequiredCriterion(name, criterion); diff --git a/src/main/java/org/violetmoon/zeta/advancement/modifier/WaxModifier.java b/src/main/java/org/violetmoon/zeta/advancement/modifier/WaxModifier.java index 3e473cf..7449f55 100644 --- a/src/main/java/org/violetmoon/zeta/advancement/modifier/WaxModifier.java +++ b/src/main/java/org/violetmoon/zeta/advancement/modifier/WaxModifier.java @@ -21,8 +21,8 @@ public class WaxModifier extends AdvancementModifier { - private static final ResourceLocation TARGET_ON = new ResourceLocation("husbandry/wax_on"); - private static final ResourceLocation TARGET_OFF = new ResourceLocation("husbandry/wax_off"); + private static final ResourceLocation TARGET_ON = ResourceLocation.withDefaultNamespace("husbandry/wax_on"); + private static final ResourceLocation TARGET_OFF = ResourceLocation.withDefaultNamespace("husbandry/wax_off"); private final Set unwaxed; private final Set waxed; @@ -46,20 +46,20 @@ public Set getTargets() { public boolean apply(ResourceLocation res, IMutableAdvancement adv) { String title = res.getPath().replaceAll(".+/", ""); Criterion criterion = adv.getCriterion(title); - if(criterion != null && criterion.getTrigger() instanceof ItemUsedOnLocationTrigger.TriggerInstance iib) { + if(criterion != null && criterion.triggerInstance() instanceof ItemUsedOnLocationTrigger.TriggerInstance iib) { // Yes I know its wordy, yes I know this is stupid. Please forgive me I couldnt make it better. - iib.location.compositePredicates = (res.equals(TARGET_ON)) ? iib.location.compositePredicates + iib.location().get().compositePredicates = (res.equals(TARGET_ON)) ? iib.location().get().compositePredicates //todo: AccessWidener .or(ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( LocationPredicate.Builder.location().setBlock( - BlockPredicate.Builder.block().of(unwaxed).build()), + BlockPredicate.Builder.block().of(unwaxed)), ItemPredicate.Builder.item().of(Items.HONEYCOMB)) - .location.compositePredicates - ) : iib.location.compositePredicates + .triggerInstance().location().get().compositePredicates + ) : iib.location().get().compositePredicates .or(ItemUsedOnLocationTrigger.TriggerInstance.itemUsedOnBlock( LocationPredicate.Builder.location().setBlock( - BlockPredicate.Builder.block().of(waxed).build()), + BlockPredicate.Builder.block().of(waxed)), ItemPredicate.Builder.item().of(ItemTags.AXES)) - .location.compositePredicates); + .triggerInstance().location().get().compositePredicates); } return true; diff --git a/src/main/java/org/violetmoon/zeta/block/ZetaButtonBlock.java b/src/main/java/org/violetmoon/zeta/block/ZetaButtonBlock.java index e07f1cd..db87707 100644 --- a/src/main/java/org/violetmoon/zeta/block/ZetaButtonBlock.java +++ b/src/main/java/org/violetmoon/zeta/block/ZetaButtonBlock.java @@ -23,8 +23,8 @@ public abstract class ZetaButtonBlock extends ButtonBlock implements IZetaBlock private final @Nullable ZetaModule module; private BooleanSupplier enabledSupplier = BooleanSuppliers.TRUE; - public ZetaButtonBlock(BlockSetType setType, int ticksToStayPressed, boolean arrowsCanPress, String regname, @Nullable ZetaModule module, Properties properties) { - super(properties, setType, ticksToStayPressed, arrowsCanPress); + public ZetaButtonBlock(BlockSetType setType, int ticksToStayPressed, String regname, @Nullable ZetaModule module, Properties properties) { + super(setType, ticksToStayPressed, properties); this.module = module; if(module == null) //auto registration below this line diff --git a/src/main/java/org/violetmoon/zeta/block/ZetaInheritedPaneBlock.java b/src/main/java/org/violetmoon/zeta/block/ZetaInheritedPaneBlock.java index 1fbf940..858babe 100644 --- a/src/main/java/org/violetmoon/zeta/block/ZetaInheritedPaneBlock.java +++ b/src/main/java/org/violetmoon/zeta/block/ZetaInheritedPaneBlock.java @@ -34,7 +34,7 @@ public ZetaInheritedPaneBlock(IZetaBlock parent, Block.Properties properties) { } public ZetaInheritedPaneBlock(IZetaBlock parent) { - this(parent, Block.Properties.copy(parent.getBlock())); + this(parent, Block.Properties.ofFullCopy(parent.getBlock())); } @Override @@ -42,9 +42,8 @@ public boolean isEnabled() { return super.isEnabled() && parent.isEnabled(); } - @Nullable @Override - public float[] getBeaconColorMultiplierZeta(BlockState state, LevelReader world, BlockPos pos, BlockPos beaconPos) { + public Integer getBeaconColorMultiplierZeta(BlockState state, LevelReader world, BlockPos pos, BlockPos beaconPos) { BlockState parentState = parent.getBlock().defaultBlockState(); return parent.getModule().zeta.blockExtensions.get(parentState).getBeaconColorMultiplierZeta(parentState, world, pos, beaconPos); } diff --git a/src/main/java/org/violetmoon/zeta/block/ZetaPressurePlateBlock.java b/src/main/java/org/violetmoon/zeta/block/ZetaPressurePlateBlock.java index 68296d0..342b442 100644 --- a/src/main/java/org/violetmoon/zeta/block/ZetaPressurePlateBlock.java +++ b/src/main/java/org/violetmoon/zeta/block/ZetaPressurePlateBlock.java @@ -20,8 +20,8 @@ public class ZetaPressurePlateBlock extends PressurePlateBlock implements IZetaB private final @Nullable ZetaModule module; private BooleanSupplier enabledSupplier = BooleanSuppliers.TRUE; - public ZetaPressurePlateBlock(Sensitivity sensitivity, String regname, @Nullable ZetaModule module, Properties properties, BlockSetType blockSetType) { - super(sensitivity, properties, blockSetType); + public ZetaPressurePlateBlock(String regname, @Nullable ZetaModule module, BlockSetType blockSetType, Properties properties) { + super(blockSetType, properties); this.module = module; if(module == null) //auto registration below this line diff --git a/src/main/java/org/violetmoon/zeta/block/ZetaSlabBlock.java b/src/main/java/org/violetmoon/zeta/block/ZetaSlabBlock.java index da57d95..bd9ba25 100644 --- a/src/main/java/org/violetmoon/zeta/block/ZetaSlabBlock.java +++ b/src/main/java/org/violetmoon/zeta/block/ZetaSlabBlock.java @@ -68,9 +68,8 @@ public boolean doesConditionApply() { return enabledSupplier.getAsBoolean(); } - @Nullable @Override - public float[] getBeaconColorMultiplierZeta(BlockState state, LevelReader world, BlockPos pos, BlockPos beaconPos) { + public Integer getBeaconColorMultiplierZeta(BlockState state, LevelReader world, BlockPos pos, BlockPos beaconPos) { BlockState parentState = parent.getBlock().defaultBlockState(); return parent.getModule().zeta.blockExtensions.get(parentState).getBeaconColorMultiplierZeta(parentState, world, pos, beaconPos); } diff --git a/src/main/java/org/violetmoon/zeta/block/ZetaStairsBlock.java b/src/main/java/org/violetmoon/zeta/block/ZetaStairsBlock.java index dedfc5a..f02ecc0 100644 --- a/src/main/java/org/violetmoon/zeta/block/ZetaStairsBlock.java +++ b/src/main/java/org/violetmoon/zeta/block/ZetaStairsBlock.java @@ -25,7 +25,7 @@ public class ZetaStairsBlock extends StairBlock implements IZetaBlock, IZetaBloc private BooleanSupplier enabledSupplier = BooleanSuppliers.TRUE; public ZetaStairsBlock(IZetaBlock parent, @Nullable ResourceKey tab) { - super(parent.getBlock()::defaultBlockState, VariantRegistry.realStateCopy(parent)); + super(parent.getBlock().defaultBlockState(), VariantRegistry.realStateCopy(parent)); this.parent = parent; @@ -68,9 +68,8 @@ public boolean doesConditionApply() { return enabledSupplier.getAsBoolean(); } - @Nullable @Override - public float[] getBeaconColorMultiplierZeta(BlockState state, LevelReader world, BlockPos pos, BlockPos beaconPos) { + public Integer getBeaconColorMultiplierZeta(BlockState state, LevelReader world, BlockPos pos, BlockPos beaconPos) { BlockState parentState = parent.getBlock().defaultBlockState(); return parent.getModule().zeta.blockExtensions.get(parentState).getBeaconColorMultiplierZeta(parentState, world, pos, beaconPos); } diff --git a/src/main/java/org/violetmoon/zeta/block/ZetaStandingSignBlock.java b/src/main/java/org/violetmoon/zeta/block/ZetaStandingSignBlock.java index 7a2e4f7..ac07bba 100644 --- a/src/main/java/org/violetmoon/zeta/block/ZetaStandingSignBlock.java +++ b/src/main/java/org/violetmoon/zeta/block/ZetaStandingSignBlock.java @@ -15,7 +15,7 @@ public class ZetaStandingSignBlock extends StandingSignBlock implements IZetaBlo private BooleanSupplier enabledSupplier = BooleanSuppliers.TRUE; public ZetaStandingSignBlock(String regname, @Nullable ZetaModule module, WoodType type, Properties properties) { - super(properties, type); + super(type, properties); this.module = module; if(module == null) //auto registration below this line diff --git a/src/main/java/org/violetmoon/zeta/block/ZetaTrapdoorBlock.java b/src/main/java/org/violetmoon/zeta/block/ZetaTrapdoorBlock.java index 1c0f4b0..441d3e0 100644 --- a/src/main/java/org/violetmoon/zeta/block/ZetaTrapdoorBlock.java +++ b/src/main/java/org/violetmoon/zeta/block/ZetaTrapdoorBlock.java @@ -22,7 +22,7 @@ public class ZetaTrapdoorBlock extends TrapDoorBlock implements IZetaBlock { private BooleanSupplier enabledSupplier = BooleanSuppliers.TRUE; public ZetaTrapdoorBlock(BlockSetType setType, String regname, ZetaModule module, Properties properties) { - super(properties, setType); + super(setType, properties); this.module = module; if(module == null) //auto registration below this line diff --git a/src/main/java/org/violetmoon/zeta/block/ZetaWallBlock.java b/src/main/java/org/violetmoon/zeta/block/ZetaWallBlock.java index 604b91a..8d3adc8 100644 --- a/src/main/java/org/violetmoon/zeta/block/ZetaWallBlock.java +++ b/src/main/java/org/violetmoon/zeta/block/ZetaWallBlock.java @@ -54,9 +54,8 @@ public boolean doesConditionApply() { return enabledSupplier.getAsBoolean(); } - @Nullable @Override - public float[] getBeaconColorMultiplierZeta(BlockState state, LevelReader world, BlockPos pos, BlockPos beaconPos) { + public Integer getBeaconColorMultiplierZeta(BlockState state, LevelReader world, BlockPos pos, BlockPos beaconPos) { BlockState parentState = parent.getBlock().defaultBlockState(); return parent.getModule().zeta.blockExtensions.get(parentState).getBeaconColorMultiplierZeta(parentState, world, pos, beaconPos); } diff --git a/src/main/java/org/violetmoon/zeta/block/ZetaWallHangingSignBlock.java b/src/main/java/org/violetmoon/zeta/block/ZetaWallHangingSignBlock.java index 418c95e..9c7593d 100644 --- a/src/main/java/org/violetmoon/zeta/block/ZetaWallHangingSignBlock.java +++ b/src/main/java/org/violetmoon/zeta/block/ZetaWallHangingSignBlock.java @@ -15,7 +15,7 @@ public class ZetaWallHangingSignBlock extends WallHangingSignBlock implements IZ private BooleanSupplier enabledSupplier = BooleanSuppliers.TRUE; public ZetaWallHangingSignBlock(String regname, @Nullable ZetaModule module, WoodType type, BlockBehaviour.Properties properties) { - super(properties, type); + super(type, properties); this.module = module; if(module == null) //auto registration below this line diff --git a/src/main/java/org/violetmoon/zeta/block/ZetaWallSignBlock.java b/src/main/java/org/violetmoon/zeta/block/ZetaWallSignBlock.java index 37d5748..5faf121 100644 --- a/src/main/java/org/violetmoon/zeta/block/ZetaWallSignBlock.java +++ b/src/main/java/org/violetmoon/zeta/block/ZetaWallSignBlock.java @@ -15,7 +15,7 @@ public class ZetaWallSignBlock extends WallSignBlock implements IZetaBlock { private BooleanSupplier enabledSupplier = BooleanSuppliers.TRUE; public ZetaWallSignBlock(String regname, ZetaModule module, WoodType type, Properties properties) { - super(properties, type); + super(type, properties); this.module = module; if(module == null) //auto registration below this line diff --git a/src/main/java/org/violetmoon/zeta/block/ZetaWoodenButtonBlock.java b/src/main/java/org/violetmoon/zeta/block/ZetaWoodenButtonBlock.java index 63652b1..bc360f6 100644 --- a/src/main/java/org/violetmoon/zeta/block/ZetaWoodenButtonBlock.java +++ b/src/main/java/org/violetmoon/zeta/block/ZetaWoodenButtonBlock.java @@ -11,7 +11,7 @@ public class ZetaWoodenButtonBlock extends ZetaButtonBlock { public ZetaWoodenButtonBlock(BlockSetType setType, String regname, @Nullable ZetaModule module, Properties properties) { - super(setType, 30, true, regname, module, properties); + super(setType, 30, regname, module, properties); } @NotNull diff --git a/src/main/java/org/violetmoon/zeta/client/ClientRegistryExtension.java b/src/main/java/org/violetmoon/zeta/client/ClientRegistryExtension.java index 660f0a6..a4a3463 100644 --- a/src/main/java/org/violetmoon/zeta/client/ClientRegistryExtension.java +++ b/src/main/java/org/violetmoon/zeta/client/ClientRegistryExtension.java @@ -48,7 +48,7 @@ public void registerItemColorHandlers(ZAddItemColorHandlers event) { ClampedItemPropertyFunction isDyed = (stack, level, entity, i) -> dyeables.isDyed(stack) ? 1 : 0; ItemColor color = (stack, layer) -> layer == 0 ? dyeables.getColor(stack) : 0xFF_FF_FF; //apparently ItemPropertyFunctions are weird and can only be assigned to the minecraft: namespace - ResourceLocation isDyedId = new ResourceLocation("minecraft", z.modid + "_dyed"); + ResourceLocation isDyedId = ResourceLocation.withDefaultNamespace( z.modid + "_dyed"); for(Item item : dyeables.dyeableConditions.keySet()) { ItemProperties.register(item, isDyedId, isDyed); diff --git a/src/main/java/org/violetmoon/zeta/client/ZetaClient.java b/src/main/java/org/violetmoon/zeta/client/ZetaClient.java index 83a6328..6138610 100644 --- a/src/main/java/org/violetmoon/zeta/client/ZetaClient.java +++ b/src/main/java/org/violetmoon/zeta/client/ZetaClient.java @@ -46,7 +46,7 @@ public ZetaClient(Zeta zeta) { public final ZetaEventBus loadBus; public final ZetaEventBus playBus; - public ResourceLocation generalIcons = new ResourceLocation("zeta", "textures/gui/general_icons.png"); + public ResourceLocation generalIcons = ResourceLocation.fromNamespaceAndPath("zeta", "textures/gui/general_icons.png"); public final ClientTicker ticker; public final ClientConfigManager clientConfigManager; diff --git a/src/main/java/org/violetmoon/zeta/client/config/screen/AbstractEditBoxInputScreen.java b/src/main/java/org/violetmoon/zeta/client/config/screen/AbstractEditBoxInputScreen.java index 1b925b5..039756c 100644 --- a/src/main/java/org/violetmoon/zeta/client/config/screen/AbstractEditBoxInputScreen.java +++ b/src/main/java/org/violetmoon/zeta/client/config/screen/AbstractEditBoxInputScreen.java @@ -25,13 +25,13 @@ public AbstractEditBoxInputScreen(ZetaClient zc, Screen parent, ChangeSet change @Override public void render(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { - renderBackground(guiGraphics); + renderBackground(guiGraphics, mouseX, mouseY, partialTicks); super.render(guiGraphics, mouseX, mouseY, partialTicks); guiGraphics.drawCenteredString(font, Component.literal(def.getTranslatedDisplayName(I18n::get)).withStyle(ChatFormatting.BOLD), width / 2, 20, 0xFFFFFF); guiGraphics.drawCenteredString(font, I18n.get("quark.gui.config.defaultvalue", def.defaultValue), width / 2, 30, 0xFFFFFF); - + //todo: Quark Reference input.render(guiGraphics, mouseX, mouseY, partialTicks); } diff --git a/src/main/java/org/violetmoon/zeta/client/config/screen/SectionScreen.java b/src/main/java/org/violetmoon/zeta/client/config/screen/SectionScreen.java index 845ec4b..3b1b867 100644 --- a/src/main/java/org/violetmoon/zeta/client/config/screen/SectionScreen.java +++ b/src/main/java/org/violetmoon/zeta/client/config/screen/SectionScreen.java @@ -72,7 +72,7 @@ public void tick() { @Override public void render(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { - renderBackground(guiGraphics); + renderBackground(guiGraphics, mouseX, mouseY, partialTicks); list.render(guiGraphics, mouseX, mouseY, partialTicks); super.render(guiGraphics, mouseX, mouseY, partialTicks); @@ -81,7 +81,7 @@ public void render(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, flo int left = 20; String modName = WordUtils.capitalizeFully(z.modid); - guiGraphics.drawString(font, ChatFormatting.BOLD + I18n.get("quark.gui.config.header", modName), left, 10, 0x48ddbc); + guiGraphics.drawString(font, ChatFormatting.BOLD + I18n.get("quark.gui.config.header", modName), left, 10, 0x48ddbc); //todo: QUARK REFERENCE guiGraphics.drawString(font, breadcrumbs, left, 20, 0xFFFFFF); } @@ -92,7 +92,7 @@ public class Divider extends Entry { public void render(@NotNull GuiGraphics guiGraphics, int index, int rowTop, int rowLeft, int rowWidth, int rowHeight, int mouseX, int mouseY, boolean hovered, float partialTicks) { assert minecraft != null; - String s = I18n.get("quark.gui.config.subcategories"); + String s = I18n.get("quark.gui.config.subcategories"); //todo: QUARK REFERENCE guiGraphics.drawString(minecraft.font, s, rowLeft + (float) (rowWidth / 2 - minecraft.font.width(s) / 2), rowTop + 7, 0x6666FF, true); } diff --git a/src/main/java/org/violetmoon/zeta/client/config/screen/StringListInputScreen.java b/src/main/java/org/violetmoon/zeta/client/config/screen/StringListInputScreen.java index e5495c0..6e34f10 100644 --- a/src/main/java/org/violetmoon/zeta/client/config/screen/StringListInputScreen.java +++ b/src/main/java/org/violetmoon/zeta/client/config/screen/StringListInputScreen.java @@ -55,7 +55,7 @@ protected void forceUpdateWidgetsTo(List value) { @Override public void render(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { - renderBackground(guiGraphics); + renderBackground(guiGraphics, mouseX, mouseY, partialTicks); list.render(guiGraphics, mouseX, mouseY, partialTicks); super.render(guiGraphics, mouseX, mouseY, partialTicks); diff --git a/src/main/java/org/violetmoon/zeta/client/config/screen/ZetaConfigHomeScreen.java b/src/main/java/org/violetmoon/zeta/client/config/screen/ZetaConfigHomeScreen.java index 43ff3b4..7615c2a 100644 --- a/src/main/java/org/violetmoon/zeta/client/config/screen/ZetaConfigHomeScreen.java +++ b/src/main/java/org/violetmoon/zeta/client/config/screen/ZetaConfigHomeScreen.java @@ -125,7 +125,7 @@ public void commit(Button button) { @Override public void render(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { - renderBackground(guiGraphics); + renderBackground(guiGraphics, mouseX, mouseY, partialTicks); super.render(guiGraphics, mouseX, mouseY, partialTicks); guiGraphics.drawCenteredString(font, ChatFormatting.BOLD + I18n.get("quark.gui.config.header", WordUtils.capitalizeFully(z.modid)), width / 2, 15, 0x48ddbc); diff --git a/src/main/java/org/violetmoon/zeta/client/config/widget/CategoryButton.java b/src/main/java/org/violetmoon/zeta/client/config/widget/CategoryButton.java index 445f213..011ea15 100644 --- a/src/main/java/org/violetmoon/zeta/client/config/widget/CategoryButton.java +++ b/src/main/java/org/violetmoon/zeta/client/config/widget/CategoryButton.java @@ -20,11 +20,11 @@ public CategoryButton(int x, int y, int w, int h, Component text, ItemStack icon } @Override - public void render(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { + public void render(@NotNull GuiGraphics guiGraphics, int mouseX, int mouseY, float partialTicks) { //Todo: Are we able to fix this on Neoforge? super.render(guiGraphics, mouseX, mouseY, partialTicks); if(!active) - setTooltip(Tooltip.create(Component.translatable("quark.gui.config.missingaddon"))); + setTooltip(Tooltip.create(Component.translatable("quark.gui.config.missingaddon"))); // todo: QUARK REFERENCE Minecraft mc = Minecraft.getInstance(); guiGraphics.renderFakeItem(icon, getX() + 5, getY() + 2); diff --git a/src/main/java/org/violetmoon/zeta/config/ConfigFlagManager.java b/src/main/java/org/violetmoon/zeta/config/ConfigFlagManager.java index 47003ad..720c239 100644 --- a/src/main/java/org/violetmoon/zeta/config/ConfigFlagManager.java +++ b/src/main/java/org/violetmoon/zeta/config/ConfigFlagManager.java @@ -36,17 +36,15 @@ public ConfigFlagManager(Zeta zeta) { public void onRegister(ZRegister event) { CraftingExtensionsRegistry ext = event.getCraftingExtensionsRegistry(); - //TODO: make these Quark-independent - ext.registerConditionSerializer(new FlagCondition.Serializer(this, new ResourceLocation(zeta.modid, "flag"))); - //Especially this one, which requires quark advancement config option :/ - ext.registerConditionSerializer(new FlagCondition.Serializer(this, new ResourceLocation(zeta.modid, "advancement_flag"), () -> ZetaGeneralConfig.enableModdedAdvancements)); + //Note: These SHOULD be Quark-independent already, but hell if I know. Todo: Double check it. + ext.registerConditionSerializer(new FlagCondition.Serializer(this, ResourceLocation.fromNamespaceAndPath(zeta.modid, "flag"))); + ext.registerConditionSerializer(new FlagCondition.Serializer(this, ResourceLocation.fromNamespaceAndPath(zeta.modid, "advancement_flag"), () -> ZetaGeneralConfig.enableModdedAdvancements)); FlagLootCondition.FlagSerializer flagSerializer = new FlagLootCondition.FlagSerializer(this); - Registry.register(BuiltInRegistries.LOOT_CONDITION_TYPE, new ResourceLocation(zeta.modid, "flag"), flagSerializer.selfType); + Registry.register(BuiltInRegistries.LOOT_CONDITION_TYPE, ResourceLocation.fromNamespaceAndPath(zeta.modid, "flag"), flagSerializer.selfType); - ext.registerIngredientSerializer(new ResourceLocation(zeta.modid, "flag"), flagIngredientSerializer); + ext.registerIngredientSerializer(ResourceLocation.fromNamespaceAndPath(zeta.modid, "flag"), flagIngredientSerializer); - //TODO: make this Quark-independent SyncedFlagHandler.setupFlagManager(this); } diff --git a/src/main/java/org/violetmoon/zeta/config/type/BiomeTagConfig.java b/src/main/java/org/violetmoon/zeta/config/type/BiomeTagConfig.java index 23e1ccc..7d44f93 100644 --- a/src/main/java/org/violetmoon/zeta/config/type/BiomeTagConfig.java +++ b/src/main/java/org/violetmoon/zeta/config/type/BiomeTagConfig.java @@ -74,7 +74,7 @@ public void onReload(ZetaModule module, ConfigFlagManager flagManager) { public void updateTypes() { tags = new LinkedList<>(); for(String s : biomeTagStrings) { - TagKey tag = TagKey.create(Registries.BIOME, new ResourceLocation(s)); + TagKey tag = TagKey.create(Registries.BIOME, ResourceLocation.parse(s)); if(tag != null) tags.add(tag); diff --git a/src/main/java/org/violetmoon/zeta/event/play/ZRecipeCrawl.java b/src/main/java/org/violetmoon/zeta/event/play/ZRecipeCrawl.java index 022e19b..8d57156 100644 --- a/src/main/java/org/violetmoon/zeta/event/play/ZRecipeCrawl.java +++ b/src/main/java/org/violetmoon/zeta/event/play/ZRecipeCrawl.java @@ -42,7 +42,7 @@ public static abstract class Visit> extends ZRecipeCrawl { public Visit(T recipe, RegistryAccess access) { this.recipe = recipe; - this.recipeID = recipe.getId(); + this.recipeID = recipe.getId(); //todo: Get ID another way this.output = recipe.getResultItem(access); this.ingredients = recipe.getIngredients(); } diff --git a/src/main/java/org/violetmoon/zeta/item/ZetaArmorItem.java b/src/main/java/org/violetmoon/zeta/item/ZetaArmorItem.java index c3d1a5c..6d04107 100644 --- a/src/main/java/org/violetmoon/zeta/item/ZetaArmorItem.java +++ b/src/main/java/org/violetmoon/zeta/item/ZetaArmorItem.java @@ -1,12 +1,14 @@ package org.violetmoon.zeta.item; +import net.minecraft.core.Holder; +import org.checkerframework.checker.units.qual.A; import org.violetmoon.zeta.item.ext.IZetaItemExtensions; import net.minecraft.world.item.ArmorItem; import net.minecraft.world.item.ArmorMaterial; public class ZetaArmorItem extends ArmorItem implements IZetaItemExtensions { - public ZetaArmorItem(ArmorMaterial mat, Type type, Properties props) { + public ZetaArmorItem(Holder mat, Type type, Properties props) { super(mat, type, props); } } diff --git a/src/main/java/org/violetmoon/zeta/item/ZetaSmithingTemplateItem.java b/src/main/java/org/violetmoon/zeta/item/ZetaSmithingTemplateItem.java index 0a6fdd4..4439362 100644 --- a/src/main/java/org/violetmoon/zeta/item/ZetaSmithingTemplateItem.java +++ b/src/main/java/org/violetmoon/zeta/item/ZetaSmithingTemplateItem.java @@ -17,22 +17,22 @@ public class ZetaSmithingTemplateItem extends SmithingTemplateItem implements IZ protected static final ChatFormatting Z_TITLE_FORMAT = ChatFormatting.GRAY; protected static final ChatFormatting Z_DESCRIPTION_FORMAT = ChatFormatting.BLUE; - protected static final ResourceLocation Z_EMPTY_SLOT_HELMET = new ResourceLocation("item/empty_armor_slot_helmet"); - protected static final ResourceLocation Z_EMPTY_SLOT_CHESTPLATE = new ResourceLocation("item/empty_armor_slot_chestplate"); - protected static final ResourceLocation Z_EMPTY_SLOT_LEGGINGS = new ResourceLocation("item/empty_armor_slot_leggings"); - protected static final ResourceLocation Z_EMPTY_SLOT_BOOTS = new ResourceLocation("item/empty_armor_slot_boots"); - protected static final ResourceLocation Z_EMPTY_SLOT_HOE = new ResourceLocation("item/empty_slot_hoe"); - protected static final ResourceLocation Z_EMPTY_SLOT_AXE = new ResourceLocation("item/empty_slot_axe"); - protected static final ResourceLocation Z_EMPTY_SLOT_SWORD = new ResourceLocation("item/empty_slot_sword"); - protected static final ResourceLocation Z_EMPTY_SLOT_SHOVEL = new ResourceLocation("item/empty_slot_shovel"); - protected static final ResourceLocation Z_EMPTY_SLOT_PICKAXE = new ResourceLocation("item/empty_slot_pickaxe"); - protected static final ResourceLocation Z_EMPTY_SLOT_INGOT = new ResourceLocation("item/empty_slot_ingot"); - protected static final ResourceLocation Z_EMPTY_SLOT_REDSTONE_DUST = new ResourceLocation("item/empty_slot_redstone_dust"); - protected static final ResourceLocation Z_EMPTY_SLOT_QUARTZ = new ResourceLocation("item/empty_slot_quartz"); - protected static final ResourceLocation Z_EMPTY_SLOT_EMERALD = new ResourceLocation("item/empty_slot_emerald"); - protected static final ResourceLocation Z_EMPTY_SLOT_DIAMOND = new ResourceLocation("item/empty_slot_diamond"); - protected static final ResourceLocation Z_EMPTY_SLOT_LAPIS_LAZULI = new ResourceLocation("item/empty_slot_lapis_lazuli"); - protected static final ResourceLocation Z_EMPTY_SLOT_AMETHYST_SHARD = new ResourceLocation("item/empty_slot_amethyst_shard"); + protected static final ResourceLocation Z_EMPTY_SLOT_HELMET = ResourceLocation.withDefaultNamespace("item/empty_armor_slot_helmet"); + protected static final ResourceLocation Z_EMPTY_SLOT_CHESTPLATE = ResourceLocation.withDefaultNamespace("item/empty_armor_slot_chestplate"); + protected static final ResourceLocation Z_EMPTY_SLOT_LEGGINGS = ResourceLocation.withDefaultNamespace("item/empty_armor_slot_leggings"); + protected static final ResourceLocation Z_EMPTY_SLOT_BOOTS = ResourceLocation.withDefaultNamespace("item/empty_armor_slot_boots"); + protected static final ResourceLocation Z_EMPTY_SLOT_HOE = ResourceLocation.withDefaultNamespace("item/empty_slot_hoe"); + protected static final ResourceLocation Z_EMPTY_SLOT_AXE = ResourceLocation.withDefaultNamespace("item/empty_slot_axe"); + protected static final ResourceLocation Z_EMPTY_SLOT_SWORD = ResourceLocation.withDefaultNamespace("item/empty_slot_sword"); + protected static final ResourceLocation Z_EMPTY_SLOT_SHOVEL = ResourceLocation.withDefaultNamespace("item/empty_slot_shovel"); + protected static final ResourceLocation Z_EMPTY_SLOT_PICKAXE = ResourceLocation.withDefaultNamespace("item/empty_slot_pickaxe"); + protected static final ResourceLocation Z_EMPTY_SLOT_INGOT = ResourceLocation.withDefaultNamespace("item/empty_slot_ingot"); + protected static final ResourceLocation Z_EMPTY_SLOT_REDSTONE_DUST = ResourceLocation.withDefaultNamespace("item/empty_slot_redstone_dust"); + protected static final ResourceLocation Z_EMPTY_SLOT_QUARTZ = ResourceLocation.withDefaultNamespace("item/empty_slot_quartz"); + protected static final ResourceLocation Z_EMPTY_SLOT_EMERALD = ResourceLocation.withDefaultNamespace("item/empty_slot_emerald"); + protected static final ResourceLocation Z_EMPTY_SLOT_DIAMOND = ResourceLocation.withDefaultNamespace("item/empty_slot_diamond"); + protected static final ResourceLocation Z_EMPTY_SLOT_LAPIS_LAZULI = ResourceLocation.withDefaultNamespace("item/empty_slot_lapis_lazuli"); + protected static final ResourceLocation Z_EMPTY_SLOT_AMETHYST_SHARD = ResourceLocation.withDefaultNamespace("item/empty_slot_amethyst_shard"); protected static List anyToolIconList() { return List.of(Z_EMPTY_SLOT_HELMET, Z_EMPTY_SLOT_SWORD, Z_EMPTY_SLOT_CHESTPLATE, Z_EMPTY_SLOT_PICKAXE, Z_EMPTY_SLOT_LEGGINGS, Z_EMPTY_SLOT_AXE, Z_EMPTY_SLOT_BOOTS, Z_EMPTY_SLOT_HOE, Z_EMPTY_SLOT_SHOVEL); diff --git a/src/main/java/org/violetmoon/zeta/item/ext/IZetaItemExtensions.java b/src/main/java/org/violetmoon/zeta/item/ext/IZetaItemExtensions.java index 4351509..32da1ab 100644 --- a/src/main/java/org/violetmoon/zeta/item/ext/IZetaItemExtensions.java +++ b/src/main/java/org/violetmoon/zeta/item/ext/IZetaItemExtensions.java @@ -3,6 +3,7 @@ import java.util.Map; import java.util.function.Consumer; +import net.minecraft.world.item.*; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; @@ -14,10 +15,6 @@ import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.monster.EnderMan; import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ElytraItem; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.Items; -import net.minecraft.world.item.ShearsItem; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.enchantment.Enchantment; @@ -90,7 +87,7 @@ default int getBurnTimeZeta(ItemStack stack, @Nullable RecipeType recipeType) return 0; } - default int damageItemZeta(ItemStack stack, int amount, T entity, Consumer onBroken) { + default int damageItemZeta(ItemStack stack, int amount, T entity, Consumer onBroken) { return amount; } diff --git a/src/main/java/org/violetmoon/zeta/network/ZetaMessageSerializer.java b/src/main/java/org/violetmoon/zeta/network/ZetaMessageSerializer.java index 8ec3c63..885ccb2 100644 --- a/src/main/java/org/violetmoon/zeta/network/ZetaMessageSerializer.java +++ b/src/main/java/org/violetmoon/zeta/network/ZetaMessageSerializer.java @@ -38,10 +38,10 @@ public final class ZetaMessageSerializer { this.mapFunctions(char.class, FriendlyByteBuf::readChar, FriendlyByteBuf::writeChar); mapFunctions(BlockPos.class, FriendlyByteBuf::readBlockPos, FriendlyByteBuf::writeBlockPos); - mapFunctions(Component.class, FriendlyByteBuf::readComponent, FriendlyByteBuf::writeComponent); + //mapFunctions(Component.class, FriendlyByteBuf::readComponent, FriendlyByteBuf::writeComponent); mapFunctions(UUID.class, FriendlyByteBuf::readUUID, FriendlyByteBuf::writeUUID); mapFunctions(CompoundTag.class, FriendlyByteBuf::readNbt, FriendlyByteBuf::writeNbt); - mapFunctions(ItemStack.class, FriendlyByteBuf::readItem, ZetaMessageSerializer::writeItemStack); + //mapFunctions(ItemStack.class, FriendlyByteBuf::readItem, ZetaMessageSerializer::writeItemStack); mapFunctions(String.class, ZetaMessageSerializer::readString, ZetaMessageSerializer::writeString); mapFunctions(ResourceLocation.class, FriendlyByteBuf::readResourceLocation, FriendlyByteBuf::writeResourceLocation); mapFunctions(Date.class, FriendlyByteBuf::readDate, FriendlyByteBuf::writeDate); @@ -170,9 +170,9 @@ public void mapHandlers(Class type, Reader reader, Writer writer) { // Needed because the methods are overloaded - private static void writeItemStack(FriendlyByteBuf buf, ItemStack stack) { + /*private static void writeItemStack(FriendlyByteBuf buf, ItemStack stack) { buf.writeItem(stack); - } + }*/ private static String readString(FriendlyByteBuf buf) { return buf.readUtf(32767); diff --git a/src/main/java/org/violetmoon/zeta/recipe/FlagIngredient.java b/src/main/java/org/violetmoon/zeta/recipe/FlagIngredient.java index 4bd8e8e..21b3aa3 100644 --- a/src/main/java/org/violetmoon/zeta/recipe/FlagIngredient.java +++ b/src/main/java/org/violetmoon/zeta/recipe/FlagIngredient.java @@ -19,7 +19,7 @@ * @author WireSegal * Created at 3:44 PM on 10/20/19. */ -public class FlagIngredient extends Ingredient implements IZetaIngredient { +public class FlagIngredient extends Ingredient implements IZetaIngredient { //AccessWidener? Idk I think this is cooked. private final Ingredient parent; diff --git a/src/main/java/org/violetmoon/zeta/recipe/ZetaDyeRecipe.java b/src/main/java/org/violetmoon/zeta/recipe/ZetaDyeRecipe.java index bcdc180..3b38ab2 100644 --- a/src/main/java/org/violetmoon/zeta/recipe/ZetaDyeRecipe.java +++ b/src/main/java/org/violetmoon/zeta/recipe/ZetaDyeRecipe.java @@ -25,7 +25,7 @@ public class ZetaDyeRecipe extends CustomRecipe { protected final RecipeSerializer serializer; public ZetaDyeRecipe(ResourceLocation id, CraftingBookCategory cat, DyeablesRegistry dyeablesRegistry) { - super(id, cat); + super(cat); this.dyeablesRegistry = dyeablesRegistry; // We need to plug the serializer into itself, so that when a fresh copy of this ZetaDyeRecipe is constructed // it will have the exact same serializer instance already registered in the recipe serializer registry. diff --git a/src/main/java/org/violetmoon/zeta/registry/BrewingRegistry.java b/src/main/java/org/violetmoon/zeta/registry/BrewingRegistry.java index df83152..863db52 100644 --- a/src/main/java/org/violetmoon/zeta/registry/BrewingRegistry.java +++ b/src/main/java/org/violetmoon/zeta/registry/BrewingRegistry.java @@ -3,6 +3,7 @@ import java.util.Map; import java.util.function.Supplier; +import net.minecraft.core.Holder; import org.jetbrains.annotations.Nullable; import org.violetmoon.zeta.Zeta; import org.violetmoon.zeta.recipe.FlagIngredient; @@ -53,10 +54,11 @@ public void addPotionMix(String flag, Supplier reagent, MobEffect ef if (loc != null) { String baseName = loc.getPath(); boolean hasStrong = strongTime > 0; + Holder effectHolder = Holder.direct(effect); - Potion normalType = registerPotion(new MobEffectInstance(effect, normalTime), baseName, baseName); - Potion longType = registerPotion(new MobEffectInstance(effect, longTime), baseName, "long_" + baseName); - Potion strongType = !hasStrong ? null : registerPotion(new MobEffectInstance(effect, strongTime, 1), baseName, "strong_" + baseName); + Potion normalType = registerPotion(new MobEffectInstance(effectHolder, normalTime), baseName, baseName); + Potion longType = registerPotion(new MobEffectInstance(effectHolder, longTime), baseName, "long_" + baseName); + Potion strongType = !hasStrong ? null : registerPotion(new MobEffectInstance(effectHolder, strongTime, 1), baseName, "strong_" + baseName); addPotionMix(flag, reagent, normalType, longType, strongType); @@ -64,10 +66,11 @@ public void addPotionMix(String flag, Supplier reagent, MobEffect ef ResourceLocation negationLoc = zeta.registry.getRegistryName(negation, BuiltInRegistries.MOB_EFFECT); if (negationLoc != null) { String negationBaseName = negationLoc.getPath(); + Holder negationHolder = Holder.direct(negation); - Potion normalNegationType = registerPotion(new MobEffectInstance(negation, normalTime), negationBaseName, negationBaseName); - Potion longNegationType = registerPotion(new MobEffectInstance(negation, longTime), negationBaseName, "long_" + negationBaseName); - Potion strongNegationType = !hasStrong ? null : registerPotion(new MobEffectInstance(negation, strongTime, 1), negationBaseName, "strong_" + negationBaseName); + Potion normalNegationType = registerPotion(new MobEffectInstance(negationHolder, normalTime), negationBaseName, negationBaseName); + Potion longNegationType = registerPotion(new MobEffectInstance(negationHolder, longTime), negationBaseName, "long_" + negationBaseName); + Potion strongNegationType = !hasStrong ? null : registerPotion(new MobEffectInstance(negationHolder, strongTime, 1), negationBaseName, "strong_" + negationBaseName); addNegation(flag, normalType, longType, strongType, normalNegationType, longNegationType, strongNegationType); } @@ -79,8 +82,8 @@ public void addPotionMix(String flag, Supplier reagent, MobEffect ef public void addPotionMix(String flag, Supplier reagent, Potion normalType, Potion longType, @Nullable Potion strongType) { boolean hasStrong = strongType != null; - addFlaggedRecipe(flag, Potions.AWKWARD, reagent, normalType); - addFlaggedRecipe(flag, Potions.WATER, reagent, Potions.MUNDANE); + addFlaggedRecipe(flag, Potions.AWKWARD.value(), reagent, normalType); + addFlaggedRecipe(flag, Potions.WATER.value(), reagent, Potions.MUNDANE.value()); if (hasStrong) addFlaggedRecipe(flag, normalType, BrewingRegistry::glowstone, strongType); diff --git a/src/main/java/org/violetmoon/zeta/registry/DyeablesRegistry.java b/src/main/java/org/violetmoon/zeta/registry/DyeablesRegistry.java index f523376..90fef3c 100644 --- a/src/main/java/org/violetmoon/zeta/registry/DyeablesRegistry.java +++ b/src/main/java/org/violetmoon/zeta/registry/DyeablesRegistry.java @@ -6,6 +6,7 @@ import java.util.function.BooleanSupplier; import net.minecraft.world.ItemInteractionResult; +import net.minecraft.world.item.ArmorItem; import org.violetmoon.zeta.event.bus.LoadEvent; import org.violetmoon.zeta.event.load.ZRegister; import org.violetmoon.zeta.module.ZetaModule; @@ -31,7 +32,7 @@ * @see org.violetmoon.zeta.client.ClientRegistryExtension */ public class DyeablesRegistry { - + //todo: This needs a redo public final Map dyeableConditions = new HashMap<>(); public final DyeableLeatherItem SURROGATE = new DyeableLeatherItem() {}; //Simply an accessor for various DyeableLeatherItem default methods diff --git a/src/main/java/org/violetmoon/zeta/registry/LateBoundHolder.java b/src/main/java/org/violetmoon/zeta/registry/LateBoundHolder.java index 580f07b..bface2d 100644 --- a/src/main/java/org/violetmoon/zeta/registry/LateBoundHolder.java +++ b/src/main/java/org/violetmoon/zeta/registry/LateBoundHolder.java @@ -64,10 +64,15 @@ public boolean is(Predicate> p_205711_) { } @Override - public boolean is(TagKey p_205705_) { + public boolean is(TagKey tagKey) { return false; //um } + @Override + public boolean is(Holder holder) { + return false; //uhhhhh + } + @Override public Stream> tags() { return Stream.of(); diff --git a/src/main/java/org/violetmoon/zeta/registry/VariantRegistry.java b/src/main/java/org/violetmoon/zeta/registry/VariantRegistry.java index 70ffbbc..7c0e901 100644 --- a/src/main/java/org/violetmoon/zeta/registry/VariantRegistry.java +++ b/src/main/java/org/violetmoon/zeta/registry/VariantRegistry.java @@ -71,7 +71,7 @@ public FlowerPotBlock addFlowerPot(Block block, String name, Function true); diff --git a/src/main/java/org/violetmoon/zeta/registry/ZetaRegistry.java b/src/main/java/org/violetmoon/zeta/registry/ZetaRegistry.java index 9787dc6..193f7d9 100644 --- a/src/main/java/org/violetmoon/zeta/registry/ZetaRegistry.java +++ b/src/main/java/org/violetmoon/zeta/registry/ZetaRegistry.java @@ -1,15 +1,11 @@ package org.violetmoon.zeta.registry; -import java.util.ArrayList; -import java.util.Collection; -import java.util.HashMap; -import java.util.IdentityHashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import java.util.function.BiConsumer; import java.util.function.Function; import java.util.function.Supplier; +import net.minecraft.core.RegistrationInfo; import org.jetbrains.annotations.Nullable; import org.violetmoon.zeta.Zeta; import org.violetmoon.zeta.item.ZetaBlockItem; @@ -59,11 +55,11 @@ public ResourceLocation getRegistryName(T obj, Registry registry) { return internal == null ? registry.getKey(obj) : internal; } - //You know how `new ResourceLocation(String)` prepends "minecraft" if there's no prefix? + //You know how `ResourceLocation.parse(String)` prepends "minecraft" if there's no prefix? //This method is like that, except it prepends *your* modid public ResourceLocation newResourceLocation(String in) { - if(in.indexOf(':') == -1) return new ResourceLocation(z.modid, in); - else return new ResourceLocation(in); + if(in.indexOf(':') == -1) return ResourceLocation.fromNamespaceAndPath(z.modid, in); + else return ResourceLocation.parse(in); } //Root registration method @@ -235,7 +231,7 @@ public void performDynamicRegistration(RegistryOps.RegistryInfoLookup lookup List> typePun = ((List>) (Object) entries); typePun.forEach(entry -> { T thing = entry.creator.apply(lookup); - writable.register(entry.id, thing, Lifecycle.stable()); + writable.register(entry.id, thing, new RegistrationInfo(Optional.empty(), Lifecycle.stable())); //todo: Should this be Optional.empty()? if(entry.lateBound != null) entry.lateBound.bind(thing, writable); diff --git a/src/main/java/org/violetmoon/zeta/util/BlockUtils.java b/src/main/java/org/violetmoon/zeta/util/BlockUtils.java index f4bed5a..8ba2dba 100644 --- a/src/main/java/org/violetmoon/zeta/util/BlockUtils.java +++ b/src/main/java/org/violetmoon/zeta/util/BlockUtils.java @@ -24,7 +24,7 @@ public static boolean isWoodBased(BlockState state) { soundType == SoundType.WOOD; } - public static boolean isGlassBased(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos) { + public static boolean isGlassBased(BlockState blockState, BlockGetter blockGetter, BlockPos blockPos) { //todo: Access Widener return blockState.getBlock().propagatesSkylightDown(blockState, blockGetter, blockPos) || blockState.getSoundType() == SoundType.GLASS; } diff --git a/src/main/java/org/violetmoon/zeta/util/ItemNBTHelper.java b/src/main/java/org/violetmoon/zeta/util/ItemNBTHelper.java deleted file mode 100644 index e62bc14..0000000 --- a/src/main/java/org/violetmoon/zeta/util/ItemNBTHelper.java +++ /dev/null @@ -1,147 +0,0 @@ -/** - * This class was created by . It's distributed as - * part of the ThaumicTinkerer Mod. - * - * ThaumicTinkerer is a Derivative Work on Thaumcraft 4. - * Thaumcraft 4 (c) Azanor 2012 - * (http://www.minecraftforum.net/topic/1585216-) - * - * File Created @ [8 Sep 2013, 19:36:25 (GMT)] - */ -package org.violetmoon.zeta.util; - -import net.minecraft.nbt.CompoundTag; -import net.minecraft.nbt.ListTag; -import net.minecraft.world.item.ItemStack; - -// TBH this entire class could be Deprecated and removed -public final class ItemNBTHelper { - - /** Checks if an ItemStack has a Tag Compound **/ - @Deprecated(forRemoval = true) // Just use stack.hasTag() - public static boolean detectNBT(ItemStack stack) { - return stack.hasTag(); - } - - /** Tries to initialize an NBT Tag Compound in an ItemStack, - * this will not do anything if the stack already has a tag - * compound **/ - @Deprecated(forRemoval = true) // Just use stack.getOrCreateTag() - public static void initNBT(ItemStack stack) { - stack.getOrCreateTag(); - } - - /** Injects an NBT Tag Compound to an ItemStack, no checks - * are made previously **/ - @Deprecated(forRemoval = true) // Just use stack.setTag(nbt) - public static void injectNBT(ItemStack stack, CompoundTag nbt) { - stack.setTag(nbt); - } - - /** Gets the CompoundNBT in an ItemStack. Tries to init it - * previously in case there isn't one present **/ - @Deprecated(forRemoval = true) // Just use stack.getOrCreateTag() - public static CompoundTag getNBT(ItemStack stack) { - return stack.getOrCreateTag(); - } - - // SETTERS /////////////////////////////////////////////////////////////////// - - // All these force create a tag if it doesn't exist - - public static void setBoolean(ItemStack stack, String tag, boolean b) { - stack.getOrCreateTag().putBoolean(tag, b); - } - - public static void setByte(ItemStack stack, String tag, byte b) { - stack.getOrCreateTag().putByte(tag, b); - } - - public static void setShort(ItemStack stack, String tag, short s) { - stack.getOrCreateTag().putShort(tag, s); - } - - public static void setInt(ItemStack stack, String tag, int i) { - stack.getOrCreateTag().putInt(tag, i); - } - - public static void setLong(ItemStack stack, String tag, long l) { - stack.getOrCreateTag().putLong(tag, l); - } - - public static void setFloat(ItemStack stack, String tag, float f) { - stack.getOrCreateTag().putFloat(tag, f); - } - - public static void setDouble(ItemStack stack, String tag, double d) { - stack.getOrCreateTag().putDouble(tag, d); - } - - public static void setCompound(ItemStack stack, String tag, CompoundTag cmp) { - if(!tag.equalsIgnoreCase("ench")) // not override the enchantments - stack.getOrCreateTag().put(tag, cmp); - } - - public static void setString(ItemStack stack, String tag, String s) { - stack.getOrCreateTag().putString(tag, s); - } - - public static void setList(ItemStack stack, String tag, ListTag list) { - stack.getOrCreateTag().put(tag, list); - } - - // GETTERS /////////////////////////////////////////////////////////////////// - - - public static boolean verifyExistence(ItemStack stack, String tag) { - return !stack.isEmpty() && stack.hasTag() && stack.getOrCreateTag().contains(tag); - } - - @Deprecated(forRemoval = true) - public static boolean verifyExistance(ItemStack stack, String tag) { - return verifyExistence(stack, tag); - } - - public static boolean getBoolean(ItemStack stack, String tag, boolean defaultExpected) { - return verifyExistence(stack, tag) ? stack.getOrCreateTag().getBoolean(tag) : defaultExpected; - } - - public static byte getByte(ItemStack stack, String tag, byte defaultExpected) { - return verifyExistence(stack, tag) ? stack.getOrCreateTag().getByte(tag) : defaultExpected; - } - - public static short getShort(ItemStack stack, String tag, short defaultExpected) { - return verifyExistence(stack, tag) ? stack.getOrCreateTag().getShort(tag) : defaultExpected; - } - - public static int getInt(ItemStack stack, String tag, int defaultExpected) { - return verifyExistence(stack, tag) ? stack.getOrCreateTag().getInt(tag) : defaultExpected; - } - - public static long getLong(ItemStack stack, String tag, long defaultExpected) { - return verifyExistence(stack, tag) ? stack.getOrCreateTag().getLong(tag) : defaultExpected; - } - - public static float getFloat(ItemStack stack, String tag, float defaultExpected) { - return verifyExistence(stack, tag) ? stack.getOrCreateTag().getFloat(tag) : defaultExpected; - } - - public static double getDouble(ItemStack stack, String tag, double defaultExpected) { - return verifyExistence(stack, tag) ? stack.getOrCreateTag().getDouble(tag) : defaultExpected; - } - - /** If nullifyOnFail is true it'll return null if it doesn't find any - * compounds, otherwise it'll return a new one. **/ - public static CompoundTag getCompound(ItemStack stack, String tag, boolean nullifyOnFail) { - return verifyExistence(stack, tag) ? stack.getOrCreateTag().getCompound(tag) : nullifyOnFail ? null : new CompoundTag(); - } - - public static String getString(ItemStack stack, String tag, String defaultExpected) { - return verifyExistence(stack, tag) ? stack.getOrCreateTag().getString(tag) : defaultExpected; - } - - public static ListTag getList(ItemStack stack, String tag, int objtype, boolean nullifyOnFail) { - return verifyExistence(stack, tag) ? stack.getOrCreateTag().getList(tag, objtype) : nullifyOnFail ? null : new ListTag(); - } - -} diff --git a/src/main/java/org/violetmoon/zeta/util/NameChanger.java b/src/main/java/org/violetmoon/zeta/util/NameChanger.java index 72b118a..4058ff0 100644 --- a/src/main/java/org/violetmoon/zeta/util/NameChanger.java +++ b/src/main/java/org/violetmoon/zeta/util/NameChanger.java @@ -50,7 +50,7 @@ protected static synchronized void changeBlockStatic(Block toChange, String newT //actually change the block's name - if there are any outstanding name-change requests, use the most recent one, //else use the block's original name - toChange.descriptionId = changeRequests.lastOrElse(originalBlockNames.get(toChange)); + toChange.descriptionId = changeRequests.lastOrElse(originalBlockNames.get(toChange)); //todo: AccessWidener //save a tiny bit of memory if(changeRequests.isEmpty()) @@ -65,7 +65,7 @@ protected static synchronized void changeItemStatic(Item toChange, String newTra changeRequests.add(newTranslationKey); else changeRequests.remove(newTranslationKey); - toChange.descriptionId = changeRequests.lastOrElse(originalItemNames.get(toChange)); + toChange.descriptionId = changeRequests.lastOrElse(originalItemNames.get(toChange)); //todo: AccessWidener if(changeRequests.isEmpty()) changedItemNames.remove(toChange); diff --git a/src/main/java/org/violetmoon/zeta/util/RegistryUtil.java b/src/main/java/org/violetmoon/zeta/util/RegistryUtil.java index 4b7c379..8e95817 100644 --- a/src/main/java/org/violetmoon/zeta/util/RegistryUtil.java +++ b/src/main/java/org/violetmoon/zeta/util/RegistryUtil.java @@ -27,10 +27,10 @@ public static List massRegistryGet(Collection coll, Registry r ImmutableList.Builder builder = new ImmutableList.Builder<>(); for (String s : coll) { if (s.startsWith("#")) { - TagKey tag = TagKey.create(reg.key(), new ResourceLocation(s.substring(1))); + TagKey tag = TagKey.create(reg.key(), ResourceLocation.parse(s.substring(1))); reg.getTagOrEmpty(tag).forEach(tHolder -> builder.add(tHolder.value())); } else { - reg.getOptional(new ResourceLocation(s)).ifPresent(builder::add); + reg.getOptional(ResourceLocation.parse(s)).ifPresent(builder::add); } } return builder.build(); diff --git a/src/main/java/org/violetmoon/zeta/world/EntitySpawnHandler.java b/src/main/java/org/violetmoon/zeta/world/EntitySpawnHandler.java index b20e76a..6023c56 100644 --- a/src/main/java/org/violetmoon/zeta/world/EntitySpawnHandler.java +++ b/src/main/java/org/violetmoon/zeta/world/EntitySpawnHandler.java @@ -4,6 +4,7 @@ import java.util.List; import java.util.function.BooleanSupplier; +import net.minecraft.world.entity.*; import org.violetmoon.zeta.Zeta; import org.violetmoon.zeta.config.type.EntitySpawnConfig; import org.violetmoon.zeta.event.bus.LoadEvent; @@ -12,12 +13,7 @@ import org.violetmoon.zeta.module.ZetaModule; import net.minecraft.core.registries.BuiltInRegistries; -import net.minecraft.world.entity.EntityType; -import net.minecraft.world.entity.Mob; -import net.minecraft.world.entity.MobCategory; -import net.minecraft.world.entity.SpawnPlacements; import net.minecraft.world.entity.SpawnPlacements.SpawnPredicate; -import net.minecraft.world.entity.SpawnPlacements.Type; import net.minecraft.world.item.Item; import net.minecraft.world.level.biome.MobSpawnSettings; import net.minecraft.world.level.levelgen.Heightmap; @@ -31,8 +27,8 @@ public EntitySpawnHandler(Zeta zeta) { this.zeta = zeta; } - public void registerSpawn(EntityType entityType, MobCategory classification, Type placementType, Heightmap.Types heightMapType, SpawnPredicate placementPredicate, EntitySpawnConfig config) { - SpawnPlacements.register(entityType, placementType, heightMapType, placementPredicate); + public void registerSpawn(EntityType entityType, MobCategory classification, SpawnPlacementType placementType, Heightmap.Types heightMapType, SpawnPredicate placementPredicate, EntitySpawnConfig config) { + SpawnPlacements.register(entityType, placementType, heightMapType, placementPredicate); //todo: Access Widener track(entityType, classification, config, false); } diff --git a/src/main/java/org/violetmoon/zetaimplforge/client/event/play/ForgeZRenderTick.java b/src/main/java/org/violetmoon/zetaimplforge/client/event/play/ForgeZRenderTick.java index bbdba8c..c94b546 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/client/event/play/ForgeZRenderTick.java +++ b/src/main/java/org/violetmoon/zetaimplforge/client/event/play/ForgeZRenderTick.java @@ -2,7 +2,7 @@ import org.violetmoon.zeta.client.event.play.ZRenderTick; -public record ForgeZRenderTick(TickEvent.RenderTickEvent e) implements ZRenderTick { +public record ForgeZRenderTick(RenderFrameEvent e) implements ZRenderTick { @Override public float getRenderTickTime() { return e.renderTickTime; diff --git a/src/main/java/org/violetmoon/zetaimplforge/event/load/ForgeZAddReloadListener.java b/src/main/java/org/violetmoon/zetaimplforge/event/load/ForgeZAddReloadListener.java index 4d382c2..0773c6d 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/event/load/ForgeZAddReloadListener.java +++ b/src/main/java/org/violetmoon/zetaimplforge/event/load/ForgeZAddReloadListener.java @@ -1,5 +1,6 @@ package org.violetmoon.zetaimplforge.event.load; +import net.neoforged.neoforge.event.AddReloadListenerEvent; import org.violetmoon.zeta.event.load.ZAddReloadListener; import net.minecraft.core.RegistryAccess; diff --git a/src/main/java/org/violetmoon/zetaimplforge/event/play/ForgeZBonemeal.java b/src/main/java/org/violetmoon/zetaimplforge/event/play/ForgeZBonemeal.java index b1010a1..a33a10c 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/event/play/ForgeZBonemeal.java +++ b/src/main/java/org/violetmoon/zetaimplforge/event/play/ForgeZBonemeal.java @@ -28,7 +28,7 @@ public BlockPos getPos() { @Override public BlockState getBlock() { - return e.getBlock(); + return e.getState(); } @Override @@ -38,7 +38,7 @@ public ItemStack getStack() { @Override public ZResult getResult() { - return ForgeZeta.from(e.getResult()); + return ForgeZeta.from(e.isSuccessful()); } @Override diff --git a/src/main/java/org/violetmoon/zetaimplforge/event/play/entity/living/ForgeZLivingTick.java b/src/main/java/org/violetmoon/zetaimplforge/event/play/entity/living/ForgeZLivingTick.java index 0a316a8..5903da2 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/event/play/entity/living/ForgeZLivingTick.java +++ b/src/main/java/org/violetmoon/zetaimplforge/event/play/entity/living/ForgeZLivingTick.java @@ -1,10 +1,11 @@ package org.violetmoon.zetaimplforge.event.play.entity.living; +import net.neoforged.neoforge.event.entity.living.LivingEvent; import org.violetmoon.zeta.event.play.entity.living.ZLivingTick; import net.minecraft.world.entity.LivingEntity; -public record ForgeZLivingTick(LivingEvent.LivingTickEvent e) implements ZLivingTick { +public record ForgeZLivingTick(LivingTickEvent e) implements ZLivingTick { @Override public LivingEntity getEntity() { return e.getEntity(); diff --git a/src/main/java/org/violetmoon/zetaimplforge/item/IForgeItemItemExtensions.java b/src/main/java/org/violetmoon/zetaimplforge/item/IForgeItemItemExtensions.java index 402b392..5bc226a 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/item/IForgeItemItemExtensions.java +++ b/src/main/java/org/violetmoon/zetaimplforge/item/IForgeItemItemExtensions.java @@ -1,6 +1,8 @@ package org.violetmoon.zetaimplforge.item; import net.minecraft.core.BlockPos; +import net.minecraft.core.Holder; +import net.minecraft.core.RegistryAccess; import net.minecraft.world.InteractionResult; import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.EquipmentSlot; @@ -8,12 +10,14 @@ import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.monster.EnderMan; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.crafting.RecipeType; import net.minecraft.world.item.enchantment.Enchantment; import net.minecraft.world.level.LevelReader; import net.neoforged.neoforge.common.ToolActions; +import net.neoforged.neoforge.event.EventHooks; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import org.violetmoon.zeta.item.ext.IZetaItemExtensions; @@ -45,7 +49,7 @@ public boolean doesSneakBypassUseZeta(ItemStack stack, LevelReader level, BlockP } @Override - public boolean canEquipZeta(ItemStack stack, EquipmentSlot armorType, Entity ent) { + public boolean canEquipZeta(ItemStack stack, EquipmentSlot armorType, LivingEntity ent) { return stack.canEquip(armorType, ent); } @@ -74,19 +78,19 @@ public int getEnchantmentValueZeta(ItemStack stack) { return stack.getItem().getEnchantmentValue(stack); } - @Override + /*@Override public boolean canApplyAtEnchantingTableZeta(ItemStack stack, Enchantment enchantment) { return stack.canApplyAtEnchantingTable(enchantment); - } + }*/ @Override - public int getEnchantmentLevelZeta(ItemStack stack, Enchantment enchantment) { + public int getEnchantmentLevelZeta(ItemStack stack, Holder enchantment) { return stack.getEnchantmentLevel(enchantment); } @Override public Map getAllEnchantmentsZeta(ItemStack stack) { - return stack.getAllEnchantments(); + return stack.getAllEnchantments(registryAccess().lookupOrThrow(net.minecraft.core.registries.Registries.ENCHANTMENT)); //todo: We need to get RegistryAccess somehow } @Override @@ -95,12 +99,12 @@ public boolean shouldCauseReequipAnimationZeta(ItemStack oldStack, ItemStack new } @Override - public int getBurnTimeZeta(ItemStack stack, @Nullable RecipeType recipeType) { - return ForgeHooks.getBurnTime(stack, recipeType); + public int getBurnTimeZeta(ItemStack stack, int burnTime, @Nullable RecipeType recipeType) { + return EventHooks.getItemBurnTime(stack, burnTime, recipeType); } @Override - public int damageItemZeta(ItemStack stack, int amount, T entity, Consumer onBroken) { + public int damageItemZeta(ItemStack stack, int amount, T entity, Consumer onBroken) { return stack.getItem().damageItem(stack, amount, entity, onBroken); } @@ -116,6 +120,6 @@ public boolean canElytraFlyZeta(ItemStack stack, LivingEntity entity) { @Override public int getDefaultTooltipHideFlagsZeta(@NotNull ItemStack stack) { - return stack.getItem().getDefaultTooltipHideFlags(stack); + return stack.getItem().getDefaultTooltipHideFlags(stack); //todo: What } } diff --git a/src/main/java/org/violetmoon/zetaimplforge/mixin/mixins/self/IZetaItemMixin_FAKE.java b/src/main/java/org/violetmoon/zetaimplforge/mixin/mixins/self/IZetaItemMixin_FAKE.java index a1a259f..7c04be9 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/mixin/mixins/self/IZetaItemMixin_FAKE.java +++ b/src/main/java/org/violetmoon/zetaimplforge/mixin/mixins/self/IZetaItemMixin_FAKE.java @@ -8,6 +8,7 @@ import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.monster.EnderMan; import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.Item; import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.context.UseOnContext; import net.minecraft.world.item.crafting.RecipeType; @@ -112,7 +113,7 @@ public int getBurnTime(ItemStack itemStack, @Nullable RecipeType recipeType) } @Override - public int damageItem(ItemStack stack, int amount, T entity, Consumer onBroken) { + public int damageItem(ItemStack stack, int amount, T entity, Consumer onBroken) { return damageItemZeta(stack, amount, entity, onBroken); } diff --git a/src/main/java/org/violetmoon/zetaimplforge/network/ForgeZetaNetworkHandler.java b/src/main/java/org/violetmoon/zetaimplforge/network/ForgeZetaNetworkHandler.java index 8b12efd..2984eda 100644 --- a/src/main/java/org/violetmoon/zetaimplforge/network/ForgeZetaNetworkHandler.java +++ b/src/main/java/org/violetmoon/zetaimplforge/network/ForgeZetaNetworkHandler.java @@ -27,7 +27,7 @@ public ForgeZetaNetworkHandler(ForgeZeta zeta, int protocolVersion) { String protocolStr = Integer.toString(protocolVersion); channel = NetworkRegistry.ChannelBuilder - .named(new ResourceLocation(zeta.modid, "main")) + .named(ResourceLocation.fromNamespaceAndPath(zeta.modid, "main")) .networkProtocolVersion(() -> protocolStr) .clientAcceptedVersions(protocolStr::equals) .serverAcceptedVersions(protocolStr::equals)