Publish changes to fix mod, and add vault limitations

This commit is contained in:
Aria 2023-02-23 07:27:38 -07:00
parent 19573bbd56
commit 553ff429f3
130 changed files with 211075 additions and 208965 deletions

View file

@ -10,8 +10,6 @@ import java.util.Map;
import java.util.Set;
import com.mojang.logging.LogUtils;
import com.mojang.serialization.Codec;
import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.client.renderer.entity.EntityRenderers;
import net.minecraft.network.chat.Component;
@ -20,9 +18,6 @@ import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer;
import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.InputEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -35,8 +30,6 @@ import net.minecraftforge.event.entity.item.ItemExpireEvent;
import net.minecraftforge.event.server.ServerStartedEvent;
import net.minecraftforge.event.server.ServerStoppingEvent;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries;
import software.bernie.geckolib3.GeckoLib;
import org.slf4j.Logger;
@ -55,7 +48,6 @@ import dev.zontreck.otemod.database.Database.DatabaseConnectionException;
import dev.zontreck.otemod.enchantments.ModEnchantments;
import dev.zontreck.otemod.entities.ModEntityTypes;
import dev.zontreck.otemod.entities.monsters.client.PossumRenderer;
import dev.zontreck.otemod.events.EventHandler;
import dev.zontreck.otemod.events.LoreHandlers;
import dev.zontreck.otemod.implementation.inits.ModMenuTypes;
import dev.zontreck.otemod.implementation.scrubber.ItemScrubberScreen;

View file

@ -36,6 +36,10 @@ public class ModBlocks {
public static final RegistryObject<Item> ETERNIUM_ORE_BLOCK_I = ITEMS.register("eternium_ore_block", () -> new BlockItem(ETERNIUM_ORE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Block> VAULT_STEEL_ORE_BLOCK = BLOCKS.register("vault_steel_ore_block", ()->new Block(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(8F).explosionResistance(1200).destroyTime(100)));
public static final RegistryObject<Item> VAULT_STEEL_ORE_BLOCK_I = ITEMS.register("vault_steel_ore_block", ()->new BlockItem(VAULT_STEEL_ORE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS)));
//#region TINKERS BLOCKS
public static final RegistryObject<Block> COBALT_ORE_BLOCK = BLOCKS.register("cobalt_ore", () -> new Block(BlockBehaviour.Properties.of(Material.STONE, MaterialColor.NETHER).sound(SoundType.NETHER_ORE).requiresCorrectToolForDrops().strength(10.0F)));
@ -46,25 +50,10 @@ public class ModBlocks {
public static final RegistryObject<Item> RAW_COBALT_ORE_ITEM = ITEMS.register("raw_cobalt_ore", ()->new BlockItem(RAW_COBALT_ORE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS)));
public static final RegistryObject<Block> GOLD_BARS = BLOCKS.register("gold_bars", ()-> new IronBarsBlock(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.NONE).requiresCorrectToolForDrops().strength(3.0F, 6.0F).sound(SoundType.METAL).noOcclusion()));
public static final RegistryObject<Item> GOLD_BARS_I = ITEMS.register("gold_bars", ()-> new BlockItem(GOLD_BARS.get(), new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS)));
public static final RegistryObject<Block> COBALT_BLOCK = BLOCKS.register("cobalt_block", ()-> new Block(BlockBehaviour.Properties.of(Material.METAL, MaterialColor.COLOR_BLUE).requiresCorrectToolForDrops().strength(3.0F, 6.0F).sound(SoundType.METAL)));
public static final RegistryObject<Item> COBALT_BLOCK_I = ITEMS.register("cobalt_block", ()-> new BlockItem(COBALT_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS)));
public static final RegistryObject<Block> NETHER_GROUT = BLOCKS.register("nether_grout", ()-> new Block(BlockBehaviour.Properties.of(Material.SAND, MaterialColor.NONE).strength(3.0F).friction(0.8F).sound(SoundType.SOUL_SOIL)));
public static final RegistryObject<Item> NETHER_GROUT_I = ITEMS.register("nether_grout", ()-> new BlockItem(NETHER_GROUT.get(), new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS)));
public static final BlockBehaviour.Properties SCORCHED_BASE = BlockBehaviour.Properties.of(Material.STONE, MaterialColor.TERRACOTTA_BROWN).requiresCorrectToolForDrops().strength(2.5F, 8.0F);
public static final BlockBehaviour.Properties SCORCHED_BASE_NONSOLID = SCORCHED_BASE.noOcclusion();
public static final RegistryObject<Block> SCORCHED_TABLE = BLOCKS.register("scorched_table", ()-> new Block(SCORCHED_BASE_NONSOLID));
public static final RegistryObject<Item> SCORCHED_TABLE_I = ITEMS.register("scorched_table", ()-> new BlockItem(SCORCHED_TABLE.get(), new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS)));
//#endregion

View file

@ -53,7 +53,7 @@ public class ChatServerOverride {
has_profile=true;
OTEMod.PROFILES.put(ev.getEntity().getStringUUID(), new Profile(rs.getString("username"), rs.getString("prefix"), rs.getString("nickname"), rs.getString("name_color"), ev.getEntity().getStringUUID(), rs.getString("prefix_color"), rs.getString("chat_color"), rs.getBoolean("flying")));
OTEMod.PROFILES.put(ev.getEntity().getStringUUID(), new Profile(rs.getString("username"), rs.getString("prefix"), rs.getString("nickname"), rs.getString("name_color"), ev.getEntity().getStringUUID(), rs.getString("prefix_color"), rs.getString("chat_color"), rs.getBoolean("flying"), rs.getInt("vaults")));
}
if(!has_profile)

View file

@ -85,14 +85,8 @@ public class HomeCommand {
position = dest.Position.asMinecraftVector();
rot = dest.Rotation.asMinecraftVector();
ServerLevel dimL=null;
try {
dimL = (ServerLevel)dest.getActualDimension();
} catch (InvalidSideException e) {
e.printStackTrace();
return 1;
}
ServerLevel dimL = (ServerLevel)dest.getActualDimension();
TeleportActioner.ApplyTeleportEffect(p);
// Instantiate a Teleport Runner

View file

@ -5,6 +5,7 @@ import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.chat.HoverTip;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.configs.Profile;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
@ -43,11 +44,11 @@ public class ShareItemInChatCommand {
Profile prof = Profile.get_profile_of(play.getUUID().toString());
MutableComponent component = new TextComponent(OTEMod.OTEPrefix + ChatColor.doColors(" !Dark_Green!" + is.getDisplayName()+" !White!-!Dark_Purple! Hover here to see the item that "+prof.name_color+prof.nickname+"!Dark_Purple! shared"));
MutableComponent component = new TextComponent(OTEMod.OTEPrefix).append(is.getDisplayName()).append(new TextComponent(ChatColor.doColors(" !White!-!Dark_Purple! Hover here to see the item that "+prof.name_color+prof.nickname+"!Dark_Purple! shared")));
Style style = Style.EMPTY.withFont(Style.DEFAULT_FONT);
component = component.withStyle(style.withHoverEvent(HoverTip.getItem(is)));
play.server.sendMessage(component, play.getUUID());
ChatServerOverride.broadcast(component, OTEMod.THE_SERVER);
}else {
return 1;

View file

@ -67,7 +67,7 @@ public class RTPCommand {
if(b.isAir()){
if(b2.isAir()){
if(!b3.isAir())
if(!b3.isAir() && !b3.is(Blocks.BEDROCK))
{
// Check names
boolean valid=true;

View file

@ -55,13 +55,8 @@ public class WarpCommand {
TeleportDestination dest = new TeleportDestination(NbtUtils.snbtToStructure(rs.getString("teleporter")));
ServerLevel dimL = null;
try{
dimL=(ServerLevel) dest.getActualDimension();
}catch(InvalidSideException e)
{
return 1;
}
ServerLevel dimL=(ServerLevel) dest.getActualDimension();
final int type = rs.getInt("warptype");
final ServerLevel f_dim = dimL;

View file

@ -31,6 +31,7 @@ public class OTEServerConfig {
public static final ForgeConfigSpec.BooleanValue DEBUG_HEALER;
public static final ForgeConfigSpec.ConfigValue<Integer> TIME_BETWEEN_BLOCKS;
public static final ForgeConfigSpec.ConfigValue<Integer> MAX_TRIES_HEAL;
public static final ForgeConfigSpec.ConfigValue<Integer> MAX_VAULTS;
public static final ForgeConfigSpec.ConfigValue<List<String>> EXCLUDE_DIMS;
@ -47,6 +48,7 @@ public class OTEServerConfig {
BUILDER.push("OTE");
INITIAL_ITEMS_TO_GIVE_ON_FIRST_JOIN = BUILDER.comment("What items, identified by modid:item, to give to a brand new user on the server").define("New Player Gear", defaults);
SPAWN_EGG_CHANCE = BUILDER.comment("What is the chance for a spawn egg to drop from a mob when looting 3 is used? Default: 0.25").define("spawn_egg_chance", 0.25);
MAX_VAULTS = BUILDER.comment("What is the maximum number of vaults a player may have available? (0 is unlimited)").define("max_vaults", 0);
BUILDER.pop();
BUILDER.push("DATABASE");

View file

@ -17,8 +17,9 @@ public class Profile {
public String prefix_color;
public String chat_color;
public Boolean flying;
public int available_vaults;
public Profile(String username, String prefix, String nickname, String name_color, String ID, String prefix_color, String chat_color, Boolean isFlying) {
public Profile(String username, String prefix, String nickname, String name_color, String ID, String prefix_color, String chat_color, Boolean isFlying, int vaults) {
this.username = username;
this.prefix = prefix;
this.nickname = nickname;
@ -27,6 +28,7 @@ public class Profile {
this.prefix_color = prefix_color;
this.chat_color = chat_color;
this.flying=isFlying;
this.available_vaults=vaults;
}
@ -43,7 +45,7 @@ public class Profile {
public static Profile factory(ServerPlayer play)
{
Profile p = new Profile(play.getName().getString(), "Member", play.getDisplayName().getString(), ChatColor.GREEN, play.getStringUUID(), ChatColor.AQUA, ChatColor.WHITE, false);
Profile p = new Profile(play.getName().getString(), "Member", play.getDisplayName().getString(), ChatColor.GREEN, play.getStringUUID(), ChatColor.AQUA, ChatColor.WHITE, false, 0);
return p;
}
@ -51,7 +53,7 @@ public class Profile {
{
// Send player to server!
Connection con = OTEMod.DB.getConnection();
String SQL = "REPLACE INTO `profiles` (username, uuid, prefix, nickname, name_color, prefix_color, chat_color, flying) values (?, ?, ?, ?, ?, ?, ?, ?);";
String SQL = "REPLACE INTO `profiles` (username, uuid, prefix, nickname, name_color, prefix_color, chat_color, flying, vaults) values (?, ?, ?, ?, ?, ?, ?, ?, ?);";
try {
PreparedStatement pstat = con.prepareStatement(SQL);
pstat.setString(1, username);
@ -62,10 +64,10 @@ public class Profile {
pstat.setString(6, prefix_color);
pstat.setString(7, chat_color);
pstat.setBoolean(8, flying);
pstat.setInt(9, available_vaults);
pstat.execute();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

View file

@ -9,17 +9,17 @@ public class PossumModel extends AnimatedGeoModel<PossumEntity>
{
@Override
public ResourceLocation getAnimationResource(PossumEntity animatable) {
public ResourceLocation getAnimationFileLocation(PossumEntity animatable) {
return new ResourceLocation(OTEMod.MOD_ID, "animations/possum.animation.json");
}
@Override
public ResourceLocation getModelResource(PossumEntity object) {
public ResourceLocation getModelLocation(PossumEntity object) {
return new ResourceLocation(OTEMod.MOD_ID, "geo/possum.geo.json");
}
@Override
public ResourceLocation getTextureResource(PossumEntity object) {
public ResourceLocation getTextureLocation(PossumEntity object) {
return new ResourceLocation(OTEMod.MOD_ID, "textures/entity/possum_texture.png");
}

View file

@ -5,6 +5,8 @@ import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.enchantments.MobEggEnchantment;
import dev.zontreck.otemod.enchantments.ModEnchantments;
import dev.zontreck.otemod.items.tags.ItemStatType;
import dev.zontreck.otemod.ore.OreGenerator;
import net.minecraftforge.eventbus.api.EventPriority;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraft.nbt.CompoundTag;
@ -15,17 +17,21 @@ import net.minecraft.world.entity.item.ItemEntity;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraft.world.level.storage.loot.LootTable;
import net.minecraftforge.common.ForgeSpawnEggItem;
import net.minecraftforge.event.LootTableLoadEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.world.BiomeLoadingEvent;
@Mod.EventBusSubscriber(modid=OTEMod.MOD_ID)
public class EventHandler {
/*
@SubscribeEvent(priority = EventPriority.HIGH)
public static void addOresToBiomes(final BiomeLoadingEvent ev){
//ShapedAionResources.LOGGER.info("Biome loading event called. Registering aion ores");
OTEMod.LOGGER.info("/!\\ Registering OTEMod ores /!\\");
OreGenerator.generateOres(ev);
}*/
}
@SubscribeEvent
public void onEntityKilled(LivingDropsEvent ev){

View file

@ -19,8 +19,6 @@ public class ModItems {
public static final RegistryObject<Item> IHAN_CRYSTAL = ITEMS.register("ihan_crystal", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> ETERNIUM_DUST = ITEMS.register("eternium_dust", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> AURORA_COMPOUND = ITEMS.register("aurora_compound", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
@ -29,9 +27,6 @@ public class ModItems {
public static final RegistryObject<Item> RAW_COBALT = ITEMS.register("raw_cobalt", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> COBALT_NUGGET = ITEMS.register("cobalt_nugget", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> COBALT_INGOT = ITEMS.register("cobalt_ingot", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> PATTERN = ITEMS.register("pattern", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> SCORCHED_BRICK = ITEMS.register("scorched_brick", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC)));
public static final RegistryObject<Item> COPPER_CAN = ITEMS.register("copper_can", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(16)));
public static final RegistryObject<Item> ETERNIUM_INGOT = ITEMS.register("eternium_ingot", ()-> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS)));
@ -43,6 +38,21 @@ public class ModItems {
public static final RegistryObject<Item> SCRUBBER_FRAME = ITEMS.register("scrubber_frame", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULTSTEEL_INGOT = ITEMS.register("vault_steel_ingot", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_BL = ITEMS.register("vault_fragment_lower_left", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_LC = ITEMS.register("vault_fragment_lower", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_BR = ITEMS.register("vault_fragment_lower_right", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_L = ITEMS.register("vault_fragment_left", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_R = ITEMS.register("vault_fragment_right", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_UR = ITEMS.register("vault_fragment_upper_right", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_UL = ITEMS.register("vault_fragment_upper_left", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_U = ITEMS.register("vault_fragment_upper", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_FRAG_C = ITEMS.register("vault_fragment_center", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT = ITEMS.register("vault", () -> new VaultItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> VAULT_RAW_ORE = ITEMS.register("raw_vault_steel_ore", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64)));
public static final RegistryObject<Item> POSSUM_SPAWN_EGG = ITEMS.register("possum_spawn_egg", () -> new ForgeSpawnEggItem(ModEntityTypes.POSSUM, 0x938686, 0xc68787, new Item.Properties().tab(CreativeModeTab.TAB_MISC)));

View file

@ -0,0 +1,78 @@
package dev.zontreck.otemod.items;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.items.lore.LoreContainer;
import dev.zontreck.libzontreck.items.lore.LoreEntry;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.configs.OTEServerConfig;
import dev.zontreck.otemod.configs.Profile;
import dev.zontreck.otemod.events.LoreHandlers;
import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.Item;
import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items;
import net.minecraft.world.item.SimpleFoiledItem;
import net.minecraft.world.level.Level;
public class VaultItem extends Item
{
@Override
public boolean isFoil(ItemStack pStack) {
return true;
}
@Override
public Item asItem()
{
return this;
}
public VaultItem(Properties pProperties) {
super(pProperties);
//TODO Auto-generated constructor stub
}
@Override
public InteractionResultHolder<ItemStack> use(Level pLevel, Player pPlayer, InteractionHand pUsedHand)
{
OTEMod.LOGGER.info("Vault item is being used");
if(!pLevel.isClientSide && pUsedHand == InteractionHand.MAIN_HAND)
{
ItemStack is = pPlayer.getItemInHand(pUsedHand);
Profile p = Profile.get_profile_of(pPlayer.getStringUUID());
if(OTEServerConfig.MAX_VAULTS.get()>0)
{
if(p.available_vaults >= OTEServerConfig.MAX_VAULTS.get())
{
ChatServerOverride.broadcastTo(pPlayer.getUUID(), new TextComponent(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Red!You cannot activate anymore vaults due to the maximum set by the server admin")), OTEMod.THE_SERVER);
return InteractionResultHolder.pass(is);
} else {
p.available_vaults++;
p.commit();
ChatServerOverride.broadcastTo(pPlayer.getUUID(), new TextComponent(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Green!You now have "+String.valueOf(p.available_vaults)+" available vaults")), OTEMod.THE_SERVER);
pPlayer.setItemInHand(pUsedHand, new ItemStack(Items.AIR));
return InteractionResultHolder.consume(is);
}
}else {
p.available_vaults++;
p.commit();
ChatServerOverride.broadcastTo(pPlayer.getUUID(), new TextComponent(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Green!You now have "+String.valueOf(p.available_vaults)+" available vaults")), OTEMod.THE_SERVER);
pPlayer.setItemInHand(pUsedHand, new ItemStack(Items.AIR));
return InteractionResultHolder.consume(is);
}
}
return super.use(pLevel, pPlayer, pUsedHand);
}
}

View file

@ -0,0 +1,24 @@
package dev.zontreck.otemod.ore;
import java.util.List;
import net.minecraft.world.level.levelgen.placement.BiomeFilter;
import net.minecraft.world.level.levelgen.placement.CountPlacement;
import net.minecraft.world.level.levelgen.placement.InSquarePlacement;
import net.minecraft.world.level.levelgen.placement.PlacementModifier;
import net.minecraft.world.level.levelgen.placement.RarityFilter;
public class ModdedOrePlacement {
public static List<PlacementModifier> orePlacement(PlacementModifier p_195347_, PlacementModifier p_195348_) {
return List.of(p_195347_, InSquarePlacement.spread(), p_195348_, BiomeFilter.biome());
}
public static List<PlacementModifier> commonOrePlacement(int p_195344_, PlacementModifier p_195345_) {
return orePlacement(CountPlacement.of(p_195344_), p_195345_);
}
public static List<PlacementModifier> rareOrePlacement(int p_195350_, PlacementModifier p_195351_) {
return orePlacement(RarityFilter.onAverageOnceEvery(p_195350_), p_195351_);
}
}

View file

@ -0,0 +1,56 @@
package dev.zontreck.otemod.ore;
import java.util.ArrayList;
import java.util.List;
import dev.zontreck.otemod.blocks.ModBlocks;
import net.minecraft.core.Holder;
import net.minecraft.data.worldgen.features.FeatureUtils;
import net.minecraft.data.worldgen.features.OreFeatures;
import net.minecraft.data.worldgen.placement.PlacementUtils;
import net.minecraft.world.level.levelgen.GenerationStep;
import net.minecraft.world.level.levelgen.VerticalAnchor;
import net.minecraft.world.level.levelgen.feature.ConfiguredFeature;
import net.minecraft.world.level.levelgen.feature.Feature;
import net.minecraft.world.level.levelgen.feature.OreFeature;
import net.minecraft.world.level.levelgen.feature.configurations.OreConfiguration;
import net.minecraft.world.level.levelgen.placement.HeightRangePlacement;
import net.minecraft.world.level.levelgen.placement.PlacedFeature;
import net.minecraftforge.event.world.BiomeLoadingEvent;
public class OreGenerator {
public static final List<ConfiguredFeature<OreConfiguration, OreFeature>> OVERWORLD_ORES = new ArrayList();
public static final List<OreConfiguration.TargetBlockState> OVERWORLD_ETERNIUM_ORE = List.of(OreConfiguration.target(OreFeatures.STONE_ORE_REPLACEABLES, ModBlocks.ETERNIUM_ORE_BLOCK.get().defaultBlockState()), OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, ModBlocks.DEEPSLATE_ETERNIUM_ORE_BLOCK.get().defaultBlockState()));
public static final List<OreConfiguration.TargetBlockState> OVERWORLD_VAULTSTEEL_ORE = List.of(OreConfiguration.target(OreFeatures.DEEPSLATE_ORE_REPLACEABLES, ModBlocks.VAULT_STEEL_ORE_BLOCK.get().defaultBlockState()));
public static final Holder<ConfiguredFeature<OreConfiguration, ?>> ETERNIUM_ORE = FeatureUtils.register("eternium_ore_block", Feature.ORE, new OreConfiguration(OVERWORLD_ETERNIUM_ORE, 8));
public static final Holder<ConfiguredFeature<OreConfiguration, ?>> VAULTSTEEL_ORE = FeatureUtils.register("vault_steel_ore_block", Feature.ORE, new OreConfiguration(OVERWORLD_VAULTSTEEL_ORE, 6));
public static final Holder<PlacedFeature> ETERNIUM_ORE_PLACED = PlacementUtils.register("eternium_ore_placed",
ETERNIUM_ORE, ModdedOrePlacement.commonOrePlacement(3, // VeinsPerChunk
HeightRangePlacement.triangle(VerticalAnchor.absolute(-20), VerticalAnchor.absolute(20))));
public static final Holder<PlacedFeature> VAULT_STEEL_ORE_PLACED = PlacementUtils.register("vaultsteel_ore_placed", VAULTSTEEL_ORE, ModdedOrePlacement.rareOrePlacement(4, // Veins per chunk
HeightRangePlacement.triangle(VerticalAnchor.absolute(-63), VerticalAnchor.absolute(-50))));
//public static final Holder<PlacedFeature> DEEPSLATE_AION_ORE_PLACED = PlacementUtils.register("deepslate_aion_ore_placed",
// DEEPSLATE_AION_ORE, ModdedOrePlacement.commonOrePlacement(3, // VeinsPerChunk
// HeightRangePlacement.triangle(VerticalAnchor.aboveBottom(-20), VerticalAnchor.aboveBottom(0))));
public static void generateOres(final BiomeLoadingEvent ev)
{
List<Holder<PlacedFeature>> base = ev.getGeneration().getFeatures(GenerationStep.Decoration.UNDERGROUND_ORES);
//ShapedAionResources.LOGGER.info("Register: AION_ORE");
base.add(ETERNIUM_ORE_PLACED);
base.add(VAULT_STEEL_ORE_PLACED);
//base.add(DEEPSLATE_AION_ORE_PLACED);
}
}

View file

@ -76,13 +76,8 @@ public class BlockContainerList {
storedBlock.tick();
if(storedBlock.isExpired()){
WorldPosition wp = storedBlock.getWorldPosition();
BlockState bs=null;
try {
bs = wp.getActualDimension().getBlockState(wp.Position.asBlockPos());
} catch (InvalidSideException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
BlockState bs = wp.getActualDimension().getBlockState(wp.Position.asBlockPos());
if(bs.is(storedBlock.getState().getBlock()) || storedBlock.getTries() >= OTEServerConfig.MAX_TRIES_HEAL.get())
{

View file

@ -24,12 +24,8 @@ public class HealRunner implements Runnable
BlockToSet = sb;
}
public static void scheduleHeal(StoredBlock sb){
try {
sb.getWorldPosition().getActualDimension().getServer().execute(new HealRunner(sb));
} catch (InvalidSideException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
sb.getWorldPosition().getActualDimension().getServer().execute(new HealRunner(sb));
}
@Override
public void run()
@ -38,14 +34,8 @@ public class HealRunner implements Runnable
//BlockSnapshot bs = BlockSnapshot.create(level.dimension(), level, sb.getPos());
//BlockState current = level.getBlockState(sb.getPos());
ServerLevel level=null;
try {
level = (ServerLevel) BlockToSet.getWorldPosition().getActualDimension();
} catch (InvalidSideException e) {
// TODO Auto-generated catch block
e.printStackTrace();
return;
}
ServerLevel level = (ServerLevel) BlockToSet.getWorldPosition().getActualDimension();
BlockState nState = Block.updateFromNeighbourShapes(BlockToSet.getState(), level, BlockToSet.getPos());
level.setBlock(BlockToSet.getPos(), nState, Block.UPDATE_CLIENTS); // no update?