Inspired by 2020's April Fools' 20w14infinite Snapshot, this mod brings endless randomly generated dimensions into Minecraft.

Merge branch 'architectury/1.20' into create-6.0

+406 -263
+5 -1
README.md
··· 10 10 11 11 ## Dependencies 12 12 13 - Architectury API is required, as well as [Fabric API](https://modrinth.com/mod/fabric-api) on Fabric and [Forgified Fabric API](https://modrinth.com/mod/forgified-fabric-api) on Forge and NeoForge. Older versions of the mod (v1.13.0 and below) only require Fabric API. 13 + [Architectury API](https://modrinth.com/mod/architectury-api) is required, as well as [Fabric API](https://modrinth.com/mod/fabric-api) on Fabric. The Forge backport also requires [Forgified Fabric API](https://modrinth.com/mod/forgified-fabric-api). 14 + 15 + If you want to configure the mod in-game, you will need [Cloth Config](https://modrinth.com/mod/cloth-config) and [Mod Menu](https://modrinth.com/mod/modmenu) (on Fabric). 16 + 17 + Older versions may have different dependencies. See their specific version pages for more details. 14 18 15 19 ## FAQ 16 20
+1 -1
build.gradle
··· 58 58 // See https://docs.gradle.org/current/userguide/declaring_repositories.html 59 59 // for more information about repositories. 60 60 maven { // Flywheel 61 - url = "https://maven.tterrag.com/" 61 + url = "https://modmaven.dev" 62 62 content { 63 63 // need to be specific here due to version overlaps 64 64 includeGroup("com.jozufozu.flywheel")
+5
common/src/main/java/net/lerariemann/infinity/InfinityModClient.java
··· 20 20 InputUtil.Type.KEYSYM, 21 21 GLFW.GLFW_KEY_F4, 22 22 "key.categories.misc"); 23 + public static KeyBinding postProcessorConfigKey = new KeyBinding("key.infinity.postprocessor", 24 + InputUtil.Type.KEYSYM, 25 + GLFW.GLFW_KEY_F12, 26 + "key.categories.misc"); 23 27 24 28 public static void initializeClient() { 25 29 ModEntities.registerEntityRenderers(); ··· 33 37 TypedActionResult<ItemStack> result = F4Item.deploy(client.world, client.player, Hand.MAIN_HAND); 34 38 client.player.setStackInHand(Hand.MAIN_HAND, result.getValue()); 35 39 } 40 + while (postProcessorConfigKey.wasPressed()) client.gameRenderer.togglePostProcessorEnabled(); 36 41 }); 37 42 } 38 43 }
+7 -3
common/src/main/java/net/lerariemann/infinity/block/custom/ChromaticBlock.java
··· 1 1 package net.lerariemann.infinity.block.custom; 2 2 3 - import com.mojang.serialization.MapCodec; 4 3 import net.lerariemann.infinity.block.entity.ChromaticBlockEntity; 4 + import net.lerariemann.infinity.registry.core.ModComponentTypes; 5 5 import net.minecraft.block.*; 6 6 import net.minecraft.block.entity.BlockEntity; 7 7 import net.minecraft.entity.player.PlayerEntity; 8 8 import net.minecraft.item.ItemStack; 9 + import net.minecraft.nbt.NbtCompound; 9 10 import net.minecraft.state.StateManager; 10 11 import net.minecraft.util.ActionResult; 11 12 import net.minecraft.util.Hand; ··· 33 34 @Override 34 35 public ItemStack getPickStack(BlockView world, BlockPos pos, BlockState state) { 35 36 ItemStack res = super.getPickStack(world, pos, state); 36 - // if (!res.isEmpty() && world.getBlockEntity(pos) instanceof ChromaticBlockEntity cbe) 37 - // res.applyComponentsFrom(cbe.asMap()); 37 + if (!res.isEmpty() && world.getBlockEntity(pos) instanceof ChromaticBlockEntity cbe) { 38 + var c = new NbtCompound(); 39 + c.putInt(ModComponentTypes.COLOR, cbe.color); 40 + res.setNbt(c); 41 + } 38 42 return res; 39 43 } 40 44
+8 -4
common/src/main/java/net/lerariemann/infinity/block/custom/InfinityPortalBlock.java
··· 6 6 import net.lerariemann.infinity.access.Timebombable; 7 7 import net.lerariemann.infinity.block.entity.InfinityPortalBlockEntity; 8 8 import net.lerariemann.infinity.dimensions.RandomDimension; 9 - import net.lerariemann.infinity.item.PortalDataHolder; 9 + import net.lerariemann.infinity.registry.core.ModComponentTypes; 10 10 import net.lerariemann.infinity.registry.core.ModItemFunctions; 11 11 import net.lerariemann.infinity.registry.var.ModPoi; 12 12 import net.lerariemann.infinity.util.InfinityMethods; ··· 32 32 import net.minecraft.particle.ParticleTypes; 33 33 import net.minecraft.registry.RegistryKey; 34 34 import net.minecraft.registry.RegistryKeys; 35 + import net.minecraft.registry.tag.ItemTags; 35 36 import net.minecraft.server.MinecraftServer; 36 37 import net.minecraft.server.network.ServerPlayerEntity; 37 38 import net.minecraft.server.world.ChunkTicketType; ··· 170 171 171 172 public static NbtCompound putKeyComponents(Item item, Identifier dim) { 172 173 NbtCompound nbtCompound = new NbtCompound(); 173 - if (!item.equals(Items.AMETHYST_SHARD)) return nbtCompound; 174 + if (!(item.equals(Items.AMETHYST_SHARD) || item.getDefaultStack().isIn(ItemTags.WOOL) || item.getDefaultStack().isIn(ItemTags.WOOL_CARPETS))) 175 + return nbtCompound; 174 176 int keycolor = WarpLogic.getKeyColorFromId(dim); 175 - nbtCompound.putInt("key_color", keycolor); 176 - nbtCompound.putString("key_destination", dim.toString()); 177 + nbtCompound.putInt(ModComponentTypes.COLOR, keycolor); 178 + if (!item.equals(Items.AMETHYST_SHARD)) 179 + return nbtCompound; 180 + nbtCompound.putString(ModComponentTypes.DESTINATION, dim.toString()); 177 181 return nbtCompound; 178 182 } 179 183
+1 -1
common/src/main/java/net/lerariemann/infinity/block/custom/NotesBlock.java
··· 96 96 97 97 @Override 98 98 public boolean onSyncedBlockEvent(BlockState state, World world, BlockPos pos, int type, int data) { 99 - Instrument[] instruments = (Instrument[]) INSTRUMENT.stream().toArray(); 99 + Instrument[] instruments = INSTRUMENT.getValues().toArray(Instrument[]::new); 100 100 Instrument noteBlockInstrument = instruments[world.random.nextInt(instruments.length-7)]; 101 101 float f; 102 102 if (world.getBlockEntity(pos.down()) instanceof ChromaticBlockEntity e) {
+1 -1
common/src/main/java/net/lerariemann/infinity/compat/ComputerCraftCompat.java
··· 14 14 } 15 15 return string; 16 16 } 17 - return null; 17 + return ""; 18 18 } 19 19 }
+1 -1
common/src/main/java/net/lerariemann/infinity/dimensions/RandomDimension.java
··· 190 190 case "minecraft:noise" -> { 191 191 res.put("biome_source", randomBiomeSource()); 192 192 res.putString("settings", randomNoiseSettings()); 193 - res.putLong("seed", numericId); 193 + res.putLong("seed", numericId ^ server.getOverworld().getSeed()); 194 194 return res; 195 195 } 196 196 default -> {
+1 -1
common/src/main/java/net/lerariemann/infinity/dimensions/RandomDimensionType.java
··· 44 44 lightLevel.putString("type", "uniform"); 45 45 lightLevel.put("value", RandomProvider.genBounds(0, random.nextInt(15))); 46 46 data.put("monster_spawn_light_level", lightLevel); 47 - data.putString("infiniburn", dim.PROVIDER.randomName(random, "tags")); 47 + data.putString("infiniburn", "#" + dim.PROVIDER.randomName(random, "tags")); 48 48 String s = dim.PROVIDER.randomName(random, "dimension_effects"); 49 49 foggy = s.equals("minecraft:the_nether"); 50 50 data.putString("effects", s);
+1 -1
common/src/main/java/net/lerariemann/infinity/dimensions/features/RandomFungus.java
··· 24 24 addRandomBlock(config, "stem_state", "full_blocks_worldgen"); 25 25 NbtCompound replaceableBlocks = new NbtCompound(); 26 26 replaceableBlocks.putString("type", "minecraft:matching_block_tag"); 27 - replaceableBlocks.putString("tag", PROVIDER.randomName(random, "tags").replace("#", "")); 27 + replaceableBlocks.putString("tag", PROVIDER.randomName(random, "tags")); 28 28 config.put("replaceable_blocks", replaceableBlocks); 29 29 config.put("valid_base_block", mainsurfaceblock); 30 30 return feature(config);
+2 -2
common/src/main/java/net/lerariemann/infinity/dimensions/features/RandomGeode.java
··· 34 34 NbtList inner_placements = new NbtList(); 35 35 inner_placements.add(PROVIDER.randomElement(random, "all_blocks")); 36 36 blocks.put("inner_placements", inner_placements); 37 - blocks.putString("cannot_replace", PROVIDER.randomName(random, "tags")); 38 - blocks.putString("invalid_blocks", PROVIDER.randomName(random, "tags")); 37 + blocks.putString("cannot_replace", "#" + PROVIDER.randomName(random, "tags")); 38 + blocks.putString("invalid_blocks", "#" + PROVIDER.randomName(random, "tags")); 39 39 config.put("blocks", blocks); 40 40 NbtCompound layers = new NbtCompound(); 41 41 double r = 1.0;
+10 -3
common/src/main/java/net/lerariemann/infinity/dimensions/features/RandomTree.java
··· 56 56 mangrove.putInt("max_root_width", 1 + random.nextInt(ishuge ? 12 : 4)); 57 57 mangrove.putInt("max_root_length", 1 + random.nextInt(ishuge ? 64 : 8)); 58 58 mangrove.putFloat("random_skew_chance", random.nextFloat()); 59 - mangrove.putString("can_grow_through", PROVIDER.randomName(random, "tags")); 60 - mangrove.putString("muddy_roots_in", PROVIDER.randomName(random, "tags")); 59 + mangrove.putString("can_grow_through", "#" + PROVIDER.randomName(random, "tags")); 60 + mangrove.putString("muddy_roots_in", "#" + PROVIDER.randomName(random, "tags")); 61 61 addRandomBlockProvider(mangrove, "muddy_roots_provider", "full_blocks"); 62 62 res.put("mangrove_root_placement", mangrove); 63 63 return res; ··· 79 79 res.putInt("extra_branch_steps", 1 + (int) Math.floor(random.nextExponential())); 80 80 res.putInt("extra_branch_length", (int) Math.floor(random.nextExponential()*3)); 81 81 res.putFloat("place_branch_per_log_probability", random.nextFloat()); 82 - res.putString("can_grow_through", PROVIDER.randomName(random, "tags")); 82 + res.putString("can_grow_through", "#" + PROVIDER.randomName(random, "tags")); 83 83 } 84 84 case "cherry_trunk_placer" -> { 85 85 addRandomIntProvider(res, "branch_count", 1, 2); ··· 96 96 res.put("branch_start_offset_from_top", branch_start_offset_from_top); 97 97 addRandomIntProvider(res, "branch_end_offset_from_top", -16, 15); 98 98 } 99 + // case "infinity:wonky" -> { 100 + // float a = random.nextFloat(); 101 + // float b = random.nextFloat(); 102 + // res.putFloat("weight_up", Math.max(a, b)); 103 + // res.putFloat("weight_down", Math.min(a, b)); 104 + // res.putFloat("weight_side", random.nextFloat()); 105 + // } 99 106 } 100 107 return res; 101 108 }
+20 -19
common/src/main/java/net/lerariemann/infinity/iridescence/IridescentEffect.java
··· 11 11 import net.minecraft.entity.effect.StatusEffectInstance; 12 12 import net.minecraft.entity.mob.Angerable; 13 13 import net.minecraft.entity.mob.MobEntity; 14 + import net.minecraft.entity.player.PlayerEntity; 14 15 import net.minecraft.particle.ParticleEffect; 15 16 import net.minecraft.server.network.ServerPlayerEntity; 16 17 import net.minecraft.sound.SoundEvents; ··· 38 39 } 39 40 40 41 public void onRemoved(LivingEntity entity) { 41 - if (Objects.requireNonNull(entity) instanceof ServerPlayerEntity player) { 42 - unloadShader(player); 43 - if (player.isInvulnerable()) endJourney(player, true, 0); 42 + if (Objects.requireNonNull(entity) instanceof PlayerEntity player) { 43 + if (player instanceof ServerPlayerEntity serverPlayer) { 44 + unloadShader(serverPlayer); 45 + if (player.isInvulnerable()) endJourney(serverPlayer, true, 0); 46 + } 44 47 } else if (entity instanceof ChaosPawn pawn) { 45 48 if (pawn.getRandom().nextBoolean()) { 46 49 pawn.unchess(); ··· 49 52 } 50 53 } else if (entity instanceof MobEntity currEntity) { 51 54 endConversion(currEntity); 52 - } else if (entity instanceof MobEntity currEntity) { 53 - endConversion(currEntity); 54 - } else if (entity instanceof MobEntity currEntity) { 55 - Iridescence.endConversion(currEntity); 56 55 } 57 56 } 58 57 59 58 @Override 60 59 public void tryApplySpecial(LivingEntity entity, int duration, int amplifier) { 61 - if (entity instanceof ServerPlayerEntity player) { 62 - if (shouldWarp(duration, amplifier)) { 63 - if (!player.isInvulnerable()) { 64 - player.setInvulnerable(true); 65 - saveCookie(player); 60 + if (entity instanceof PlayerEntity player) { 61 + if (player instanceof ServerPlayerEntity serverPlayer) { 62 + if (shouldWarp(duration, amplifier)) { 63 + if (!player.isInvulnerable()) { 64 + player.setInvulnerable(true); 65 + saveCookie(serverPlayer); 66 + } 67 + Identifier id = getIdForWarp(serverPlayer); 68 + WarpLogic.requestWarp(serverPlayer, id, false); 69 + } 70 + if (shouldReturn(duration, amplifier)) { 71 + endJourney(serverPlayer, false, amplifier); 66 72 } 67 - Identifier id = getIdForWarp(player); 68 - WarpLogic.requestWarp(player, id, false); 73 + if (shouldRequestShaderLoad(duration, amplifier)) 74 + loadShader(serverPlayer); 69 75 } 70 - if (shouldReturn(duration, amplifier)) { 71 - endJourney(player, false, amplifier); 72 - } 73 - if (shouldRequestShaderLoad(duration, amplifier)) 74 - loadShader(player); 75 76 if (amplifier == 0 && duration == 2) { 76 77 player.addStatusEffect(new StatusEffectInstance(ModStatusEffects.AFTERGLOW.value(), 77 78 getAfterglowDuration() / 2, 0, true, true));
+1 -1
common/src/main/java/net/lerariemann/infinity/item/ChromaticBlockItem.java
··· 29 29 if (player != null && player.getStackInHand(Hand.OFF_HAND) 30 30 .isOf(ModItems.CHROMATIC_MATTER.get()) 31 31 && world.getBlockEntity(pos) instanceof ChromaticBlockEntity cbe) { 32 - cbe.setColor(BackportMethods.getOrDefaultInt(stack, ModComponentTypes.KEY_COLOR, 0xFFFFFF)); 32 + cbe.setColor(BackportMethods.getOrDefaultInt(stack, ModComponentTypes.COLOR, 0xFFFFFF)); 33 33 } 34 34 return bl; 35 35 }
+29 -6
common/src/main/java/net/lerariemann/infinity/item/ChromaticItem.java
··· 2 2 3 3 import net.lerariemann.infinity.block.custom.AltarBlock; 4 4 import net.lerariemann.infinity.block.entity.ChromaticBlockEntity; 5 + import net.lerariemann.infinity.block.entity.InfinityPortalBlockEntity; 5 6 import net.lerariemann.infinity.registry.core.ModBlocks; 6 7 import net.lerariemann.infinity.registry.core.ModComponentTypes; 7 8 import net.lerariemann.infinity.registry.var.ModTags; ··· 12 13 import net.minecraft.item.Item; 13 14 import net.minecraft.item.ItemStack; 14 15 import net.minecraft.item.ItemUsageContext; 16 + import net.minecraft.nbt.NbtCompound; 15 17 import net.minecraft.sound.SoundEvents; 16 18 import net.minecraft.text.Style; 17 19 import net.minecraft.text.Text; ··· 21 23 import net.minecraft.util.math.BlockPos; 22 24 import net.minecraft.world.World; 23 25 26 + import java.awt.*; 24 27 import java.util.concurrent.atomic.AtomicBoolean; 25 28 26 29 public class ChromaticItem extends Item implements PortalDataHolder { ··· 32 35 player.playSound(SoundEvents.ENTITY_EXPERIENCE_ORB_PICKUP, 0.5f, pitch); 33 36 } 34 37 38 + static NbtCompound ofColor(int color) { 39 + NbtCompound compound = new NbtCompound(); 40 + compound.putInt(ModComponentTypes.COLOR, color); 41 + return compound; 42 + } 43 + 44 + static NbtCompound ofHue(int hue) { 45 + NbtCompound compound = new NbtCompound(); 46 + compound.putInt(ModComponentTypes.COLOR, Color.HSBtoRGB(hue/360f, 1.0f, 1.0f) & 0xFFFFFF); 47 + return compound; 48 + } 49 + 50 + static NbtCompound ofDye(DyeColor dyeColor) { 51 + NbtCompound compound = new NbtCompound(); 52 + compound.putInt(ModComponentTypes.COLOR, ColorLogic.getChromaticColor(dyeColor)); 53 + compound.putString(ModComponentTypes.DYE_COLOR, dyeColor.getName()); 54 + return compound; 55 + } 56 + 35 57 @Override 36 58 public ActionResult useOnBlock(ItemUsageContext context) { 37 59 PlayerEntity player = context.getPlayer(); ··· 42 64 43 65 public boolean useOnBlock(PlayerEntity player, Hand hand, World world, BlockPos pos, ItemStack currStack) { 44 66 BlockState oldState = world.getBlockState(pos); 45 - int currColor = BackportMethods.getOrDefaultInt(currStack, ModComponentTypes.KEY_COLOR, 0xFFFFFF); 67 + int currColor = BackportMethods.getOrDefaultInt(currStack, ModComponentTypes.COLOR, 0xFFFFFF); 46 68 if (player.isSneaking()) { //copy color 47 69 ItemStack newStack = currStack.copy(); 48 70 int i = -1; 49 71 if (world.getBlockEntity(pos) instanceof ChromaticBlockEntity cbe) i = cbe.getTint(); 72 + else if (world.getBlockEntity(pos) instanceof InfinityPortalBlockEntity cbe) i = cbe.getTint(); 50 73 else if (oldState.isOf(ModBlocks.ALTAR.get())) { 51 74 int altarState = oldState.get(AltarBlock.COLOR); 52 75 if (altarState == 0) i = ColorLogic.getChromaticColor(DyeColor.LIGHT_GRAY); 53 76 else { 54 77 int hue = (altarState - 1) * (360 / (AltarBlock.numColors - 1)); 55 78 if (!ColorLogic.matchesPureHue(currColor, hue)) 56 - BackportMethods.apply(newStack, ModComponentTypes.HUE, hue); 79 + newStack.setNbt(ofHue(hue)); 57 80 else return false; 58 81 } 59 82 } 60 83 else { //copy color from vanilla blocks 61 84 DyeColor dyeColor = ColorLogic.getColorByState(oldState); 62 85 if (dyeColor != null && 63 - !(dyeColor.getId() == (BackportMethods.getOrDefaultInt(newStack, ModComponentTypes.DYE_COLOR, -1)))) { 64 - BackportMethods.apply(newStack, ModComponentTypes.DYE_COLOR, dyeColor.getId()); 86 + !dyeColor.getName().equals(BackportMethods.getOrDefaultString(newStack, ModComponentTypes.DYE_COLOR, "null"))) { 87 + newStack.setNbt(ofDye(dyeColor)); 65 88 } 66 89 else return false; 67 90 } 68 91 if (i > 0) { 69 - if (i != currColor) BackportMethods.apply(newStack, ModComponentTypes.DYE_COLOR, i); 92 + if (i != currColor) newStack.setNbt(ofColor(i)); 70 93 else return false; 71 94 } 72 95 player.setStackInHand(hand, newStack); ··· 77 100 if (oldState.isIn(ModTags.IRIDESCENT_BLOCKS)) return false; 78 101 boolean bl = BackportMethods.contains(currStack, ModComponentTypes.DYE_COLOR); 79 102 BlockState state; 80 - if (bl) state = ColorLogic.recolor(BackportMethods.getOrDefaultString(currStack, ModComponentTypes.DYE_COLOR, "infinity:chromatic"), oldState); 103 + if (bl) state = ColorLogic.recolor(BackportMethods.getOrDefaultString(currStack, ModComponentTypes.DYE_COLOR, null), oldState); 81 104 else state = ColorLogic.recolor("infinity:chromatic", oldState); 82 105 if (state == null) return false; 83 106 world.setBlockState(pos, state);
+9 -10
common/src/main/java/net/lerariemann/infinity/item/F4Item.java
··· 1 1 package net.lerariemann.infinity.item; 2 2 3 + import dev.architectury.platform.Platform; 3 4 import net.lerariemann.infinity.block.entity.InfinityPortalBlockEntity; 4 5 import net.lerariemann.infinity.registry.core.ModBlocks; 5 6 import net.lerariemann.infinity.registry.core.ModComponentTypes; ··· 49 50 50 51 51 52 public static int getCharge(ItemStack f4) { 52 - if (f4.hasNbt()) { 53 - assert f4.getNbt() != null; 54 - return f4.getNbt().getInt("f4_charge"); 55 - } 56 - return 0; 53 + return BackportMethods.getOrDefaultInt(f4, ModComponentTypes.F4_CHARGE, 0); 57 54 } 58 55 59 56 @Override ··· 70 67 int size_x, int size_y) { 71 68 Direction.Axis dir2 = player.getHorizontalFacing().rotateClockwise(Direction.Axis.Y).getAxis(); 72 69 73 - int charges = getCharge(stack); 70 + int charges = BackportMethods.getOrDefaultInt(stack, ModComponentTypes.F4_CHARGE, 0); 74 71 int useCharges = player.isCreative() ? 0 : 2*(2 + size_x + size_y); 75 72 if (charges < useCharges) { 76 73 if (!world.isClient()) ··· 105 102 useCharges -= obsNotReplaced; 106 103 107 104 world.playSound(player, player.getBlockPos(), SoundEvents.BLOCK_BELL_USE, SoundCategory.BLOCKS, 1, 0.75f); 108 - BackportMethods.apply(stack, ModComponentTypes.F4_CHARGE, charges-useCharges); 109 - return stack; 105 + return BackportMethods.apply(stack, ModComponentTypes.F4_CHARGE, charges-useCharges); 110 106 } 111 107 112 108 @Override ··· 172 168 World world = context.getWorld(); 173 169 BlockPos pos = context.getBlockPos(); 174 170 BlockState bs = world.getBlockState(pos); 171 + if (bs.isReplaceable()) { 172 + pos = pos.down(); 173 + bs = world.getBlockState(pos); 174 + } 175 175 Hand hand = context.getHand(); 176 176 177 177 if (isPortal(bs)) { ··· 273 273 } 274 274 for (int i = 0; i < portal.width; i++) for (int j = 0; j < portal.height; j++) 275 275 world.setBlockState(portal.lowerLeft.offset(axis, i).up(j), Blocks.AIR.getDefaultState(), 3, 0); 276 - BackportMethods.apply(stack, ModComponentTypes.F4_CHARGE, getCharge(stack) + obsidian); 277 276 world.playSound(null, origin, SoundEvents.BLOCK_GLASS_BREAK, SoundCategory.BLOCKS, 1, 0.75f); 278 - return stack; 277 + return BackportMethods.apply(stack, ModComponentTypes.F4_CHARGE, getCharge(stack) + obsidian); 279 278 } 280 279 }
+6 -7
common/src/main/java/net/lerariemann/infinity/item/function/F4RechargingRecipe.java
··· 36 36 37 37 public ItemStack craft(RecipeInputInventory inventory, DynamicRegistryManager registryManager) { 38 38 ItemStack f4 = null; 39 - int i = 0; 40 - for (int k = 0; k < inventory.getInputStacks().size(); k++) { 41 - ItemStack itemStack = inventory.getStack(k); 39 + int obsidian = 0; 40 + for (int slot = 0; slot < inventory.getInputStacks().size(); slot++) { 41 + ItemStack itemStack = inventory.getStack(slot); 42 42 if (itemStack.isOf(ModItems.F4.get())) f4 = itemStack; 43 - else if (!itemStack.isEmpty()) i++; 43 + else if (!itemStack.isEmpty()) obsidian++; 44 44 } 45 45 assert f4 != null; 46 46 int charge = F4Item.getCharge(f4); 47 - if (i == 0) { 47 + if (obsidian == 0) { 48 48 if (charge > 0) return Items.OBSIDIAN.getDefaultStack().copyWithCount(Math.min(charge, 64)); //"removing obsidian" recipe 49 49 } 50 50 ItemStack result = f4.copy(); 51 - BackportMethods.apply(result, ModComponentTypes.F4_CHARGE, charge+i); 52 - return result; 51 + return BackportMethods.apply(result, ModComponentTypes.F4_CHARGE, charge+obsidian); 53 52 } 54 53 55 54 @Override
+8 -3
common/src/main/java/net/lerariemann/infinity/mixin/core/NetherPortalBlockMixin.java
··· 59 59 if (!bl && !InfinityMethods.isInfinity(world)) return; 60 60 world.setBlockState(pos, ModBlocks.PORTAL.get().getDefaultState(). 61 61 with(AXIS, state.get(AXIS))); 62 - if (bl && world.getBlockEntity(pos) instanceof InfinityPortalBlockEntity ipbe) { 63 - long l = InfinityMethods.getRandomSeed(new java.util.Random(world.getTime())); 64 - ipbe.setDimension(l); 62 + if (world.getBlockEntity(pos) instanceof InfinityPortalBlockEntity ipbe) { 63 + if (bl) { 64 + long l = InfinityMethods.getRandomSeed(new java.util.Random(world.getTime())); 65 + ipbe.setDimension(l); 66 + } 67 + else { 68 + ipbe.setOpen(true); 69 + } 65 70 } 66 71 } 67 72 }
+1 -1
common/src/main/java/net/lerariemann/infinity/mixin/iridescence/LandPathNodeMakerMixin.java
··· 22 22 @Inject(method = "getNodeType(Lnet/minecraft/world/BlockView;IIILnet/minecraft/entity/mob/MobEntity;)Lnet/minecraft/entity/ai/pathing/PathNodeType;", 23 23 at = @At("HEAD"), cancellable = true) 24 24 private void inj(BlockView world, int x, int y, int z, MobEntity mob, CallbackInfoReturnable<PathNodeType> cir) { 25 - if (Iridescence.isIridescence(entity.getWorld(), new BlockPos(x, y, z))) { 25 + if (mob != null && Iridescence.isIridescence(entity.getWorld(), new BlockPos(x, y, z))) { 26 26 if (entity instanceof AbstractChessFigure figure && figure.isBlackOrWhite()) 27 27 cir.setReturnValue(PathNodeType.BLOCKED); 28 28 }
+23
common/src/main/java/net/lerariemann/infinity/mixin/iridescence/LilyPadBlockMixin.java
··· 1 + package net.lerariemann.infinity.mixin.iridescence; 2 + 3 + import net.minecraft.block.BlockState; 4 + import net.minecraft.block.LilyPadBlock; 5 + import net.minecraft.fluid.Fluids; 6 + import net.minecraft.registry.tag.FluidTags; 7 + import net.minecraft.util.math.BlockPos; 8 + import net.minecraft.world.BlockView; 9 + import org.spongepowered.asm.mixin.Mixin; 10 + import org.spongepowered.asm.mixin.injection.At; 11 + import org.spongepowered.asm.mixin.injection.Inject; 12 + import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable; 13 + 14 + @Mixin(LilyPadBlock.class) 15 + public class LilyPadBlockMixin { 16 + /* make lilypads plantable on iridescence */ 17 + @Inject(method = "canPlantOnTop", at = @At(value = "RETURN"), cancellable = true) 18 + void inj(BlockState floor, BlockView world, BlockPos pos, CallbackInfoReturnable<Boolean> cir) { 19 + if (world.getFluidState(pos).isIn(FluidTags.WATER) && world.getFluidState(pos.up()).getFluid() == Fluids.EMPTY) { 20 + cir.setReturnValue(true); 21 + } 22 + } 23 + }
+16
common/src/main/java/net/lerariemann/infinity/mixin/qol/KeyboardMixin.java
··· 1 + package net.lerariemann.infinity.mixin.qol; 2 + 3 + import com.llamalad7.mixinextras.injector.wrapoperation.Operation; 4 + import com.llamalad7.mixinextras.injector.wrapoperation.WrapOperation; 5 + import net.minecraft.client.Keyboard; 6 + import net.minecraft.client.render.GameRenderer; 7 + import org.spongepowered.asm.mixin.Mixin; 8 + import org.spongepowered.asm.mixin.injection.At; 9 + 10 + @Mixin(Keyboard.class) 11 + public class KeyboardMixin { 12 + /* disable f4 being a hardcoded toggle postprocessing shaders key, as the mod makes it rebindable */ 13 + @WrapOperation(method="onKey", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/render/GameRenderer;togglePostProcessorEnabled()V")) 14 + void inj(GameRenderer instance, Operation<Void> original) { 15 + } 16 + }
+2
common/src/main/java/net/lerariemann/infinity/registry/core/ModBlocks.java
··· 61 61 public static void registerFlammableBlocks() { 62 62 PlatformMethods.registerFlammableBlock(ModBlocks.IRIDESCENT_WOOL, 60, 30); 63 63 PlatformMethods.registerFlammableBlock(ModBlocks.IRIDESCENT_CARPET, 20, 60); 64 + PlatformMethods.registerFlammableBlock(ModBlocks.CHROMATIC_WOOL, 60, 30); 65 + PlatformMethods.registerFlammableBlock(ModBlocks.CHROMATIC_CARPET, 20, 60); 64 66 } 65 67 }
+1 -1
common/src/main/java/net/lerariemann/infinity/registry/core/ModComponentTypes.java
··· 4 4 5 5 public static String DESTINATION = "key_destination"; 6 6 public static String BIOME_CONTENTS = "biome_contents"; 7 - public static String KEY_COLOR = "key_color"; 7 + public static String COLOR = "key_color"; 8 8 public static String HUE = "hue"; 9 9 public static String DYE_COLOR = "dye_color"; 10 10 public static String F4_CHARGE = "f4_charge";
+1 -1
common/src/main/java/net/lerariemann/infinity/registry/core/ModItemFunctions.java
··· 124 124 if (match.isEmpty()) return; 125 125 126 126 ItemStack resStack = match.get().getOutput(w.getRegistryManager()); 127 - // componentFunction.apply(resStack.getItem()).ifPresent(resStack::applyChanges); 127 + resStack.setNbt(compound); 128 128 129 129 Vec3d v = itemEntity.getVelocity(); 130 130 ItemEntity result = new ItemEntity(w, itemEntity.getX(), itemEntity.getY(), itemEntity.getZ(),
+8 -1
common/src/main/java/net/lerariemann/infinity/registry/var/ModCommands.java
··· 4 4 import com.mojang.brigadier.arguments.StringArgumentType; 5 5 import com.mojang.brigadier.exceptions.DynamicCommandExceptionType; 6 6 import dev.architectury.event.events.common.CommandRegistrationEvent; 7 + import dev.architectury.platform.Platform; 7 8 import net.lerariemann.infinity.util.teleport.WarpLogic; 8 9 import net.minecraft.command.argument.DimensionArgumentType; 9 10 import net.minecraft.server.command.CommandManager; ··· 23 24 ); 24 25 25 26 public static void registerCommands() { 26 - CommandRegistrationEvent.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher.register(literal("warp") 27 + String warp; 28 + if (Platform.isModLoaded("ftbessentials") || Platform.isModLoaded("fabric-essentials")) // FTB/Fabric Essentials add their own warp command that plays havoc with ours. 29 + warp = "dimwarp"; 30 + else { 31 + warp = "warp"; 32 + } 33 + CommandRegistrationEvent.EVENT.register((dispatcher, registryAccess, environment) -> dispatcher.register(literal(warp) 27 34 .requires(source -> source.hasPermissionLevel(2)) 28 35 .then( 29 36 CommandManager.literal("existing").then(
+15 -3
common/src/main/java/net/lerariemann/infinity/util/BackportMethods.java
··· 2 2 3 3 import net.lerariemann.infinity.registry.core.ModComponentTypes; 4 4 import net.minecraft.item.ItemStack; 5 + import net.minecraft.nbt.NbtCompound; 5 6 import net.minecraft.util.Identifier; 6 7 import org.jetbrains.annotations.Nullable; 7 8 ··· 11 12 public static int getOrDefaultInt(ItemStack stack, String key, int i) { 12 13 if (stack.hasNbt()) { 13 14 assert stack.getNbt() != null; 14 - return stack.getNbt().getInt(key); 15 + if (stack.getNbt().contains(key)) 16 + return stack.getNbt().getInt(key); 15 17 } 16 18 return i; 17 19 } ··· 19 21 public static String getOrDefaultString(ItemStack stack, String key, String i) { 20 22 if (stack.hasNbt()) { 21 23 assert stack.getNbt() != null; 22 - return stack.getNbt().getString(key); 24 + if (stack.getNbt().contains(key)) 25 + return stack.getNbt().getString(key); 23 26 } 24 27 return i; 25 28 } 26 29 27 30 public static boolean contains(ItemStack stack, String key) { 28 31 if (stack.hasNbt()) { 29 - return !Objects.requireNonNull(stack.getSubNbt(key)).isEmpty(); 32 + assert stack.getNbt() != null; 33 + return stack.getNbt().contains(key); 30 34 } 31 35 return false; 32 36 } ··· 36 40 assert stack.getNbt() != null; 37 41 stack.getNbt().putInt(key, i); 38 42 return stack; 43 + } else { 44 + NbtCompound nbtCompound = new NbtCompound(); 45 + nbtCompound.putInt(key, i); 46 + stack.setNbt(nbtCompound); 39 47 } 40 48 return stack; 41 49 } ··· 45 53 assert stack.getNbt() != null; 46 54 stack.getNbt().putString(key, i); 47 55 return stack; 56 + } else { 57 + NbtCompound nbtCompound = new NbtCompound(); 58 + nbtCompound.putString(key, i); 59 + stack.setNbt(nbtCompound); 48 60 } 49 61 return stack; 50 62 }
+15 -23
common/src/main/java/net/lerariemann/infinity/util/InfinityMethods.java
··· 7 7 import net.lerariemann.infinity.access.Timebombable; 8 8 import net.lerariemann.infinity.block.entity.BiomeBottleBlockEntity; 9 9 import net.lerariemann.infinity.block.entity.InfinityPortalBlockEntity; 10 + import net.lerariemann.infinity.block.entity.TintableBlockEntity; 10 11 import net.lerariemann.infinity.registry.core.ModComponentTypes; 11 12 import net.lerariemann.infinity.registry.core.ModItems; 12 13 import net.lerariemann.infinity.util.core.RandomProvider; ··· 18 19 import net.minecraft.server.world.ServerWorld; 19 20 import net.minecraft.text.MutableText; 20 21 import net.minecraft.text.Text; 22 + import net.minecraft.util.DyeColor; 21 23 import net.minecraft.util.Identifier; 22 24 import net.minecraft.util.Util; 23 25 import net.minecraft.util.math.BlockPos; ··· 163 165 } 164 166 165 167 static int getOverlayColorFromComponents(ItemStack stack, int layer) { 166 - if (stack.getNbt() != null && layer == 1) { 167 - if (stack.getItem().equals(ModItems.TRANSFINITE_KEY.get())) 168 - return stack.getNbt().getInt("key_color"); 169 - else if (stack.getItem().equals(ModItems.BIOME_BOTTLE_ITEM.get())) { 170 - return stack.getNbt().getCompound("BlockEntityTag").getInt("Color"); 171 - } 172 - else if (stack.getItem().equals(ModItems.F4.get())) { 173 - return stack.getNbt().getInt(ModComponentTypes.KEY_COLOR); 168 + if (stack.getNbt() != null) { 169 + if (layer == 1) { 170 + if (stack.isOf(ModItems.TRANSFINITE_KEY.get())) 171 + return stack.getNbt().getInt(ModComponentTypes.COLOR); 172 + else if (stack.isOf(ModItems.BIOME_BOTTLE_ITEM.get())) { 173 + return stack.getNbt().getCompound("BlockEntityTag").getInt("Color"); 174 + } 175 + else if (stack.isOf(ModItems.F4.get())) { 176 + return BackportMethods.getOrDefaultInt(stack, ModComponentTypes.COLOR, 10879231); 177 + } 174 178 } 179 + else if (stack.isOf(ModItems.CHROMATIC_MATTER.get()) || stack.isOf(ModItems.CHROMATIC_WOOL.get()) || stack.isOf(ModItems.CHROMATIC_CARPET.get())) 180 + return stack.getNbt().getInt(ModComponentTypes.COLOR); 175 181 } 176 182 return 0xFFFFFF; 177 183 } ··· 186 192 static int getBlockEntityColor(BlockState state, BlockRenderView world, BlockPos pos, int tintIndex) { 187 193 if (world != null && pos != null) { 188 194 BlockEntity blockEntity = world.getBlockEntity(pos); 189 - if (blockEntity instanceof InfinityPortalBlockEntity be) { 195 + if (blockEntity instanceof TintableBlockEntity be) { 190 196 Object j = be.getTint(); 191 197 return (int)j & 0xFFFFFF; 192 - } 193 - } 194 - return 0xFFFFFF; 195 - } 196 - 197 - /** 198 - * Gets a Biome Bottle's color from its block entity - for use in color providers. 199 - */ 200 - static int getBiomeBottleColor(BlockState state, BlockRenderView world, BlockPos pos, int tintIndex) { 201 - if (world != null && pos != null) { 202 - BlockEntity blockEntity = world.getBlockEntity(pos); 203 - if (blockEntity instanceof BiomeBottleBlockEntity be) { 204 - int j = be.color; 205 - return j & 0xFFFFFF; 206 198 } 207 199 } 208 200 return 0xFFFFFF;
+2 -40
common/src/main/java/net/lerariemann/infinity/util/PlatformMethods.java
··· 89 89 return (int)(256 * ((r + 1)/2)) + 256*((int)(256 * ((g + 1)/2)) + 256*(int)(256 * ((b + 1)/2))); 90 90 } 91 91 92 - public static int getBookBoxColour(BlockState state, BlockRenderView world, BlockPos pos, int tintIndex) { 93 - if (pos != null) { 94 - return posToColor(pos); 95 - } 96 - return 16777215; 97 - } 98 - 99 - public static int getOverlayColorFromComponents(ItemStack stack, int layer) { 100 - if (stack.getNbt() != null) { 101 - int color = stack.getNbt().getInt("key_color"); 102 - if (layer == 1) { 103 - return color; 104 - } 105 - } 106 - return 0xFFFFFF; 107 - } 108 - 109 - public static int getNeitherPortalColour(BlockState state, BlockRenderView world, BlockPos pos, int tintIndex) { 110 - if (world != null && pos != null) { 111 - BlockEntity blockEntity = world.getBlockEntity(pos); 112 - if (blockEntity instanceof InfinityPortalBlockEntity be) { 113 - Object j = be.getTint(); 114 - return (int)j & 0xFFFFFF; 115 - } 116 - } 117 - return 0xFFFFFF; 118 - } 119 - 120 - public static int getBiomeBottleColor(BlockState state, BlockRenderView world, BlockPos pos, int tintIndex) { 121 - if (world != null && pos != null) { 122 - BlockEntity blockEntity = world.getBlockEntity(pos); 123 - if (blockEntity instanceof BiomeBottleBlockEntity be) { 124 - Object j = be.getTint(); 125 - return (int)j & 0xFFFFFF; 126 - } 127 - } 128 - return 0xFFFFFF; 129 - } 130 - 131 92 @ExpectPlatform 132 93 public static <T extends Item> void addAfter(RegistrySupplier<T> blockItem, RegistryKey<ItemGroup> group, Item item) { 133 94 throw new AssertionError(); ··· 191 152 } 192 153 193 154 /** 194 - * Neoforge-exclusive method of testing if a mob is located in iridescence as far as fluid types are concerned. 155 + * Forge-exclusive method of testing if a mob is located in iridescence as far as fluid types are concerned. 195 156 * Used only in mixins, to fix the neoforge loader stripping mobs of ability to swim in non-water fluids. 196 157 * On Fabric, returns false. 197 158 */ ··· 199 160 public static boolean acidTest(Entity entity, boolean eyes) { 200 161 throw new AssertionError(); 201 162 } 163 + 202 164 @ExpectPlatform 203 165 public static double acidHeightTest(Entity entity) { 204 166 throw new AssertionError();
+39 -9
common/src/main/java/net/lerariemann/infinity/util/teleport/PortalCreator.java
··· 14 14 import net.lerariemann.infinity.util.BackportMethods; 15 15 import net.lerariemann.infinity.util.InfinityMethods; 16 16 import net.lerariemann.infinity.util.PlatformMethods; 17 + import net.lerariemann.infinity.util.core.CommonIO; 17 18 import net.lerariemann.infinity.util.core.RandomProvider; 18 19 import net.lerariemann.infinity.util.loading.DimensionGrabber; 19 20 import net.lerariemann.infinity.options.PortalColorApplier; ··· 34 35 import net.minecraft.nbt.NbtCompound; 35 36 import net.minecraft.nbt.NbtElement; 36 37 import net.minecraft.nbt.NbtList; 38 + import net.minecraft.nbt.NbtString; 37 39 import net.minecraft.network.PacketByteBuf; 38 40 import net.minecraft.registry.RegistryKey; 39 41 import net.minecraft.registry.RegistryKeys; ··· 45 47 import net.minecraft.sound.SoundEvents; 46 48 import net.minecraft.text.Text; 47 49 import net.minecraft.util.Identifier; 50 + import net.minecraft.util.WorldSavePath; 48 51 import net.minecraft.util.math.BlockPos; 49 52 import net.minecraft.util.math.Direction; 50 53 import net.minecraft.world.BlockLocating; 51 54 import net.minecraft.world.TeleportTarget; 52 55 import net.minecraft.world.World; 53 56 57 + import java.nio.file.Path; 54 58 import java.util.*; 55 59 import java.util.function.BiConsumer; 56 60 import java.util.function.Consumer; ··· 90 94 if (world instanceof ServerWorld serverWorld) { 91 95 boolean bl = modifyOnInitialCollision(id, serverWorld, pos); 92 96 if (bl) entity.remove(Entity.RemovalReason.CHANGED_DIMENSION); 97 + recordIdTranslation(world.getServer(), id, content); 93 98 } 94 99 } 95 100 } 96 101 else if (Platform.isModLoaded("computercraft")) { 97 - String content; 98 - content = checkPrintedPage(itemStack); 99 - MinecraftServer server = world.getServer(); 100 - if (server != null) { 101 - Identifier id = InfinityMethods.dimTextToId(content); 102 - if (world instanceof ServerWorld serverWorld) { 103 - boolean bl = modifyOnInitialCollision(id, serverWorld, pos); 104 - if (bl) entity.remove(Entity.RemovalReason.CHANGED_DIMENSION); 102 + try { 103 + String content; 104 + content = checkPrintedPage(itemStack); 105 + MinecraftServer server = world.getServer(); 106 + if (server != null) { 107 + Identifier id = InfinityMethods.dimTextToId(content); 108 + if (world instanceof ServerWorld serverWorld) { 109 + boolean bl = modifyOnInitialCollision(id, serverWorld, pos); 110 + if (bl) entity.remove(Entity.RemovalReason.CHANGED_DIMENSION); 111 + recordIdTranslation(world.getServer(), id, content); 112 + } 105 113 } 114 + } catch (Exception e) { 115 + InfinityMod.LOGGER.warn("An incompatible version of ComputerCraft is present. Please update it to the latest version"); 106 116 } 107 117 } 108 - 109 118 } 110 119 111 120 /** ··· 350 359 } 351 360 } 352 361 return bl; 362 + } 363 + 364 + static void recordIdTranslation(MinecraftServer server, Identifier id, String value) { 365 + value = value.replaceAll("\n", "/n"); 366 + Path dir = server.getSavePath(WorldSavePath.DATAPACKS).resolve("infinity"); 367 + String filename = "translation_tables.json"; 368 + NbtCompound comp = CommonIO.read(dir.resolve(filename)); 369 + String key = id.getPath(); 370 + if (comp.contains(key)) { 371 + NbtList l; 372 + if (comp.contains(key, NbtElement.STRING_TYPE)) { 373 + l = new NbtList(); 374 + l.add(comp.get(key)); 375 + } 376 + else l = comp.getList(key, NbtElement.STRING_TYPE); 377 + l.add(NbtString.of(value)); 378 + comp.remove(key); 379 + comp.put(key, l); 380 + } 381 + else comp.putString(key, value); 382 + CommonIO.write(comp, dir, filename); 353 383 } 354 384 }
+3 -1
common/src/main/java/net/lerariemann/infinity/util/teleport/WarpLogic.java
··· 57 57 * Handles the /warp text command, warping the player to a specified dimension. This is the same as writing the input into a book. 58 58 */ 59 59 static void requestWarpByText(CommandContext<ServerCommandSource> context, String value) { 60 - requestWarp(context.getSource().getPlayer(), InfinityMethods.dimTextToId(value), true); 60 + Identifier id = InfinityMethods.dimTextToId(value); 61 + requestWarp(context.getSource().getPlayer(), id, true); 62 + PortalCreator.recordIdTranslation(context.getSource().getServer(), id, value); 61 63 } 62 64 63 65 /**
+1
common/src/main/resources/assets/infinity/lang/en_us.json
··· 127 127 "item.infinity.chromatic_potion": "Chromatic Potion", 128 128 "item.infinity.iridescent_potion": "Iridescent Potion", 129 129 "key.infinity.f4": "Place a Nether Portal", 130 + "key.infinity.postprocessor": "Toggle dimension postprocessing shaders", 130 131 "lore.infinity.altar": "This block can be crafted by throwing a Lectern into an Infinity Portal.", 131 132 "lore.infinity.ant": "This strange block rapidly moves, changing White Concrete to Black Concrete and back again.", 132 133 "lore.infinity.book_box": "This block can be found in the Infinite Library. Using it will give you a randomly generated book based on the block's position.",
+1 -1
common/src/main/resources/config/.util/invocation.lock
··· 1 - infinity_version: 2003009 1 + infinity_version: 2004005 2 2 Delete this file to regenerate modular configs automatically 3 3 (e.g. you may want to do this when adding new mods to the instance)
+2 -2
common/src/main/resources/config/easter/credits.json
··· 1 1 { 2 - "infinity_version": 2004002, 2 + "infinity_version": 2004005, 3 3 "options": { 4 4 "portal_color": 11894492 5 5 }, ··· 73 73 "then_run": { 74 74 "type": "minecraft:condition", 75 75 "if_true": { 76 - "text": "Acknowledgements$n----------------------$nMod by LeraRiemann, cassiancc$n$nMusic by ivory rosewood$n$nAdditional code by:$n* BasiqueEvangelist$n* unilock$n$nAlpha testers:$n* MamonaTheGreed$n* Mirakuzura$n* sweetbriar$n$nGolden bug catcher:$n* JustImagineIT$n$nBug catchers:$n* ezioishere$n* MommysDebitCard$n* 0tvechau$n* purplenathaniel$n* bravely-beep$n* tylerb153$n* Lord_Drakostar$n* slomas04$n* Strike_GR$n* TVFLabs$n* krispyking24$n* wknowleskellett$n* CrownScorpion$n* CraftyZombie$n* Pookette$n* anhonestheart$n----------------------$nMay contain elephants", 76 + "text": "Acknowledgements$n----------------------$nMod by LeraRiemann, cassiancc$n$nMusic by ivory rosewood$n$nAdditional code by:$n* BasiqueEvangelist$n* unilock$n$nAlpha testers:$n* MamonaTheGreed$n* Mirakuzura$n* sweetbriar$n$nGolden bug catcher:$n* JustImagineIT$n$nBug catchers:$n* ezioishere$n* MommysDebitCard$n* 0tvechau$n* purplenathaniel$n* bravely-beep$n* tylerb153$n* Lord_Drakostar$n* slomas04$n* Strike_GR$n* TVFLabs$n* krispyking24$n* wknowleskellett$n* CrownScorpion$n* CraftyZombie$n* Pookette$n* anhonestheart$n* hollow_egg$n* zontreck$n* erasemint$n* EssGeeEich$n* CryptidArtha----------------------$nMay contain elephants", 77 77 "type": "infinity:text" 78 78 }, 79 79 "then_run": {
+1 -2
common/src/main/resources/data/infinity/advancements/bishop_taken.json
··· 24 24 "translate": "advancements.infinity.bishop_taken.description" 25 25 }, 26 26 "icon": { 27 - "count": 1, 28 - "id": "infinity:star_of_lang" 27 + "item": "infinity:star_of_lang" 29 28 }, 30 29 "frame": "goal", 31 30 "show_toast": true,
+1 -1
common/src/main/resources/data/infinity/advancements/iridescence_root.json
··· 2 2 "parent": "infinity:multiverse_root", 3 3 "display": { 4 4 "icon": { 5 - "id": "infinity:iridescence_bucket" 5 + "item": "infinity:iridescence_bucket" 6 6 }, 7 7 "title": { 8 8 "translate": "advancements.infinity.iridescence_root.title"
+2 -2
common/src/main/resources/data/infinity/worldgen/biome/custom.json
··· 3 3 "temperature": 0.5, 4 4 "downfall": 0.5, 5 5 "effects": { 6 - "fog_color": 16645990, 7 - "sky_color": 16758886, 6 + "fog_color": 12638463, 7 + "sky_color": 65493, 8 8 "water_color": 6141935, 9 9 "water_fog_color": 6141935, 10 10 "foliage_color": 16087296,
+2 -2
common/src/main/resources/data/infinity/worldgen/biome/isolation.json
··· 3 3 "temperature": 0.5, 4 4 "downfall": 0.5, 5 5 "effects": { 6 - "fog_color": 12638463, 7 - "sky_color": 65493, 6 + "fog_color": 16645990, 7 + "sky_color": 16758886, 8 8 "water_color": 4159204, 9 9 "water_fog_color": 329011, 10 10 "foliage_color": 16087296,
+4 -2
common/src/main/resources/infinity.mixins.json
··· 50 50 "options.PlayerManagerMixin", 51 51 "options.ServerWorldMixin", 52 52 "qol.FireBlockMixin", 53 - "qol.LavaFluidMixin" 53 + "qol.LavaFluidMixin", 54 + "iridescence.LilyPadBlockMixin" 54 55 ], 55 56 "client": [ 56 57 "SoundListMixin", ··· 61 62 "options.GameRendererMixin", 62 63 "options.MinecraftClientMixin", 63 64 "options.SoundSystemMixin", 64 - "options.WorldRendererMixin" 65 + "options.WorldRendererMixin", 66 + "qol.KeyboardMixin" 65 67 ], 66 68 "injectors": { 67 69 "defaultRequire": 1
+1 -2
fabric/src/main/java/net/lerariemann/infinity/fabric/client/InfinityModFabricClient.java
··· 29 29 ColorProviderRegistry.ITEM.register(InfinityMethods::getOverlayColorFromComponents, 30 30 ModItems.TRANSFINITE_KEY.get(), 31 31 ModItems.BIOME_BOTTLE_ITEM.get(), 32 - ModItems.F4.get()); 33 - ColorProviderRegistry.ITEM.register(InfinityMethods::getOverlayColorFromComponents, 32 + ModItems.F4.get(), 34 33 ModItems.CHROMATIC_WOOL.get(), 35 34 ModItems.CHROMATIC_CARPET.get(), 36 35 ModItems.CHROMATIC_MATTER.get());
+1 -1
forge/build.gradle
··· 73 73 includeGroup "curse.maven" 74 74 } 75 75 } 76 - maven { url = "https://maven.tterrag.com/" } // Flywheel on both, Create and Registrate on forge 76 + maven { url = "https://modmaven.dev/" } // Flywheel on both, Create and Registrate on forge 77 77 } 78 78 79 79 processResources {
+1 -79
forge/src/main/java/net/lerariemann/infinity/fluids/forge/FluidTypes.java
··· 10 10 import net.minecraft.sound.SoundEvents; 11 11 import net.minecraft.util.Identifier; 12 12 import net.minecraft.util.math.BlockPos; 13 + import net.minecraft.util.math.ColorHelper; 13 14 import net.minecraft.world.BlockRenderView; 14 15 import net.minecraft.world.BlockView; 15 16 import net.minecraft.world.World; ··· 32 33 import java.util.function.Consumer; 33 34 34 35 public class FluidTypes { 35 - private static final DeferredRegister<FluidType> FLUID_TYPES = DeferredRegister.create(ForgeRegistries.Keys.FLUID_TYPES, InfinityMod.MOD_ID); 36 - 37 - public static final RegistryObject<FluidType> IRIDESCENCE_TYPE = FLUID_TYPES.register("iridescence", 38 - () -> new IridescentFluidType(FluidType.Properties.create() 39 - .descriptionId("fluid.infinity.iridescence") 40 - .fallDistanceModifier(0F) 41 - .canExtinguish(true) 42 - .canConvertToSource(true) 43 - .supportsBoating(true) 44 - .canSwim(true) 45 - .canHydrate(true) 46 - .sound(SoundActions.BUCKET_FILL, SoundEvents.ITEM_BUCKET_FILL) 47 - .sound(SoundActions.BUCKET_EMPTY, SoundEvents.ITEM_BUCKET_EMPTY) 48 - .sound(SoundActions.FLUID_VAPORIZE, SoundEvents.BLOCK_FIRE_EXTINGUISH) 49 - .pathType(PathNodeType.WATER) 50 - .adjacentPathType(PathNodeType.WATER)) { 51 - 52 - @Override 53 - public void initializeClient(Consumer<IClientFluidTypeExtensions> consumer) { 54 - consumer.accept(new IClientFluidTypeExtensions() { 55 - private static final Identifier IRIDESCENCE = InfinityMethods.getId("block/iridescence"); 56 - 57 - @Override 58 - public @NotNull Identifier getStillTexture() { 59 - return IRIDESCENCE; 60 - } 61 - 62 - @Override 63 - public @NotNull Identifier getFlowingTexture() { 64 - return IRIDESCENCE; 65 - } 66 - 67 - @Override 68 - public int getTintColor(@NotNull FluidState state, @NotNull BlockRenderView getter, @NotNull BlockPos pos) { 69 - return Iridescence.getPosBasedColor(pos); 70 - } 71 - }); 72 - } 73 - }); 74 36 75 - public static FluidInteractionRegistry.InteractionInformation getIridescentInteraction(FluidType type) { 76 - return new FluidInteractionRegistry.InteractionInformation( 77 - (level, currentPos, relativePos, currentState) -> level.getFluidState(relativePos).getFluidType() == type, 78 - (level, currentPos, relativePos, currentState) -> { 79 - level.setBlockState(currentPos, ForgeEventFactory.fireFluidPlaceBlockEvent(level, currentPos, currentPos, 80 - currentState.isStill() ? Blocks.OBSIDIAN.getDefaultState() : 81 - Iridescence.getRandomColorBlock(level,"glazed_terracotta").getDefaultState())); 82 - level.syncWorldEvent(1501, currentPos, 0); 83 - }); 84 - } 85 - 86 - public static void registerFluidTypes(IEventBus bus) { 87 - FLUID_TYPES.register(bus); 88 - } 89 - public static void registerFluidInteractions(FMLCommonSetupEvent event) { 90 - FluidInteractionRegistry.addInteraction(ForgeMod.LAVA_TYPE.get(), getIridescentInteraction(IRIDESCENCE_TYPE.get())); 91 - } 92 - 93 - public static class IridescentFluidType extends FluidType { 94 - public IridescentFluidType(Properties properties) { 95 - super(properties); 96 - } 97 - @Override 98 - public PathNodeType getBlockPathType(@NotNull FluidState state, @NotNull BlockView level, @NotNull BlockPos pos, 99 - @Nullable MobEntity mob, boolean canFluidLog) { 100 - return canFluidLog ? super.getBlockPathType(state, level, pos, mob, true) : null; 101 - } 102 - @Override 103 - public boolean canConvertToSource(@NotNull FluidState state, @NotNull WorldView reader, @NotNull BlockPos pos) { 104 - if (reader instanceof World level) { 105 - return Iridescence.isInfinite(level); 106 - } 107 - //Best guess fallback to default (true) 108 - return super.canConvertToSource(state, reader, pos); 109 - } 110 - @Override 111 - public boolean isVaporizedOnPlacement(@NotNull World w, @NotNull BlockPos pos, @NotNull FluidStack stack) { 112 - return false; 113 - } 114 - } 115 37 }
+110 -2
forge/src/main/java/net/lerariemann/infinity/fluids/forge/ModFluidsForge.java
··· 2 2 3 3 import dev.architectury.registry.registries.DeferredRegister; 4 4 import dev.architectury.registry.registries.RegistrySupplier; 5 + import net.lerariemann.infinity.InfinityMod; 6 + import net.lerariemann.infinity.iridescence.Iridescence; 5 7 import net.lerariemann.infinity.registry.core.ModBlocks; 6 8 import net.lerariemann.infinity.registry.core.ModItems; 9 + import net.lerariemann.infinity.util.InfinityMethods; 10 + import net.minecraft.block.Blocks; 11 + import net.minecraft.entity.ai.pathing.PathNodeType; 12 + import net.minecraft.entity.mob.MobEntity; 7 13 import net.minecraft.fluid.Fluid; 14 + import net.minecraft.fluid.FluidState; 8 15 import net.minecraft.registry.RegistryKeys; 16 + import net.minecraft.sound.SoundEvents; 17 + import net.minecraft.util.Identifier; 18 + import net.minecraft.util.math.BlockPos; 19 + import net.minecraft.util.math.ColorHelper; 20 + import net.minecraft.world.BlockRenderView; 21 + import net.minecraft.world.BlockView; 22 + import net.minecraft.world.World; 23 + import net.minecraft.world.WorldView; 24 + import net.minecraftforge.client.extensions.common.IClientFluidTypeExtensions; 25 + import net.minecraftforge.common.ForgeMod; 26 + import net.minecraftforge.common.SoundActions; 27 + import net.minecraftforge.event.ForgeEventFactory; 28 + import net.minecraftforge.eventbus.api.IEventBus; 29 + import net.minecraftforge.fluids.FluidInteractionRegistry; 30 + import net.minecraftforge.fluids.FluidStack; 31 + import net.minecraftforge.fluids.FluidType; 9 32 import net.minecraftforge.fluids.ForgeFlowingFluid; 33 + import net.minecraftforge.registries.ForgeRegistries; 34 + import net.minecraftforge.registries.RegistryObject; 35 + import org.jetbrains.annotations.NotNull; 36 + import org.jetbrains.annotations.Nullable; 37 + 38 + import java.util.function.Consumer; 10 39 11 40 import static net.lerariemann.infinity.InfinityMod.MOD_ID; 12 41 13 42 public class ModFluidsForge { 14 43 public static final DeferredRegister<Fluid> FLUIDS = DeferredRegister.create(MOD_ID, RegistryKeys.FLUID); 44 + private static final net.minecraftforge.registries.DeferredRegister<FluidType> FLUID_TYPES = net.minecraftforge.registries.DeferredRegister.create(ForgeRegistries.Keys.FLUID_TYPES, InfinityMod.MOD_ID); 15 45 16 46 public static final RegistrySupplier<ForgeFlowingFluid.Flowing> IRIDESCENCE_FLOWING = 17 47 FLUIDS.register("flowing_iridescence", () -> new ForgeFlowingFluid.Flowing(iridProp())); 48 + 18 49 public static final RegistrySupplier<ForgeFlowingFluid.Source> IRIDESCENCE_STILL = 19 50 FLUIDS.register("iridescence", () -> new ForgeFlowingFluid.Source(iridProp())); 20 51 21 52 public static ForgeFlowingFluid.Properties iridProp() { 22 - return (new ForgeFlowingFluid.Properties(FluidTypes.IRIDESCENCE_TYPE, 53 + return (new ForgeFlowingFluid.Properties(IRIDESCENCE_TYPE, 23 54 IRIDESCENCE_STILL, IRIDESCENCE_FLOWING)) 24 55 .bucket(ModItems.IRIDESCENCE_BUCKET) 25 56 .block(ModBlocks.IRIDESCENCE); 26 57 } 27 58 28 - public static void registerModFluids() { 59 + public static final RegistryObject<FluidType> IRIDESCENCE_TYPE = FLUID_TYPES.register("iridescence", 60 + () -> new IridescentFluidType(FluidType.Properties.create() 61 + .descriptionId("fluid.infinity.iridescence") 62 + .fallDistanceModifier(0F) 63 + .canExtinguish(true) 64 + .canConvertToSource(true) 65 + .supportsBoating(true) 66 + .canSwim(true) 67 + .canHydrate(true) 68 + .sound(SoundActions.BUCKET_FILL, SoundEvents.ITEM_BUCKET_FILL) 69 + .sound(SoundActions.BUCKET_EMPTY, SoundEvents.ITEM_BUCKET_EMPTY) 70 + .sound(SoundActions.FLUID_VAPORIZE, SoundEvents.BLOCK_FIRE_EXTINGUISH) 71 + .pathType(PathNodeType.WATER) 72 + .adjacentPathType(PathNodeType.WATER)) { 73 + 74 + @Override 75 + public void initializeClient(Consumer<IClientFluidTypeExtensions> consumer) { 76 + consumer.accept(new IClientFluidTypeExtensions() { 77 + private static final Identifier IRIDESCENCE = InfinityMethods.getId("block/iridescence"); 78 + 79 + @Override 80 + public @NotNull Identifier getStillTexture() { 81 + return IRIDESCENCE; 82 + } 83 + 84 + @Override 85 + public @NotNull Identifier getFlowingTexture() { 86 + return IRIDESCENCE; 87 + } 88 + 89 + @Override 90 + public int getTintColor(@NotNull FluidState state, @NotNull BlockRenderView getter, @NotNull BlockPos pos) { 91 + return ColorHelper.Abgr.toOpaque(Iridescence.getPosBasedColor(pos)); 92 + } 93 + }); 94 + } 95 + }); 96 + 97 + public static class IridescentFluidType extends FluidType { 98 + public IridescentFluidType(Properties properties) { 99 + super(properties); 100 + } 101 + @Override 102 + public PathNodeType getBlockPathType(@NotNull FluidState state, @NotNull BlockView level, @NotNull BlockPos pos, 103 + @Nullable MobEntity mob, boolean canFluidLog) { 104 + return canFluidLog ? super.getBlockPathType(state, level, pos, mob, true) : null; 105 + } 106 + @Override 107 + public boolean canConvertToSource(@NotNull FluidState state, @NotNull WorldView reader, @NotNull BlockPos pos) { 108 + if (reader instanceof World level) { 109 + return Iridescence.isInfinite(level); 110 + } 111 + //Best guess fallback to default (true) 112 + return super.canConvertToSource(state, reader, pos); 113 + } 114 + @Override 115 + public boolean isVaporizedOnPlacement(@NotNull World w, @NotNull BlockPos pos, @NotNull FluidStack stack) { 116 + return false; 117 + } 118 + } 119 + 120 + public static FluidInteractionRegistry.InteractionInformation getIridescentInteraction(FluidType type) { 121 + return new FluidInteractionRegistry.InteractionInformation( 122 + (level, currentPos, relativePos, currentState) -> level.getFluidState(relativePos).getFluidType() == type, 123 + (level, currentPos, relativePos, currentState) -> { 124 + level.setBlockState(currentPos, ForgeEventFactory.fireFluidPlaceBlockEvent(level, currentPos, currentPos, 125 + currentState.isStill() ? Blocks.OBSIDIAN.getDefaultState() : 126 + Iridescence.getRandomColorBlock(level,"glazed_terracotta").getDefaultState())); 127 + level.syncWorldEvent(1501, currentPos, 0); 128 + }); 129 + } 130 + 131 + public static void registerModFluids(IEventBus bus) { 29 132 FLUIDS.register(); 133 + FLUID_TYPES.register(bus); 134 + } 135 + 136 + public static void registerFluidInteractions() { 137 + FluidInteractionRegistry.addInteraction(ForgeMod.LAVA_TYPE.get(), getIridescentInteraction(IRIDESCENCE_TYPE.get())); 30 138 } 31 139 }
+7 -7
forge/src/main/java/net/lerariemann/infinity/forge/InfinityModForge.java
··· 32 32 @Mod(InfinityMod.MOD_ID) 33 33 public final class InfinityModForge { 34 34 public InfinityModForge() { 35 + FMLJavaModLoadingContext context = FMLJavaModLoadingContext.get(); 35 36 // Register compat file ASAP to prevent a Canary crash. 36 37 if (Platform.isModLoaded("canary")) 37 38 CanaryCompat.writeCompatFile(); ··· 39 40 if (Platform.isModLoaded("radium")) 40 41 RadiumCompat.writeCompatFile(); 41 42 // Submit our event bus to let Architectury API register our content on the right time. 42 - EventBuses.registerModEventBus(InfinityMod.MOD_ID, FMLJavaModLoadingContext.get().getModEventBus()); 43 - IEventBus eventBus = FMLJavaModLoadingContext.get().getModEventBus(); 43 + EventBuses.registerModEventBus(InfinityMod.MOD_ID, context.getModEventBus()); 44 + IEventBus eventBus = context.getModEventBus(); 44 45 // Run our common setup. 45 46 InfinityMod.init(); 46 47 // Run our client setup. 47 48 if (FMLEnvironment.dist == Dist.CLIENT) 48 - InfinityModForgeClient.initializeClient(eventBus); 49 + InfinityModForgeClient.initializeClient(context, eventBus); 49 50 // Run any remaining Forge specific tasks. 50 51 eventBus.addListener(InfinityModForge::registerSpawns); 51 52 eventBus.addListener(InfinityModForge::commonSetup); 52 - eventBus.addListener(FluidTypes::registerFluidInteractions); 53 53 MinecraftForge.EVENT_BUS.addListener(InfinityModForge::sliderSpamFix); 54 - 55 - FluidTypes.registerFluidTypes(eventBus); 56 - ModFluidsForge.registerModFluids(); 54 + 55 + ModFluidsForge.registerModFluids(eventBus); 57 56 ModEffectsForge.register(eventBus); 58 57 ModTags.IRIDESCENT_ITEMS = ItemTags.create(InfinityMethods.getId("iridescent")); 59 58 } ··· 81 80 ModItemFunctions.registerDispenserBehaviour(); 82 81 if (isCreateLoaded()) 83 82 CreateCompat.register(); 83 + ModFluidsForge.registerFluidInteractions(); 84 84 } 85 85 }
+22 -7
forge/src/main/java/net/lerariemann/infinity/forge/client/InfinityModForgeClient.java
··· 5 5 import net.lerariemann.infinity.registry.core.ModBlocks; 6 6 import net.lerariemann.infinity.registry.core.ModItemFunctions; 7 7 import net.lerariemann.infinity.registry.core.ModItems; 8 + import net.lerariemann.infinity.util.InfinityMethods; 8 9 import net.lerariemann.infinity.util.PlatformMethods; 9 10 import net.lerariemann.infinity.compat.forge.ModConfigFactory; 10 11 import net.minecraft.client.render.RenderLayer; ··· 15 16 import net.minecraftforge.eventbus.api.SubscribeEvent; 16 17 import net.minecraftforge.fml.ModLoadingContext; 17 18 import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent; 19 + import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext; 18 20 19 21 public class InfinityModForgeClient { 20 22 21 - public static void initializeClient(IEventBus eventBus) { 23 + public static void initializeClient(FMLJavaModLoadingContext context, IEventBus eventBus) { 22 24 InfinityModClient.initializeClient(); 23 - InfinityModForgeClient.registerModsPage(); 25 + InfinityModForgeClient.registerModsPage(ModLoadingContext.get()); 24 26 eventBus.addListener(InfinityModForgeClient::registerBlockColorHandlers); 25 27 eventBus.addListener(InfinityModForgeClient::registerItemColorHandlers); 26 28 eventBus.addListener(InfinityModForgeClient::registerFluidRenderLayers); ··· 28 30 } 29 31 30 32 //Integrate Cloth Config screen (if mod present) with Forge mod menu. 31 - public static void registerModsPage() { 32 - if (clothConfigInstalled()) ModLoadingContext.get().registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () -> new ConfigScreenHandler.ConfigScreenFactory(ModConfigFactory::createScreen)); 33 + public static void registerModsPage(ModLoadingContext context) { 34 + if (clothConfigInstalled()) context.registerExtensionPoint(ConfigScreenHandler.ConfigScreenFactory.class, () -> new ConfigScreenHandler.ConfigScreenFactory(ModConfigFactory::createScreen)); 33 35 } 34 36 35 37 // Apply colour handlers to tint Neither Portals and Book Boxes. 36 38 @SubscribeEvent 37 39 public static void registerBlockColorHandlers(RegisterColorHandlersEvent.Block event) { 38 - event.register(PlatformMethods::getNeitherPortalColour, ModBlocks.PORTAL.get()); 39 - event.register(PlatformMethods::getBookBoxColour, ModBlocks.BOOK_BOX.get(), ModBlocks.IRIDESCENCE.get()); 40 + event.register(InfinityMethods::getBlockEntityColor, 41 + ModBlocks.PORTAL.get(), 42 + ModBlocks.BIOME_BOTTLE.get(), 43 + ModBlocks.CHROMATIC_WOOL.get(), 44 + ModBlocks.CHROMATIC_CARPET.get()); 45 + event.register(InfinityMethods::getBookBoxColor, 46 + ModBlocks.BOOK_BOX.get()); 40 47 } 41 48 @SubscribeEvent 42 49 public static void registerItemColorHandlers(RegisterColorHandlersEvent.Item event) { 43 - event.register(PlatformMethods::getOverlayColorFromComponents, ModItems.TRANSFINITE_KEY.get(), ModItems.BIOME_BOTTLE_ITEM.get()); 50 + event.register(InfinityMethods::getOverlayColorFromComponents, 51 + ModItems.TRANSFINITE_KEY.get(), 52 + ModItems.BIOME_BOTTLE_ITEM.get(), 53 + ModItems.F4.get(), 54 + ModItems.CHROMATIC_WOOL.get(), 55 + ModItems.CHROMATIC_CARPET.get(), 56 + ModItems.CHROMATIC_MATTER.get()); 57 + event.register(InfinityMethods::getPortalItemColor, 58 + ModItems.PORTAL_ITEM.get()); 44 59 } 45 60 @SubscribeEvent 46 61 public static void registerModelPredicates(FMLClientSetupEvent event) {
+3 -3
forge/src/main/java/net/lerariemann/infinity/util/forge/PlatformMethodsImpl.java
··· 105 105 106 106 public static boolean acidTest(Entity entity, boolean eyes) { 107 107 if (entity instanceof PlayerEntity) return false; 108 - if (eyes) return entity.isEyeInFluidType(FluidTypes.IRIDESCENCE_TYPE.get()); 109 - return entity.isInFluidType(FluidTypes.IRIDESCENCE_TYPE.get()); 108 + if (eyes) return entity.isEyeInFluidType(ModFluidsForge.IRIDESCENCE_TYPE.get()); 109 + return entity.isInFluidType(ModFluidsForge.IRIDESCENCE_TYPE.get()); 110 110 } 111 111 112 112 public static double acidHeightTest(Entity entity) { 113 113 if (entity instanceof PlayerEntity) return -1; 114 - return entity.getFluidTypeHeight(FluidTypes.IRIDESCENCE_TYPE.get()); 114 + return entity.getFluidTypeHeight(ModFluidsForge.IRIDESCENCE_TYPE.get()); 115 115 } 116 116 117 117 public static Function<Item.Settings, ? extends StarOfLangItem> getStarOfLangConstructor() {
+5 -5
gradle.properties
··· 3 3 org.gradle.parallel=true 4 4 5 5 # Mod properties 6 - mod_version = 2.4.3 6 + mod_version = 2.4.5 7 7 maven_group = net.lerariemann 8 8 archives_name = infinity 9 9 enabled_platforms = fabric,forge 10 - tbversion = 4 10 + tbversion = 0 11 11 12 12 # Minecraft properties 13 13 minecraft_version = 1.20.1 ··· 17 17 architectury_api_version = 9.2.14 18 18 19 19 # Fabric Dependencies 20 - fabric_loader_version = 0.16.8 20 + fabric_loader_version = 0.16.10 21 21 fabric_api_version = 0.92.2+1.20.1 22 22 23 23 # Forge Dependencies 24 - forge_version = 1.20.1-47.3.33 24 + forge_version = 1.20.1-47.1.3 25 25 forgified_fabric_api_version = 0.92.2+1.11.8+1.20.1 26 26 27 27 # Optional Dependencies ··· 31 31 cct_version = 1.115.0 32 32 gravity_changer_version = 1.0.2 33 33 cca_version = 5.2.2 34 - emi_version = 1.1.3 34 + emi_version = 1.1.20 35 35 36 36 # Create - Fabric 37 37 # https://modrinth.com/mod/create-fabric/versions