diff --git a/src/generated/resources/data/forge/tags/blocks/needs_netherite_tool.json b/src/generated/resources/data/forge/tags/blocks/needs_netherite_tool.json new file mode 100644 index 0000000000..2512d79574 --- /dev/null +++ b/src/generated/resources/data/forge/tags/blocks/needs_netherite_tool.json @@ -0,0 +1,6 @@ +{ + "replace": false, + "values": [ + "rankine:lonsdaleite_ore" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/forge/tags/items/breedables/llama.json b/src/generated/resources/data/forge/tags/items/breedables/llama.json new file mode 100644 index 0000000000..10c9c161c3 --- /dev/null +++ b/src/generated/resources/data/forge/tags/items/breedables/llama.json @@ -0,0 +1,7 @@ +{ + "replace": false, + "values": [ + "#forge:grain", + "#rankine:bales" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json b/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json index fe0d4105bb..0fd7956d1f 100644 --- a/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json +++ b/src/generated/resources/data/minecraft/tags/blocks/mineable/pickaxe.json @@ -1900,7 +1900,6 @@ "rankine:coltan_ore", "rankine:greenockite_ore", "rankine:ilmenite_ore", - "rankine:lonsdaleite_ore", "rankine:magnetite_ore", "rankine:molybdenite_ore", "rankine:petalite_ore", @@ -1909,6 +1908,7 @@ "rankine:uraninite_ore", "rankine:wolframite_ore", "rankine:xenotime_ore", + "rankine:lonsdaleite_ore", "rankine:pegmatite", "rankine:gray_granite", "rankine:rhyolite", diff --git a/src/generated/resources/data/minecraft/tags/blocks/needs_diamond_tool.json b/src/generated/resources/data/minecraft/tags/blocks/needs_diamond_tool.json index 5a3d4c8ebd..941cadf8c7 100644 --- a/src/generated/resources/data/minecraft/tags/blocks/needs_diamond_tool.json +++ b/src/generated/resources/data/minecraft/tags/blocks/needs_diamond_tool.json @@ -9,7 +9,6 @@ "rankine:coltan_ore", "rankine:greenockite_ore", "rankine:ilmenite_ore", - "rankine:lonsdaleite_ore", "rankine:magnetite_ore", "rankine:molybdenite_ore", "rankine:petalite_ore", diff --git a/src/generated/resources/data/rankine/recipes/stone_hammer.json b/src/generated/resources/data/rankine/recipes/stone_hammer.json index e756c4f07b..52fcf34b6d 100644 --- a/src/generated/resources/data/rankine/recipes/stone_hammer.json +++ b/src/generated/resources/data/rankine/recipes/stone_hammer.json @@ -7,7 +7,7 @@ ], "key": { "P": { - "tag": "forge:cobblestone" + "tag": "minecraft:stone_tool_materials" }, "S": { "tag": "forge:rods/wooden" diff --git a/src/generated/resources/data/rankine/tags/blocks/bales.json b/src/generated/resources/data/rankine/tags/blocks/bales.json new file mode 100644 index 0000000000..ec0cd24566 --- /dev/null +++ b/src/generated/resources/data/rankine/tags/blocks/bales.json @@ -0,0 +1,10 @@ +{ + "replace": false, + "values": [ + "rankine:barley_bale", + "rankine:rye_bale", + "rankine:millet_bale", + "rankine:sorghum_bale", + "rankine:oat_bale" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/rankine/tags/blocks/fireproof_logs.json b/src/generated/resources/data/rankine/tags/blocks/fireproof_logs.json index da5142eb92..cff8e070ac 100644 --- a/src/generated/resources/data/rankine/tags/blocks/fireproof_logs.json +++ b/src/generated/resources/data/rankine/tags/blocks/fireproof_logs.json @@ -1,24 +1,6 @@ { "replace": false, "values": [ - "minecraft:grass", - "minecraft:tall_grass", - "minecraft:fern", - "minecraft:large_fern", - "minecraft:seagrass", - "minecraft:tall_seagrass", - "minecraft:vine", - "minecraft:twisting_vines", - "minecraft:weeping_vines", - "minecraft:dead_bush", - "rankine:willow_branchlet", - "rankine:willow_branchlet_plant", - "rankine:short_grass", - "rankine:stinging_nettle", - "rankine:yellow_clover", - "rankine:red_clover", - "rankine:crimson_clover", - "rankine:white_clover", "#minecraft:warped_stems", "#minecraft:crimson_stems", "#rankine:petrified_chorus_logs", diff --git a/src/generated/resources/data/rankine/tags/blocks/knife_shearable.json b/src/generated/resources/data/rankine/tags/blocks/knife_shearable.json new file mode 100644 index 0000000000..3bd1b50dd2 --- /dev/null +++ b/src/generated/resources/data/rankine/tags/blocks/knife_shearable.json @@ -0,0 +1,23 @@ +{ + "replace": false, + "values": [ + "minecraft:grass", + "minecraft:tall_grass", + "minecraft:fern", + "minecraft:large_fern", + "minecraft:seagrass", + "minecraft:tall_seagrass", + "minecraft:vine", + "minecraft:twisting_vines", + "minecraft:weeping_vines", + "minecraft:dead_bush", + "rankine:willow_branchlet", + "rankine:willow_branchlet_plant", + "rankine:short_grass", + "rankine:stinging_nettle", + "rankine:yellow_clover", + "rankine:red_clover", + "rankine:crimson_clover", + "rankine:white_clover" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/rankine/tags/items/bales.json b/src/generated/resources/data/rankine/tags/items/bales.json new file mode 100644 index 0000000000..ec0cd24566 --- /dev/null +++ b/src/generated/resources/data/rankine/tags/items/bales.json @@ -0,0 +1,10 @@ +{ + "replace": false, + "values": [ + "rankine:barley_bale", + "rankine:rye_bale", + "rankine:millet_bale", + "rankine:sorghum_bale", + "rankine:oat_bale" + ] +} \ No newline at end of file diff --git a/src/generated/resources/data/rankine/tags/items/fireproof_logs.json b/src/generated/resources/data/rankine/tags/items/fireproof_logs.json index da5142eb92..cff8e070ac 100644 --- a/src/generated/resources/data/rankine/tags/items/fireproof_logs.json +++ b/src/generated/resources/data/rankine/tags/items/fireproof_logs.json @@ -1,24 +1,6 @@ { "replace": false, "values": [ - "minecraft:grass", - "minecraft:tall_grass", - "minecraft:fern", - "minecraft:large_fern", - "minecraft:seagrass", - "minecraft:tall_seagrass", - "minecraft:vine", - "minecraft:twisting_vines", - "minecraft:weeping_vines", - "minecraft:dead_bush", - "rankine:willow_branchlet", - "rankine:willow_branchlet_plant", - "rankine:short_grass", - "rankine:stinging_nettle", - "rankine:yellow_clover", - "rankine:red_clover", - "rankine:crimson_clover", - "rankine:white_clover", "#minecraft:warped_stems", "#minecraft:crimson_stems", "#rankine:petrified_chorus_logs", diff --git a/src/main/java/com/cannolicatfish/rankine/events/RankineClientEventHandler.java b/src/main/java/com/cannolicatfish/rankine/events/RankineClientEventHandler.java index c3869f5e6b..d13fd744d8 100644 --- a/src/main/java/com/cannolicatfish/rankine/events/RankineClientEventHandler.java +++ b/src/main/java/com/cannolicatfish/rankine/events/RankineClientEventHandler.java @@ -1,37 +1,15 @@ package com.cannolicatfish.rankine.events; -import com.cannolicatfish.rankine.blocks.GasBlock; -import com.cannolicatfish.rankine.init.*; -import com.cannolicatfish.rankine.items.tools.KnifeItem; -import com.cannolicatfish.rankine.recipe.AlloyCraftingRecipe; -import com.cannolicatfish.rankine.recipe.AlloyingRecipe; -import com.cannolicatfish.rankine.recipe.ElementRecipe; -import com.cannolicatfish.rankine.recipe.helper.AlloyCustomHelper; -import com.mojang.blaze3d.systems.RenderSystem; -import com.mojang.blaze3d.vertex.*; -import net.minecraft.world.level.block.Block; -import net.minecraft.client.Minecraft; -import net.minecraft.client.multiplayer.ClientLevel; -import net.minecraft.world.item.enchantment.EnchantmentHelper; -import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.entity.ai.attributes.AttributeInstance; -import net.minecraft.world.entity.player.Player; -import net.minecraft.world.item.ItemStack; -import net.minecraft.world.item.crafting.RecipeType; -import net.minecraft.resources.ResourceLocation; -import net.minecraft.core.BlockPos; -import com.mojang.math.Matrix4f; -import net.minecraft.world.level.Level; +import com.cannolicatfish.rankine.events.handlers.client.*; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.event.*; +import net.minecraftforge.client.event.FOVModifierEvent; +import net.minecraftforge.client.event.RecipesUpdatedEvent; +import net.minecraftforge.client.event.RenderBlockOverlayEvent; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.fml.common.Mod; -import org.lwjgl.opengl.GL11; - -import java.util.ArrayList; -import java.util.List; -import java.util.stream.Collectors; @Mod.EventBusSubscriber public class RankineClientEventHandler { @@ -39,131 +17,31 @@ public class RankineClientEventHandler { @SubscribeEvent @OnlyIn(Dist.CLIENT) public static void onRecipesUpdated(RecipesUpdatedEvent event) { - ClientLevel world = Minecraft.getInstance().level; - if (world != null) { - List alloyingRecipes = new ArrayList<>(world.getRecipeManager().getAllRecipesFor(RankineRecipeTypes.ALLOYING)); - AlloyCustomHelper.setAlloyingRecipes(alloyingRecipes); - - List elementRecipes = new ArrayList<>(world.getRecipeManager().getAllRecipesFor(RankineRecipeTypes.ELEMENT)); - AlloyCustomHelper.setElementRecipes(elementRecipes); - - List alloyCraftingRecipes = world.getRecipeManager().getAllRecipesFor(RecipeType.CRAFTING).stream() - .filter((iCraftingRecipe -> iCraftingRecipe instanceof AlloyCraftingRecipe)) - .map(AlloyCraftingRecipe.class::cast) - .collect(Collectors.toList()); - AlloyCustomHelper.setCraftingRecipes(alloyCraftingRecipes); - } + RecipesUpdatedHandler.onRecipesUpdated(event); } @SubscribeEvent @OnlyIn(Dist.CLIENT) public static void fovUpdate(FOVModifierEvent event) { - Player player = event.getEntity(); - AttributeInstance movementSpeed = player.getAttribute(Attributes.MOVEMENT_SPEED); - if (Config.GENERAL.MOVEMENT_MODIFIERS.get() && movementSpeed != null) { - if (movementSpeed.hasModifier(RankineAttributes.GRASS_PATH_MS) || movementSpeed.hasModifier(RankineAttributes.SAND_MS) || movementSpeed.hasModifier(RankineAttributes.BRICKS_MS) || - movementSpeed.hasModifier(RankineAttributes.ROMAN_CONCRETE_MS) || movementSpeed.hasModifier(RankineAttributes.DIRT_MS) || movementSpeed.hasModifier(RankineAttributes.POLISHED_STONE_MS) || - movementSpeed.hasModifier(RankineAttributes.WOODEN_MS) || movementSpeed.hasModifier(RankineAttributes.CONCRETE_MS) || movementSpeed.hasModifier(RankineAttributes.SNOW_MS) || - movementSpeed.hasModifier(RankineAttributes.MUD_MS)) { - event.setNewfov(Minecraft.getInstance().options.fovEffectScale * (player.isSprinting() ? 1.3f : 1)); - } - } + FOVModifierHandler.fovUpdate(event); } @SubscribeEvent @OnlyIn(Dist.CLIENT) - public static void renderOverlay(RenderGameOverlayEvent event) { - if (event.getType() == RenderGameOverlayEvent.ElementType.LAYER && Minecraft.getInstance().player != null) { - Player player = Minecraft.getInstance().player; - ItemStack stack = player.getOffhandItem().getItem() instanceof KnifeItem ? player.getOffhandItem() : ItemStack.EMPTY; - if (!stack.isEmpty()) { - int i = stack.getItem().getUseDuration(stack) - player.getUseItemRemainingTicks(); - if (i < (10 + EnchantmentHelper.getItemEnchantmentLevel(RankineEnchantments.PREPARATION,stack))) { - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - RenderSystem.disableDepthTest(); - RenderSystem.depthMask(false); - RenderSystem.defaultBlendFunc(); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - //RenderSystem.disableAlphaTest(); - Minecraft.getInstance().getTextureManager().bindForSetup(new ResourceLocation("rankine:textures/misc/parry_overlay.png")); - Tesselator tessellator = Tesselator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuilder(); - bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - bufferbuilder.vertex(0.0D, (double)event.getWindow().getGuiScaledHeight(), -90.0D).uv(0.0F, 1.0F).endVertex(); - bufferbuilder.vertex((double)event.getWindow().getGuiScaledWidth(), (double)event.getWindow().getGuiScaledHeight(), -90.0D).uv(1.0F, 1.0F).endVertex(); - bufferbuilder.vertex((double)event.getWindow().getGuiScaledWidth(), 0.0D, -90.0D).uv(1.0F, 0.0F).endVertex(); - bufferbuilder.vertex(0.0D, 0.0D, -90.0D).uv(0.0F, 0.0F).endVertex(); - tessellator.end(); - RenderSystem.depthMask(true); - RenderSystem.enableDepthTest(); - //RenderSystem.enableAlphaTest(); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glPopMatrix(); - } - } - } - if (event.getType() == RenderGameOverlayEvent.ElementType.LAYER && Minecraft.getInstance().player != null) { - Player player = Minecraft.getInstance().player; - Level worldIn = player.getCommandSenderWorld(); + public static void renderGameOverlayEvent(RenderGameOverlayEvent event) { + RenderGameOverlayHandler.renderOverlay(event); + } - Block bl = worldIn.getBlockState(new BlockPos(player.getX(),player.getEyeY(),player.getZ())).getBlock(); - if (bl instanceof GasBlock) { - GL11.glPushMatrix(); - GL11.glEnable(GL11.GL_BLEND); - RenderSystem.disableDepthTest(); - RenderSystem.depthMask(false); - RenderSystem.defaultBlendFunc(); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - //RenderSystem.disableAlphaTest(); - Minecraft.getInstance().getTextureManager().bindForSetup(new ResourceLocation("rankine:textures/block/"+bl.getRegistryName().getPath()+".png")); - Tesselator tessellator = Tesselator.getInstance(); - BufferBuilder bufferbuilder = tessellator.getBuilder(); - bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); - bufferbuilder.vertex(0.0D, (double)event.getWindow().getGuiScaledHeight(), -90.0D).uv(0.0F, 1.0F).endVertex(); - bufferbuilder.vertex((double)event.getWindow().getGuiScaledWidth(), (double)event.getWindow().getGuiScaledHeight(), -90.0D).uv(1.0F, 1.0F).endVertex(); - bufferbuilder.vertex((double)event.getWindow().getGuiScaledWidth(), 0.0D, -90.0D).uv(1.0F, 0.0F).endVertex(); - bufferbuilder.vertex(0.0D, 0.0D, -90.0D).uv(0.0F, 0.0F).endVertex(); - tessellator.end(); - RenderSystem.depthMask(true); - RenderSystem.enableDepthTest(); - //RenderSystem.enableAlphaTest(); - RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); - GL11.glPopMatrix(); - } - } + @SubscribeEvent + @OnlyIn(Dist.CLIENT) + public void renderBlockOverlayEvent(RenderBlockOverlayEvent event) { + RenderBlockOverlayHandler.renderOverlayBlockEvent(event); } @SubscribeEvent @OnlyIn(Dist.CLIENT) - public void renderOverlayBlockEvent(RenderBlockOverlayEvent event) { - if (event.getOverlayType() == RenderBlockOverlayEvent.OverlayType.WATER && event.getBlockState().getBlock().getRegistryName().getNamespace().equals("rankine")) { - Minecraft minecraftIn = Minecraft.getInstance(); - RenderSystem.enableTexture(); - minecraftIn.getTextureManager().bindForSetup(new ResourceLocation("rankine:textures/block/"+event.getBlockState().getBlock().getRegistryName().getPath()+"_overlay.png")); - BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); - float f = minecraftIn.player.getBrightness(); - RenderSystem.enableBlend(); - RenderSystem.defaultBlendFunc(); - float f1 = 4.0F; - float f2 = -1.0F; - float f3 = 1.0F; - float f4 = -1.0F; - float f5 = 1.0F; - float f6 = -0.5F; - float f7 = -minecraftIn.player.getYRot() / 64.0F; - float f8 = minecraftIn.player.getXRot() / 64.0F; - Matrix4f matrix4f = event.getPoseStack().last().pose(); - bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); - bufferbuilder.vertex(matrix4f, -1.0F, -1.0F, -0.5F).color(f, f, f, 0.1F).uv(4.0F + f7, 4.0F + f8).endVertex(); - bufferbuilder.vertex(matrix4f, 1.0F, -1.0F, -0.5F).color(f, f, f, 0.1F).uv(0.0F + f7, 4.0F + f8).endVertex(); - bufferbuilder.vertex(matrix4f, 1.0F, 1.0F, -0.5F).color(f, f, f, 0.1F).uv(0.0F + f7, 0.0F + f8).endVertex(); - bufferbuilder.vertex(matrix4f, -1.0F, 1.0F, -0.5F).color(f, f, f, 0.1F).uv(4.0F + f7, 0.0F + f8).endVertex(); - bufferbuilder.end(); - BufferUploader.end(bufferbuilder); - RenderSystem.disableBlend(); - event.setCanceled(true); - } + public static void onTooltipCheck(ItemTooltipEvent event) { + ItemTooltipHandler.onTooltipCheck(event); } diff --git a/src/main/java/com/cannolicatfish/rankine/events/RankineEventHandler.java b/src/main/java/com/cannolicatfish/rankine/events/RankineEventHandler.java index 4065b78d8a..be0b34d2e6 100644 --- a/src/main/java/com/cannolicatfish/rankine/events/RankineEventHandler.java +++ b/src/main/java/com/cannolicatfish/rankine/events/RankineEventHandler.java @@ -10,13 +10,12 @@ import com.cannolicatfish.rankine.blocks.states.TripleBlockSection; import com.cannolicatfish.rankine.blocks.tilledsoil.TilledSoilBlock; import com.cannolicatfish.rankine.capabilities.ChunkRetrogenProvider; -import com.cannolicatfish.rankine.capabilities.IChunkRetrogenHandler; import com.cannolicatfish.rankine.commands.BlockWallCommand; import com.cannolicatfish.rankine.commands.CreateAlloyCommand; import com.cannolicatfish.rankine.commands.GiveTagCommand; import com.cannolicatfish.rankine.compatibility.Patchouli; import com.cannolicatfish.rankine.enchantment.RankineEnchantmentHelper; -import com.cannolicatfish.rankine.entities.goals.EatGrassGoalModified; +import com.cannolicatfish.rankine.events.handlers.common.*; import com.cannolicatfish.rankine.init.*; import com.cannolicatfish.rankine.items.InformationItem; import com.cannolicatfish.rankine.items.alloys.*; @@ -25,19 +24,18 @@ import com.cannolicatfish.rankine.items.tools.KnifeItem; import com.cannolicatfish.rankine.items.tools.SpearItem; import com.cannolicatfish.rankine.items.totems.InvigoratingTotemItem; -import com.cannolicatfish.rankine.items.totems.SofteningTotemItem; import com.cannolicatfish.rankine.potion.RankineEffects; import com.cannolicatfish.rankine.recipe.RockGeneratorRecipe; import com.cannolicatfish.rankine.recipe.SluicingRecipe; import com.cannolicatfish.rankine.recipe.StrippingRecipe; -import com.cannolicatfish.rankine.util.*; +import com.cannolicatfish.rankine.util.RankineMathHelper; +import com.cannolicatfish.rankine.util.RockGeneratorUtils; import com.mojang.datafixers.DataFixUtils; import net.minecraft.ChatFormatting; import net.minecraft.Util; import net.minecraft.core.BlockPos; import net.minecraft.core.Direction; import net.minecraft.core.Registry; -import net.minecraft.core.Vec3i; import net.minecraft.nbt.CompoundTag; import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.TranslatableComponent; @@ -46,39 +44,36 @@ import net.minecraft.sounds.SoundEvent; import net.minecraft.sounds.SoundEvents; import net.minecraft.sounds.SoundSource; -import net.minecraft.tags.*; +import net.minecraft.tags.BiomeTags; +import net.minecraft.tags.BlockTags; +import net.minecraft.tags.FluidTags; +import net.minecraft.tags.TagKey; import net.minecraft.util.Mth; import net.minecraft.world.InteractionHand; import net.minecraft.world.SimpleContainer; import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.effect.MobEffectInstance; import net.minecraft.world.effect.MobEffects; -import net.minecraft.world.entity.*; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.entity.LivingEntity; +import net.minecraft.world.entity.Mob; import net.minecraft.world.entity.ai.attributes.AttributeInstance; import net.minecraft.world.entity.ai.attributes.AttributeModifier; import net.minecraft.world.entity.ai.attributes.Attributes; -import net.minecraft.world.entity.ai.goal.EatBlockGoal; -import net.minecraft.world.entity.ai.goal.TemptGoal; -import net.minecraft.world.entity.animal.*; +import net.minecraft.world.entity.animal.AbstractGolem; import net.minecraft.world.entity.monster.*; -import net.minecraft.world.entity.npc.VillagerProfession; -import net.minecraft.world.entity.npc.VillagerTrades; import net.minecraft.world.entity.player.Player; import net.minecraft.world.item.*; -import net.minecraft.world.item.crafting.Ingredient; import net.minecraft.world.item.enchantment.EnchantmentHelper; -import net.minecraft.world.item.trading.MerchantOffer; import net.minecraft.world.level.GameRules; import net.minecraft.world.level.Level; -import net.minecraft.world.level.LevelAccessor; import net.minecraft.world.level.LightLayer; import net.minecraft.world.level.biome.Biome; import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.DoubleBlockHalf; -import net.minecraft.world.level.chunk.ChunkAccess; -import net.minecraft.world.level.chunk.ChunkStatus; import net.minecraft.world.level.chunk.LevelChunk; import net.minecraft.world.level.material.Material; import net.minecraft.world.level.storage.loot.LootContext; @@ -86,20 +81,14 @@ import net.minecraft.world.level.storage.loot.parameters.LootContextParamSets; import net.minecraft.world.level.storage.loot.parameters.LootContextParams; import net.minecraft.world.phys.AABB; -import net.minecraftforge.api.distmarker.Dist; -import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.common.BasicItemListing; import net.minecraftforge.common.ForgeMod; import net.minecraftforge.common.Tags; import net.minecraftforge.common.TierSortingRegistry; -import net.minecraftforge.common.capabilities.ICapabilityProvider; -import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.event.*; import net.minecraftforge.event.entity.EntityJoinWorldEvent; import net.minecraftforge.event.entity.living.LivingDamageEvent; import net.minecraftforge.event.entity.living.LivingEvent; import net.minecraftforge.event.entity.living.LivingSetAttackTargetEvent; -import net.minecraftforge.event.entity.player.ItemTooltipEvent; import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.furnace.FurnaceFuelBurnTimeEvent; @@ -131,36 +120,6 @@ public static void attachCapabilities(AttachCapabilitiesEvent event) event.addCapability(new ResourceLocation("rankine:retrogen_chunk"), new ChunkRetrogenProvider()); } - @SubscribeEvent(priority = EventPriority.LOWEST) - public static void retrogenChunk(ChunkEvent.Load event) { - if (!event.getWorld().isClientSide() && Config.WORLDGEN.RETRO_GEN.get()) { - ChunkAccess chunkAccess = event.getChunk(); - if (chunkAccess instanceof ICapabilityProvider && chunkAccess.getStatus().isOrAfter(ChunkStatus.FULL)) { - LazyOptional capability = ((ICapabilityProvider) chunkAccess).getCapability(ChunkRetrogenProvider.CAPABILITY, null); - if (capability.isPresent() && capability.resolve().isPresent() && !capability.resolve().get().getValue()) { - ReplacementUtils.performRetrogenReplacement(chunkAccess); - capability.ifPresent(iChunkRetrogenHandler -> iChunkRetrogenHandler.setValue(true)); - } - } - } - - } - - @SubscribeEvent - public static void onItemPickup(PlayerEvent.ItemPickupEvent event) { - - // Totem of Cobbling - if (((ForgeRegistries.ITEMS.tags().getTag(Tags.Items.STONE).contains(event.getStack().getItem()) || event.getStack().getItem() == Items.COBBLESTONE) && (event.getPlayer().getMainHandItem().getItem() == RankineItems.TOTEM_OF_COBBLING.get() || event.getPlayer().getOffhandItem().getItem() == RankineItems.TOTEM_OF_COBBLING.get()))) { - Player player = event.getPlayer(); - ItemStack totem = player.getMainHandItem().getItem() == RankineItems.TOTEM_OF_COBBLING.get() ? player.getMainHandItem() : player.getOffhandItem(); - if (totem.getDamageValue() != 0) { - int x = totem.getDamageValue() - event.getStack().copy().getCount(); - player.getInventory().getItem(event.getPlayer().getInventory().findSlotMatchingItem(event.getStack())).shrink(totem.getDamageValue()); - totem.setDamageValue(Math.max(x,0)); - - } - } - } @SubscribeEvent @@ -170,163 +129,7 @@ public static void registerCommands(RegisterCommandsEvent event) { BlockWallCommand.register(event.getDispatcher()); } - @SubscribeEvent - public static void addWandererTrades(WandererTradesEvent event) { - if (Config.GENERAL.VILLAGER_TRADES.get()) { - event.getGenericTrades().add(new BasicItemListing(1,new ItemStack(RankineItems.PINEAPPLE.get(), 1),4,1,0.5f)); - event.getGenericTrades().add(new BasicItemListing(1,new ItemStack(RankineBlocks.LIMESTONE.get(), 8),8,1,0.05f)); - event.getRareTrades().add(new BasicItemListing(3,new ItemStack(RankineItems.METEORIC_IRON.get()),6,1,0.5f)); - } - } - @SubscribeEvent - public static void addVillagerTrades(VillagerTradesEvent event) { - List level1 = event.getTrades().get(1); - List level2 = event.getTrades().get(2); - List level3 = event.getTrades().get(3); - List level4 = event.getTrades().get(4); - List level5 = event.getTrades().get(5); - - if (event.getType() == RankineVillagerProfessions.METALLURGIST) { - level1.add(new BasicItemListing(1, new ItemStack(RankineItems.ALLOY_TEMPLATE.get()),12,1,0.05f)); - level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.TIN_INGOT.get(), 8), new ItemStack(Items.EMERALD),12,2,0.05f)); - level1.add((entity,rand) -> new MerchantOffer(new ItemStack(Items.COPPER_INGOT, 4), new ItemStack(Items.EMERALD),12,2,0.05f)); - level2.add(new BasicItemListing(1, new ItemStack(RankineItems.ZINC_INGOT.get(), 2),12,10,0.05f)); - level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.METEORIC_IRON.get(), 4), new ItemStack(Items.EMERALD),12,10,0.05f)); - level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.COIN.get(), 16), new ItemStack(Items.EMERALD),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(RankineItems.MANGANESE_INGOT.get(), 2),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(RankineItems.MOLYBDENUM_INGOT.get(), 2),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(RankineItems.VANADIUM_INGOT.get(), 2),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(RankineItems.NIOBIUM_INGOT.get(), 2),12,10,0.05f)); - level4.add(new BasicItemListing(6, new ItemStack(RankineItems.ELEMENT_INDEXER.get()),12,15,0.05f)); - level5.add(new BasicItemListing(10, new ItemStack(RankineItems.ORE_DETECTOR.get()),12,30,0.05f)); - level5.add(new RankineVillagerTrades.EnchantedAlloyItemForEmeraldsTrade(RankineItems.STEEL_PICKAXE.get(),"76Fe-15Cr-4V-4W-1C","rankine:alloying/damascus_steel_alloying","item.rankine.damascus_steel_alloying",15,3,30,0.2f)); - level5.add(new RankineVillagerTrades.EnchantedAlloyItemForEmeraldsTrade(RankineItems.STEEL_SWORD.get(),"76Fe-15Cr-4V-4W-1C","rankine:alloying/damascus_steel_alloying","item.rankine.damascus_steel_alloying",15,3,30,0.2f)); - } else if (event.getType() == RankineVillagerProfessions.MINERALOGIST) { - level1.add(new BasicItemListing(1, new ItemStack(RankineItems.STIBNITE.get()),12,1,0.05f)); - level1.add(new BasicItemListing(1, new ItemStack(RankineItems.PROSPECTING_STICK.get()),12,1,0.05f)); - level1.add(new BasicItemListing(1, new ItemStack(RankineItems.HARDNESS_TESTER.get()),12,1,0.05f)); - level2.add(new BasicItemListing(1, new ItemStack(RankineItems.CHALCOPYRITE.get()),12,5,0.05f)); - level2.add(new BasicItemListing(1, new ItemStack(RankineItems.BORAX.get()),12,5,0.05f)); - level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.MICA.get(), 4), new ItemStack(Items.EMERALD),12,10,0.05f)); - level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.AMPHIBOLE.get(), 4), new ItemStack(Items.EMERALD),12,10,0.05f)); - level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.PLAGIOCLASE_FELDSPAR.get(), 4), new ItemStack(Items.EMERALD),12,10,0.05f)); - level3.add(new RankineVillagerTrades.EnchantedAlloyItemForEmeraldsTrade(RankineItems.INVAR_HAMMER.get(),"90Fe-10Ni","rankine:invar_alloying","item.rankine.invar_alloying",8,3,10,0.2f)); - level3.add(new BasicItemListing(1, new ItemStack(RankineItems.ZIRCON.get()),12,15,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(RankineItems.BAUXITE.get()),12,15,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(RankineItems.MAGNESITE.get()),12,15,0.05f)); - level4.add(new BasicItemListing(1, new ItemStack(RankineItems.VANADINITE.get()),12,15,0.05f)); - level4.add(new BasicItemListing(1, new ItemStack(RankineItems.PETALITE.get()),12,15,0.05f)); - level4.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.OLIVINE.get(), 4), new ItemStack(Items.EMERALD),12,20,0.05f)); - level4.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.PYROXENE.get(), 4), new ItemStack(Items.EMERALD),12,20,0.05f)); - level5.add(new BasicItemListing(1, new ItemStack(RankineItems.WOLFRAMITE.get()),12,30,0.05f)); - level5.add(new BasicItemListing(1, new ItemStack(RankineItems.COBALTITE.get()),12,30,0.05f)); - level5.add(new RankineVillagerTrades.EnchantedAlloyItemForEmeraldsTrade(RankineItems.STEEL_HAMMER.get(),"76Fe-15Cr-4V-4W-1C","rankine:alloying/damascus_steel_alloying","item.rankine.damascus_steel_alloying",15,3,30,0.2f)); - } else if (event.getType() == RankineVillagerProfessions.BOTANIST) { - level1.addAll(RankineVillagerTrades.returnTagTrades(ItemTags.SMALL_FLOWERS,Items.DANDELION,3,1,12,10,0.05f)); - level1.addAll(RankineVillagerTrades.returnTagTrades(ItemTags.TALL_FLOWERS,Items.ROSE_BUSH,2,1,12,10,0.05f)); - level1.addAll(RankineVillagerTrades.returnTagTrades(RankineTags.Items.BERRIES,RankineItems.ELDERBERRIES.get(),2,1,12,10,0.05f)); - level2.addAll(RankineVillagerTrades.returnTagTrades(ItemTags.SAPLINGS,Items.OAK_SAPLING,2,1,12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.BAMBOO, 4),12,15,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.VINE, 4),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.LILY_PAD, 4),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.RED_MUSHROOM, 4),12,15,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.BROWN_MUSHROOM, 4),12,15,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.SEA_PICKLE, 4),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.KELP, 4),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.SUGAR_CANE, 4),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.CACTUS, 4),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.DEAD_BUSH, 4),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.NETHER_WART, 4),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.POISONOUS_POTATO, 4),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(RankineItems.ALOE.get(), 4),12,30,0.05f)); - level4.add(new BasicItemListing(1, new ItemStack(Items.WARPED_NYLIUM, 1),12,15,0.05f)); - level4.add(new BasicItemListing(1, new ItemStack(Items.CRIMSON_NYLIUM, 1),12,15,0.05f)); - level4.add(new BasicItemListing(1, new ItemStack(Items.BRAIN_CORAL, 2),12,15,0.05f)); - level4.add(new BasicItemListing(1, new ItemStack(Items.BUBBLE_CORAL, 2),12,15,0.05f)); - level4.add(new BasicItemListing(1, new ItemStack(Items.FIRE_CORAL, 2),12,15,0.05f)); - level4.add(new BasicItemListing(1, new ItemStack(Items.HORN_CORAL, 2),12,15,0.05f)); - level4.add(new BasicItemListing(1, new ItemStack(Items.TUBE_CORAL, 2),12,15,0.05f)); - level5.add(new BasicItemListing(1, new ItemStack(Items.SHROOMLIGHT, 2),12,15,0.05f)); - level5.add(new BasicItemListing(1, new ItemStack(Items.MYCELIUM, 1),12,30,0.05f)); - level5.add(new BasicItemListing(5, new ItemStack(Items.CHORUS_FLOWER, 1),12,30,0.05f)); - level5.add(new BasicItemListing(10, new ItemStack(Items.WITHER_ROSE),12,30,0.05f)); - - } else if (event.getType() == RankineVillagerProfessions.GEM_CUTTER) { - level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.AQUAMARINE.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); - level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.OPAL.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); - level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.GARNET.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); - level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.RUBY.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); - level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.SAPPHIRE.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); - level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.PERIDOT.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); - level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.TOPAZ.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); - level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.PEARL.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); - level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.TOURMALINE.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); - level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.TIGER_IRON.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); - level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.LABRADORITE.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); - level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.RHODONITE.get(), 1), new ItemStack(Items.EMERALD, 3),12,20,0.05f)); - level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.RHODOCHROSITE.get(), 1), new ItemStack(Items.EMERALD, 3),12,20,0.05f)); - level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.CHROME_ENSTATITE.get(), 1), new ItemStack(Items.EMERALD, 3),12,20,0.05f)); - level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.FLUORITE.get(), 3), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); - level4.addAll(RankineVillagerTrades.returnTagTrades(Tags.Items.GEMS,RankineItems.OPAL.get(),1,12,16,10,0.05f)); - level5.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.LONSDALEITE_DIAMOND.get(), 1), new ItemStack(Items.EMERALD, 6),12,20,0.05f)); - level5.add(new BasicItemListing(20, new ItemStack(RankineItems.LONSDALEITE_DIAMOND.get(), 1),12,50,0.05f)); - level5.add((entity,rand) -> new MerchantOffer(new ItemStack(Items.NETHER_STAR, 1), new ItemStack(Items.EMERALD, 64),12,50,0.05f)); - - } else if (event.getType() == RankineVillagerProfessions.ROCK_COLLECTOR) { - level1.addAll(RankineVillagerTrades.returnTagTrades(Tags.Items.STONE,RankineItems.ANORTHOSITE.get(),16,1,16,10,0.05f)); - List rocks = ForgeRegistries.BLOCKS.tags().getTag(Tags.Blocks.STONE).stream().toList(); - if (!rocks.isEmpty()) { - for (Block rock : rocks) { - level2.add((entity, rand) -> new MerchantOffer(new ItemStack(rock.asItem(), 24), new ItemStack(Items.EMERALD, 1), 16, 10, 0.05f)); - } - } else { - level2.add((entity, rand) -> new MerchantOffer(new ItemStack(Items.SANDSTONE, 24), new ItemStack(Items.EMERALD, 1), 16, 10, 0.05f)); - level2.add((entity, rand) -> new MerchantOffer(new ItemStack(Items.RED_SANDSTONE, 12), new ItemStack(Items.EMERALD, 1), 16, 10, 0.05f)); - } - level3.add(new BasicItemListing(1, new ItemStack(Items.OBSIDIAN, 1),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.NETHERRACK, 8),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.END_STONE, 2),12,10,0.05f)); - level3.add(new BasicItemListing(1, new ItemStack(Items.PURPUR_BLOCK, 2),12,10,0.05f)); - level4.add(new BasicItemListing(1, new ItemStack(RankineItems.PHOSPHORITE.get(), 2),12,10,0.05f)); - level4.add(new BasicItemListing(1, new ItemStack(RankineItems.IRONSTONE.get(), 2),12,10,0.05f)); - level4.add(new BasicItemListing(1, new ItemStack(RankineItems.METEORITE.get(), 2),12,10,0.05f)); - level4.add(new BasicItemListing(1, new ItemStack(RankineItems.ENSTATITE_CHONDRITE.get(), 2),12,10,0.05f)); - level5.add(new BasicItemListing(1, new ItemStack(RankineItems.ROMAN_CONCRETE.get(), 1),24,10,0.05f)); - } - - if (Config.GENERAL.VILLAGER_TRADES.get()) { - if (event.getType() == VillagerProfession.MASON) { - event.getTrades().get(1).add(new BasicItemListing(1,new ItemStack(RankineItems.MORTAR.get(), 16),16,1,0.05f)); - event.getTrades().get(1).add(new BasicItemListing(1,new ItemStack(RankineItems.REFRACTORY_BRICK.get(), 10),16,1,0.05f)); - } else if (event.getType() == VillagerProfession.CLERIC) { - event.getTrades().get(1).add(new BasicItemListing(1, new ItemStack(RankineItems.SALTPETER.get(),2),12,1,0.05f)); - } - } - - } - - @SubscribeEvent - public static void onSaplingGrow(SaplingGrowTreeEvent event) { - if (event.getRand().nextFloat() < 1-Config.GENERAL.SAPLING_GROW.get()) { - event.setResult(Event.Result.DENY); - } - BlockPos pos = event.getPos(); - LevelAccessor worldIn = event.getWorld(); - if (worldIn.getBlockState(pos).is(Blocks.SPRUCE_SAPLING)) { - - } - } - - @SubscribeEvent - public static void onCropTrample(BlockEvent.FarmlandTrampleEvent event) { - if (event.getEntity() instanceof Player) { - Player player = (Player) event.getEntity(); - if (player.getItemInHand(InteractionHand.MAIN_HAND).getItem() instanceof SofteningTotemItem || player.getItemInHand(InteractionHand.OFF_HAND).getItem() instanceof SofteningTotemItem) { - event.setCanceled(true); - } - } - } @SubscribeEvent public static void onPlayerTick(TickEvent.PlayerTickEvent event) { Player player = event.player; @@ -479,41 +282,6 @@ public static void onPlayerTick(TickEvent.PlayerTickEvent event) { } } - @SubscribeEvent - public static void onLightningEvent(EntityJoinWorldEvent event) { - if (event.getEntity() instanceof LightningBolt) { - LightningBolt entity = (LightningBolt) event.getEntity(); - Level worldIn = event.getWorld(); - BlockPos startPos = entity.blockPosition().below(); - if (!worldIn.isClientSide && Config.GENERAL.LIGHTNING_CONVERSION.get()) { - Iterable positions = BlockPos.withinManhattan(startPos,2,2,2); - for (BlockPos pos : positions) { - double rand; - if (startPos.getX() == pos.getX() && startPos.getZ() == pos.getZ()) { - rand = 1/(1f + Math.abs(startPos.getY() - pos.getY())); - } else { - rand = pos.distSqr(new Vec3i(startPos.getX(),startPos.getY(),startPos.getZ())); - } - - Block BLK = worldIn.getBlockState(pos).getBlock(); - if (worldIn.getRandom().nextFloat() < 1/rand && ForgeRegistries.BLOCKS.tags().getTag(RankineTags.Blocks.LIGHTNING_VITRIFIED).contains(BLK)) { - worldIn.setBlock(pos,RankineBlocks.FULGURITE.get().defaultBlockState(),3); - } else if (worldIn.getRandom().nextFloat() < 1/rand && BLK.equals(Blocks.SAND) || BLK.equals(RankineBlocks.SILT.get()) || BLK.equals(RankineBlocks.DESERT_SAND.get())) { - worldIn.setBlock(pos,RankineBlocks.LIGHTNING_GLASS.get().defaultBlockState(),3); - } else if (worldIn.getRandom().nextFloat() < 1/rand && BLK.equals(Blocks.RED_SAND)) { - worldIn.setBlock(pos,RankineBlocks.RED_LIGHTNING_GLASS.get().defaultBlockState(),3); - } else if (worldIn.getRandom().nextFloat() < 1/rand && BLK.equals(Blocks.SOUL_SAND)) { - worldIn.setBlock(pos,RankineBlocks.SOUL_LIGHTNING_GLASS.get().defaultBlockState(),3); - } else if (worldIn.getRandom().nextFloat() < 1/rand && BLK.equals(RankineBlocks.BLACK_SAND.get())) { - worldIn.setBlock(pos,RankineBlocks.BLACK_LIGHTNING_GLASS.get().defaultBlockState(),3); - } else if (worldIn.getRandom().nextFloat() < 1/rand && BLK.equals(RankineBlocks.WHITE_SAND.get())) { - worldIn.setBlock(pos,RankineBlocks.WHITE_LIGHTNING_GLASS.get().defaultBlockState(),3); - } - } - } - } - } - @SubscribeEvent public static void onLivingDamaged(LivingDamageEvent event) { if (event.getEntityLiving() instanceof Player) { @@ -647,18 +415,54 @@ public static void onEnvironmentEffect(LivingEvent.LivingUpdateEvent event) { } - @SubscribeEvent - public static void fuelValues(WorldEvent.Load event) { - VanillaIntegration.populateFuelMap(); + public static void worldLoadEvent(WorldEvent.Load event) { + WorldLoadHandler.updateFuelValues(event); } - @SubscribeEvent - public static void fuelValues(FurnaceFuelBurnTimeEvent event) { - Item Fuel = event.getItemStack().getItem(); - if (VanillaIntegration.fuelValueMap.containsKey(Fuel)) { - event.setBurnTime(VanillaIntegration.fuelValueMap.get(Fuel)); - } + public static void furnaceFuelBurnTimeEvent(FurnaceFuelBurnTimeEvent event) { + FurnaceFuelBurnTimeHandler.updateFuelValues(event); + } + @SubscribeEvent + public static void entityInteractEvent(PlayerInteractEvent.EntityInteract event) { + EntityInteractHandler.breedables(event); + } + @SubscribeEvent + public static void noWater(BlockEvent.CreateFluidSourceEvent event) { + CreateFluidSourceHandler.noWater(event); + } + @SubscribeEvent + public static void entityJoinWorldEvent(EntityJoinWorldEvent event) { + EntityJoinWorldHandler.onLightningEvent(event); + EntityJoinWorldHandler.onSheepJoinWorld(event); + } + @SubscribeEvent(priority = EventPriority.LOWEST) + public static void chunkLoadEvent(ChunkEvent.Load event) { + ChunkLoadHandler.retrogenChunk(event); + } + @SubscribeEvent + public static void itemPickupEvent(PlayerEvent.ItemPickupEvent event) { + ItemPickupHandler.onItemPickup(event); + } + @SubscribeEvent + public static void wandererTradesEvent(WandererTradesEvent event) { + WandererTradesHandler.addWandererTrades(event); + } + @SubscribeEvent + public static void villagerTradesEvent(VillagerTradesEvent event) { + VillagerTradesHandler.addVillagerTrades(event); + } + @SubscribeEvent + public static void saplingGrowTreeEvent(SaplingGrowTreeEvent event) { + SaplingGrowTreeHandler.onSaplingGrow(event); + } + @SubscribeEvent + public static void onCropTrample(BlockEvent.FarmlandTrampleEvent event) { + FarmlandTrampleHandler.onCropTrample(event); + } + @SubscribeEvent + public static void anvilUpdateEvent(AnvilUpdateEvent event) { + AnvilUpdateHandler.specialEnchants(event); } @SubscribeEvent @@ -831,35 +635,6 @@ public static void movementModifier(TickEvent.PlayerTickEvent event) { } - @SubscribeEvent - public static void specialEnchants(AnvilUpdateEvent event) { - ItemStack input = event.getLeft(); - if (event.getRight().getItem() == RankineItems.SANDALS.get() && input.getItem() instanceof ArmorItem && ((ArmorItem)input.getItem()).getSlot() == EquipmentSlot.FEET) { - event.setOutput(input.copy()); - if (EnchantmentHelper.getItemEnchantmentLevel(RankineEnchantments.DUNE_WALKER,event.getOutput()) != 1) { - event.getOutput().enchant(RankineEnchantments.DUNE_WALKER, 1); - event.setCost(20); - } - } else if (event.getRight().getItem() == RankineItems.SNOWSHOES.get() && input.getItem() instanceof ArmorItem && ((ArmorItem)input.getItem()).getSlot() == EquipmentSlot.FEET) { - event.setOutput(input.copy()); - if (EnchantmentHelper.getItemEnchantmentLevel(RankineEnchantments.SNOW_DRIFTER,event.getOutput()) != 1) { - event.getOutput().enchant(RankineEnchantments.SNOW_DRIFTER, 1); - event.setCost(20); - } - } else if (event.getRight().getItem() == RankineItems.ICE_SKATES.get() && input.getItem() instanceof ArmorItem && ((ArmorItem)input.getItem()).getSlot() == EquipmentSlot.FEET) { - event.setOutput(input.copy()); - if (EnchantmentHelper.getItemEnchantmentLevel(RankineEnchantments.SPEED_SKATER,event.getOutput()) != 1) { - event.getOutput().enchant(RankineEnchantments.SPEED_SKATER, 1); - event.setCost(20); - } - } else if (event.getRight().getItem() == RankineItems.GAS_MASK.get() && input.getItem() instanceof ArmorItem && ((ArmorItem)input.getItem()).getSlot() == EquipmentSlot.HEAD) { - event.setOutput(input.copy()); - if (EnchantmentHelper.getItemEnchantmentLevel(RankineEnchantments.GAS_PROTECTION,event.getOutput()) != 1) { - event.getOutput().enchant(RankineEnchantments.GAS_PROTECTION, 1); - event.setCost(20); - } - } - } @SubscribeEvent @@ -978,13 +753,6 @@ public static void onFluidInteraction(BlockEvent.FluidPlaceBlockEvent event) } } } -/* - @SubscribeEvent - public static void onBlockPlaced(BlockEvent.EntityPlaceEvent event) { - if (event.getBlockSnapshot().getReplacedBlock().getBlock() instanceof GasBlock && event.getPlacedBlock().getBlock() instanceof AbstractFireBlock) { - event.setCanceled(true); - } - }*/ private static final String NBT_KEY = "rankine.firstjoin"; @SubscribeEvent @@ -1382,41 +1150,6 @@ public static void onDamageEntity(LivingDamageEvent event) { } - @OnlyIn(Dist.CLIENT) - @SubscribeEvent - public static void onTooltipCheck(ItemTooltipEvent event) { - if (Config.TOOLS.DISABLE_WOODEN_SWORD.get() && event.getItemStack().getItem() == Items.WOODEN_SWORD) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_WOODEN_AXE.get() && event.getItemStack().getItem() == Items.WOODEN_AXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_WOODEN_SHOVEL.get() && event.getItemStack().getItem() == Items.WOODEN_SHOVEL) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_WOODEN_PICKAXE.get() && event.getItemStack().getItem() == Items.WOODEN_PICKAXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_WOODEN_HOE.get() && event.getItemStack().getItem() == Items.WOODEN_HOE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_STONE_SWORD.get() && event.getItemStack().getItem() == Items.STONE_SWORD) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_STONE_AXE.get() && event.getItemStack().getItem() == Items.STONE_AXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_STONE_SHOVEL.get() && event.getItemStack().getItem() == Items.STONE_SHOVEL) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_STONE_PICKAXE.get() && event.getItemStack().getItem() == Items.STONE_PICKAXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_STONE_HOE.get() && event.getItemStack().getItem() == Items.STONE_HOE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_IRON_SWORD.get() && event.getItemStack().getItem() == Items.IRON_SWORD) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_IRON_AXE.get() && event.getItemStack().getItem() == Items.IRON_AXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_IRON_SHOVEL.get() && event.getItemStack().getItem() == Items.IRON_SHOVEL) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_IRON_PICKAXE.get() && event.getItemStack().getItem() == Items.IRON_PICKAXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_IRON_HOE.get() && event.getItemStack().getItem() == Items.IRON_HOE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_GOLDEN_SWORD.get() && event.getItemStack().getItem() == Items.GOLDEN_SWORD) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_GOLDEN_AXE.get() && event.getItemStack().getItem() == Items.GOLDEN_AXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_GOLDEN_SHOVEL.get() && event.getItemStack().getItem() == Items.GOLDEN_SHOVEL) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_GOLDEN_PICKAXE.get() && event.getItemStack().getItem() == Items.GOLDEN_PICKAXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_GOLDEN_HOE.get() && event.getItemStack().getItem() == Items.GOLDEN_HOE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_DIAMOND_SWORD.get() && event.getItemStack().getItem() == Items.DIAMOND_SWORD) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_DIAMOND_AXE.get() && event.getItemStack().getItem() == Items.DIAMOND_AXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_DIAMOND_SHOVEL.get() && event.getItemStack().getItem() == Items.DIAMOND_SHOVEL) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_DIAMOND_PICKAXE.get() && event.getItemStack().getItem() == Items.DIAMOND_PICKAXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_DIAMOND_HOE.get() && event.getItemStack().getItem() == Items.DIAMOND_HOE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_NETHERITE_SWORD.get() && event.getItemStack().getItem() == Items.NETHERITE_SWORD) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_NETHERITE_AXE.get() && event.getItemStack().getItem() == Items.NETHERITE_AXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_NETHERITE_SHOVEL.get() && event.getItemStack().getItem() == Items.NETHERITE_SHOVEL) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_NETHERITE_PICKAXE.get() && event.getItemStack().getItem() == Items.NETHERITE_PICKAXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - if (Config.TOOLS.DISABLE_NETHERITE_HOE.get() && event.getItemStack().getItem() == Items.NETHERITE_HOE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } - } - @SubscribeEvent public static void onLeftClick(PlayerInteractEvent.LeftClickBlock event) { if (event.getPlayer().getMainHandItem().getItem() instanceof HammerItem) { @@ -1453,65 +1186,6 @@ public static void onLeftClick(PlayerInteractEvent.LeftClickBlock event) { } } -/* - @SubscribeEvent - public static void onPistonCrush(PistonEvent event) - { - Direction pistonDir = event.getDirection(); - BlockPos end = event.getFaceOffsetPos(); - BlockPos barrier = event.getFaceOffsetPos().offset(pistonDir,1); - IWorld world = event.getWorld(); - World worldIn = world.getWorld(); - - if (event.getPistonMoveType() == PistonEvent.PistonMoveType.EXTEND && !PistonCrusherRecipes.getInstance().getPrimaryResult(new ItemStack(world.getBlockState(end).getBlock())).getKey().isEmpty() && event.getState().getBlock() != Blocks.STICKY_PISTON && world.getBlockState(barrier).getBlock() == ModBlocks.CAST_IRON_BLOCK) - { - world.destroyBlock(end, false); - if (!worldIn.isRemote() && worldIn.getGameRules().getBoolean(GameRules.DO_TILE_DROPS) && !worldIn.restoringBlockSnapshots) - { - Pair p = PistonCrusherRecipes.getInstance().getPrimaryResult(new ItemStack(world.getBlockState(end).getBlock())); - float f = 0.5F; - Random rand = rand; - double d0 = (double)(rand.nextFloat() * 0.5F) + 0.25D; - double d1 = (double)(rand.nextFloat() * 0.5F) + 0.25D; - double d2 = (double)(rand.nextFloat() * 0.5F) + 0.25D; - ItemEntity itementity = new ItemEntity(worldIn, (double)end.getX() + d0, (double)end.getY() + d1, (double)end.getZ() + d2, new ItemStack(p.getKey().getItem(),p.getValue()[0].intValue())); - itementity.setDefaultPickupDelay(); - worldIn.addEntity(itementity); - } - } - } - - @SubscribeEvent - public static void glassCheck(ProjectileImpactEvent event) - { - World worldIn = event.getEntity().getEntityWorld(); - RayTraceResult e = event.getRayTraceResult(); // Only works at certain angle/look position - BlockPos hit = new BlockPos(e.getHitVec().getX(), e.getHitVec().getY(), e.getHitVec().getZ()); - System.out.println(hit); - System.out.println(worldIn.getBlockState(hit).getBlock()); - if (worldIn.getBlockState(hit).getBlock() instanceof GlassBlock && !worldIn.isRemote() && worldIn.getGameRules().getBoolean(GameRules.DO_TILE_DROPS) && !worldIn.restoringBlockSnapshots) - { - System.out.println("SUCCESS"); - double d0 = (double)hit.getX() + 0.5D; - double d1 = (double)hit.getY(); - double d2 = (double)hit.getZ() + 0.5D; - worldIn.playSound(d0, d1, d2, SoundEvents.BLOCK_GLASS_BREAK, SoundCategory.BLOCKS, 1.0F, 1.0F, false); - worldIn.removeBlock(new BlockPos(hit),false); - float f = 0.5F; - Random rand = rand; - double e0 = (double)(rand.nextFloat() * 0.5F) + 0.25D; - double e1 = (double)(rand.nextFloat() * 0.5F) + 0.25D; - double e2 = (double)(rand.nextFloat() * 0.5F) + 0.25D; - ItemEntity itementity = new ItemEntity(worldIn, (double)hit.getX() + e0, (double)hit.getY() + e1, (double)hit.getZ() + e2, new ItemStack(Items.GLASS,1)); - itementity.setDefaultPickupDelay(); - worldIn.addEntity(itementity); - } - - } - - */ - - @SubscribeEvent public static void worldDye(PlayerInteractEvent.RightClickBlock event) { Stream> targetStream = ForgeRegistries.BLOCKS.tags().getReverseTag(event.getWorld().getBlockState(event.getPos()).getBlock()).map(IReverseTag::getTagKeys).orElseGet(Stream::of); @@ -1883,6 +1557,16 @@ public static void flintFire(PlayerInteractEvent.RightClickBlock event) { } } world.playSound(player, blockpos1, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.0F, rand.nextFloat() * 0.4F + 0.8F); + } else if (world.getBlockState(pos) == Blocks.CAMPFIRE.defaultBlockState().setValue(BlockStateProperties.LIT, false)) { + if (!world.isClientSide()) { + world.setBlock(pos, world.getBlockState(pos).setValue(BlockStateProperties.LIT, Boolean.TRUE), 3); + player.swing(InteractionHand.MAIN_HAND); + if (rand.nextFloat() < Config.GENERAL.FLINT_FIRE_CHANCE.get()) { + player.getItemInHand(InteractionHand.MAIN_HAND).shrink(1); + player.getItemInHand(InteractionHand.OFF_HAND).shrink(1); + } + } + world.playSound(player, blockpos1, SoundEvents.FLINTANDSTEEL_USE, SoundSource.BLOCKS, 1.0F, rand.nextFloat() * 0.4F + 0.8F); } else if (BaseFireBlock.canBePlacedAt(world, blockpos1, event.getFace()) && !world.isClientSide && !(world.getBlockState(pos).getBlock() instanceof BeehiveOvenPitBlock) && world.getBlockState(pos) != RankineBlocks.CHARCOAL_PIT.get().defaultBlockState().setValue(CharcoalPitBlock.LIT, true)) { world.setBlock(blockpos1, BaseFireBlock.getState(world, blockpos1), 11); @@ -2092,29 +1776,6 @@ public static void axeStrip(PlayerInteractEvent.RightClickBlock event) { } } - @SubscribeEvent - public static void noWater(BlockEvent.CreateFluidSourceEvent event) { - /* - List waterBiomes = WorldgenUtils.getBiomeNamesFromCategory(Collections.emptyList(), true); - - for (String b : Config.GENERAL.INFI_WATER_BIOMES.get()) { - List biomeName = Arrays.asList(b.split(":")); - if (biomeName.size() > 1) { - waterBiomes.add(ResourceLocation.tryCreate(b)); - } else { - waterBiomes.addAll(WorldgenUtils.getBiomeNamesFromCategory(Collections.singletonList(Biome.Category.byName(b)), true)); - } - } - if (Config.GENERAL.DISABLE_WATER.get() && !waterBiomes.contains(event.getWorld().getBiome(event.getPos()).toString())) { - event.setResult(Event.Result.DENY); - } - - */ - if (Config.GENERAL.DISABLE_WATER.get() && event.getPos().getY() > WorldgenUtils.waterTableHeight((Level) event.getWorld(), event.getPos())) { - event.setResult(Event.Result.DENY); - } - - } @SubscribeEvent public static void treeChop(PlayerEvent.BreakSpeed event) { @@ -2417,35 +2078,6 @@ else if ( == Biome.BiomeCategory.THEEND && rand.nextFloat() < Config.GENERAL.GLO } - - @SubscribeEvent - public static void onSheepJoinWorld(EntityJoinWorldEvent event) { - Entity entity = event.getEntity(); - if (entity instanceof Sheep) { - Sheep ent = (Sheep) entity; - ent.goalSelector.removeGoal(new EatBlockGoal(ent)); - ent.goalSelector.addGoal(5,new EatGrassGoalModified(ent)); - ent.goalSelector.removeGoal(new TemptGoal(ent, 1.1D, Ingredient.of(Items.WHEAT), false)); - ent.goalSelector.addGoal(3,new TemptGoal(ent, 1.1D, Ingredient.of(RankineTags.Items.BREEDABLES_SHEEP), false)); - } else if (entity instanceof Cow) { - Cow ent = (Cow) entity; - //ent.goalSelector.removeGoal(new TemptGoal(ent, 1.1D, Ingredient.fromItems(Items.WHEAT), false)); - ent.goalSelector.addGoal(3,new TemptGoal(ent, 1.25D, Ingredient.of(RankineTags.Items.BREEDABLES_COW), false)); - } else if (entity instanceof Pig) { - Pig ent = (Pig) entity; - //ent.goalSelector.removeGoal(new TemptGoal(ent, 1.1D, Ingredient.fromItems(Items.WHEAT), false)); - ent.goalSelector.addGoal(4,new TemptGoal(ent, 1.2D, Ingredient.of(RankineTags.Items.BREEDABLES_PIG), false)); - } else if (entity instanceof Chicken) { - Chicken ent = (Chicken) entity; - //ent.goalSelector.removeGoal(new TemptGoal(ent, 1.1D, Ingredient.fromItems(Items.WHEAT), false)); - ent.goalSelector.addGoal(3,new TemptGoal(ent, 1.0D, Ingredient.of(RankineTags.Items.BREEDABLES_CHICKEN), false)); - } else if (entity instanceof Rabbit) { - Rabbit ent = (Rabbit) entity; - //ent.goalSelector.removeGoal(new TemptGoal(ent, 1.1D, Ingredient.fromItems(Items.WHEAT), false)); - ent.goalSelector.addGoal(3,new TemptGoal(ent, 1.0D, Ingredient.of(RankineTags.Items.BREEDABLES_RABBIT), false)); - } - } - @SubscribeEvent public static void onLivingSetAttackTarget(LivingSetAttackTargetEvent event) { if (event.getEntityLiving() instanceof Monster && event.getTarget() != null) { @@ -2465,62 +2097,5 @@ public static void onLivingUpdate(LivingEvent.LivingUpdateEvent event) { } - @SubscribeEvent - public static void onBreedEvent(PlayerInteractEvent.EntityInteract event) { - Player player = event.getPlayer(); - Entity ent = event.getTarget(); - ItemStack itemStack = event.getItemStack(); - - if (ent instanceof Animal) { - Animal entA = (Animal) ent; - EntityType type = ent.getType(); - boolean flag = false; - if (type.equals(EntityType.PIG) && itemStack.is(RankineTags.Items.BREEDABLES_PIG)) { - flag = true; - } else if ((type.equals(EntityType.COW) || type.equals(EntityType.MOOSHROOM)) && itemStack.is(RankineTags.Items.BREEDABLES_COW)) { - flag = true; - } else if (type.equals(EntityType.SHEEP) && itemStack.is(RankineTags.Items.BREEDABLES_SHEEP)) { - flag = true; - } else if (type.equals(EntityType.CHICKEN) && itemStack.is(RankineTags.Items.BREEDABLES_CHICKEN)) { - flag = true; - } else if (type.equals(EntityType.FOX) && itemStack.is(RankineTags.Items.BREEDABLES_FOX)) { - flag = true; - } else if (type.equals(EntityType.RABBIT) && itemStack.is(RankineTags.Items.BREEDABLES_RABBIT)) { - flag = true; - } else if (type.equals(EntityType.CAT) && itemStack.is(RankineTags.Items.BREEDABLES_CAT)) { - flag = true; - } else if ((type.equals(EntityType.HORSE) || type.equals(EntityType.DONKEY)) && itemStack.is(RankineTags.Items.BREEDABLES_HORSE)) { - flag = true; - } - - if (flag) { - int i = entA.getAge(); - if (!entA.level.isClientSide && i == 0 && entA.canFallInLove()) { - if (!player.getAbilities().instabuild) { - itemStack.shrink(1); - } - entA.setInLove(player); - event.setResult(Event.Result.ALLOW); - } - - if (entA.isBaby()) { - if (!player.getAbilities().instabuild) { - itemStack.shrink(1); - } - entA.ageUp((int) ((float) (-i / 20) * 0.1F), true); - event.setResult(Event.Result.ALLOW); - } - - if (entA.level.isClientSide) { - event.setResult(Event.Result.ALLOW); - } - } else { - event.setResult(Event.Result.DENY); - } - - } - - - } } diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/client/FOVModifierHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/client/FOVModifierHandler.java new file mode 100644 index 0000000000..6217b3fbb5 --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/client/FOVModifierHandler.java @@ -0,0 +1,24 @@ +package com.cannolicatfish.rankine.events.handlers.client; + +import com.cannolicatfish.rankine.init.Config; +import com.cannolicatfish.rankine.init.RankineAttributes; +import net.minecraft.client.Minecraft; +import net.minecraft.world.entity.ai.attributes.AttributeInstance; +import net.minecraft.world.entity.ai.attributes.Attributes; +import net.minecraft.world.entity.player.Player; +import net.minecraftforge.client.event.FOVModifierEvent; + +public class FOVModifierHandler { + public static void fovUpdate(FOVModifierEvent event) { + Player player = event.getEntity(); + AttributeInstance movementSpeed = player.getAttribute(Attributes.MOVEMENT_SPEED); + if (Config.GENERAL.MOVEMENT_MODIFIERS.get() && movementSpeed != null) { + if (movementSpeed.hasModifier(RankineAttributes.GRASS_PATH_MS) || movementSpeed.hasModifier(RankineAttributes.SAND_MS) || movementSpeed.hasModifier(RankineAttributes.BRICKS_MS) || + movementSpeed.hasModifier(RankineAttributes.ROMAN_CONCRETE_MS) || movementSpeed.hasModifier(RankineAttributes.DIRT_MS) || movementSpeed.hasModifier(RankineAttributes.POLISHED_STONE_MS) || + movementSpeed.hasModifier(RankineAttributes.WOODEN_MS) || movementSpeed.hasModifier(RankineAttributes.CONCRETE_MS) || movementSpeed.hasModifier(RankineAttributes.SNOW_MS) || + movementSpeed.hasModifier(RankineAttributes.MUD_MS)) { + event.setNewfov(Minecraft.getInstance().options.fovEffectScale * (player.isSprinting() ? 1.3f : 1)); + } + } + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/client/ItemTooltipHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/client/ItemTooltipHandler.java new file mode 100644 index 0000000000..f273a2eda3 --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/client/ItemTooltipHandler.java @@ -0,0 +1,42 @@ +package com.cannolicatfish.rankine.events.handlers.client; + +import com.cannolicatfish.rankine.init.Config; +import net.minecraft.ChatFormatting; +import net.minecraft.network.chat.TextComponent; +import net.minecraft.world.item.Items; +import net.minecraftforge.event.entity.player.ItemTooltipEvent; + +public class ItemTooltipHandler { + public static void onTooltipCheck(ItemTooltipEvent event) { + if (Config.TOOLS.DISABLE_WOODEN_SWORD.get() && event.getItemStack().getItem() == Items.WOODEN_SWORD) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_WOODEN_AXE.get() && event.getItemStack().getItem() == Items.WOODEN_AXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_WOODEN_SHOVEL.get() && event.getItemStack().getItem() == Items.WOODEN_SHOVEL) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_WOODEN_PICKAXE.get() && event.getItemStack().getItem() == Items.WOODEN_PICKAXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_WOODEN_HOE.get() && event.getItemStack().getItem() == Items.WOODEN_HOE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_STONE_SWORD.get() && event.getItemStack().getItem() == Items.STONE_SWORD) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_STONE_AXE.get() && event.getItemStack().getItem() == Items.STONE_AXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_STONE_SHOVEL.get() && event.getItemStack().getItem() == Items.STONE_SHOVEL) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_STONE_PICKAXE.get() && event.getItemStack().getItem() == Items.STONE_PICKAXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_STONE_HOE.get() && event.getItemStack().getItem() == Items.STONE_HOE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_IRON_SWORD.get() && event.getItemStack().getItem() == Items.IRON_SWORD) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_IRON_AXE.get() && event.getItemStack().getItem() == Items.IRON_AXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_IRON_SHOVEL.get() && event.getItemStack().getItem() == Items.IRON_SHOVEL) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_IRON_PICKAXE.get() && event.getItemStack().getItem() == Items.IRON_PICKAXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_IRON_HOE.get() && event.getItemStack().getItem() == Items.IRON_HOE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_GOLDEN_SWORD.get() && event.getItemStack().getItem() == Items.GOLDEN_SWORD) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_GOLDEN_AXE.get() && event.getItemStack().getItem() == Items.GOLDEN_AXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_GOLDEN_SHOVEL.get() && event.getItemStack().getItem() == Items.GOLDEN_SHOVEL) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_GOLDEN_PICKAXE.get() && event.getItemStack().getItem() == Items.GOLDEN_PICKAXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_GOLDEN_HOE.get() && event.getItemStack().getItem() == Items.GOLDEN_HOE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_DIAMOND_SWORD.get() && event.getItemStack().getItem() == Items.DIAMOND_SWORD) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_DIAMOND_AXE.get() && event.getItemStack().getItem() == Items.DIAMOND_AXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_DIAMOND_SHOVEL.get() && event.getItemStack().getItem() == Items.DIAMOND_SHOVEL) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_DIAMOND_PICKAXE.get() && event.getItemStack().getItem() == Items.DIAMOND_PICKAXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_DIAMOND_HOE.get() && event.getItemStack().getItem() == Items.DIAMOND_HOE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_NETHERITE_SWORD.get() && event.getItemStack().getItem() == Items.NETHERITE_SWORD) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_NETHERITE_AXE.get() && event.getItemStack().getItem() == Items.NETHERITE_AXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_NETHERITE_SHOVEL.get() && event.getItemStack().getItem() == Items.NETHERITE_SHOVEL) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_NETHERITE_PICKAXE.get() && event.getItemStack().getItem() == Items.NETHERITE_PICKAXE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + if (Config.TOOLS.DISABLE_NETHERITE_HOE.get() && event.getItemStack().getItem() == Items.NETHERITE_HOE) { event.getToolTip().add(new TextComponent("This tool is disabled in the config.").withStyle(ChatFormatting.RED)); } + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/client/RecipesUpdatedHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/client/RecipesUpdatedHandler.java new file mode 100644 index 0000000000..1d17095a27 --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/client/RecipesUpdatedHandler.java @@ -0,0 +1,34 @@ +package com.cannolicatfish.rankine.events.handlers.client; + +import com.cannolicatfish.rankine.init.RankineRecipeTypes; +import com.cannolicatfish.rankine.recipe.AlloyCraftingRecipe; +import com.cannolicatfish.rankine.recipe.AlloyingRecipe; +import com.cannolicatfish.rankine.recipe.ElementRecipe; +import com.cannolicatfish.rankine.recipe.helper.AlloyCustomHelper; +import net.minecraft.client.Minecraft; +import net.minecraft.client.multiplayer.ClientLevel; +import net.minecraft.world.item.crafting.RecipeType; +import net.minecraftforge.client.event.RecipesUpdatedEvent; + +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +public class RecipesUpdatedHandler { + public static void onRecipesUpdated(RecipesUpdatedEvent event) { + ClientLevel world = Minecraft.getInstance().level; + if (world != null) { + List alloyingRecipes = new ArrayList<>(world.getRecipeManager().getAllRecipesFor(RankineRecipeTypes.ALLOYING)); + AlloyCustomHelper.setAlloyingRecipes(alloyingRecipes); + + List elementRecipes = new ArrayList<>(world.getRecipeManager().getAllRecipesFor(RankineRecipeTypes.ELEMENT)); + AlloyCustomHelper.setElementRecipes(elementRecipes); + + List alloyCraftingRecipes = world.getRecipeManager().getAllRecipesFor(RecipeType.CRAFTING).stream() + .filter((iCraftingRecipe -> iCraftingRecipe instanceof AlloyCraftingRecipe)) + .map(AlloyCraftingRecipe.class::cast) + .collect(Collectors.toList()); + AlloyCustomHelper.setCraftingRecipes(alloyCraftingRecipes); + } + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/client/RenderBlockOverlayHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/client/RenderBlockOverlayHandler.java new file mode 100644 index 0000000000..d3ec445a64 --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/client/RenderBlockOverlayHandler.java @@ -0,0 +1,40 @@ +package com.cannolicatfish.rankine.events.handlers.client; + +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.*; +import com.mojang.math.Matrix4f; +import net.minecraft.client.Minecraft; +import net.minecraft.resources.ResourceLocation; +import net.minecraftforge.client.event.RenderBlockOverlayEvent; + +public class RenderBlockOverlayHandler { + public static void renderOverlayBlockEvent(RenderBlockOverlayEvent event) { + if (event.getOverlayType() == RenderBlockOverlayEvent.OverlayType.WATER && event.getBlockState().getBlock().getRegistryName().getNamespace().equals("rankine")) { + Minecraft minecraftIn = Minecraft.getInstance(); + RenderSystem.enableTexture(); + minecraftIn.getTextureManager().bindForSetup(new ResourceLocation("rankine:textures/block/"+event.getBlockState().getBlock().getRegistryName().getPath()+"_overlay.png")); + BufferBuilder bufferbuilder = Tesselator.getInstance().getBuilder(); + float f = minecraftIn.player.getBrightness(); + RenderSystem.enableBlend(); + RenderSystem.defaultBlendFunc(); + float f1 = 4.0F; + float f2 = -1.0F; + float f3 = 1.0F; + float f4 = -1.0F; + float f5 = 1.0F; + float f6 = -0.5F; + float f7 = -minecraftIn.player.getYRot() / 64.0F; + float f8 = minecraftIn.player.getXRot() / 64.0F; + Matrix4f matrix4f = event.getPoseStack().last().pose(); + bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_COLOR_TEX); + bufferbuilder.vertex(matrix4f, -1.0F, -1.0F, -0.5F).color(f, f, f, 0.1F).uv(4.0F + f7, 4.0F + f8).endVertex(); + bufferbuilder.vertex(matrix4f, 1.0F, -1.0F, -0.5F).color(f, f, f, 0.1F).uv(0.0F + f7, 4.0F + f8).endVertex(); + bufferbuilder.vertex(matrix4f, 1.0F, 1.0F, -0.5F).color(f, f, f, 0.1F).uv(0.0F + f7, 0.0F + f8).endVertex(); + bufferbuilder.vertex(matrix4f, -1.0F, 1.0F, -0.5F).color(f, f, f, 0.1F).uv(4.0F + f7, 0.0F + f8).endVertex(); + bufferbuilder.end(); + BufferUploader.end(bufferbuilder); + RenderSystem.disableBlend(); + event.setCanceled(true); + } + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/client/RenderGameOverlayHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/client/RenderGameOverlayHandler.java new file mode 100644 index 0000000000..0237da34b3 --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/client/RenderGameOverlayHandler.java @@ -0,0 +1,84 @@ +package com.cannolicatfish.rankine.events.handlers.client; + +import com.cannolicatfish.rankine.blocks.GasBlock; +import com.cannolicatfish.rankine.init.RankineEnchantments; +import com.cannolicatfish.rankine.items.tools.KnifeItem; +import com.mojang.blaze3d.systems.RenderSystem; +import com.mojang.blaze3d.vertex.BufferBuilder; +import com.mojang.blaze3d.vertex.DefaultVertexFormat; +import com.mojang.blaze3d.vertex.Tesselator; +import com.mojang.blaze3d.vertex.VertexFormat; +import net.minecraft.client.Minecraft; +import net.minecraft.core.BlockPos; +import net.minecraft.resources.ResourceLocation; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraftforge.client.event.RenderGameOverlayEvent; +import org.lwjgl.opengl.GL11; + +public class RenderGameOverlayHandler { + public static void renderOverlay(RenderGameOverlayEvent event) { + if (event.getType() == RenderGameOverlayEvent.ElementType.LAYER && Minecraft.getInstance().player != null) { + Player player = Minecraft.getInstance().player; + ItemStack stack = player.getOffhandItem().getItem() instanceof KnifeItem ? player.getOffhandItem() : ItemStack.EMPTY; + if (!stack.isEmpty()) { + int i = stack.getItem().getUseDuration(stack) - player.getUseItemRemainingTicks(); + if (i < (10 + EnchantmentHelper.getItemEnchantmentLevel(RankineEnchantments.PREPARATION,stack))) { + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + RenderSystem.disableDepthTest(); + RenderSystem.depthMask(false); + RenderSystem.defaultBlendFunc(); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + //RenderSystem.disableAlphaTest(); + Minecraft.getInstance().getTextureManager().bindForSetup(new ResourceLocation("rankine:textures/misc/parry_overlay.png")); + Tesselator tessellator = Tesselator.getInstance(); + BufferBuilder bufferbuilder = tessellator.getBuilder(); + bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + bufferbuilder.vertex(0.0D, (double)event.getWindow().getGuiScaledHeight(), -90.0D).uv(0.0F, 1.0F).endVertex(); + bufferbuilder.vertex((double)event.getWindow().getGuiScaledWidth(), (double)event.getWindow().getGuiScaledHeight(), -90.0D).uv(1.0F, 1.0F).endVertex(); + bufferbuilder.vertex((double)event.getWindow().getGuiScaledWidth(), 0.0D, -90.0D).uv(1.0F, 0.0F).endVertex(); + bufferbuilder.vertex(0.0D, 0.0D, -90.0D).uv(0.0F, 0.0F).endVertex(); + tessellator.end(); + RenderSystem.depthMask(true); + RenderSystem.enableDepthTest(); + //RenderSystem.enableAlphaTest(); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + } + } + } + if (event.getType() == RenderGameOverlayEvent.ElementType.LAYER && Minecraft.getInstance().player != null) { + Player player = Minecraft.getInstance().player; + Level worldIn = player.getCommandSenderWorld(); + + Block bl = worldIn.getBlockState(new BlockPos(player.getX(),player.getEyeY(),player.getZ())).getBlock(); + if (bl instanceof GasBlock) { + GL11.glPushMatrix(); + GL11.glEnable(GL11.GL_BLEND); + RenderSystem.disableDepthTest(); + RenderSystem.depthMask(false); + RenderSystem.defaultBlendFunc(); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + //RenderSystem.disableAlphaTest(); + Minecraft.getInstance().getTextureManager().bindForSetup(new ResourceLocation("rankine:textures/block/"+bl.getRegistryName().getPath()+".png")); + Tesselator tessellator = Tesselator.getInstance(); + BufferBuilder bufferbuilder = tessellator.getBuilder(); + bufferbuilder.begin(VertexFormat.Mode.QUADS, DefaultVertexFormat.POSITION_TEX); + bufferbuilder.vertex(0.0D, (double)event.getWindow().getGuiScaledHeight(), -90.0D).uv(0.0F, 1.0F).endVertex(); + bufferbuilder.vertex((double)event.getWindow().getGuiScaledWidth(), (double)event.getWindow().getGuiScaledHeight(), -90.0D).uv(1.0F, 1.0F).endVertex(); + bufferbuilder.vertex((double)event.getWindow().getGuiScaledWidth(), 0.0D, -90.0D).uv(1.0F, 0.0F).endVertex(); + bufferbuilder.vertex(0.0D, 0.0D, -90.0D).uv(0.0F, 0.0F).endVertex(); + tessellator.end(); + RenderSystem.depthMask(true); + RenderSystem.enableDepthTest(); + //RenderSystem.enableAlphaTest(); + RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F); + GL11.glPopMatrix(); + } + } + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/common/AnvilUpdateHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/AnvilUpdateHandler.java new file mode 100644 index 0000000000..812bd26d9b --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/AnvilUpdateHandler.java @@ -0,0 +1,40 @@ +package com.cannolicatfish.rankine.events.handlers.common; + +import com.cannolicatfish.rankine.init.RankineEnchantments; +import com.cannolicatfish.rankine.init.RankineItems; +import net.minecraft.world.entity.EquipmentSlot; +import net.minecraft.world.item.ArmorItem; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.enchantment.EnchantmentHelper; +import net.minecraftforge.event.AnvilUpdateEvent; + +public class AnvilUpdateHandler { + public static void specialEnchants(AnvilUpdateEvent event) { + ItemStack input = event.getLeft(); + if (event.getRight().getItem() == RankineItems.SANDALS.get() && input.getItem() instanceof ArmorItem && ((ArmorItem)input.getItem()).getSlot() == EquipmentSlot.FEET) { + event.setOutput(input.copy()); + if (EnchantmentHelper.getItemEnchantmentLevel(RankineEnchantments.DUNE_WALKER,event.getOutput()) != 1) { + event.getOutput().enchant(RankineEnchantments.DUNE_WALKER, 1); + event.setCost(20); + } + } else if (event.getRight().getItem() == RankineItems.SNOWSHOES.get() && input.getItem() instanceof ArmorItem && ((ArmorItem)input.getItem()).getSlot() == EquipmentSlot.FEET) { + event.setOutput(input.copy()); + if (EnchantmentHelper.getItemEnchantmentLevel(RankineEnchantments.SNOW_DRIFTER,event.getOutput()) != 1) { + event.getOutput().enchant(RankineEnchantments.SNOW_DRIFTER, 1); + event.setCost(20); + } + } else if (event.getRight().getItem() == RankineItems.ICE_SKATES.get() && input.getItem() instanceof ArmorItem && ((ArmorItem)input.getItem()).getSlot() == EquipmentSlot.FEET) { + event.setOutput(input.copy()); + if (EnchantmentHelper.getItemEnchantmentLevel(RankineEnchantments.SPEED_SKATER,event.getOutput()) != 1) { + event.getOutput().enchant(RankineEnchantments.SPEED_SKATER, 1); + event.setCost(20); + } + } else if (event.getRight().getItem() == RankineItems.GAS_MASK.get() && input.getItem() instanceof ArmorItem && ((ArmorItem)input.getItem()).getSlot() == EquipmentSlot.HEAD) { + event.setOutput(input.copy()); + if (EnchantmentHelper.getItemEnchantmentLevel(RankineEnchantments.GAS_PROTECTION,event.getOutput()) != 1) { + event.getOutput().enchant(RankineEnchantments.GAS_PROTECTION, 1); + event.setCost(20); + } + } + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/common/ChunkLoadHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/ChunkLoadHandler.java new file mode 100644 index 0000000000..07e381d7f3 --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/ChunkLoadHandler.java @@ -0,0 +1,27 @@ +package com.cannolicatfish.rankine.events.handlers.common; + +import com.cannolicatfish.rankine.capabilities.ChunkRetrogenProvider; +import com.cannolicatfish.rankine.capabilities.IChunkRetrogenHandler; +import com.cannolicatfish.rankine.init.Config; +import com.cannolicatfish.rankine.util.ReplacementUtils; +import net.minecraft.world.level.chunk.ChunkAccess; +import net.minecraft.world.level.chunk.ChunkStatus; +import net.minecraftforge.common.capabilities.ICapabilityProvider; +import net.minecraftforge.common.util.LazyOptional; +import net.minecraftforge.event.world.ChunkEvent; + +public class ChunkLoadHandler { + public static void retrogenChunk(ChunkEvent.Load event) { + if (!event.getWorld().isClientSide() && Config.WORLDGEN.RETRO_GEN.get()) { + ChunkAccess chunkAccess = event.getChunk(); + if (chunkAccess instanceof ICapabilityProvider && chunkAccess.getStatus().isOrAfter(ChunkStatus.FULL)) { + LazyOptional capability = ((ICapabilityProvider) chunkAccess).getCapability(ChunkRetrogenProvider.CAPABILITY, null); + if (capability.isPresent() && capability.resolve().isPresent() && !capability.resolve().get().getValue()) { + ReplacementUtils.performRetrogenReplacement(chunkAccess); + capability.ifPresent(iChunkRetrogenHandler -> iChunkRetrogenHandler.setValue(true)); + } + } + } + + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/common/CreateFluidSourceHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/CreateFluidSourceHandler.java new file mode 100644 index 0000000000..ccde6a04b1 --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/CreateFluidSourceHandler.java @@ -0,0 +1,15 @@ +package com.cannolicatfish.rankine.events.handlers.common; + +import com.cannolicatfish.rankine.init.Config; +import com.cannolicatfish.rankine.util.WorldgenUtils; +import net.minecraft.world.level.Level; +import net.minecraftforge.event.world.BlockEvent; +import net.minecraftforge.eventbus.api.Event; + +public class CreateFluidSourceHandler { + public static void noWater(BlockEvent.CreateFluidSourceEvent event) { + if (Config.GENERAL.DISABLE_WATER.get() && event.getPos().getY() > WorldgenUtils.waterTableHeight((Level) event.getWorld(), event.getPos())) { + event.setResult(Event.Result.DENY); + } + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/common/EntityInteractHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/EntityInteractHandler.java new file mode 100644 index 0000000000..b8995257b4 --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/EntityInteractHandler.java @@ -0,0 +1,68 @@ +package com.cannolicatfish.rankine.events.handlers.common; + +import com.cannolicatfish.rankine.init.RankineTags; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.EntityType; +import net.minecraft.world.entity.animal.Animal; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.event.entity.player.PlayerInteractEvent; +import net.minecraftforge.eventbus.api.Event; + +public class EntityInteractHandler { + public static void breedables(PlayerInteractEvent.EntityInteract event) { + Player player = event.getPlayer(); + Entity ent = event.getTarget(); + ItemStack itemStack = event.getItemStack(); + + if (ent instanceof Animal entA) { + EntityType type = ent.getType(); + boolean flag = false; + if (type.equals(EntityType.PIG) && itemStack.is(RankineTags.Items.BREEDABLES_PIG)) { + flag = true; + } else if ((type.equals(EntityType.COW) || type.equals(EntityType.MOOSHROOM)) && itemStack.is(RankineTags.Items.BREEDABLES_COW)) { + flag = true; + } else if (type.equals(EntityType.SHEEP) && itemStack.is(RankineTags.Items.BREEDABLES_SHEEP)) { + flag = true; + } else if (type.equals(EntityType.CHICKEN) && itemStack.is(RankineTags.Items.BREEDABLES_CHICKEN)) { + flag = true; + } else if (type.equals(EntityType.FOX) && itemStack.is(RankineTags.Items.BREEDABLES_FOX)) { + flag = true; + } else if (type.equals(EntityType.RABBIT) && itemStack.is(RankineTags.Items.BREEDABLES_RABBIT)) { + flag = true; + } else if (type.equals(EntityType.CAT) && itemStack.is(RankineTags.Items.BREEDABLES_CAT)) { + flag = true; + } else if ((type.equals(EntityType.HORSE) || type.equals(EntityType.DONKEY)) && itemStack.is(RankineTags.Items.BREEDABLES_HORSE)) { + flag = true; + } + + if (flag) { + int i = entA.getAge(); + if (!entA.level.isClientSide && i == 0 && entA.canFallInLove()) { + if (!player.getAbilities().instabuild) { + itemStack.shrink(1); + } + entA.setInLove(player); + event.setResult(Event.Result.ALLOW); + } + + if (entA.isBaby()) { + if (!player.getAbilities().instabuild) { + itemStack.shrink(1); + } + entA.ageUp((int) ((float) (-i / 20) * 0.1F), true); + event.setResult(Event.Result.ALLOW); + } + + if (entA.level.isClientSide) { + event.setResult(Event.Result.ALLOW); + } + } else { + event.setResult(Event.Result.DENY); + } + + } + + + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/common/EntityJoinWorldHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/EntityJoinWorldHandler.java new file mode 100644 index 0000000000..9628e020f8 --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/EntityJoinWorldHandler.java @@ -0,0 +1,74 @@ +package com.cannolicatfish.rankine.events.handlers.common; + +import com.cannolicatfish.rankine.entities.goals.EatGrassGoalModified; +import com.cannolicatfish.rankine.init.Config; +import com.cannolicatfish.rankine.init.RankineBlocks; +import com.cannolicatfish.rankine.init.RankineTags; +import net.minecraft.core.BlockPos; +import net.minecraft.core.Vec3i; +import net.minecraft.world.entity.Entity; +import net.minecraft.world.entity.LightningBolt; +import net.minecraft.world.entity.ai.goal.EatBlockGoal; +import net.minecraft.world.entity.ai.goal.TemptGoal; +import net.minecraft.world.entity.animal.*; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.crafting.Ingredient; +import net.minecraft.world.level.Level; +import net.minecraft.world.level.block.Block; +import net.minecraft.world.level.block.Blocks; +import net.minecraftforge.event.entity.EntityJoinWorldEvent; +import net.minecraftforge.registries.ForgeRegistries; + +public class EntityJoinWorldHandler { + public static void onLightningEvent(EntityJoinWorldEvent event) { + if (event.getEntity() instanceof LightningBolt) { + LightningBolt entity = (LightningBolt) event.getEntity(); + Level worldIn = event.getWorld(); + BlockPos startPos = entity.blockPosition().below(); + if (!worldIn.isClientSide && Config.GENERAL.LIGHTNING_CONVERSION.get()) { + Iterable positions = BlockPos.withinManhattan(startPos,2,2,2); + for (BlockPos pos : positions) { + double rand; + if (startPos.getX() == pos.getX() && startPos.getZ() == pos.getZ()) { + rand = 1/(1f + Math.abs(startPos.getY() - pos.getY())); + } else { + rand = pos.distSqr(new Vec3i(startPos.getX(),startPos.getY(),startPos.getZ())); + } + + Block BLK = worldIn.getBlockState(pos).getBlock(); + if (worldIn.getRandom().nextFloat() < 1/rand && ForgeRegistries.BLOCKS.tags().getTag(RankineTags.Blocks.LIGHTNING_VITRIFIED).contains(BLK)) { + worldIn.setBlock(pos, RankineBlocks.FULGURITE.get().defaultBlockState(),3); + } else if (worldIn.getRandom().nextFloat() < 1/rand && BLK.equals(Blocks.SAND) || BLK.equals(RankineBlocks.SILT.get()) || BLK.equals(RankineBlocks.DESERT_SAND.get())) { + worldIn.setBlock(pos,RankineBlocks.LIGHTNING_GLASS.get().defaultBlockState(),3); + } else if (worldIn.getRandom().nextFloat() < 1/rand && BLK.equals(Blocks.RED_SAND)) { + worldIn.setBlock(pos,RankineBlocks.RED_LIGHTNING_GLASS.get().defaultBlockState(),3); + } else if (worldIn.getRandom().nextFloat() < 1/rand && BLK.equals(Blocks.SOUL_SAND)) { + worldIn.setBlock(pos,RankineBlocks.SOUL_LIGHTNING_GLASS.get().defaultBlockState(),3); + } else if (worldIn.getRandom().nextFloat() < 1/rand && BLK.equals(RankineBlocks.BLACK_SAND.get())) { + worldIn.setBlock(pos,RankineBlocks.BLACK_LIGHTNING_GLASS.get().defaultBlockState(),3); + } else if (worldIn.getRandom().nextFloat() < 1/rand && BLK.equals(RankineBlocks.WHITE_SAND.get())) { + worldIn.setBlock(pos,RankineBlocks.WHITE_LIGHTNING_GLASS.get().defaultBlockState(),3); + } + } + } + } + } + + public static void onSheepJoinWorld(EntityJoinWorldEvent event) { + Entity entity = event.getEntity(); + if (entity instanceof Sheep ent) { + ent.goalSelector.removeGoal(new EatBlockGoal(ent)); + ent.goalSelector.addGoal(5,new EatGrassGoalModified(ent)); + ent.goalSelector.removeGoal(new TemptGoal(ent, 1.1D, Ingredient.of(Items.WHEAT), false)); + ent.goalSelector.addGoal(3,new TemptGoal(ent, 1.1D, Ingredient.of(RankineTags.Items.BREEDABLES_SHEEP), false)); + } else if (entity instanceof Cow ent) { + ent.goalSelector.addGoal(3,new TemptGoal(ent, 1.25D, Ingredient.of(RankineTags.Items.BREEDABLES_COW), false)); + } else if (entity instanceof Pig ent) { + ent.goalSelector.addGoal(4,new TemptGoal(ent, 1.2D, Ingredient.of(RankineTags.Items.BREEDABLES_PIG), false)); + } else if (entity instanceof Chicken ent) { + ent.goalSelector.addGoal(3,new TemptGoal(ent, 1.0D, Ingredient.of(RankineTags.Items.BREEDABLES_CHICKEN), false)); + } else if (entity instanceof Rabbit ent) { + ent.goalSelector.addGoal(3,new TemptGoal(ent, 1.0D, Ingredient.of(RankineTags.Items.BREEDABLES_RABBIT), false)); + } + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/common/FarmlandTrampleHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/FarmlandTrampleHandler.java new file mode 100644 index 0000000000..fa4773690e --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/FarmlandTrampleHandler.java @@ -0,0 +1,16 @@ +package com.cannolicatfish.rankine.events.handlers.common; + +import com.cannolicatfish.rankine.items.totems.SofteningTotemItem; +import net.minecraft.world.InteractionHand; +import net.minecraft.world.entity.player.Player; +import net.minecraftforge.event.world.BlockEvent; + +public class FarmlandTrampleHandler { + public static void onCropTrample(BlockEvent.FarmlandTrampleEvent event) { + if (event.getEntity() instanceof Player player) { + if (player.getItemInHand(InteractionHand.MAIN_HAND).getItem() instanceof SofteningTotemItem || player.getItemInHand(InteractionHand.OFF_HAND).getItem() instanceof SofteningTotemItem) { + event.setCanceled(true); + } + } + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/common/FurnaceFuelBurnTimeHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/FurnaceFuelBurnTimeHandler.java new file mode 100644 index 0000000000..10f1c76034 --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/FurnaceFuelBurnTimeHandler.java @@ -0,0 +1,14 @@ +package com.cannolicatfish.rankine.events.handlers.common; + +import com.cannolicatfish.rankine.init.VanillaIntegration; +import net.minecraft.world.item.Item; +import net.minecraftforge.event.furnace.FurnaceFuelBurnTimeEvent; + +public class FurnaceFuelBurnTimeHandler { + public static void updateFuelValues(FurnaceFuelBurnTimeEvent event) { + Item Fuel = event.getItemStack().getItem(); + if (VanillaIntegration.fuelValueMap.containsKey(Fuel)) { + event.setBurnTime(VanillaIntegration.fuelValueMap.get(Fuel)); + } + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/common/ItemPickupHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/ItemPickupHandler.java new file mode 100644 index 0000000000..b0c135acc0 --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/ItemPickupHandler.java @@ -0,0 +1,24 @@ +package com.cannolicatfish.rankine.events.handlers.common; + +import com.cannolicatfish.rankine.init.RankineItems; +import net.minecraft.world.entity.player.Player; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraftforge.common.Tags; +import net.minecraftforge.event.entity.player.PlayerEvent; +import net.minecraftforge.registries.ForgeRegistries; + +public class ItemPickupHandler { + public static void onItemPickup(PlayerEvent.ItemPickupEvent event) { + if (((ForgeRegistries.ITEMS.tags().getTag(Tags.Items.STONE).contains(event.getStack().getItem()) || event.getStack().getItem() == Items.COBBLESTONE) && (event.getPlayer().getMainHandItem().getItem() == RankineItems.TOTEM_OF_COBBLING.get() || event.getPlayer().getOffhandItem().getItem() == RankineItems.TOTEM_OF_COBBLING.get()))) { + Player player = event.getPlayer(); + ItemStack totem = player.getMainHandItem().getItem() == RankineItems.TOTEM_OF_COBBLING.get() ? player.getMainHandItem() : player.getOffhandItem(); + if (totem.getDamageValue() != 0) { + int x = totem.getDamageValue() - event.getStack().copy().getCount(); + player.getInventory().getItem(event.getPlayer().getInventory().findSlotMatchingItem(event.getStack())).shrink(totem.getDamageValue()); + totem.setDamageValue(Math.max(x,0)); + + } + } + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/common/SaplingGrowTreeHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/SaplingGrowTreeHandler.java new file mode 100644 index 0000000000..06b64eda50 --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/SaplingGrowTreeHandler.java @@ -0,0 +1,21 @@ +package com.cannolicatfish.rankine.events.handlers.common; + +import com.cannolicatfish.rankine.init.Config; +import net.minecraft.core.BlockPos; +import net.minecraft.world.level.LevelAccessor; +import net.minecraft.world.level.block.Blocks; +import net.minecraftforge.event.world.SaplingGrowTreeEvent; +import net.minecraftforge.eventbus.api.Event; + +public class SaplingGrowTreeHandler { + public static void onSaplingGrow(SaplingGrowTreeEvent event) { + if (event.getRand().nextFloat() < 1- Config.GENERAL.SAPLING_GROW.get()) { + event.setResult(Event.Result.DENY); + } + BlockPos pos = event.getPos(); + LevelAccessor worldIn = event.getWorld(); + if (worldIn.getBlockState(pos).is(Blocks.SPRUCE_SAPLING)) { + + } + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/common/VillagerTradesHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/VillagerTradesHandler.java new file mode 100644 index 0000000000..7a855894df --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/VillagerTradesHandler.java @@ -0,0 +1,148 @@ +package com.cannolicatfish.rankine.events.handlers.common; + +import com.cannolicatfish.rankine.init.Config; +import com.cannolicatfish.rankine.init.RankineItems; +import com.cannolicatfish.rankine.init.RankineTags; +import com.cannolicatfish.rankine.init.RankineVillagerProfessions; +import com.cannolicatfish.rankine.util.RankineVillagerTrades; +import net.minecraft.tags.ItemTags; +import net.minecraft.world.entity.npc.VillagerProfession; +import net.minecraft.world.entity.npc.VillagerTrades; +import net.minecraft.world.item.ItemStack; +import net.minecraft.world.item.Items; +import net.minecraft.world.item.trading.MerchantOffer; +import net.minecraft.world.level.block.Block; +import net.minecraftforge.common.BasicItemListing; +import net.minecraftforge.common.Tags; +import net.minecraftforge.event.village.VillagerTradesEvent; +import net.minecraftforge.registries.ForgeRegistries; + +import java.util.List; + +public class VillagerTradesHandler { + public static void addVillagerTrades(VillagerTradesEvent event) { + List level1 = event.getTrades().get(1); + List level2 = event.getTrades().get(2); + List level3 = event.getTrades().get(3); + List level4 = event.getTrades().get(4); + List level5 = event.getTrades().get(5); + + if (event.getType() == RankineVillagerProfessions.METALLURGIST) { + level1.add(new BasicItemListing(1, new ItemStack(RankineItems.ALLOY_TEMPLATE.get()),12,1,0.05f)); + level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.TIN_INGOT.get(), 8), new ItemStack(Items.EMERALD),12,2,0.05f)); + level1.add((entity,rand) -> new MerchantOffer(new ItemStack(Items.COPPER_INGOT, 4), new ItemStack(Items.EMERALD),12,2,0.05f)); + level2.add(new BasicItemListing(1, new ItemStack(RankineItems.ZINC_INGOT.get(), 2),12,10,0.05f)); + level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.METEORIC_IRON.get(), 4), new ItemStack(Items.EMERALD),12,10,0.05f)); + level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.COIN.get(), 16), new ItemStack(Items.EMERALD),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(RankineItems.MANGANESE_INGOT.get(), 2),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(RankineItems.MOLYBDENUM_INGOT.get(), 2),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(RankineItems.VANADIUM_INGOT.get(), 2),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(RankineItems.NIOBIUM_INGOT.get(), 2),12,10,0.05f)); + level4.add(new BasicItemListing(6, new ItemStack(RankineItems.ELEMENT_INDEXER.get()),12,15,0.05f)); + level5.add(new BasicItemListing(10, new ItemStack(RankineItems.ORE_DETECTOR.get()),12,30,0.05f)); + level5.add(new RankineVillagerTrades.EnchantedAlloyItemForEmeraldsTrade(RankineItems.STEEL_PICKAXE.get(),"76Fe-15Cr-4V-4W-1C","rankine:alloying/damascus_steel_alloying","item.rankine.damascus_steel_alloying",15,3,30,0.2f)); + level5.add(new RankineVillagerTrades.EnchantedAlloyItemForEmeraldsTrade(RankineItems.STEEL_SWORD.get(),"76Fe-15Cr-4V-4W-1C","rankine:alloying/damascus_steel_alloying","item.rankine.damascus_steel_alloying",15,3,30,0.2f)); + } else if (event.getType() == RankineVillagerProfessions.MINERALOGIST) { + level1.add(new BasicItemListing(1, new ItemStack(RankineItems.STIBNITE.get()),12,1,0.05f)); + level1.add(new BasicItemListing(1, new ItemStack(RankineItems.PROSPECTING_STICK.get()),12,1,0.05f)); + level1.add(new BasicItemListing(1, new ItemStack(RankineItems.HARDNESS_TESTER.get()),12,1,0.05f)); + level2.add(new BasicItemListing(1, new ItemStack(RankineItems.CHALCOPYRITE.get()),12,5,0.05f)); + level2.add(new BasicItemListing(1, new ItemStack(RankineItems.BORAX.get()),12,5,0.05f)); + level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.MICA.get(), 4), new ItemStack(Items.EMERALD),12,10,0.05f)); + level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.AMPHIBOLE.get(), 4), new ItemStack(Items.EMERALD),12,10,0.05f)); + level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.PLAGIOCLASE_FELDSPAR.get(), 4), new ItemStack(Items.EMERALD),12,10,0.05f)); + level3.add(new RankineVillagerTrades.EnchantedAlloyItemForEmeraldsTrade(RankineItems.INVAR_HAMMER.get(),"90Fe-10Ni","rankine:invar_alloying","item.rankine.invar_alloying",8,3,10,0.2f)); + level3.add(new BasicItemListing(1, new ItemStack(RankineItems.ZIRCON.get()),12,15,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(RankineItems.BAUXITE.get()),12,15,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(RankineItems.MAGNESITE.get()),12,15,0.05f)); + level4.add(new BasicItemListing(1, new ItemStack(RankineItems.VANADINITE.get()),12,15,0.05f)); + level4.add(new BasicItemListing(1, new ItemStack(RankineItems.PETALITE.get()),12,15,0.05f)); + level4.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.OLIVINE.get(), 4), new ItemStack(Items.EMERALD),12,20,0.05f)); + level4.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.PYROXENE.get(), 4), new ItemStack(Items.EMERALD),12,20,0.05f)); + level5.add(new BasicItemListing(1, new ItemStack(RankineItems.WOLFRAMITE.get()),12,30,0.05f)); + level5.add(new BasicItemListing(1, new ItemStack(RankineItems.COBALTITE.get()),12,30,0.05f)); + level5.add(new RankineVillagerTrades.EnchantedAlloyItemForEmeraldsTrade(RankineItems.STEEL_HAMMER.get(),"76Fe-15Cr-4V-4W-1C","rankine:alloying/damascus_steel_alloying","item.rankine.damascus_steel_alloying",15,3,30,0.2f)); + } else if (event.getType() == RankineVillagerProfessions.BOTANIST) { + level1.addAll(RankineVillagerTrades.returnTagTrades(ItemTags.SMALL_FLOWERS,Items.DANDELION,3,1,12,10,0.05f)); + level1.addAll(RankineVillagerTrades.returnTagTrades(ItemTags.TALL_FLOWERS,Items.ROSE_BUSH,2,1,12,10,0.05f)); + level1.addAll(RankineVillagerTrades.returnTagTrades(RankineTags.Items.BERRIES,RankineItems.ELDERBERRIES.get(),2,1,12,10,0.05f)); + level2.addAll(RankineVillagerTrades.returnTagTrades(ItemTags.SAPLINGS,Items.OAK_SAPLING,2,1,12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.BAMBOO, 4),12,15,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.VINE, 4),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.LILY_PAD, 4),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.RED_MUSHROOM, 4),12,15,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.BROWN_MUSHROOM, 4),12,15,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.SEA_PICKLE, 4),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.KELP, 4),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.SUGAR_CANE, 4),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.CACTUS, 4),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.DEAD_BUSH, 4),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.NETHER_WART, 4),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.POISONOUS_POTATO, 4),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(RankineItems.ALOE.get(), 4),12,30,0.05f)); + level4.add(new BasicItemListing(1, new ItemStack(Items.WARPED_NYLIUM, 1),12,15,0.05f)); + level4.add(new BasicItemListing(1, new ItemStack(Items.CRIMSON_NYLIUM, 1),12,15,0.05f)); + level4.add(new BasicItemListing(1, new ItemStack(Items.BRAIN_CORAL, 2),12,15,0.05f)); + level4.add(new BasicItemListing(1, new ItemStack(Items.BUBBLE_CORAL, 2),12,15,0.05f)); + level4.add(new BasicItemListing(1, new ItemStack(Items.FIRE_CORAL, 2),12,15,0.05f)); + level4.add(new BasicItemListing(1, new ItemStack(Items.HORN_CORAL, 2),12,15,0.05f)); + level4.add(new BasicItemListing(1, new ItemStack(Items.TUBE_CORAL, 2),12,15,0.05f)); + level5.add(new BasicItemListing(1, new ItemStack(Items.SHROOMLIGHT, 2),12,15,0.05f)); + level5.add(new BasicItemListing(1, new ItemStack(Items.MYCELIUM, 1),12,30,0.05f)); + level5.add(new BasicItemListing(5, new ItemStack(Items.CHORUS_FLOWER, 1),12,30,0.05f)); + level5.add(new BasicItemListing(10, new ItemStack(Items.WITHER_ROSE),12,30,0.05f)); + + } else if (event.getType() == RankineVillagerProfessions.GEM_CUTTER) { + level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.AQUAMARINE.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); + level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.OPAL.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); + level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.GARNET.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); + level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.RUBY.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); + level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.SAPPHIRE.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); + level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.PERIDOT.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); + level1.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.TOPAZ.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); + level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.PEARL.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); + level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.TOURMALINE.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); + level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.TIGER_IRON.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); + level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.LABRADORITE.get(), 1), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); + level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.RHODONITE.get(), 1), new ItemStack(Items.EMERALD, 3),12,20,0.05f)); + level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.RHODOCHROSITE.get(), 1), new ItemStack(Items.EMERALD, 3),12,20,0.05f)); + level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.CHROME_ENSTATITE.get(), 1), new ItemStack(Items.EMERALD, 3),12,20,0.05f)); + level2.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.FLUORITE.get(), 3), new ItemStack(Items.EMERALD, 2),12,20,0.05f)); + level4.addAll(RankineVillagerTrades.returnTagTrades(Tags.Items.GEMS,RankineItems.OPAL.get(),1,12,16,10,0.05f)); + level5.add((entity,rand) -> new MerchantOffer(new ItemStack(RankineItems.LONSDALEITE_DIAMOND.get(), 1), new ItemStack(Items.EMERALD, 6),12,20,0.05f)); + level5.add(new BasicItemListing(20, new ItemStack(RankineItems.LONSDALEITE_DIAMOND.get(), 1),12,50,0.05f)); + level5.add((entity,rand) -> new MerchantOffer(new ItemStack(Items.NETHER_STAR, 1), new ItemStack(Items.EMERALD, 64),12,50,0.05f)); + + } else if (event.getType() == RankineVillagerProfessions.ROCK_COLLECTOR) { + level1.addAll(RankineVillagerTrades.returnTagTrades(Tags.Items.STONE, RankineItems.ANORTHOSITE.get(),16,1,16,10,0.05f)); + List rocks = ForgeRegistries.BLOCKS.tags().getTag(Tags.Blocks.STONE).stream().toList(); + if (!rocks.isEmpty()) { + for (Block rock : rocks) { + level2.add((entity, rand) -> new MerchantOffer(new ItemStack(rock.asItem(), 24), new ItemStack(Items.EMERALD, 1), 16, 10, 0.05f)); + } + } else { + level2.add((entity, rand) -> new MerchantOffer(new ItemStack(Items.SANDSTONE, 24), new ItemStack(Items.EMERALD, 1), 16, 10, 0.05f)); + level2.add((entity, rand) -> new MerchantOffer(new ItemStack(Items.RED_SANDSTONE, 12), new ItemStack(Items.EMERALD, 1), 16, 10, 0.05f)); + } + level3.add(new BasicItemListing(1, new ItemStack(Items.OBSIDIAN, 1),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.NETHERRACK, 8),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.END_STONE, 2),12,10,0.05f)); + level3.add(new BasicItemListing(1, new ItemStack(Items.PURPUR_BLOCK, 2),12,10,0.05f)); + level4.add(new BasicItemListing(1, new ItemStack(RankineItems.PHOSPHORITE.get(), 2),12,10,0.05f)); + level4.add(new BasicItemListing(1, new ItemStack(RankineItems.IRONSTONE.get(), 2),12,10,0.05f)); + level4.add(new BasicItemListing(1, new ItemStack(RankineItems.METEORITE.get(), 2),12,10,0.05f)); + level4.add(new BasicItemListing(1, new ItemStack(RankineItems.ENSTATITE_CHONDRITE.get(), 2),12,10,0.05f)); + level5.add(new BasicItemListing(1, new ItemStack(RankineItems.ROMAN_CONCRETE.get(), 1),24,10,0.05f)); + } + + if (Config.GENERAL.VILLAGER_TRADES.get()) { + if (event.getType() == VillagerProfession.MASON) { + event.getTrades().get(1).add(new BasicItemListing(1,new ItemStack(RankineItems.MORTAR.get(), 16),16,1,0.05f)); + event.getTrades().get(1).add(new BasicItemListing(1,new ItemStack(RankineItems.REFRACTORY_BRICK.get(), 10),16,1,0.05f)); + } else if (event.getType() == VillagerProfession.CLERIC) { + event.getTrades().get(1).add(new BasicItemListing(1, new ItemStack(RankineItems.SALTPETER.get(),2),12,1,0.05f)); + } + } + + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/common/WandererTradesHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/WandererTradesHandler.java new file mode 100644 index 0000000000..aa2453bbbf --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/WandererTradesHandler.java @@ -0,0 +1,18 @@ +package com.cannolicatfish.rankine.events.handlers.common; + +import com.cannolicatfish.rankine.init.Config; +import com.cannolicatfish.rankine.init.RankineBlocks; +import com.cannolicatfish.rankine.init.RankineItems; +import net.minecraft.world.item.ItemStack; +import net.minecraftforge.common.BasicItemListing; +import net.minecraftforge.event.village.WandererTradesEvent; + +public class WandererTradesHandler { + public static void addWandererTrades(WandererTradesEvent event) { + if (Config.GENERAL.VILLAGER_TRADES.get()) { + event.getGenericTrades().add(new BasicItemListing(1,new ItemStack(RankineItems.PINEAPPLE.get(), 1),4,1,0.5f)); + event.getGenericTrades().add(new BasicItemListing(1,new ItemStack(RankineBlocks.LIMESTONE.get(), 8),8,1,0.05f)); + event.getRareTrades().add(new BasicItemListing(3,new ItemStack(RankineItems.METEORIC_IRON.get()),6,1,0.5f)); + } + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/events/handlers/common/WorldLoadHandler.java b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/WorldLoadHandler.java new file mode 100644 index 0000000000..1e484e165e --- /dev/null +++ b/src/main/java/com/cannolicatfish/rankine/events/handlers/common/WorldLoadHandler.java @@ -0,0 +1,10 @@ +package com.cannolicatfish.rankine.events.handlers.common; + +import com.cannolicatfish.rankine.init.VanillaIntegration; +import net.minecraftforge.event.world.WorldEvent; + +public class WorldLoadHandler { + public static void updateFuelValues(WorldEvent.Load event) { + VanillaIntegration.populateFuelMap(); + } +} diff --git a/src/main/java/com/cannolicatfish/rankine/init/Config.java b/src/main/java/com/cannolicatfish/rankine/init/Config.java index 3a41fddeba..7444c31392 100644 --- a/src/main/java/com/cannolicatfish/rankine/init/Config.java +++ b/src/main/java/com/cannolicatfish/rankine/init/Config.java @@ -650,7 +650,7 @@ public Worldgen(ForgeConfigSpec.Builder b) { EVAPORITE_GEN = b.comment("Enables the generation of evaporite disks.") .define("generateEvaporite",true); FUMAROLE_GEN = b.comment("Average number of chuncks to generate a fumarole in. Set to 0 to disable.") - .defineInRange("fumaroleGenerationChance", 10, 0, Integer.MAX_VALUE); + .defineInRange("fumaroleGenerationChance", 40, 0, Integer.MAX_VALUE); ALLUVIUM_GEN = b.comment("Enables the generation of alluvium disks.") .define("generateAlluvium",true); WHITE_SAND_GEN = b.comment("Enables the generation of white sand disks in beaches.") @@ -730,7 +730,7 @@ public static class BiomeGen { public BiomeGen(ForgeConfigSpec.Builder b) { biomeSettings.add(List.of("minecraft:soul_sand_valley", List.of(), - List.of("minecraft:air|15|minecraft:air|0.0","rankine:scoria|1|rankine:scoria|0.0","rankine:pumice|1|rankine:pumice|0.0"), + List.of("minecraft:air|20|minecraft:air|0.0","rankine:scoria|1|rankine:scoria|0.0","rankine:pumice|1|rankine:pumice|0.0"), List.of("rankine:blueschist","rankine:blueschist","rankine:blueschist","rankine:blueschist","rankine:honeystone","rankine:honeystone","rankine:honeystone","rankine:wehrlite"), List.of(), "rankine:dark_gravel", @@ -739,7 +739,7 @@ public BiomeGen(ForgeConfigSpec.Builder b) { "minecraft:air")); biomeSettings.add(List.of("minecraft:basalt_deltas", List.of(), - List.of("minecraft:air|15|minecraft:air|0.0","rankine:scoria|1|rankine:scoria|0.0","rankine:pumice|1|rankine:pumice|0.0"), + List.of("minecraft:air|20|minecraft:air|0.0","rankine:scoria|1|rankine:scoria|0.0","rankine:pumice|1|rankine:pumice|0.0"), List.of("minecraft:blackstone","minecraft:blackstone","minecraft:blackstone","minecraft:blackstone","minecraft:basalt","minecraft:basalt","minecraft:basalt","rankine:dunite"), List.of(), "rankine:dark_gravel", @@ -748,7 +748,7 @@ public BiomeGen(ForgeConfigSpec.Builder b) { "minecraft:air")); biomeSettings.add(List.of("minecraft:crimson_forest", List.of(), - List.of("minecraft:air|15|minecraft:air|0.0","rankine:scoria|1|rankine:scoria|0.0","rankine:pumice|1|rankine:pumice|0.0"), + List.of("minecraft:air|20|minecraft:air|0.0","rankine:scoria|1|rankine:scoria|0.0","rankine:pumice|1|rankine:pumice|0.0"), List.of("rankine:purple_porphyry","rankine:purple_porphyry","rankine:purple_porphyry","rankine:purple_porphyry","rankine:komatiite","rankine:komatiite","rankine:komatiite","rankine:red_porphyry"), List.of(), "rankine:dark_gravel", @@ -757,7 +757,7 @@ public BiomeGen(ForgeConfigSpec.Builder b) { "minecraft:air")); biomeSettings.add(List.of("minecraft:warped_forest", List.of(), - List.of("minecraft:air|15|minecraft:air|0.0","rankine:scoria|1|rankine:scoria|0.0","rankine:pumice|1|rankine:pumice|0.0"), + List.of("minecraft:air|20|minecraft:air|0.0","rankine:scoria|1|rankine:scoria|0.0","rankine:pumice|1|rankine:pumice|0.0"), List.of("rankine:lherzolite","rankine:lherzolite","rankine:lherzolite","rankine:lherzolite","rankine:pyroxenite","rankine:pyroxenite","rankine:pyroxenite","rankine:harzburgite"), List.of(), "rankine:dark_gravel", @@ -766,7 +766,7 @@ public BiomeGen(ForgeConfigSpec.Builder b) { "minecraft:air")); biomeSettings.add(List.of("minecraft:nether_wastes", List.of(), - List.of("minecraft:air|15|minecraft:air|0.0","rankine:scoria|1|rankine:scoria|0.0","rankine:pumice|1|rankine:pumice|0.0"), + List.of("minecraft:air|20|minecraft:air|0.0","rankine:scoria|1|rankine:scoria|0.0","rankine:pumice|1|rankine:pumice|0.0"), List.of("minecraft:netherrack"), List.of(), "rankine:dark_gravel", @@ -1043,6 +1043,7 @@ public BiomeGen(ForgeConfigSpec.Builder b) { oreSettings.add(List.of("rankine:coltan_ore", List.of("overworld"), "default", "triangle", -84, -40, 6, 1.0D, 1, 1.0, 0.0D)); oreSettings.add(List.of("rankine:chromite_ore", List.of("overworld"), "default", "triangle", -84, -40, 6, 1.0D, 1, 1.0, 0.0D)); + oreSettings.add(List.of("rankine:banded_iron_formation", List.of("overworld"), "disk", "uniform", 30, 70, 4, 0.6D, 1, 0.4, 0.0D)); oreSettings.add(List.of("rankine:bog_iron", List.of("swamp","jungle"), "disk", "uniform", 30, 70, 4, 0.3D, 1, 1.0, 0.0D)); oreSettings.add(List.of("rankine:ironstone", List.of("desert","savanna","mesa"), "disk", "uniform", 30, 70, 4, 0.3D, 1, 1.0, 0.0D)); oreSettings.add(List.of("rankine:kaolin", List.of("swamp","jungle","mushroom"), "disk", "uniform", 40, 70, 4, 0.7D, 1, 0.4, 0.0D)); diff --git a/src/main/java/com/cannolicatfish/rankine/init/RankineBlocks.java b/src/main/java/com/cannolicatfish/rankine/init/RankineBlocks.java index d437bab172..4c13104e18 100644 --- a/src/main/java/com/cannolicatfish/rankine/init/RankineBlocks.java +++ b/src/main/java/com/cannolicatfish/rankine/init/RankineBlocks.java @@ -70,6 +70,7 @@ import com.cannolicatfish.rankine.util.GasUtilsEnum; import com.cannolicatfish.rankine.world.grower.*; import net.minecraft.resources.ResourceLocation; +import net.minecraft.util.valueproviders.UniformInt; import net.minecraft.world.inventory.MenuType; import net.minecraft.world.level.block.*; import net.minecraft.world.level.block.entity.BlockEntityType; @@ -105,7 +106,7 @@ public class RankineBlocks { public static Block.Properties DEF_STONE = Block.Properties.of(Material.STONE).sound(SoundType.STONE).requiresCorrectToolForDrops().strength(1.5F, 6.0F); - public static Block.Properties DEF_ORE = Block.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(2.5F, 4.0F); + public static Block.Properties DEF_ORE = Block.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(4.5F, 3.0F); public static Block.Properties DEF_METAL_BLOCK = Block.Properties.of(Material.METAL).sound(SoundType.METAL).requiresCorrectToolForDrops().strength(5.0F, 6.0F); public static Block.Properties DEF_WOOD = Block.Properties.of(Material.WOOD).sound(SoundType.WOOD).strength(2.0F, 3.0F); public static Block.Properties DEF_LEAVES = Block.Properties.of(Material.LEAVES).randomTicks().strength(0.2F).sound(SoundType.GRASS).noOcclusion(); @@ -1772,8 +1773,8 @@ public class RankineBlocks { public static final RegistryObject FUMAROLE_DEPOSIT = BLOCKS.register("fumarole_deposit", () -> new Block(DEF_STONE)); public static final RegistryObject IRONSTONE = BLOCKS.register("ironstone", () -> new Block(DEF_STONE)); public static final RegistryObject BOG_IRON = BLOCKS.register("bog_iron", () -> new Block(DEF_STONE)); - public static final RegistryObject PORPHYRY_COPPER = BLOCKS.register("porphyry_copper", () -> new Block(DEF_STONE)); - public static final RegistryObject KIMBERLITIC_DIAMOND_ORE = BLOCKS.register("kimberlitic_diamond_ore", () -> new Block(DEF_STONE)); + public static final RegistryObject PORPHYRY_COPPER = BLOCKS.register("porphyry_copper", () -> new OreBlock(DEF_STONE, UniformInt.of(0,1))); + public static final RegistryObject KIMBERLITIC_DIAMOND_ORE = BLOCKS.register("kimberlitic_diamond_ore", () -> new OreBlock(DEF_STONE, UniformInt.of(3,7))); public static final RegistryObject QUICKLIME_BLOCK = BLOCKS.register("quicklime_block", () -> new Block(Block.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2.0F, 2.0F))); public static final RegistryObject MAGNESITE_BLOCK = BLOCKS.register("magnesite_block", () -> new Block(Block.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2.0F, 2.0F))); public static final RegistryObject MAGNESIA_BLOCK = BLOCKS.register("magnesia_block", () -> new Block(Block.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2.0F, 2.0F))); @@ -2849,13 +2850,13 @@ public class RankineBlocks { //ORES public static final RegistryObject CHALCOCITE_ORE = BLOCKS.register("chalcocite_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject PETALITE_ORE = BLOCKS.register("petalite_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject LIGNITE_ORE = BLOCKS.register("lignite_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject SUBBITUMINOUS_ORE = BLOCKS.register("subbituminous_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject BITUMINOUS_ORE = BLOCKS.register("bituminous_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject ANTHRACITE_ORE = BLOCKS.register("anthracite_ore", () -> new RankineOreBlock(DEF_ORE)); + public static final RegistryObject LIGNITE_ORE = BLOCKS.register("lignite_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(0,1))); + public static final RegistryObject SUBBITUMINOUS_ORE = BLOCKS.register("subbituminous_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(0,2))); + public static final RegistryObject BITUMINOUS_ORE = BLOCKS.register("bituminous_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(1,3))); + public static final RegistryObject ANTHRACITE_ORE = BLOCKS.register("anthracite_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(2,4))); public static final RegistryObject MAGNESITE_ORE = BLOCKS.register("magnesite_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject BAUXITE_ORE = BLOCKS.register("bauxite_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject NATIVE_SULFUR_ORE = BLOCKS.register("native_sulfur_ore", () -> new RankineOreBlock(DEF_ORE)); + public static final RegistryObject NATIVE_SULFUR_ORE = BLOCKS.register("native_sulfur_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(0,2))); public static final RegistryObject ILMENITE_ORE = BLOCKS.register("ilmenite_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject CHROMITE_ORE = BLOCKS.register("chromite_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject PYROLUSITE_ORE = BLOCKS.register("pyrolusite_ore", () -> new RankineOreBlock(DEF_ORE)); @@ -2866,54 +2867,54 @@ public class RankineBlocks { public static final RegistryObject INTERSPINIFEX_ORE = BLOCKS.register("interspinifex_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject MALACHITE_ORE = BLOCKS.register("malachite_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject SPHALERITE_ORE = BLOCKS.register("sphalerite_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject NATIVE_GALLIUM_ORE = BLOCKS.register("native_gallium_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject NATIVE_ARSENIC_ORE = BLOCKS.register("native_arsenic_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject NATIVE_SELENIUM_ORE = BLOCKS.register("native_selenium_ore", () -> new RankineOreBlock(DEF_ORE)); + public static final RegistryObject NATIVE_GALLIUM_ORE = BLOCKS.register("native_gallium_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(1,3))); + public static final RegistryObject NATIVE_ARSENIC_ORE = BLOCKS.register("native_arsenic_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(1,3))); + public static final RegistryObject NATIVE_SELENIUM_ORE = BLOCKS.register("native_selenium_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(1,3))); public static final RegistryObject CELESTINE_ORE = BLOCKS.register("celestine_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject XENOTIME_ORE = BLOCKS.register("xenotime_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject BADDELEYITE_ORE = BLOCKS.register("baddeleyite_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject COLTAN_ORE = BLOCKS.register("coltan_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject MOLYBDENITE_ORE = BLOCKS.register("molybdenite_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject NATIVE_SILVER_ORE = BLOCKS.register("native_silver_ore", () -> new RankineOreBlock(DEF_ORE)); + public static final RegistryObject NATIVE_SILVER_ORE = BLOCKS.register("native_silver_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(0,1))); public static final RegistryObject ACANTHITE_ORE = BLOCKS.register("acanthite_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject GREENOCKITE_ORE = BLOCKS.register("greenockite_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject NATIVE_INDIUM_ORE = BLOCKS.register("native_indium_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject NATIVE_TIN_ORE = BLOCKS.register("native_tin_ore", () -> new RankineOreBlock(DEF_ORE)); + public static final RegistryObject NATIVE_INDIUM_ORE = BLOCKS.register("native_indium_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(1,3))); + public static final RegistryObject NATIVE_TIN_ORE = BLOCKS.register("native_tin_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(0,1))); public static final RegistryObject CASSITERITE_ORE = BLOCKS.register("cassiterite_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject STIBNITE_ORE = BLOCKS.register("stibnite_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject NATIVE_TELLURIUM_ORE = BLOCKS.register("native_tellurium_ore", () -> new RankineOreBlock(DEF_ORE)); + public static final RegistryObject STIBNITE_ORE = BLOCKS.register("stibnite_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(0,1))); + public static final RegistryObject NATIVE_TELLURIUM_ORE = BLOCKS.register("native_tellurium_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(1,3))); public static final RegistryObject WOLFRAMITE_ORE = BLOCKS.register("wolframite_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject RHENIITE_ORE = BLOCKS.register("rheniite_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject NATIVE_GOLD_ORE = BLOCKS.register("native_gold_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject NATIVE_LEAD_ORE = BLOCKS.register("native_lead_ore", () -> new RankineOreBlock(DEF_ORE)); + public static final RegistryObject NATIVE_GOLD_ORE = BLOCKS.register("native_gold_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(0,1))); + public static final RegistryObject NATIVE_LEAD_ORE = BLOCKS.register("native_lead_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(0,1))); public static final RegistryObject GALENA_ORE = BLOCKS.register("galena_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject NATIVE_BISMUTH_ORE = BLOCKS.register("native_bismuth_ore", () -> new RankineOreBlock(DEF_ORE)); + public static final RegistryObject NATIVE_BISMUTH_ORE = BLOCKS.register("native_bismuth_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(0,1))); public static final RegistryObject BISMUTHINITE_ORE = BLOCKS.register("bismuthinite_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject URANINITE_ORE = BLOCKS.register("uraninite_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject PLUMBAGO_ORE = BLOCKS.register("plumbago_ore", () -> new RankineOreBlock(DEF_ORE)); + public static final RegistryObject PLUMBAGO_ORE = BLOCKS.register("plumbago_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(2,5))); public static final RegistryObject SPERRYLITE_ORE = BLOCKS.register("sperrylite_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject CINNABAR_ORE = BLOCKS.register("cinnabar_ore", () -> new RankineOreBlock(DEF_ORE)); + public static final RegistryObject CINNABAR_ORE = BLOCKS.register("cinnabar_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(2,4))); public static final RegistryObject CRYOLITE_ORE = BLOCKS.register("cryolite_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject PYRITE_ORE = BLOCKS.register("pyrite_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject KAMACITE_ORE = BLOCKS.register("kamacite_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject ANTITAENITE_ORE = BLOCKS.register("antitaenite_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject TAENITE_ORE = BLOCKS.register("taenite_ore", () -> new RankineOreBlock(DEF_ORE)); public static final RegistryObject TETRATAENITE_ORE = BLOCKS.register("tetrataenite_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject LONSDALEITE_ORE = BLOCKS.register("lonsdaleite_ore", () -> new RankineOreBlock(DEF_ORE)); + public static final RegistryObject LONSDALEITE_ORE = BLOCKS.register("lonsdaleite_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(5,10))); public static final RegistryObject MONAZITE_ORE = BLOCKS.register("monazite_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject LAZURITE_ORE = BLOCKS.register("lazurite_ore", () -> new RankineOreBlock(DEF_ORE)); - public static final RegistryObject BERYL_ORE = BLOCKS.register("beryl_ore", () -> new RankineOreBlock(DEF_ORE)); + public static final RegistryObject LAZURITE_ORE = BLOCKS.register("lazurite_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(2,5))); + public static final RegistryObject BERYL_ORE = BLOCKS.register("beryl_ore", () -> new RankineOreBlock(DEF_ORE, UniformInt.of(3,7))); - public static final RegistryObject COAL_ORE = BLOCKS.register("coal_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.COAL_ORE))); + public static final RegistryObject COAL_ORE = BLOCKS.register("coal_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.COAL_ORE), UniformInt.of(0,2))); public static final RegistryObject IRON_ORE = BLOCKS.register("iron_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.IRON_ORE))); public static final RegistryObject COPPER_ORE = BLOCKS.register("copper_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.COPPER_ORE))); public static final RegistryObject GOLD_ORE = BLOCKS.register("gold_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.GOLD_ORE))); public static final RegistryObject REDSTONE_ORE = BLOCKS.register("redstone_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.LAPIS_ORE))); - public static final RegistryObject LAPIS_ORE = BLOCKS.register("lapis_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.LAPIS_ORE))); - public static final RegistryObject DIAMOND_ORE = BLOCKS.register("diamond_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.DIAMOND_ORE))); - public static final RegistryObject EMERALD_ORE = BLOCKS.register("emerald_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.EMERALD_ORE))); - public static final RegistryObject NETHER_QUARTZ_ORE = BLOCKS.register("nether_quartz_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.NETHER_QUARTZ_ORE))); - public static final RegistryObject NETHER_GOLD_ORE = BLOCKS.register("nether_gold_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.NETHER_GOLD_ORE))); + public static final RegistryObject LAPIS_ORE = BLOCKS.register("lapis_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.LAPIS_ORE), UniformInt.of(2,5))); + public static final RegistryObject DIAMOND_ORE = BLOCKS.register("diamond_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.DIAMOND_ORE), UniformInt.of(3,7))); + public static final RegistryObject EMERALD_ORE = BLOCKS.register("emerald_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.EMERALD_ORE), UniformInt.of(3,7))); + public static final RegistryObject NETHER_QUARTZ_ORE = BLOCKS.register("nether_quartz_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.NETHER_QUARTZ_ORE), UniformInt.of(2,5))); + public static final RegistryObject NETHER_GOLD_ORE = BLOCKS.register("nether_gold_ore", () -> new RankineOreBlock(BlockBehaviour.Properties.copy(Blocks.NETHER_GOLD_ORE), UniformInt.of(0,1))); public static final RegistryObject METEORITE = BLOCKS.register("meteorite", () -> new Block(DEF_STONE)); public static final RegistryObject METEORITE_BRICKS = BLOCKS.register("meteorite_bricks", () -> new Block(DEF_STONE)); diff --git a/src/main/java/com/cannolicatfish/rankine/init/RankineLists.java b/src/main/java/com/cannolicatfish/rankine/init/RankineLists.java index b2d4d9a74f..c86eaa42d3 100644 --- a/src/main/java/com/cannolicatfish/rankine/init/RankineLists.java +++ b/src/main/java/com/cannolicatfish/rankine/init/RankineLists.java @@ -238,10 +238,10 @@ public class RankineLists { RankineBlocks.PLUMBAGO_ORE.get(), RankineBlocks.PYRITE_ORE.get(),RankineBlocks.SPHALERITE_ORE.get(), RankineBlocks.SUBBITUMINOUS_ORE.get(),RankineBlocks.TAENITE_ORE.get(), RankineBlocks.TETRATAENITE_ORE.get()); public static List NEEDS_DIAMOND_TOOL_ORES = Arrays.asList(RankineBlocks.KIMBERLITIC_DIAMOND_ORE.get(),RankineBlocks.ANTHRACITE_ORE.get(),RankineBlocks.CELESTINE_ORE.get(),RankineBlocks.CHROMITE_ORE.get(),RankineBlocks.COBALTITE_ORE.get(), - RankineBlocks.COLTAN_ORE.get(), RankineBlocks.GREENOCKITE_ORE.get(), RankineBlocks.ILMENITE_ORE.get(),RankineBlocks.LONSDALEITE_ORE.get(),RankineBlocks.MAGNETITE_ORE.get(),RankineBlocks.MOLYBDENITE_ORE.get(), + RankineBlocks.COLTAN_ORE.get(), RankineBlocks.GREENOCKITE_ORE.get(), RankineBlocks.ILMENITE_ORE.get(),RankineBlocks.MAGNETITE_ORE.get(),RankineBlocks.MOLYBDENITE_ORE.get(), RankineBlocks.PETALITE_ORE.get(),RankineBlocks.PYROLUSITE_ORE.get(),RankineBlocks.RHENIITE_ORE.get(),RankineBlocks.URANINITE_ORE.get(),RankineBlocks.WOLFRAMITE_ORE.get(),RankineBlocks.XENOTIME_ORE.get()); - public static List NEEDS_NETHERITE_TOOL_ORES = Collections.emptyList(); + public static List NEEDS_NETHERITE_TOOL_ORES =Arrays.asList(RankineBlocks.LONSDALEITE_ORE.get()); public static List MINERAL_ITEMS = Arrays.asList(RankineItems.HEMATITE.get(),RankineItems.ACANTHITE.get(),RankineItems.ALUMINA.get(),RankineItems.AMBER.get(),RankineItems.AMPHIBOLE.get(),RankineItems.ANDESINE.get(),RankineItems.ANTHRACITE_COAL.get(),RankineItems.AQUAMARINE.get(),RankineItems.APATITE.get(),RankineItems.AZURITE.get(),RankineItems.AZURMALACHITE.get(),RankineItems.BADDELEYITE.get(),RankineItems.BARITE.get(),RankineItems.BAUXITE.get(),RankineItems.BISMUTHINITE.get(),RankineItems.BITUMINOUS_COAL.get(),RankineItems.BRIDGMANITE.get(),RankineItems.CALCIUM_CHLORIDE.get(),RankineItems.CALCIUM_SILICATE.get(),RankineItems.CASSITERITE.get(),RankineItems.CELESTINE.get(),RankineItems.CHALCOCITE.get(),RankineItems.CHALCOPYRITE.get(),RankineItems.CERIUM_MONAZITE.get(),RankineItems.CHROME_ENSTATITE.get(),RankineItems.CHROMITE.get(),RankineItems.CHLORITE.get(),RankineItems.CINNABAR.get(),RankineItems.COBALTITE.get(),RankineItems.COKE.get(),RankineItems.COLUMBITE.get(),RankineItems.COOPERITE.get(),RankineItems.CRYOLITE.get(),RankineItems.DIOPSIDE.get(),RankineItems.DOLOMITE.get(),RankineItems.ENSTATITE.get(),RankineItems.FERROPERICLASE.get(),RankineItems.FLUORITE.get(),RankineItems.FORSTERITE.get(),RankineItems.GALENA.get(),RankineItems.GADOLINIUM_MONAZITE.get(),RankineItems.GARNET.get(),RankineItems.GRAPHITE.get(),RankineItems.GREENOCKITE.get(),RankineItems.GOETHITE.get(),RankineItems.GYPSUM.get(),RankineItems.HEDENBERGITE.get(),RankineItems.ILMENITE.get(),RankineItems.KYANITE.get(),RankineItems.LABRADORITE.get(),RankineItems.LANTHANUM_MONAZITE.get(),RankineItems.LAURITE.get(),RankineItems.LAUTARITE.get(),RankineItems.LEPIDOLITE.get(),RankineItems.LIGNITE.get(),RankineItems.LONSDALEITE_DIAMOND.get(),RankineItems.MAGNESIA.get(),RankineItems.MAGNESITE.get(),RankineItems.MAGNETITE.get(),RankineItems.MALACHITE.get(),RankineItems.MELLITE.get(),RankineItems.MONTROYDITE.get(),RankineItems.MICA.get(),RankineItems.MOLYBDENITE.get(),RankineItems.NEODYMIUM_MONAZITE.get(),RankineItems.OLIVINE.get(),RankineItems.OPAL.get(),RankineItems.ORTHOCLASE_FELDSPAR.get(),RankineItems.PEARL.get(),RankineItems.PENTLANDITE.get(),RankineItems.PERIDOT.get(),RankineItems.PERLITE.get(),RankineItems.PEROVSKITE.get(),RankineItems.PETALITE.get(),RankineItems.PINK_SALT.get(),RankineItems.PLAGIOCLASE_FELDSPAR.get(),RankineItems.PLATINUM_ARSENIDE.get(),RankineItems.PYRITE.get(),RankineItems.PYROLUSITE.get(),RankineItems.PYROXENE.get(),RankineItems.QUICKLIME.get(),RankineItems.REALGAR.get(),RankineItems.RHENIITE.get(),RankineItems.RHODOCHROSITE.get(),RankineItems.RHODONITE.get(),RankineItems.RINGWOODITE.get(),RankineItems.RUBY.get(),RankineItems.RUTILE.get(),RankineItems.SAMARIUM_MONAZITE.get(),RankineItems.SANIDINE.get(),RankineItems.SAPPHIRE.get(),RankineItems.SERPENTINE.get(),RankineItems.SILICON_CARBIDE.get(),RankineItems.SPHALERITE.get(),RankineItems.SPINEL.get(),RankineItems.SPODUMENE.get(),RankineItems.SODIUM_CHLORIDE.get(),RankineItems.STIBNITE.get(),RankineItems.SUBBITUMINOUS_COAL.get(),RankineItems.TALC.get(),RankineItems.TANTALITE.get(),RankineItems.THORITE.get(),RankineItems.THORTVEITITE.get(),RankineItems.TIGER_IRON.get(),RankineItems.TOPAZ.get(),RankineItems.TOURMALINE.get(),RankineItems.URANINITE.get(),RankineItems.VANADINITE.get(),RankineItems.WADSLEYITE.get(),RankineItems.WOLFRAMITE.get(),RankineItems.XENOTIME.get(),RankineItems.YTTRIUM_MONAZITE.get(),RankineItems.ZIRCON.get(),RankineItems.ZIRCONIA.get(),RankineItems.HAFNIA.get(),RankineItems.LORANDITE.get(),RankineItems.POLLUCITE.get(),RankineItems.IRON_CHLORIDE.get(),RankineItems.MAGNESIUM_CHLORIDE.get()); public static List MINERAL_BLOCKS = Arrays.asList(RankineBlocks.HEMATITE_BLOCK.get(),RankineBlocks.ACANTHITE_BLOCK.get(),RankineBlocks.ALUMINA_BLOCK.get(),RankineBlocks.AMBER_BLOCK.get(),RankineBlocks.AMPHIBOLE_BLOCK.get(),RankineBlocks.ANDESINE_BLOCK.get(),RankineBlocks.ANTHRACITE_COAL_BLOCK.get(),RankineBlocks.AQUAMARINE_BLOCK.get(),RankineBlocks.APATITE_BLOCK.get(),RankineBlocks.AZURITE_BLOCK.get(),RankineBlocks.AZURMALACHITE_BLOCK.get(),RankineBlocks.BADDELEYITE_BLOCK.get(),RankineBlocks.BARITE_BLOCK.get(),RankineBlocks.BAUXITE_BLOCK.get(),RankineBlocks.BISMUTHINITE_BLOCK.get(),RankineBlocks.BITUMINOUS_COAL_BLOCK.get(),RankineBlocks.BRIDGMANITE_BLOCK.get(),RankineBlocks.CALCIUM_CHLORIDE_BLOCK.get(),RankineBlocks.CALCIUM_SILICATE_BLOCK.get(),RankineBlocks.CASSITERITE_BLOCK.get(),RankineBlocks.CELESTINE_BLOCK.get(),RankineBlocks.CHALCOCITE_BLOCK.get(),RankineBlocks.CHALCOPYRITE_BLOCK.get(),RankineBlocks.CERIUM_MONAZITE_BLOCK.get(),RankineBlocks.CHROME_ENSTATITE_BLOCK.get(),RankineBlocks.CHROMITE_BLOCK.get(),RankineBlocks.CHLORITE_BLOCK.get(),RankineBlocks.CINNABAR_BLOCK.get(),RankineBlocks.COBALTITE_BLOCK.get(),RankineBlocks.COKE_BLOCK.get(),RankineBlocks.COLUMBITE_BLOCK.get(),RankineBlocks.COOPERITE_BLOCK.get(),RankineBlocks.CRYOLITE_BLOCK.get(),RankineBlocks.DIOPSIDE_BLOCK.get(),RankineBlocks.DOLOMITE_BLOCK.get(),RankineBlocks.ENSTATITE_BLOCK.get(),RankineBlocks.FERROPERICLASE_BLOCK.get(),RankineBlocks.FLUORITE_BLOCK.get(),RankineBlocks.FORSTERITE_BLOCK.get(),RankineBlocks.GALENA_BLOCK.get(),RankineBlocks.GADOLINIUM_MONAZITE_BLOCK.get(),RankineBlocks.GARNET_BLOCK.get(),RankineBlocks.GRAPHITE_BLOCK.get(),RankineBlocks.GREENOCKITE_BLOCK.get(),RankineBlocks.GOETHITE_BLOCK.get(),RankineBlocks.GYPSUM_BLOCK.get(),RankineBlocks.HEDENBERGITE_BLOCK.get(),RankineBlocks.ILMENITE_BLOCK.get(),RankineBlocks.KYANITE_BLOCK.get(),RankineBlocks.LABRADORITE_BLOCK.get(),RankineBlocks.LANTHANUM_MONAZITE_BLOCK.get(),RankineBlocks.LAURITE_BLOCK.get(),RankineBlocks.LAUTARITE_BLOCK.get(),RankineBlocks.LEPIDOLITE_BLOCK.get(),RankineBlocks.LIGNITE_BLOCK.get(),RankineBlocks.LONSDALEITE_DIAMOND_BLOCK.get(),RankineBlocks.MAGNESIA_BLOCK.get(),RankineBlocks.MAGNESITE_BLOCK.get(),RankineBlocks.MAGNETITE_BLOCK.get(),RankineBlocks.MALACHITE_BLOCK.get(),RankineBlocks.MELLITE_BLOCK.get(),RankineBlocks.MONTROYDITE_BLOCK.get(),RankineBlocks.MICA_BLOCK.get(),RankineBlocks.MOLYBDENITE_BLOCK.get(),RankineBlocks.NEODYMIUM_MONAZITE_BLOCK.get(),RankineBlocks.OLIVINE_BLOCK.get(),RankineBlocks.OPAL_BLOCK.get(),RankineBlocks.ORTHOCLASE_FELDSPAR_BLOCK.get(),RankineBlocks.PEARL_BLOCK.get(),RankineBlocks.PENTLANDITE_BLOCK.get(),RankineBlocks.PERIDOT_BLOCK.get(),RankineBlocks.PERLITE_BLOCK.get(),RankineBlocks.PEROVSKITE_BLOCK.get(),RankineBlocks.PETALITE_BLOCK.get(),RankineBlocks.PINK_SALT_BLOCK.get(),RankineBlocks.PLAGIOCLASE_FELDSPAR_BLOCK.get(),RankineBlocks.PLATINUM_ARSENIDE_BLOCK.get(),RankineBlocks.PYRITE_BLOCK.get(),RankineBlocks.PYROLUSITE_BLOCK.get(),RankineBlocks.PYROXENE_BLOCK.get(),RankineBlocks.QUICKLIME_BLOCK.get(),RankineBlocks.REALGAR_BLOCK.get(),RankineBlocks.RHENIITE_BLOCK.get(),RankineBlocks.RHODOCHROSITE_BLOCK.get(),RankineBlocks.RHODONITE_BLOCK.get(),RankineBlocks.RINGWOODITE_BLOCK.get(),RankineBlocks.RUBY_BLOCK.get(),RankineBlocks.RUTILE_BLOCK.get(),RankineBlocks.SAMARIUM_MONAZITE_BLOCK.get(),RankineBlocks.SANIDINE_BLOCK.get(),RankineBlocks.SAPPHIRE_BLOCK.get(),RankineBlocks.SERPENTINE_BLOCK.get(),RankineBlocks.SILICON_CARBIDE_BLOCK.get(),RankineBlocks.SPHALERITE_BLOCK.get(),RankineBlocks.SPINEL_BLOCK.get(),RankineBlocks.SPODUMENE_BLOCK.get(),RankineBlocks.SODIUM_CHLORIDE_BLOCK.get(),RankineBlocks.STIBNITE_BLOCK.get(),RankineBlocks.SUBBITUMINOUS_COAL_BLOCK.get(),RankineBlocks.TALC_BLOCK.get(),RankineBlocks.TANTALITE_BLOCK.get(),RankineBlocks.THORITE_BLOCK.get(),RankineBlocks.THORTVEITITE_BLOCK.get(),RankineBlocks.TIGER_IRON_BLOCK.get(),RankineBlocks.TOPAZ_BLOCK.get(),RankineBlocks.TOURMALINE_BLOCK.get(),RankineBlocks.URANINITE_BLOCK.get(),RankineBlocks.VANADINITE_BLOCK.get(),RankineBlocks.WADSLEYITE_BLOCK.get(),RankineBlocks.WOLFRAMITE_BLOCK.get(),RankineBlocks.XENOTIME_BLOCK.get(),RankineBlocks.YTTRIUM_MONAZITE_BLOCK.get(),RankineBlocks.ZIRCON_BLOCK.get(),RankineBlocks.ZIRCONIA_BLOCK.get(),RankineBlocks.HAFNIA_BLOCK.get(),RankineBlocks.LORANDITE_BLOCK.get(),RankineBlocks.POLLUCITE_BLOCK.get(),RankineBlocks.IRON_CHLORIDE_BLOCK.get(),RankineBlocks.MAGNESIUM_CHLORIDE_BLOCK.get()); diff --git a/src/main/java/com/cannolicatfish/rankine/init/RankinePlacedFeatures.java b/src/main/java/com/cannolicatfish/rankine/init/RankinePlacedFeatures.java index 0f53ca20ee..d4eb93e391 100644 --- a/src/main/java/com/cannolicatfish/rankine/init/RankinePlacedFeatures.java +++ b/src/main/java/com/cannolicatfish/rankine/init/RankinePlacedFeatures.java @@ -22,7 +22,7 @@ public class RankinePlacedFeatures { public static final DeferredRegister PLACED_FEATURES = DeferredRegister.create(Registry.PLACED_FEATURE_REGISTRY, ProjectRankine.MODID); - public static final RegistryObject PLACED_FUMAROLE = PLACED_FEATURES.register("fumarole", () -> new PlacedFeature(RankineConfiguredFeatures.CONFIGURED_FUMAROLE.getHolder().get(), Arrays.asList(BiomeFilter.biome(), RarityFilter.onAverageOnceEvery(Config.WORLDGEN.FUMAROLE_GEN.get())))); + public static final RegistryObject PLACED_FUMAROLE = PLACED_FEATURES.register("fumarole", () -> new PlacedFeature(RankineConfiguredFeatures.CONFIGURED_FUMAROLE.getHolder().get(), Arrays.asList(RarityFilter.onAverageOnceEvery(Config.WORLDGEN.FUMAROLE_GEN.get()), BiomeFilter.biome()))); public static final RegistryObject PLACED_INTRUSION = PLACED_FEATURES.register("intrusion", () -> new PlacedFeature(RankineConfiguredFeatures.CONFIGURED_INTRUSION.getHolder().get(), Arrays.asList(BiomeFilter.biome()))); public static final RegistryObject PLACED_METEORITE = PLACED_FEATURES.register("meteorite", () -> new PlacedFeature(RankineConfiguredFeatures.CONFIGURED_METEORITE.getHolder().get(), Arrays.asList(InSquarePlacement.spread(), PlacementUtils.HEIGHTMAP_WORLD_SURFACE, RarityFilter.onAverageOnceEvery(Config.WORLDGEN.METEORITE_CHANCE.get()), BiomeFilter.biome()))); public static final RegistryObject PLACED_END_METEORITE = PLACED_FEATURES.register("end_meteorite", () -> new PlacedFeature(RankineConfiguredFeatures.CONFIGURED_END_METEORITE.getHolder().get(), Collections.singletonList(BiomeFilter.biome()))); diff --git a/src/main/java/com/cannolicatfish/rankine/util/ReplacementUtils.java b/src/main/java/com/cannolicatfish/rankine/util/ReplacementUtils.java index d3aa3d17b6..c9a59ca20d 100644 --- a/src/main/java/com/cannolicatfish/rankine/util/ReplacementUtils.java +++ b/src/main/java/com/cannolicatfish/rankine/util/ReplacementUtils.java @@ -140,6 +140,7 @@ public class ReplacementUtils { }); replacerMap.put(Blocks.GRAVEL, index -> WorldgenUtils.GRAVELS.get(index) != Blocks.AIR ? WorldgenUtils.GRAVELS.get(index) : Blocks.AIR); replacerMap.put(Blocks.SAND, index -> (WorldgenUtils.SANDS.get(index) != Blocks.AIR) ? WorldgenUtils.SANDS.get(index) : SAND_NOISE > 0.5f ? RankineBlocks.WHITE_SAND.get() : Blocks.AIR); + replacerMap.put(RankineBlocks.SOUL_SANDSTONE.get(), index -> (WorldgenUtils.SANDSTONES.get(index) != Blocks.AIR) ? WorldgenUtils.SANDSTONES.get(index) : SAND_NOISE > 0.8f ? RankineBlocks.BLACK_SANDSTONE.get() : Blocks.AIR); replacerMap.put(Blocks.SANDSTONE, index -> (WorldgenUtils.SANDSTONES.get(index) != Blocks.AIR) ? WorldgenUtils.SANDSTONES.get(index) : SAND_NOISE > 0.5f ? RankineBlocks.WHITE_SANDSTONE.get() : Blocks.AIR); replacerMap.put(Blocks.SMOOTH_SANDSTONE, index -> ForgeRegistries.BLOCKS.getValue(ResourceLocation.tryParse(WorldgenUtils.SANDSTONES.get(index).getRegistryName().toString().replace(":",":smooth_")))); replacerMap.put(Blocks.SMOOTH_RED_SANDSTONE, index -> ForgeRegistries.BLOCKS.getValue(ResourceLocation.tryParse(WorldgenUtils.SANDSTONES.get(index).getRegistryName().toString().replace(":",":smooth_")))); diff --git a/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item3.json b/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item3.json index 107f07ed9a..b142ccdee3 100644 --- a/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item3.json +++ b/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item3.json @@ -1,13 +1,13 @@ { "components": [ { - "type": "header", + "type": "patchouli:header", "text": "#heading", "x": -1, "y": -1 }, { - "type": "item", + "type": "patchouli:item", "item": "#item1", "framed": "true", "link_recipe": true, @@ -15,7 +15,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item2", "framed": "true", "link_recipe": true, @@ -23,7 +23,7 @@ "y": 35 }, { - "type": "item", + "type": "patchouli:item", "item": "#item3", "framed": "true", "link_recipe": true, @@ -31,7 +31,7 @@ "y": 35 }, { - "type": "text", + "type": "patchouli:text", "text": "#text", "x": 0, "y": 60 diff --git a/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item4.json b/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item4.json index ca9be1009b..d8f690f32c 100644 --- a/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item4.json +++ b/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item4.json @@ -1,13 +1,13 @@ { "components": [ { - "type": "header", + "type": "patchouli:header", "text": "#heading", "x": -1, "y": -1 }, { - "type": "item", + "type": "patchouli:item", "item": "#item1", "framed": "true", "link_recipe": true, @@ -15,7 +15,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item2", "framed": "true", "link_recipe": true, @@ -23,7 +23,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item3", "framed": "true", "link_recipe": true, @@ -31,7 +31,7 @@ "y": 35 }, { - "type": "item", + "type": "patchouli:item", "item": "#item4", "framed": "true", "link_recipe": true, @@ -39,7 +39,7 @@ "y": 35 }, { - "type": "text", + "type": "patchouli:text", "text": "#text", "x": 0, "y": 60 diff --git a/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item5.json b/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item5.json index 30e9114c9f..4cd6daa3d2 100644 --- a/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item5.json +++ b/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item5.json @@ -1,13 +1,13 @@ { "components": [ { - "type": "header", + "type": "patchouli:header", "text": "#heading", "x": -1, "y": -1 }, { - "type": "item", + "type": "patchouli:item", "item": "#item1", "framed": "true", "link_recipe": true, @@ -15,7 +15,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item2", "framed": "true", "link_recipe": true, @@ -23,7 +23,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item3", "framed": "true", "link_recipe": true, @@ -31,7 +31,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item4", "framed": "true", "link_recipe": true, @@ -39,7 +39,7 @@ "y": 35 }, { - "type": "item", + "type": "patchouli:item", "item": "#item5", "framed": "true", "link_recipe": true, @@ -47,7 +47,7 @@ "y": 35 }, { - "type": "text", + "type": "patchouli:text", "text": "#text", "x": 0, "y": 60 diff --git a/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item6.json b/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item6.json index 1eaf1c85df..40457628e9 100644 --- a/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item6.json +++ b/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item6.json @@ -1,13 +1,13 @@ { "components": [ { - "type": "header", + "type": "patchouli:header", "text": "#heading", "x": -1, "y": -1 }, { - "type": "item", + "type": "patchouli:item", "item": "#item1", "framed": "true", "link_recipe": true, @@ -15,7 +15,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item2", "framed": "true", "link_recipe": true, @@ -23,7 +23,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item3", "framed": "true", "link_recipe": true, @@ -31,7 +31,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item4", "framed": "true", "link_recipe": true, @@ -39,7 +39,7 @@ "y": 35 }, { - "type": "item", + "type": "patchouli:item", "item": "#item5", "framed": "true", "link_recipe": true, @@ -47,7 +47,7 @@ "y": 35 }, { - "type": "item", + "type": "patchouli:item", "item": "#item6", "framed": "true", "link_recipe": true, @@ -55,7 +55,7 @@ "y": 35 }, { - "type": "text", + "type": "patchouli:text", "text": "#text", "x": 0, "y": 60 diff --git a/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item7.json b/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item7.json index f01c7634d9..577aeb5df6 100644 --- a/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item7.json +++ b/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item7.json @@ -1,13 +1,13 @@ { "components": [ { - "type": "header", + "type": "patchouli:header", "text": "#heading", "x": -1, "y": -1 }, { - "type": "item", + "type": "patchouli:item", "item": "#item1", "framed": "true", "link_recipe": true, @@ -15,7 +15,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item2", "framed": "true", "link_recipe": true, @@ -23,7 +23,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item3", "framed": "true", "link_recipe": true, @@ -31,7 +31,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item4", "framed": "true", "link_recipe": true, @@ -39,7 +39,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item5", "framed": "true", "link_recipe": true, @@ -47,7 +47,7 @@ "y": 35 }, { - "type": "item", + "type": "patchouli:item", "item": "#item6", "framed": "true", "link_recipe": true, @@ -55,7 +55,7 @@ "y": 35 }, { - "type": "item", + "type": "patchouli:item", "item": "#item7", "framed": "true", "link_recipe": true, @@ -63,7 +63,7 @@ "y": 35 }, { - "type": "text", + "type": "patchouli:text", "text": "#text", "x": 0, "y": 60 diff --git a/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item8.json b/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item8.json index 8daeac4004..359087063b 100644 --- a/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item8.json +++ b/src/main/resources/data/rankine/patchouli_books/rankine_journal/en_us/templates/item8.json @@ -1,13 +1,13 @@ { "components": [ { - "type": "header", + "type": "patchouli:header", "text": "#heading", "x": -1, "y": -1 }, { - "type": "item", + "type": "patchouli:item", "item": "#item1", "framed": "true", "link_recipe": true, @@ -15,7 +15,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item2", "framed": "true", "link_recipe": true, @@ -23,7 +23,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item3", "framed": "true", "link_recipe": true, @@ -31,7 +31,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item4", "framed": "true", "link_recipe": true, @@ -39,7 +39,7 @@ "y": 15 }, { - "type": "item", + "type": "patchouli:item", "item": "#item5", "framed": "true", "link_recipe": true, @@ -47,7 +47,7 @@ "y": 35 }, { - "type": "item", + "type": "patchouli:item", "item": "#item6", "framed": "true", "link_recipe": true, @@ -55,7 +55,7 @@ "y": 35 }, { - "type": "item", + "type": "patchouli:item", "item": "#item7", "framed": "true", "link_recipe": true, @@ -63,7 +63,7 @@ "y": 35 }, { - "type": "item", + "type": "patchouli:item", "item": "#item8", "framed": "true", "link_recipe": true, @@ -71,7 +71,7 @@ "y": 35 }, { - "type": "text", + "type": "patchouli:text", "text": "#text", "x": 0, "y": 60 diff --git a/src/main/resources/data/rankine/recipes/crushing/shonkinite_crushing.json b/src/main/resources/data/rankine/recipes/crushing/shonkinite_crushing.json index 3a90f6a7fd..abddb2b883 100644 --- a/src/main/resources/data/rankine/recipes/crushing/shonkinite_crushing.json +++ b/src/main/resources/data/rankine/recipes/crushing/shonkinite_crushing.json @@ -1,7 +1,7 @@ { "type": "rankine:crushing", "input": { - "item": "rankine:red_porphyry" + "item": "rankine:shonkinite" }, "output1": { "item": "minecraft:cobblestone",