Update to 1.19.3

This commit is contained in:
Aria 2023-05-16 17:38:10 -07:00
parent c5dd4b402f
commit d93f7fdd00
51 changed files with 264 additions and 360 deletions

View file

@ -164,15 +164,15 @@ dependencies {
// http://www.gradle.org/docs/current/userguide/dependency_management.html // http://www.gradle.org/docs/current/userguide/dependency_management.html
//api 'curse.maven:mariadb-jdbc-561883:3586357' //api 'curse.maven:mariadb-jdbc-561883:3586357'
runtimeOnly fg.deobf("curse.maven:mekanism-268560:3875976") runtimeOnly fg.deobf("curse.maven:mekanism-268560:4385637")
//Add JAOPCA to verify proper recipe handling. //Add JAOPCA to verify proper recipe handling.
//implementation fg.deobf("curse.maven:jaopca-266936:4405973") //implementation fg.deobf("curse.maven:jaopca-266936:4405973")
//runtimeOnly fg.deobf("curse.maven:jaopca-266936:4405973") //runtimeOnly fg.deobf("curse.maven:jaopca-266936:4405973")
// Add Tinkers to the runtime dependencies // Add Tinkers to the runtime dependencies
implementation fg.deobf("curse.maven:mantle-74924:4353120") //implementation fg.deobf("curse.maven:mantle-74924:4353120")
implementation fg.deobf("curse.maven:tinkers-construct-74072:4395997") //implementation fg.deobf("curse.maven:tinkers-construct-74072:4395997")
} }
// Example for how to get properties into the manifest for reading at runtime. // Example for how to get properties into the manifest for reading at runtime.

View file

@ -7,10 +7,10 @@ my_version=1.3.7.0306231532
my_modgroup=dev.zontreck.otemod my_modgroup=dev.zontreck.otemod
my_modid=otemod my_modid=otemod
mc_version=1.18.2 mc_version=1.19.3
forge_version=40.2.1 forge_version=44.1.0
libz_version=1.0.5.0306230154 libz_version=1.0.7.0515232132
parchment_version=2022.11.06 parchment_version=2023.03.12
jei_version=10.2.1.283 jei_version=12.4.0.22
# luckperms_version=5.4 # luckperms_version=5.4

View file

@ -14,7 +14,6 @@ import com.mojang.logging.LogUtils;
import net.minecraft.client.gui.screens.MenuScreens; import net.minecraft.client.gui.screens.MenuScreens;
import net.minecraft.client.renderer.entity.EntityRenderers; import net.minecraft.client.renderer.entity.EntityRenderers;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.world.entity.item.ItemEntity; import net.minecraft.world.entity.item.ItemEntity;

View file

@ -1,12 +1,21 @@
package dev.zontreck.otemod.blocks; package dev.zontreck.otemod.blocks;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.DoorBlock; import net.minecraft.world.level.block.DoorBlock;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
public class AuroraDoorBlock extends DoorBlock public class AuroraDoorBlock extends DoorBlock
{ {
public static final BlockBehaviour.Properties DOOR_PROPS;
static
{
DOOR_PROPS = BlockBehaviour.Properties.of(Blocks.IRON_DOOR.defaultBlockState().getMaterial()).requiresCorrectToolForDrops().strength(10, 100000f).sound(SoundType.NETHERITE_BLOCK);
}
public AuroraDoorBlock(Properties p_52737_, String name) { public AuroraDoorBlock() {
super(p_52737_); super(DOOR_PROPS, SoundEvents.IRON_DOOR_CLOSE, SoundEvents.IRON_DOOR_OPEN);
} }

View file

@ -1,7 +1,5 @@
package dev.zontreck.otemod.blocks; package dev.zontreck.otemod.blocks;
import javax.annotation.Nullable;
import dev.zontreck.otemod.blocks.entity.ItemScrubberBlockEntity; import dev.zontreck.otemod.blocks.entity.ItemScrubberBlockEntity;
import dev.zontreck.otemod.blocks.entity.ModEntities; import dev.zontreck.otemod.blocks.entity.ModEntities;
import dev.zontreck.otemod.networking.ModMessages; import dev.zontreck.otemod.networking.ModMessages;
@ -21,6 +19,8 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.NetworkHooks;
import javax.annotation.Nullable;
public class ItemScrubberBlock extends BaseEntityBlock public class ItemScrubberBlock extends BaseEntityBlock
{ {
@ -59,7 +59,7 @@ public class ItemScrubberBlock extends BaseEntityBlock
if(be instanceof ItemScrubberBlockEntity) if(be instanceof ItemScrubberBlockEntity)
{ {
ItemScrubberBlockEntity entity = (ItemScrubberBlockEntity)be; ItemScrubberBlockEntity entity = (ItemScrubberBlockEntity)be;
NetworkHooks.openGui(((ServerPlayer)player), entity, pos); NetworkHooks.openScreen(((ServerPlayer)player), entity, pos);
ModMessages.sendToPlayer(new EnergySyncS2CPacket(entity.getEnergyStorage().getEnergyStored(), entity.getBlockPos()), (ServerPlayer)player); ModMessages.sendToPlayer(new EnergySyncS2CPacket(entity.getEnergyStorage().getEnergyStored(), entity.getBlockPos()), (ServerPlayer)player);

View file

@ -1,7 +1,5 @@
package dev.zontreck.otemod.blocks; package dev.zontreck.otemod.blocks;
import javax.annotation.Nullable;
import dev.zontreck.otemod.blocks.entity.MagicalScrubberBlockEntity; import dev.zontreck.otemod.blocks.entity.MagicalScrubberBlockEntity;
import dev.zontreck.otemod.blocks.entity.ModEntities; import dev.zontreck.otemod.blocks.entity.ModEntities;
import dev.zontreck.otemod.networking.ModMessages; import dev.zontreck.otemod.networking.ModMessages;
@ -21,6 +19,8 @@ import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.phys.BlockHitResult; import net.minecraft.world.phys.BlockHitResult;
import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.NetworkHooks;
import javax.annotation.Nullable;
public class MagicalScrubberBlock extends BaseEntityBlock public class MagicalScrubberBlock extends BaseEntityBlock
{ {
@ -59,7 +59,7 @@ public class MagicalScrubberBlock extends BaseEntityBlock
if(be instanceof MagicalScrubberBlockEntity) if(be instanceof MagicalScrubberBlockEntity)
{ {
MagicalScrubberBlockEntity entity = (MagicalScrubberBlockEntity)be; MagicalScrubberBlockEntity entity = (MagicalScrubberBlockEntity)be;
NetworkHooks.openGui(((ServerPlayer)player), entity, pos); NetworkHooks.openScreen(((ServerPlayer)player), entity, pos);
ModMessages.sendToPlayer(new EnergySyncS2CPacket(entity.getEnergyStorage().getEnergyStored(), entity.getBlockPos()), (ServerPlayer)player); ModMessages.sendToPlayer(new EnergySyncS2CPacket(entity.getEnergyStorage().getEnergyStored(), entity.getBlockPos()), (ServerPlayer)player);
}else{ }else{

View file

@ -2,21 +2,15 @@ package dev.zontreck.otemod.blocks;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.sounds.SoundEvents;
import net.minecraft.world.item.BlockItem; import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item; import net.minecraft.world.item.Item;
import net.minecraft.world.level.BlockGetter; import net.minecraft.world.level.BlockGetter;
import net.minecraft.world.level.block.Block; import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.DoorBlock;
import net.minecraft.world.level.block.IronBarsBlock;
import net.minecraft.world.level.block.SoundType; import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.BlockBehaviour.StatePredicate;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material; import net.minecraft.world.level.material.Material;
import net.minecraft.world.level.material.MaterialColor;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.DeferredRegister;
import net.minecraftforge.registries.ForgeRegistries; import net.minecraftforge.registries.ForgeRegistries;
@ -34,54 +28,55 @@ public class ModBlocks {
public static final RegistryObject<Block> ETERNIUM_ORE_BLOCK = BLOCKS.register("eternium_ore_block", () -> new Block(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(7F).explosionResistance(1200).destroyTime(6))); public static final RegistryObject<Block> ETERNIUM_ORE_BLOCK = BLOCKS.register("eternium_ore_block", () -> new Block(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(7F).explosionResistance(1200).destroyTime(6)));
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<Item> ETERNIUM_ORE_BLOCK_I = ITEMS.register("eternium_ore_block", () -> new BlockItem(ETERNIUM_ORE_BLOCK.get(), new Item.Properties()));
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<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))); 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()));
public static final RegistryObject<Block> NETHER_VAULT_STEEL_ORE_BLOCK = BLOCKS.register("nether_vault_steel_ore_block", ()->new Block(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(8F).explosionResistance(1200).destroyTime(100))); public static final RegistryObject<Block> NETHER_VAULT_STEEL_ORE_BLOCK = BLOCKS.register("nether_vault_steel_ore_block", ()->new Block(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(8F).explosionResistance(1200).destroyTime(100)));
public static final RegistryObject<Item> NETHER_VAULT_STEEL_ORE_BLOCK_I = ITEMS.register("nether_vault_steel_ore_block", ()->new BlockItem(NETHER_VAULT_STEEL_ORE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS))); public static final RegistryObject<Item> NETHER_VAULT_STEEL_ORE_BLOCK_I = ITEMS.register("nether_vault_steel_ore_block", ()->new BlockItem(NETHER_VAULT_STEEL_ORE_BLOCK.get(), new Item.Properties()));
public static final RegistryObject<Block> ETERNIUM_BLOCK = BLOCKS.register("eternium_block", ()->new Block(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(8F).explosionResistance(1200).destroyTime(100))); public static final RegistryObject<Block> ETERNIUM_BLOCK = BLOCKS.register("eternium_block", ()->new Block(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(8F).explosionResistance(1200).destroyTime(100)));
public static final RegistryObject<Item> ETERNIUM_BLOCK_I = ITEMS.register("eternium_block", ()->new FoiledBlockItem(ETERNIUM_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS))); public static final RegistryObject<Item> ETERNIUM_BLOCK_I = ITEMS.register("eternium_block", ()->new FoiledBlockItem(ETERNIUM_BLOCK.get(), new Item.Properties()));
public static final RegistryObject<Block> DEEPSLATE_ETERNIUM_ORE_BLOCK = BLOCKS.register("deepslate_eternium_ore_block", () -> new Block(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(5f).explosionResistance(1200).destroyTime(7))); public static final RegistryObject<Block> DEEPSLATE_ETERNIUM_ORE_BLOCK = BLOCKS.register("deepslate_eternium_ore_block", () -> new Block(BlockBehaviour.Properties.of(Material.METAL).requiresCorrectToolForDrops().strength(5f).explosionResistance(1200).destroyTime(7)));
public static final RegistryObject<Item> DEEPSLATE_ETERNIUM_ORE_BLOCK_I = ITEMS.register("deepslate_eternium_ore_block", () -> new BlockItem(DEEPSLATE_ETERNIUM_ORE_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC))); public static final RegistryObject<Item> DEEPSLATE_ETERNIUM_ORE_BLOCK_I = ITEMS.register("deepslate_eternium_ore_block", () -> new BlockItem(DEEPSLATE_ETERNIUM_ORE_BLOCK.get(), new Item.Properties()));
public static final RegistryObject<Block> AURORA_BLOCK = BLOCKS.register("aurora_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(9f).explosionResistance(100000f).destroyTime(10).sound(SoundType.NETHERITE_BLOCK))); public static final RegistryObject<Block> AURORA_BLOCK = BLOCKS.register("aurora_block", () -> new Block(BlockBehaviour.Properties.of(Material.STONE).requiresCorrectToolForDrops().strength(9f).explosionResistance(100000f).destroyTime(10).sound(SoundType.NETHERITE_BLOCK)));
public static final RegistryObject<Item> AURORA_BLOCK_I = ITEMS.register("aurora_block", () -> new BlockItem(AURORA_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC))); public static final RegistryObject<Item> AURORA_BLOCK_I = ITEMS.register("aurora_block", () -> new BlockItem(AURORA_BLOCK.get(), new Item.Properties()));
public static final RegistryObject<Block> AURORA_DOOR = BLOCKS.register("aurora_door", () -> new DoorBlock(BlockBehaviour.Properties.copy(Blocks.IRON_DOOR).requiresCorrectToolForDrops().strength(9f).explosionResistance(100000f).destroyTime(10).sound(SoundType.NETHERITE_BLOCK)));
public static final RegistryObject<Item> AURORA_DOOR_I = ITEMS.register("aurora_door", () -> new BlockItem(AURORA_DOOR.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC))); public static final RegistryObject<Block> AURORA_DOOR = BLOCKS.register("aurora_door", AuroraDoorBlock::new);
public static final RegistryObject<Item> AURORA_DOOR_I = ITEMS.register("aurora_door", () -> new BlockItem(AURORA_DOOR.get(), new Item.Properties()));
public static final RegistryObject<Block> CLEAR_GLASS_BLOCK = BLOCKS.register("clear_glass_block", () -> new Block(BlockBehaviour.Properties.copy(Blocks.GLASS).strength(1f).destroyTime(6).noOcclusion().isViewBlocking(ModBlocks::never))); public static final RegistryObject<Block> CLEAR_GLASS_BLOCK = BLOCKS.register("clear_glass_block", () -> new Block(BlockBehaviour.Properties.copy(Blocks.GLASS).strength(1f).destroyTime(6).noOcclusion().isViewBlocking(ModBlocks::never)));
public static final RegistryObject<Item> CLEAR_GLASS_BLOCK_I = ITEMS.register("clear_glass_block", () -> new BlockItem(CLEAR_GLASS_BLOCK.get(), new Item.Properties().tab(CreativeModeTab.TAB_MISC))); public static final RegistryObject<Item> CLEAR_GLASS_BLOCK_I = ITEMS.register("clear_glass_block", () -> new BlockItem(CLEAR_GLASS_BLOCK.get(), new Item.Properties()));
public static final RegistryObject<Block> ITEM_SCRUBBER = BLOCKS.register("item_scrubber", ()->new ItemScrubberBlock(BlockBehaviour.Properties.copy(ModBlocks.AURORA_BLOCK.get()).noOcclusion().isViewBlocking(ModBlocks::never))); public static final RegistryObject<Block> ITEM_SCRUBBER = BLOCKS.register("item_scrubber", ()->new ItemScrubberBlock(BlockBehaviour.Properties.copy(ModBlocks.AURORA_BLOCK.get()).noOcclusion().isViewBlocking(ModBlocks::never)));
public static final RegistryObject<Item> ITEM_SCRUBBER_I = ITEMS.register("item_scrubber", ()->new BlockItem(ITEM_SCRUBBER.get(), new Item.Properties().tab(CreativeModeTab.TAB_REDSTONE))); public static final RegistryObject<Item> ITEM_SCRUBBER_I = ITEMS.register("item_scrubber", ()->new BlockItem(ITEM_SCRUBBER.get(), new Item.Properties()));
public static final RegistryObject<Block> MAGICAL_SCRUBBER = BLOCKS.register("magical_scrubber", ()->new MagicalScrubberBlock(BlockBehaviour.Properties.copy(ModBlocks.AURORA_BLOCK.get()).noOcclusion().isViewBlocking(ModBlocks::never))); public static final RegistryObject<Block> MAGICAL_SCRUBBER = BLOCKS.register("magical_scrubber", ()->new MagicalScrubberBlock(BlockBehaviour.Properties.copy(ModBlocks.AURORA_BLOCK.get()).noOcclusion().isViewBlocking(ModBlocks::never)));
public static final RegistryObject<Item> MAGICAL_SCRUBBER_I = ITEMS.register("magical_scrubber", ()->new BlockItem(MAGICAL_SCRUBBER.get(), new Item.Properties().tab(CreativeModeTab.TAB_REDSTONE))); public static final RegistryObject<Item> MAGICAL_SCRUBBER_I = ITEMS.register("magical_scrubber", ()->new BlockItem(MAGICAL_SCRUBBER.get(), new Item.Properties()));
public static final RegistryObject<Block> STABLE_SINGULARITY = BLOCKS.register("stable_singularity", ()->new Block(BlockBehaviour.Properties.copy(ModBlocks.AURORA_BLOCK.get()).noOcclusion().isViewBlocking(ModBlocks::never))); public static final RegistryObject<Block> STABLE_SINGULARITY = BLOCKS.register("stable_singularity", ()->new Block(BlockBehaviour.Properties.copy(ModBlocks.AURORA_BLOCK.get()).noOcclusion().isViewBlocking(ModBlocks::never)));
public static final RegistryObject<Item> STABLE_SINGULARITY_I = ITEMS.register("stable_singularity", ()->new BlockItem(STABLE_SINGULARITY.get(), new Item.Properties().tab(CreativeModeTab.TAB_REDSTONE))); public static final RegistryObject<Item> STABLE_SINGULARITY_I = ITEMS.register("stable_singularity", ()->new BlockItem(STABLE_SINGULARITY.get(), new Item.Properties()));

View file

@ -1,7 +1,5 @@
package dev.zontreck.otemod.blocks.entity; package dev.zontreck.otemod.blocks.entity;
import javax.annotation.Nullable;
import dev.zontreck.otemod.implementation.OutputItemStackHandler; import dev.zontreck.otemod.implementation.OutputItemStackHandler;
import dev.zontreck.otemod.implementation.energy.OTEEnergy; import dev.zontreck.otemod.implementation.energy.OTEEnergy;
import dev.zontreck.otemod.implementation.scrubber.ItemScrubberMenu; import dev.zontreck.otemod.implementation.scrubber.ItemScrubberMenu;
@ -11,7 +9,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.Containers; import net.minecraft.world.Containers;
import net.minecraft.world.MenuProvider; import net.minecraft.world.MenuProvider;
import net.minecraft.world.SimpleContainer; import net.minecraft.world.SimpleContainer;
@ -25,13 +22,14 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.ItemStackHandler;
import javax.annotation.Nullable;
public class ItemScrubberBlockEntity extends BlockEntity implements MenuProvider public class ItemScrubberBlockEntity extends BlockEntity implements MenuProvider
{ {
@ -113,22 +111,22 @@ public class ItemScrubberBlockEntity extends BlockEntity implements MenuProvider
@Override @Override
public Component getDisplayName() { public Component getDisplayName() {
return new TranslatableComponent("block.otemod.item_scrubber"); return Component.translatable("block.otemod.item_scrubber");
} }
@Override @Override
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side)
{ {
if(cap == CapabilityEnergy.ENERGY) if(cap == ForgeCapabilities.ENERGY)
{ {
return lazyEnergyHandler.cast(); return lazyEnergyHandler.cast();
} }
if(side == Direction.DOWN && cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) if(side == Direction.DOWN && cap == ForgeCapabilities.ITEM_HANDLER)
{ {
// Return the output slot only // Return the output slot only
return lazyOutputItems.cast(); return lazyOutputItems.cast();
} }
if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) if(cap == ForgeCapabilities.ITEM_HANDLER)
{ {
return lazyItemHandler.cast(); return lazyItemHandler.cast();
} }

View file

@ -1,9 +1,5 @@
package dev.zontreck.otemod.blocks.entity; package dev.zontreck.otemod.blocks.entity;
import java.util.Iterator;
import java.util.Map;
import javax.annotation.Nullable;
import dev.zontreck.libzontreck.util.ItemUtils; import dev.zontreck.libzontreck.util.ItemUtils;
import dev.zontreck.otemod.implementation.OutputItemStackHandler; import dev.zontreck.otemod.implementation.OutputItemStackHandler;
import dev.zontreck.otemod.implementation.energy.OTEEnergy; import dev.zontreck.otemod.implementation.energy.OTEEnergy;
@ -14,7 +10,6 @@ import net.minecraft.core.BlockPos;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TranslatableComponent;
import net.minecraft.world.Containers; import net.minecraft.world.Containers;
import net.minecraft.world.MenuProvider; import net.minecraft.world.MenuProvider;
import net.minecraft.world.SimpleContainer; import net.minecraft.world.SimpleContainer;
@ -31,13 +26,16 @@ import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.common.capabilities.Capability; import net.minecraftforge.common.capabilities.Capability;
import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.common.util.LazyOptional; import net.minecraftforge.common.util.LazyOptional;
import net.minecraftforge.energy.CapabilityEnergy;
import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.energy.IEnergyStorage;
import net.minecraftforge.items.CapabilityItemHandler;
import net.minecraftforge.items.IItemHandler; import net.minecraftforge.items.IItemHandler;
import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.ItemStackHandler;
import javax.annotation.Nullable;
import java.util.Iterator;
import java.util.Map;
public class MagicalScrubberBlockEntity extends BlockEntity implements MenuProvider public class MagicalScrubberBlockEntity extends BlockEntity implements MenuProvider
{ {
@ -119,22 +117,22 @@ public class MagicalScrubberBlockEntity extends BlockEntity implements MenuProvi
@Override @Override
public Component getDisplayName() { public Component getDisplayName() {
return new TranslatableComponent("block.otemod.magical_scrubber"); return Component.translatable("block.otemod.magical_scrubber");
} }
@Override @Override
public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side) public <T> LazyOptional<T> getCapability(Capability<T> cap, Direction side)
{ {
if(cap == CapabilityEnergy.ENERGY) if(cap == ForgeCapabilities.ENERGY)
{ {
return lazyEnergyHandler.cast(); return lazyEnergyHandler.cast();
} }
if(side == Direction.DOWN && cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) if(side == Direction.DOWN && cap == ForgeCapabilities.ITEM_HANDLER)
{ {
// Return the output slot only // Return the output slot only
return lazyOutputItems.cast(); return lazyOutputItems.cast();
} }
if(cap == CapabilityItemHandler.ITEM_HANDLER_CAPABILITY) if(cap == ForgeCapabilities.ITEM_HANDLER)
{ {
return lazyItemHandler.cast(); return lazyItemHandler.cast();
} }

View file

@ -10,7 +10,7 @@ import net.minecraftforge.registries.RegistryObject;
public class ModEntities { public class ModEntities {
public static final DeferredRegister<BlockEntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITIES, OTEMod.MOD_ID); public static final DeferredRegister<BlockEntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.BLOCK_ENTITY_TYPES, OTEMod.MOD_ID);
public static final RegistryObject <BlockEntityType <ItemScrubberBlockEntity>> ITEM_SCRUBBER = ENTITIES.register("item_scrubber", ()-> BlockEntityType.Builder.of(ItemScrubberBlockEntity::new, ModBlocks.ITEM_SCRUBBER.get()).build(null)); public static final RegistryObject <BlockEntityType <ItemScrubberBlockEntity>> ITEM_SCRUBBER = ENTITIES.register("item_scrubber", ()-> BlockEntityType.Builder.of(ItemScrubberBlockEntity::new, ModBlocks.ITEM_SCRUBBER.get()).build(null));

View file

@ -1,13 +1,13 @@
package dev.zontreck.otemod.blocks.types; package dev.zontreck.otemod.blocks.types;
import java.util.EnumMap;
import net.minecraft.core.Direction; import net.minecraft.core.Direction;
import net.minecraft.core.Direction.Plane; import net.minecraft.core.Direction.Plane;
import net.minecraft.world.level.block.IronBarsBlock; import net.minecraft.world.level.block.IronBarsBlock;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BooleanProperty; import net.minecraft.world.level.block.state.properties.BooleanProperty;
import java.util.EnumMap;
/** Pane block with sensible culling */ /** Pane block with sensible culling */
public class AlternatePaneBlock extends IronBarsBlock { public class AlternatePaneBlock extends IronBarsBlock {
public static final EnumMap<Direction,BooleanProperty> DIRECTIONS; public static final EnumMap<Direction,BooleanProperty> DIRECTIONS;

View file

@ -12,8 +12,8 @@ import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.configs.OTEServerConfig; import dev.zontreck.otemod.configs.OTEServerConfig;
import dev.zontreck.otemod.configs.PlayerFlyCache; import dev.zontreck.otemod.configs.PlayerFlyCache;
import dev.zontreck.otemod.enchantments.ModEnchantments; import dev.zontreck.otemod.enchantments.ModEnchantments;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.Style; import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.EquipmentSlot; import net.minecraft.world.entity.EquipmentSlot;
import net.minecraft.world.entity.player.Abilities; import net.minecraft.world.entity.player.Abilities;
@ -55,7 +55,7 @@ public class ChatServerOverride {
if(!OTEServerConfig.USE_CUSTOM_JOINLEAVE.get()) return; if(!OTEServerConfig.USE_CUSTOM_JOINLEAVE.get()) return;
ChatHelpers.broadcast(new TextComponent(ChatColor.doColors("!Dark_Gray![!Dark_Green!+!Dark_Gray!] !Bold!!Dark_Aqua!"+prof.nickname)), ev.level.getServer()); ChatHelpers.broadcast(ChatHelpers.macro("!Dark_Gray![!Dark_Green!+!Dark_Gray!] !Bold!!Dark_Aqua![0]",prof.nickname), ev.level.getServer());
} }
@ -71,7 +71,8 @@ public class ChatServerOverride {
if(!OTEServerConfig.USE_CUSTOM_JOINLEAVE.get()) return; if(!OTEServerConfig.USE_CUSTOM_JOINLEAVE.get()) return;
// Send the alert // Send the alert
ChatHelpers.broadcast(new TextComponent(ChatColor.DARK_GRAY + "[" + ChatColor.DARK_RED + "-" + ChatColor.DARK_GRAY + "] "+ChatColor.BOLD + ChatColor.DARK_AQUA + px.nickname), px.player.server); ChatHelpers.broadcast(ChatHelpers.macro("!Dark_Gray![!Dark_Red!-!Dark_Gray!] !Bold!!Dark_Aqua![0]", px.nickname), px.player.server);
px.flying=px.player.getAbilities().flying; px.flying=px.player.getAbilities().flying;
ev.setCanceled(true); ev.setCanceled(true);
@ -83,7 +84,7 @@ public class ChatServerOverride {
if(ev.getEntity().level.isClientSide)return; if(ev.getEntity().level.isClientSide)return;
// Fix for fly ability not copying to new instance on death or other circumstances // Fix for fly ability not copying to new instance on death or other circumstances
Player old = ev.getOriginal(); Player old = ev.getOriginal();
Player n = ev.getPlayer(); Player n = ev.getEntity();
PlayerFlyCache c = PlayerFlyCache.cachePlayer((ServerPlayer)old); PlayerFlyCache c = PlayerFlyCache.cachePlayer((ServerPlayer)old);
c.Assert((ServerPlayer)n); c.Assert((ServerPlayer)n);
@ -112,7 +113,7 @@ public class ChatServerOverride {
prefixStr = ChatColor.DARK_GRAY + "[" + ChatColor.BOLD + XD.prefix_color + XD.prefix + ChatColor.resetChat() + ChatColor.DARK_GRAY + "] "; prefixStr = ChatColor.DARK_GRAY + "[" + ChatColor.BOLD + XD.prefix_color + XD.prefix + ChatColor.resetChat() + ChatColor.DARK_GRAY + "] ";
} }
String msg = ev.getMessage(); String msg = ev.getRawText();
msg= ChatColor.doColors(msg); msg= ChatColor.doColors(msg);
String nameStr = ChatColor.resetChat() + "< "+ XD.name_color + XD.nickname + ChatColor.resetChat() + " >"; String nameStr = ChatColor.resetChat() + "< "+ XD.name_color + XD.nickname + ChatColor.resetChat() + " >";
@ -121,7 +122,7 @@ public class ChatServerOverride {
hover=hover.withFont(Style.DEFAULT_FONT).withHoverEvent(HoverTip.get(ChatColor.MINECOIN_GOLD+"User Name: "+XD.username)); hover=hover.withFont(Style.DEFAULT_FONT).withHoverEvent(HoverTip.get(ChatColor.MINECOIN_GOLD+"User Name: "+XD.username));
ev.setCanceled(true); ev.setCanceled(true);
ChatHelpers.broadcast(new TextComponent(prefixStr+nameStr+message).setStyle(hover), ev.getPlayer().server); ChatHelpers.broadcast(Component.literal(prefixStr + nameStr + message).setStyle(hover), ev.getPlayer().server);
} }

View file

@ -2,14 +2,12 @@ package dev.zontreck.otemod.commands;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.context.CommandContext; import com.mojang.brigadier.context.CommandContext;
import dev.zontreck.libzontreck.chat.ChatColor; import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent; import net.minecraft.server.level.ServerPlayer;
public class FlyCommand { public class FlyCommand {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
@ -39,12 +37,12 @@ public class FlyCommand {
p.getAbilities().flying=false; p.getAbilities().flying=false;
p.onUpdateAbilities(); p.onUpdateAbilities();
ctx.sendSuccess(new TextComponent(OTEMod.OTEPrefix + ChatColor.DARK_PURPLE + " Your ability to fly has been disabled"), false); ctx.sendSuccess(Component.literal(OTEMod.OTEPrefix + ChatColor.DARK_PURPLE + " Your ability to fly has been disabled"), false);
}else { }else {
p.getAbilities().mayfly=true; p.getAbilities().mayfly=true;
p.onUpdateAbilities(); p.onUpdateAbilities();
ctx.sendSuccess(new TextComponent(OTEMod.OTEPrefix + ChatColor.DARK_PURPLE + " You can now fly"), false); ctx.sendSuccess(Component.literal(OTEMod.OTEPrefix + ChatColor.DARK_PURPLE + " You can now fly"), false);
} }
return 0; return 0;

View file

@ -1,8 +1,6 @@
package dev.zontreck.otemod.commands.items; package dev.zontreck.otemod.commands.items;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.chat.HoverTip; import dev.zontreck.libzontreck.chat.HoverTip;
import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException; import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
@ -12,7 +10,6 @@ import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.network.chat.MutableComponent; import net.minecraft.network.chat.MutableComponent;
import net.minecraft.network.chat.Style; import net.minecraft.network.chat.Style;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -39,7 +36,7 @@ public class ShareItemInChatCommand {
ItemStack is = play.getItemInHand(InteractionHand.MAIN_HAND); ItemStack is = play.getItemInHand(InteractionHand.MAIN_HAND);
if(is.getItem() instanceof AirItem) if(is.getItem() instanceof AirItem)
{ {
play.displayClientMessage(new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You cannot share air in the chat.")), false); play.displayClientMessage(ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You cannot share air in the chat."), false);
return 0; return 0;
} }
@ -50,7 +47,7 @@ public class ShareItemInChatCommand {
return 1; return 1;
} }
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"))); MutableComponent component = ChatHelpers.macro(OTEMod.OTEPrefix).append(is.getDisplayName()).append(ChatHelpers.macro(" !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); Style style = Style.EMPTY.withFont(Style.DEFAULT_FONT);
component = component.withStyle(style.withHoverEvent(HoverTip.getItem(is))); component = component.withStyle(style.withHoverEvent(HoverTip.getItem(is)));

View file

@ -1,17 +1,15 @@
package dev.zontreck.otemod.commands.profilecmds; package dev.zontreck.otemod.commands.profilecmds;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.LibZontreck; import dev.zontreck.libzontreck.LibZontreck;
import dev.zontreck.libzontreck.chat.ChatColor; import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.chat.ChatColor.ColorOptions; import dev.zontreck.libzontreck.chat.ChatColor.ColorOptions;
import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException; import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraftforge.server.command.EnumArgument; import net.minecraftforge.server.command.EnumArgument;
@ -54,7 +52,7 @@ public class ChatColorCommand {
p.commit(); p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p); LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix + " "+ChatColor.DARK_PURPLE + "Your chat color has been updated"), false); source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix + " "+ChatColor.DARK_PURPLE + "Your chat color has been updated"), false);
return 0; return 0;
} }

View file

@ -1,17 +1,15 @@
package dev.zontreck.otemod.commands.profilecmds; package dev.zontreck.otemod.commands.profilecmds;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.LibZontreck; import dev.zontreck.libzontreck.LibZontreck;
import dev.zontreck.libzontreck.chat.ChatColor; import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.chat.ChatColor.ColorOptions; import dev.zontreck.libzontreck.chat.ChatColor.ColorOptions;
import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException; import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraftforge.server.command.EnumArgument; import net.minecraftforge.server.command.EnumArgument;
@ -54,7 +52,7 @@ public class NameColorCommand {
p.commit(); p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p); LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your name color has been updated"), false); source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your name color has been updated"), false);
return 0; return 0;
} }

View file

@ -2,16 +2,14 @@ package dev.zontreck.otemod.commands.profilecmds;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.arguments.StringArgumentType;
import dev.zontreck.libzontreck.LibZontreck; import dev.zontreck.libzontreck.LibZontreck;
import dev.zontreck.libzontreck.chat.ChatColor; import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException; import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -50,7 +48,7 @@ public class NickCommand {
p.commit(); p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p); LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your nickname has been updated"), false); source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your nickname has been updated"), false);
return 0; return 0;
} }

View file

@ -1,16 +1,15 @@
package dev.zontreck.otemod.commands.profilecmds; package dev.zontreck.otemod.commands.profilecmds;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.LibZontreck; import dev.zontreck.libzontreck.LibZontreck;
import dev.zontreck.libzontreck.chat.ChatColor; import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.chat.ChatColor.ColorOptions; import dev.zontreck.libzontreck.chat.ChatColor.ColorOptions;
import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException; import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraftforge.server.command.EnumArgument; import net.minecraftforge.server.command.EnumArgument;
@ -54,7 +53,7 @@ public class PrefixColorCommand {
p.commit(); p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p); LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your prefix color has been updated"), false); source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your prefix color has been updated"), false);
return 0; return 0;
} }

View file

@ -2,16 +2,14 @@ package dev.zontreck.otemod.commands.profilecmds;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.arguments.StringArgumentType;
import dev.zontreck.libzontreck.LibZontreck; import dev.zontreck.libzontreck.LibZontreck;
import dev.zontreck.libzontreck.chat.ChatColor; import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException; import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -50,7 +48,7 @@ public class PrefixCommand {
p.commit(); p.commit();
LibZontreck.PROFILES.put(play.getStringUUID(), p); LibZontreck.PROFILES.put(play.getStringUUID(), p);
source.sendSuccess(new TextComponent(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your prefix has been updated"), false); source.sendSuccess(ChatHelpers.macro(OTEMod.OTEPrefix+ " "+ChatColor.DARK_PURPLE + "Your prefix has been updated"), false);
return 0; return 0;
} }

View file

@ -1,15 +1,13 @@
package dev.zontreck.otemod.commands.vaults; package dev.zontreck.otemod.commands.vaults;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.implementation.vault.NoMoreVaultException; import dev.zontreck.otemod.implementation.vault.NoMoreVaultException;
import dev.zontreck.otemod.implementation.vault.VaultContainer; import dev.zontreck.otemod.implementation.vault.VaultContainer;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.SimpleMenuProvider; import net.minecraft.world.SimpleMenuProvider;
import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.NetworkHooks;
@ -35,11 +33,11 @@ public class TrashCommand {
try { try {
container = new VaultContainer(play, -1); container = new VaultContainer(play, -1);
} catch (NoMoreVaultException e) { } catch (NoMoreVaultException e) {
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You cannot open anymore vaults. Craft a new vault!")), play.server); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You cannot open anymore vaults. Craft a new vault!"), play.server);
return 0; return 0;
} }
NetworkHooks.openGui(play, new SimpleMenuProvider(container.serverMenu, new TextComponent("Trash"))); NetworkHooks.openScreen(play, new SimpleMenuProvider(container.serverMenu, Component.literal("Trash")));
// Add to the master vault registry // Add to the master vault registry
if(VaultContainer.VAULT_REGISTRY.containsKey(play.getUUID()))VaultContainer.VAULT_REGISTRY.remove(play.getUUID()); if(VaultContainer.VAULT_REGISTRY.containsKey(play.getUUID()))VaultContainer.VAULT_REGISTRY.remove(play.getUUID());

View file

@ -2,15 +2,13 @@ package dev.zontreck.otemod.commands.vaults;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.IntegerArgumentType; import com.mojang.brigadier.arguments.IntegerArgumentType;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.implementation.vault.NoMoreVaultException; import dev.zontreck.otemod.implementation.vault.NoMoreVaultException;
import dev.zontreck.otemod.implementation.vault.VaultContainer; import dev.zontreck.otemod.implementation.vault.VaultContainer;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.SimpleMenuProvider; import net.minecraft.world.SimpleMenuProvider;
import net.minecraftforge.network.NetworkHooks; import net.minecraftforge.network.NetworkHooks;
@ -34,7 +32,7 @@ public class VaultCommand {
ServerPlayer play = (ServerPlayer)source.getEntity(); ServerPlayer play = (ServerPlayer)source.getEntity();
if(i <0) if(i <0)
{ {
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Red!You can only specify a vault number in the positive range")), source.getServer()); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You can only specify a vault number in the positive range"), source.getServer());
return 0; return 0;
} }
doOpen(play, i); doOpen(play, i);
@ -49,11 +47,11 @@ public class VaultCommand {
try { try {
container = new VaultContainer(p, i); container = new VaultContainer(p, i);
} catch (NoMoreVaultException e) { } catch (NoMoreVaultException e) {
ChatHelpers.broadcastTo(p.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You cannot open anymore vaults. Craft a new vault!")), p.server); ChatHelpers.broadcastTo(p.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You cannot open anymore vaults. Craft a new vault!"), p.server);
return; return;
} }
NetworkHooks.openGui(p, new SimpleMenuProvider(container.serverMenu, new TextComponent("Vault "+i))); NetworkHooks.openScreen(p, new SimpleMenuProvider(container.serverMenu, Component.literal("Vault " + i)));
// Add to the master vault registry // Add to the master vault registry
if(VaultContainer.VAULT_REGISTRY.containsKey(p.getUUID()))VaultContainer.VAULT_REGISTRY.remove(p.getUUID()); if(VaultContainer.VAULT_REGISTRY.containsKey(p.getUUID()))VaultContainer.VAULT_REGISTRY.remove(p.getUUID());

View file

@ -1,16 +1,7 @@
package dev.zontreck.otemod.commands.zschem; package dev.zontreck.otemod.commands.zschem;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.arguments.StringArgumentType;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.vectors.Vector3; import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.libzontreck.vectors.WorldPosition; import dev.zontreck.libzontreck.vectors.WorldPosition;
@ -26,12 +17,18 @@ import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag; import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtIo; import net.minecraft.nbt.NbtIo;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.fml.loading.FMLConfig; import net.minecraftforge.fml.loading.FMLConfig;
import net.minecraftforge.fml.loading.FMLPaths; import net.minecraftforge.fml.loading.FMLPaths;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class LoadSchem { public class LoadSchem {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
@ -115,17 +112,17 @@ public class LoadSchem {
MemoryHolder.setBlocks(play, blocks); MemoryHolder.setBlocks(play, blocks);
}else { }else {
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix + ChatColor.doColors(" !Dark_Red!No such ZSchem exists!")), source.getServer()); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix + " !Dark_Red!No such ZSchem exists!"), source.getServer());
return 0; return 0;
} }
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!ZSchem loaded from disk!")), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Green!ZSchem loaded from disk!"), OTEMod.THE_SERVER);
return 0; return 0;
} }
} }
} }
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(ChatColor.doColors("!Dark_Red! You must set the first position")), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro("!Dark_Red! You must set the first position"), OTEMod.THE_SERVER);
return 0; return 0;
} }
@ -133,10 +130,10 @@ public class LoadSchem {
private static int loadSchematicUsage(CommandSourceStack source) private static int loadSchematicUsage(CommandSourceStack source)
{ {
String usage = OTEMod.OTEPrefix; String usage = OTEMod.OTEPrefix;
usage += ChatColor.doColors("!gold! /loadzschem [string:name]"); usage += "!gold! /loadzschem [string:name]";
ServerPlayer play=(ServerPlayer)source.getEntity(); ServerPlayer play=(ServerPlayer)source.getEntity();
if(play==null)return 1; if(play==null)return 1;
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(usage), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(usage), OTEMod.THE_SERVER);
return 0; return 0;
} }
} }

View file

@ -1,26 +1,21 @@
package dev.zontreck.otemod.commands.zschem; package dev.zontreck.otemod.commands.zschem;
import java.util.Collections;
import java.util.List;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.integrations.LuckPermsHelper; import dev.zontreck.otemod.integrations.LuckPermsHelper;
import dev.zontreck.otemod.permissions.Permissions; import dev.zontreck.otemod.permissions.Permissions;
import dev.zontreck.otemod.zschem.MemoryHolder; import dev.zontreck.otemod.zschem.MemoryHolder;
import dev.zontreck.otemod.zschem.MemoryHolder.Container;
import dev.zontreck.otemod.zschem.StoredBlock; import dev.zontreck.otemod.zschem.StoredBlock;
import dev.zontreck.otemod.zschem.WorldProp; import dev.zontreck.otemod.zschem.WorldProp;
import dev.zontreck.otemod.zschem.MemoryHolder.Container;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import java.util.Collections;
import java.util.List;
// This command will place the loaded schematic in world. The schematic will originate from position 1. The positions are relative and are added onto position 1. // This command will place the loaded schematic in world. The schematic will originate from position 1. The positions are relative and are added onto position 1.
public class Place { public class Place {
@ -46,7 +41,7 @@ public class Place {
if(!MemoryHolder.hasPlayerCached(play)){ if(!MemoryHolder.hasPlayerCached(play)){
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first load the zschem!")), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You must first load the zschem!"), OTEMod.THE_SERVER);
return 1; return 1;
} }
@ -67,13 +62,13 @@ public class Place {
}else { }else {
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first load the zschem!")), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You must first load the zschem!"), OTEMod.THE_SERVER);
return 1; return 1;
} }
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Enqueued!")), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Green!Enqueued!"), OTEMod.THE_SERVER);
return 0; return 0;
} }

View file

@ -1,29 +1,24 @@
package dev.zontreck.otemod.commands.zschem; package dev.zontreck.otemod.commands.zschem;
import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.integrations.LuckPermsHelper;
import dev.zontreck.otemod.permissions.Permissions;
import dev.zontreck.otemod.zschem.MemoryHolder;
import dev.zontreck.otemod.zschem.MemoryHolder.Container;
import dev.zontreck.otemod.zschem.StoredBlock;
import dev.zontreck.otemod.zschem.WorldProp;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.block.Blocks;
import java.util.Collections; import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.integrations.LuckPermsHelper;
import dev.zontreck.otemod.permissions.Permissions;
import dev.zontreck.otemod.zschem.MemoryHolder;
import dev.zontreck.otemod.zschem.StoredBlock;
import dev.zontreck.otemod.zschem.WorldProp;
import dev.zontreck.otemod.zschem.MemoryHolder.Container;
import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.level.block.Blocks;
// This command will place the loaded schematic in world. The schematic will originate from position 1. The positions are relative and are added onto position 1. // This command will place the loaded schematic in world. The schematic will originate from position 1. The positions are relative and are added onto position 1.
public class PlaceAsAir { public class PlaceAsAir {
@ -49,7 +44,7 @@ public class PlaceAsAir {
if(!MemoryHolder.hasPlayerCached(play)){ if(!MemoryHolder.hasPlayerCached(play)){
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first set the positions!")), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You must first set the positions!"), OTEMod.THE_SERVER);
return 1; return 1;
} }
@ -74,13 +69,13 @@ public class PlaceAsAir {
}else { }else {
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!You must first set the positions!")), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Red!You must first set the positions!"), OTEMod.THE_SERVER);
return 1; return 1;
} }
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Enqueued!")), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Green!Enqueued!"), OTEMod.THE_SERVER);
return 0; return 0;
} }

View file

@ -1,19 +1,10 @@
package dev.zontreck.otemod.commands.zschem; package dev.zontreck.otemod.commands.zschem;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import com.mojang.brigadier.arguments.StringArgumentType; import com.mojang.brigadier.arguments.StringArgumentType;
import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.vectors.Vector3; import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.integrations.LuckPermsHelper; import dev.zontreck.otemod.integrations.LuckPermsHelper;
import dev.zontreck.otemod.permissions.Permissions; import dev.zontreck.otemod.permissions.Permissions;
import dev.zontreck.otemod.zschem.MemoryHolder; import dev.zontreck.otemod.zschem.MemoryHolder;
@ -25,12 +16,16 @@ import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.ListTag; import net.minecraft.nbt.ListTag;
import net.minecraft.nbt.NbtIo; import net.minecraft.nbt.NbtIo;
import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraftforge.fml.loading.FMLConfig; import net.minecraftforge.fml.loading.FMLConfig;
import net.minecraftforge.fml.loading.FMLPaths; import net.minecraftforge.fml.loading.FMLPaths;
import java.io.File;
import java.io.IOException;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.List;
public class SaveSchem { public class SaveSchem {
public static void register(CommandDispatcher<CommandSourceStack> dispatcher) public static void register(CommandDispatcher<CommandSourceStack> dispatcher)
@ -108,12 +103,12 @@ public class SaveSchem {
} catch (IOException e) { } catch (IOException e) {
e.printStackTrace(); e.printStackTrace();
} }
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!ZSchem saved to disk!")), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Green!ZSchem saved to disk!"), OTEMod.THE_SERVER);
return 0; return 0;
} }
} }
} }
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(ChatColor.doColors("!Dark_Red! You must first set the positions")), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro("!Dark_Red! You must first set the positions"), OTEMod.THE_SERVER);
return 0; return 0;
} }
@ -121,10 +116,10 @@ public class SaveSchem {
private static int saveSchematicUsage(CommandSourceStack source) private static int saveSchematicUsage(CommandSourceStack source)
{ {
String usage = OTEMod.OTEPrefix; String usage = OTEMod.OTEPrefix;
usage += ChatColor.doColors("!gold! /savezschem [string:name]"); usage += "!gold! /savezschem [string:name]";
ServerPlayer play=(ServerPlayer)source.getEntity(); ServerPlayer play=(ServerPlayer)source.getEntity();
if(play==null)return 1; if(play==null)return 1;
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(usage), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(usage), OTEMod.THE_SERVER);
return 0; return 0;
} }
} }

View file

@ -1,19 +1,16 @@
package dev.zontreck.otemod.commands.zschem; package dev.zontreck.otemod.commands.zschem;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.chat.ChatColor; import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.vectors.Vector3; import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.integrations.LuckPermsHelper; import dev.zontreck.otemod.integrations.LuckPermsHelper;
import dev.zontreck.otemod.permissions.Permissions; import dev.zontreck.otemod.permissions.Permissions;
import dev.zontreck.otemod.zschem.MemoryHolder; import dev.zontreck.otemod.zschem.MemoryHolder;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
public class SetPos1 { public class SetPos1 {
@ -40,7 +37,7 @@ public class SetPos1 {
MemoryHolder.setPos1(play, new Vector3(source.getPosition())); MemoryHolder.setPos1(play, new Vector3(source.getPosition()));
MemoryHolder.setLevel(play, source.getLevel()); MemoryHolder.setLevel(play, source.getLevel());
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Position 1 set!")), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Position 1 set!")), OTEMod.THE_SERVER);
return 0; return 0;
} }

View file

@ -1,19 +1,16 @@
package dev.zontreck.otemod.commands.zschem; package dev.zontreck.otemod.commands.zschem;
import com.mojang.brigadier.CommandDispatcher; import com.mojang.brigadier.CommandDispatcher;
import dev.zontreck.libzontreck.chat.ChatColor; import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.vectors.Vector3; import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.integrations.LuckPermsHelper; import dev.zontreck.otemod.integrations.LuckPermsHelper;
import dev.zontreck.otemod.permissions.Permissions; import dev.zontreck.otemod.permissions.Permissions;
import dev.zontreck.otemod.zschem.MemoryHolder; import dev.zontreck.otemod.zschem.MemoryHolder;
import net.minecraft.commands.CommandSourceStack; import net.minecraft.commands.CommandSourceStack;
import net.minecraft.commands.Commands; import net.minecraft.commands.Commands;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
public class SetPos2 { public class SetPos2 {
@ -40,7 +37,7 @@ public class SetPos2 {
MemoryHolder.setPos2(play, new Vector3(source.getPosition())); MemoryHolder.setPos2(play, new Vector3(source.getPosition()));
MemoryHolder.setLevel(play, source.getLevel()); MemoryHolder.setLevel(play, source.getLevel());
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Position 2 set!")), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(play.getUUID(), Component.literal(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Green!Position 2 set!")), OTEMod.THE_SERVER);
return 0; return 0;
} }

View file

@ -1,13 +1,9 @@
package dev.zontreck.otemod.entities; package dev.zontreck.otemod.entities;
import java.util.function.Supplier;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.entities.monsters.PossumEntity; import dev.zontreck.otemod.entities.monsters.PossumEntity;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.EntityType; import net.minecraft.world.entity.EntityType;
import net.minecraft.world.entity.Mob;
import net.minecraft.world.entity.MobCategory; import net.minecraft.world.entity.MobCategory;
import net.minecraftforge.eventbus.api.IEventBus; import net.minecraftforge.eventbus.api.IEventBus;
import net.minecraftforge.registries.DeferredRegister; import net.minecraftforge.registries.DeferredRegister;
@ -15,7 +11,7 @@ import net.minecraftforge.registries.ForgeRegistries;
import net.minecraftforge.registries.RegistryObject; import net.minecraftforge.registries.RegistryObject;
public class ModEntityTypes { public class ModEntityTypes {
public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITIES, OTEMod.MOD_ID); public static final DeferredRegister<EntityType<?>> ENTITIES = DeferredRegister.create(ForgeRegistries.ENTITY_TYPES, OTEMod.MOD_ID);
public static final RegistryObject<EntityType<? extends PossumEntity>> POSSUM = ENTITIES.register("possum", ()-> EntityType.Builder.of(PossumEntity::new, MobCategory.CREATURE).sized(1.5f, 0.5f).build(new ResourceLocation(OTEMod.MOD_ID, "possum").toString())); public static final RegistryObject<EntityType<? extends PossumEntity>> POSSUM = ENTITIES.register("possum", ()-> EntityType.Builder.of(PossumEntity::new, MobCategory.CREATURE).sized(1.5f, 0.5f).build(new ResourceLocation(OTEMod.MOD_ID, "possum").toString()));

View file

@ -15,10 +15,10 @@ public class ClientEvents {
{ {
@SubscribeEvent @SubscribeEvent
public static void onKeyInput(InputEvent.ClickInputEvent event) public static void onKeyInput(InputEvent.Key event)
{ {
//OTEMod.LOGGER.info("KEY PRESS: "+event.getKey()); //OTEMod.LOGGER.info("KEY PRESS: "+event.getKey());
if(KeyBindings.OPEN_VAULT.consumeClick()) if(KeyBindings.OPEN_VAULT.matches(event.getKey(), event.getScanCode()))
{ {
ModMessages.sendToServer(new OpenVaultC2SPacket(0, false, 0)); ModMessages.sendToServer(new OpenVaultC2SPacket(0, false, 0));
} }

View file

@ -1,13 +1,7 @@
package dev.zontreck.otemod.events; package dev.zontreck.otemod.events;
import java.time.Instant; import dev.zontreck.libzontreck.lore.LoreContainer;
import java.util.Date; import dev.zontreck.libzontreck.lore.LoreEntry;
import java.util.Random;
import org.antlr.v4.parse.ANTLRParser.id_return;
import dev.zontreck.libzontreck.items.lore.LoreContainer;
import dev.zontreck.libzontreck.items.lore.LoreEntry;
import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException; import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
@ -19,12 +13,8 @@ import dev.zontreck.otemod.enchantments.MobEggEnchantment;
import dev.zontreck.otemod.enchantments.ModEnchantments; import dev.zontreck.otemod.enchantments.ModEnchantments;
import dev.zontreck.otemod.implementation.DeathMessages; import dev.zontreck.otemod.implementation.DeathMessages;
import dev.zontreck.otemod.items.tags.ItemStatType; 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; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.TextComponent; import net.minecraft.network.chat.Component;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.LivingEntity; import net.minecraft.world.entity.LivingEntity;
@ -35,18 +25,16 @@ import net.minecraft.world.item.enchantment.Enchantments;
import net.minecraftforge.common.ForgeSpawnEggItem; import net.minecraftforge.common.ForgeSpawnEggItem;
import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.living.LivingDropsEvent; import net.minecraftforge.event.entity.living.LivingDropsEvent;
import net.minecraftforge.event.entity.player.PlayerEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.event.world.BiomeLoadingEvent; import net.minecraftforge.fml.common.Mod;
import java.time.Instant;
import java.util.Date;
import java.util.Random;
@Mod.EventBusSubscriber(modid=OTEMod.MOD_ID) @Mod.EventBusSubscriber(modid=OTEMod.MOD_ID)
public class EventHandler { 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 @SubscribeEvent
public static void playerDied(LivingDeathEvent event) public static void playerDied(LivingDeathEvent event)
@ -83,7 +71,6 @@ public class EventHandler {
double num = rng.nextDouble(0,100000); double num = rng.nextDouble(0,100000);
if(num <= base_chance) if(num <= base_chance)
{ {
ItemStack head = HeadUtilities.get(profile.username).setHoverName(ChatHelpers.macro(profile.nickname+"'s Head")); ItemStack head = HeadUtilities.get(profile.username).setHoverName(ChatHelpers.macro(profile.nickname+"'s Head"));
LoreContainer lore = new LoreContainer(head); LoreContainer lore = new LoreContainer(head);
LoreEntry entry = new LoreEntry(); LoreEntry entry = new LoreEntry();
@ -105,7 +92,7 @@ public class EventHandler {
} }
try { try {
ChatHelpers.broadcast(new TextComponent(DeathMessages.getRandomDeathMessage(Profile.get_profile_of(event.getEntity().getStringUUID()), event.getSource())), event.getEntity().level.getServer()); ChatHelpers.broadcast(Component.literal(DeathMessages.getRandomDeathMessage(Profile.get_profile_of(event.getEntity().getStringUUID()), event.getSource())), event.getEntity().level.getServer());
} catch (UserProfileNotYetExistsException e) { } catch (UserProfileNotYetExistsException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
e.printStackTrace(); e.printStackTrace();
@ -116,12 +103,12 @@ public class EventHandler {
public void onEntityKilled(LivingDropsEvent ev){ public void onEntityKilled(LivingDropsEvent ev){
if(ev.getEntity().level.isClientSide)return; if(ev.getEntity().level.isClientSide)return;
Entity killedentity = ev.getEntityLiving(); Entity killedentity = ev.getEntity();
Entity ent = ev.getSource().getEntity(); Entity ent = ev.getSource().getEntity();
if(ent instanceof Player) if(ent instanceof Player)
{ {
ServerPlayer play = (ServerPlayer)ent; ServerPlayer play = (ServerPlayer)ent;
LivingEntity killed = ev.getEntityLiving(); LivingEntity killed = ev.getEntity();
ItemStack stack = play.getMainHandItem(); ItemStack stack = play.getMainHandItem();
int levelOfEgging = ItemUtils.getEnchantmentLevel(ModEnchantments.MOB_EGGING_ENCHANTMENT.get(),stack); int levelOfEgging = ItemUtils.getEnchantmentLevel(ModEnchantments.MOB_EGGING_ENCHANTMENT.get(),stack);

View file

@ -1,7 +1,7 @@
package dev.zontreck.otemod.events; package dev.zontreck.otemod.events;
import dev.zontreck.libzontreck.items.lore.LoreContainer; import dev.zontreck.libzontreck.lore.LoreContainer;
import dev.zontreck.libzontreck.items.lore.LoreEntry; import dev.zontreck.libzontreck.lore.LoreEntry;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.items.tags.ItemStatTag; import dev.zontreck.otemod.items.tags.ItemStatTag;
@ -13,23 +13,17 @@ import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResult; import net.minecraft.world.InteractionResult;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
import net.minecraft.world.entity.animal.Sheep;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.item.AxeItem;
import net.minecraft.world.item.HoeItem;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.PickaxeItem;
import net.minecraft.world.item.ShearsItem;
import net.minecraft.world.item.ShovelItem;
import net.minecraft.world.item.SwordItem;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.event.entity.living.LivingDeathEvent; import net.minecraftforge.event.entity.living.LivingDeathEvent;
import net.minecraftforge.event.entity.player.PlayerInteractEvent; import net.minecraftforge.event.entity.player.PlayerInteractEvent;
import net.minecraftforge.event.world.BlockEvent; import net.minecraftforge.event.level.BlockEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.Mod.EventBusSubscriber; import net.minecraftforge.fml.common.Mod.EventBusSubscriber;
import net.minecraftforge.registries.ForgeRegistries;
@EventBusSubscriber(modid=OTEMod.MOD_ID, bus=Mod.EventBusSubscriber.Bus.FORGE) @EventBusSubscriber(modid=OTEMod.MOD_ID, bus=Mod.EventBusSubscriber.Bus.FORGE)
public class LoreHandlers { public class LoreHandlers {
@ -37,11 +31,11 @@ public class LoreHandlers {
@SubscribeEvent @SubscribeEvent
public void onBlockMined(BlockEvent.BreakEvent ev) public void onBlockMined(BlockEvent.BreakEvent ev)
{ {
if(ev.getWorld().isClientSide())return; if(ev.getLevel().isClientSide())return;
ServerPlayer sp = (ServerPlayer)ev.getPlayer(); ServerPlayer sp = (ServerPlayer)ev.getPlayer();
ItemStack itemUsed = sp.getItemInHand(InteractionHand.MAIN_HAND); ItemStack itemUsed = sp.getItemInHand(InteractionHand.MAIN_HAND);
ResourceLocation loc = itemUsed.getItem().getRegistryName(); ResourceLocation loc = ForgeRegistries.ITEMS.getKey(itemUsed.getItem());
String itemModName = ChatHelpers.macroize("[0]:[1]", loc.getNamespace(), loc.getPath()); String itemModName = ChatHelpers.macroize("[0]:[1]", loc.getNamespace(), loc.getPath());
if(itemModName.contains("pickaxe")) if(itemModName.contains("pickaxe"))
{ {
@ -62,14 +56,14 @@ public class LoreHandlers {
public void onBlock(BlockEvent.BlockToolModificationEvent ev) public void onBlock(BlockEvent.BlockToolModificationEvent ev)
{ {
if(ev.getWorld().isClientSide())return; if(ev.getLevel().isClientSide())return;
// Check the block right clicked, and the item in hand // Check the block right clicked, and the item in hand
ServerPlayer sp = (ServerPlayer)ev.getPlayer(); ServerPlayer sp = (ServerPlayer)ev.getPlayer();
ItemStack itemUsed = sp.getMainHandItem(); ItemStack itemUsed = sp.getMainHandItem();
BlockState bs = ev.getState(); BlockState bs = ev.getState();
ResourceLocation loc = itemUsed.getItem().getRegistryName(); ResourceLocation loc = ForgeRegistries.ITEMS.getKey(itemUsed.getItem());
String itemModName = ChatHelpers.macroize("[0]:[1]", loc.getNamespace(), loc.getPath()); String itemModName = ChatHelpers.macroize("[0]:[1]", loc.getNamespace(), loc.getPath());
if(itemModName.contains("hoe")) if(itemModName.contains("hoe"))
@ -94,18 +88,18 @@ public class LoreHandlers {
public void onShears(PlayerInteractEvent.EntityInteract ev) public void onShears(PlayerInteractEvent.EntityInteract ev)
{ {
if(ev.getWorld().isClientSide)return; if(ev.getLevel().isClientSide)return;
if(ev.getCancellationResult() == InteractionResult.PASS) if(ev.getCancellationResult() == InteractionResult.PASS)
{ {
// Check the entity right clicked, and the item in hand // Check the entity right-clicked, and the item in hand
OTEMod.LOGGER.info("Success"); OTEMod.LOGGER.info("Success");
ServerPlayer sp = (ServerPlayer)ev.getEntity(); ServerPlayer sp = (ServerPlayer)ev.getEntity();
ItemStack itemUsed = sp.getMainHandItem(); ItemStack itemUsed = sp.getMainHandItem();
Entity target = ev.getTarget(); Entity target = ev.getTarget();
ResourceLocation loc = itemUsed.getItem().getRegistryName(); ResourceLocation loc = ForgeRegistries.ITEMS.getKey(itemUsed.getItem());
String itemModName = ChatHelpers.macroize("[0]:[1]", loc.getNamespace(), loc.getPath()); String itemModName = ChatHelpers.macroize("[0]:[1]", loc.getNamespace(), loc.getPath());
ResourceLocation locEnt = itemUsed.getItem().getRegistryName(); ResourceLocation locEnt = ForgeRegistries.ENTITY_TYPES.getKey(ev.getTarget().getType());
String entityModName = ChatHelpers.macroize("[0]:[1]", locEnt.getNamespace(), locEnt.getPath()); String entityModName = ChatHelpers.macroize("[0]:[1]", locEnt.getNamespace(), locEnt.getPath());
if(itemModName.contains("shears")) if(itemModName.contains("shears"))
{ {
@ -137,7 +131,7 @@ public class LoreHandlers {
if(sp==null)return; if(sp==null)return;
ItemStack weaponUsed = sp.getItemInHand(InteractionHand.MAIN_HAND); ItemStack weaponUsed = sp.getItemInHand(InteractionHand.MAIN_HAND);
ResourceLocation loc = weaponUsed.getItem().getRegistryName(); ResourceLocation loc = ForgeRegistries.ITEMS.getKey(weaponUsed.getItem());
String itemModName = ChatHelpers.macroize("[0]:[1]", loc.getNamespace(), loc.getPath()); String itemModName = ChatHelpers.macroize("[0]:[1]", loc.getNamespace(), loc.getPath());
if(itemModName.contains("sword")) if(itemModName.contains("sword"))
{ {

View file

@ -44,7 +44,7 @@ public class DeathMessages {
{ {
if(sourceName.equals("")) if(sourceName.equals(""))
{ {
sourceName = source.getEntity().getName().getContents(); sourceName = source.getEntity().getName().getString();
} }
} else sourceName = "an imaginary zombie!"; } else sourceName = "an imaginary zombie!";

View file

@ -1,14 +1,12 @@
package dev.zontreck.otemod.implementation.energy.screenrenderer; package dev.zontreck.otemod.implementation.energy.screenrenderer;
import java.util.List;
import com.mojang.blaze3d.vertex.PoseStack; import com.mojang.blaze3d.vertex.PoseStack;
import net.minecraft.client.renderer.Rect2i; import net.minecraft.client.renderer.Rect2i;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraftforge.energy.IEnergyStorage; import net.minecraftforge.energy.IEnergyStorage;
import java.util.List;
/* /*
* BluSunrize * BluSunrize
* Copyright (c) 2021 * Copyright (c) 2021
@ -33,7 +31,7 @@ public class EnergyInfoArea extends InfoArea {
} }
public List<Component> getTooltips() { public List<Component> getTooltips() {
return List.of(new TextComponent(energy.getEnergyStored()+"/"+energy.getMaxEnergyStored()+" FE")); return List.of(Component.literal(energy.getEnergyStored()+"/"+energy.getMaxEnergyStored()+" FE"));
} }
@Override @Override

View file

@ -15,7 +15,7 @@ import net.minecraftforge.registries.RegistryObject;
public final class ModMenuTypes public final class ModMenuTypes
{ {
public static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.CONTAINERS, OTEMod.MOD_ID); public static final DeferredRegister<MenuType<?>> CONTAINERS = DeferredRegister.create(ForgeRegistries.MENU_TYPES, OTEMod.MOD_ID);
public static final RegistryObject <MenuType <VaultMenu>> VAULT = CONTAINERS.register("vault", ()-> new MenuType<>(VaultMenu::new)); public static final RegistryObject <MenuType <VaultMenu>> VAULT = CONTAINERS.register("vault", ()-> new MenuType<>(VaultMenu::new));

View file

@ -7,15 +7,11 @@ import net.minecraft.core.Direction;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.*;
import net.minecraft.world.inventory.ContainerData;
import net.minecraft.world.inventory.ContainerLevelAccess;
import net.minecraft.world.inventory.SimpleContainerData;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.items.SlotItemHandler; import net.minecraftforge.items.SlotItemHandler;
public class ItemScrubberMenu extends AbstractContainerMenu public class ItemScrubberMenu extends AbstractContainerMenu
@ -40,10 +36,10 @@ public class ItemScrubberMenu extends AbstractContainerMenu
addPlayerInventory(inv); addPlayerInventory(inv);
addPlayerHotbar(inv); addPlayerHotbar(inv);
this.entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.UP).ifPresent(handler->{ this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.UP).ifPresent(handler->{
addSlot(new SlotItemHandler(handler, 0, 16, 41)); addSlot(new SlotItemHandler(handler, 0, 16, 41));
}); });
this.entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN).ifPresent(handler->{ this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.DOWN).ifPresent(handler->{
addSlot(new SlotItemHandler(handler, 0, 177, 41)); addSlot(new SlotItemHandler(handler, 0, 177, 41));
}); });

View file

@ -7,15 +7,11 @@ import net.minecraft.core.Direction;
import net.minecraft.network.FriendlyByteBuf; import net.minecraft.network.FriendlyByteBuf;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
import net.minecraft.world.inventory.AbstractContainerMenu; import net.minecraft.world.inventory.*;
import net.minecraft.world.inventory.ContainerData;
import net.minecraft.world.inventory.ContainerLevelAccess;
import net.minecraft.world.inventory.SimpleContainerData;
import net.minecraft.world.inventory.Slot;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraftforge.items.CapabilityItemHandler; import net.minecraftforge.common.capabilities.ForgeCapabilities;
import net.minecraftforge.items.SlotItemHandler; import net.minecraftforge.items.SlotItemHandler;
public class MagicalScrubberMenu extends AbstractContainerMenu public class MagicalScrubberMenu extends AbstractContainerMenu
@ -40,10 +36,10 @@ public class MagicalScrubberMenu extends AbstractContainerMenu
addPlayerInventory(inv); addPlayerInventory(inv);
addPlayerHotbar(inv); addPlayerHotbar(inv);
this.entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.UP).ifPresent(handler->{ this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.UP).ifPresent(handler->{
addSlot(new SlotItemHandler(handler, 0, 16, 41)); addSlot(new SlotItemHandler(handler, 0, 16, 41));
}); });
this.entity.getCapability(CapabilityItemHandler.ITEM_HANDLER_CAPABILITY, Direction.DOWN).ifPresent(handler->{ this.entity.getCapability(ForgeCapabilities.ITEM_HANDLER, Direction.DOWN).ifPresent(handler->{
addSlot(new SlotItemHandler(handler, 0, 177, 41)); addSlot(new SlotItemHandler(handler, 0, 177, 41));
}); });

View file

@ -1,12 +1,12 @@
package dev.zontreck.otemod.implementation.vault; package dev.zontreck.otemod.implementation.vault;
import java.io.File;
import java.io.IOException;
import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.Profile;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo; import net.minecraft.nbt.NbtIo;
import java.io.File;
import java.io.IOException;
public class Vault { public class Vault {
public int vaultNum; public int vaultNum;
public File file_location; public File file_location;

View file

@ -1,38 +1,26 @@
package dev.zontreck.otemod.implementation.vault; package dev.zontreck.otemod.implementation.vault;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import com.mojang.brigadier.exceptions.CommandSyntaxException;
import dev.zontreck.libzontreck.chat.ChatColor; import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException; import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.implementation.events.VaultModifiedEvent; import dev.zontreck.otemod.implementation.events.VaultModifiedEvent;
import dev.zontreck.otemod.implementation.vault.VaultProvider.VaultAccessStrategy; import dev.zontreck.otemod.implementation.vault.VaultProvider.VaultAccessStrategy;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtIo;
import net.minecraft.nbt.NbtUtils;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.MinecraftServer; import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Inventory;
import net.minecraft.world.inventory.MenuConstructor; import net.minecraft.world.inventory.MenuConstructor;
import net.minecraft.world.item.ItemStack; import net.minecraft.world.item.ItemStack;
import net.minecraft.world.item.Items; import net.minecraft.world.item.Items;
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.ItemStackHandler;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
public class VaultContainer public class VaultContainer
{ {
public static Map<UUID, VaultContainer> VAULT_REGISTRY = new HashMap<>(); public static Map<UUID, VaultContainer> VAULT_REGISTRY = new HashMap<>();
@ -88,7 +76,7 @@ public class VaultContainer
if(VAULT_NUMBER == -1)return; // We have no need to save the trash if(VAULT_NUMBER == -1)return; // We have no need to save the trash
boolean isEmpty=true; boolean isEmpty=true;
CompoundTag saved = myInventory.serializeNBT(); CompoundTag saved = myInventory.serializeNBT();
ChatHelpers.broadcastToAbove(owner, new TextComponent(ChatColor.BOLD+ChatColor.DARK_GREEN+"Saving the vault's contents..."), server); ChatHelpers.broadcastToAbove(owner, Component.literal(ChatColor.BOLD+ChatColor.DARK_GREEN+"Saving the vault's contents..."), server);
Profile profile=null; Profile profile=null;
try { try {

View file

@ -15,7 +15,6 @@ import net.minecraft.client.gui.font.TextFieldHelper;
import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen; import net.minecraft.client.gui.screens.inventory.AbstractContainerScreen;
import net.minecraft.client.renderer.GameRenderer; import net.minecraft.client.renderer.GameRenderer;
import net.minecraft.network.chat.Component; import net.minecraft.network.chat.Component;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.resources.ResourceLocation; import net.minecraft.resources.ResourceLocation;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Inventory; import net.minecraft.world.entity.player.Inventory;
@ -70,16 +69,17 @@ public class VaultScreen extends AbstractContainerScreen <VaultMenu>
super.init(); super.init();
// This is where custom controls would be added! // This is where custom controls would be added!
this.addWidget(new Button(this.leftPos+7,this.topPos+84,16,16,new TextComponent(""), (button)->{ this.addWidget(Button.builder(Component.literal(""), (BTN)->{
thePlayer.closeContainer(); thePlayer.closeContainer();
ModMessages.sendToServer(new OpenVaultC2SPacket(0, true, -1));
}).size(16,16).pos(this.leftPos+7, this.topPos+86).build());
ModMessages.sendToServer(new OpenVaultC2SPacket(0,true,-1));
} ));
this.addWidget(new Button(this.leftPos+187,this.topPos+84,16,16,new TextComponent(""), (button)->{ this.addWidget(Button.builder(Component.literal(""), (BTN)->{
thePlayer.closeContainer(); thePlayer.closeContainer();
ModMessages.sendToServer(new OpenVaultC2SPacket(0, true, 1)); ModMessages.sendToServer(new OpenVaultC2SPacket(0, true, 1));
} )); }).size(16,16).pos(this.leftPos+187, this.topPos+84).build());
} }
@Override @Override

View file

@ -3,6 +3,8 @@ package dev.zontreck.otemod.integrations;
import com.mojang.blaze3d.platform.InputConstants; import com.mojang.blaze3d.platform.InputConstants;
import net.minecraft.client.KeyMapping; import net.minecraft.client.KeyMapping;
import net.minecraft.client.multiplayer.ClientRegistryLayer;
import net.minecraft.core.registries.Registries;
import net.minecraftforge.client.ClientRegistry; import net.minecraftforge.client.ClientRegistry;
public class KeyBindings { public class KeyBindings {
@ -13,6 +15,7 @@ public class KeyBindings {
private static KeyMapping registerKeyMapping(String name, int keycode, String category){ private static KeyMapping registerKeyMapping(String name, int keycode, String category){
final KeyMapping key = new KeyMapping(name, keycode, category); final KeyMapping key = new KeyMapping(name, keycode, category);
ClientRegistry.registerKeyBinding(key); ClientRegistry.registerKeyBinding(key);
return key; return key;
} }

View file

@ -4,8 +4,7 @@ import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import dev.zontreck.otemod.chat.ChatServerOverride; import dev.zontreck.otemod.chat.ChatServerOverride;
import net.minecraft.network.chat.Component; import dev.zontreck.otemod.implementation.Messages;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerPlayer; import net.minecraft.server.level.ServerPlayer;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -36,6 +35,6 @@ public class LuckPermsHelper {
} }
public static void sendNoPermissionsMessage(ServerPlayer play, String perm, String group) { public static void sendNoPermissionsMessage(ServerPlayer play, String perm, String group) {
ChatHelpers.broadcastTo(play.getUUID(), new TextComponent(OTEMod.OTEPrefix + ChatColor.doColors(" !Dark_Red!You do not have permission to use that command. You need permission !Gold!"+perm+" !White! or !Gold!"+group)), play.server); ChatHelpers.broadcastTo(play.getUUID(), ChatHelpers.macro(Messages.OTE_PREFIX+" !Dark_Red!You do not have permission to use that command. You need permission !Gold!"+perm+" !White! or !Gold!"+group), play.server);
} }
} }

View file

@ -15,47 +15,47 @@ import net.minecraftforge.registries.RegistryObject;
public class ModItems { public class ModItems {
public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, OTEMod.MOD_ID); public static final DeferredRegister<Item> ITEMS = DeferredRegister.create(ForgeRegistries.ITEMS, OTEMod.MOD_ID);
public static final RegistryObject<Item> ETERNIUM_FRAGMENT = ITEMS.register("eternium_fragment", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC))); public static final RegistryObject<Item> ETERNIUM_FRAGMENT = ITEMS.register("eternium_fragment", () -> new Item(new Item.Properties()));
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> IHAN_CRYSTAL = ITEMS.register("ihan_crystal", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> AURORA_COMPOUND = ITEMS.register("aurora_compound", () -> 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()));
public static final RegistryObject<Item> ETERNIUM_RAW_ORE = ITEMS.register("eternium_ore", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC))); public static final RegistryObject<Item> ETERNIUM_RAW_ORE = ITEMS.register("eternium_ore", () -> new Item(new Item.Properties()));
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> RAW_COBALT = ITEMS.register("raw_cobalt", () -> new Item(new Item.Properties()));
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_NUGGET = ITEMS.register("cobalt_nugget", () -> new Item(new Item.Properties()));
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> COBALT_INGOT = ITEMS.register("cobalt_ingot", () -> new Item(new Item.Properties()));
public static final RegistryObject<Item> ETERNIUM_INGOT = ITEMS.register("eternium_ingot", ()-> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MATERIALS))); public static final RegistryObject<Item> ETERNIUM_INGOT = ITEMS.register("eternium_ingot", ()-> new SimpleFoiledItem(new Item.Properties()));
public static final RegistryObject<Item> MELTED_NETHER_STAR = ITEMS.register("melted_nether_star", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64))); public static final RegistryObject<Item> MELTED_NETHER_STAR = ITEMS.register("melted_nether_star", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> SINGULARITY = ITEMS.register("singularity", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(1))); public static final RegistryObject<Item> SINGULARITY = ITEMS.register("singularity", () -> new Item(new Item.Properties().stacksTo(1)));
public static final RegistryObject<Item> ETERNIUM_ROD = ITEMS.register("eternium_rod", () -> new SimpleFoiledItem(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64))); public static final RegistryObject<Item> ETERNIUM_ROD = ITEMS.register("eternium_rod", () -> new SimpleFoiledItem(new Item.Properties().stacksTo(64)));
public static final RegistryObject<Item> SCRUBBER_FRAME_PIECE = ITEMS.register("scrubber_frame_piece", () -> new Item(new Item.Properties().tab(CreativeModeTab.TAB_MISC).stacksTo(64))); public static final RegistryObject<Item> SCRUBBER_FRAME_PIECE = ITEMS.register("scrubber_frame_piece", () -> new Item(new Item.Properties().stacksTo(64)));
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> SCRUBBER_FRAME = ITEMS.register("scrubber_frame", () -> new Item(new Item.Properties().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> VAULTSTEEL_INGOT = ITEMS.register("vault_steel_ingot", () -> new SimpleFoiledItem(new Item.Properties().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_BL = ITEMS.register("vault_fragment_lower_left", () -> new SimpleFoiledItem(new Item.Properties().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_LC = ITEMS.register("vault_fragment_lower", () -> new SimpleFoiledItem(new Item.Properties().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_BR = ITEMS.register("vault_fragment_lower_right", () -> new SimpleFoiledItem(new Item.Properties().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_L = ITEMS.register("vault_fragment_left", () -> new SimpleFoiledItem(new Item.Properties().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_R = ITEMS.register("vault_fragment_right", () -> new SimpleFoiledItem(new Item.Properties().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_UR = ITEMS.register("vault_fragment_upper_right", () -> new SimpleFoiledItem(new Item.Properties().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_UL = ITEMS.register("vault_fragment_upper_left", () -> new SimpleFoiledItem(new Item.Properties().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_U = ITEMS.register("vault_fragment_upper", () -> new SimpleFoiledItem(new Item.Properties().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_FRAG_C = ITEMS.register("vault_fragment_center", () -> new SimpleFoiledItem(new Item.Properties().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 = ITEMS.register("vault", () -> new VaultItem(new Item.Properties().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> VAULT_RAW_ORE = ITEMS.register("raw_vault_steel_ore", () -> new Item(new Item.Properties().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))); public static final RegistryObject<Item> POSSUM_SPAWN_EGG = ITEMS.register("possum_spawn_egg", () -> new ForgeSpawnEggItem(ModEntityTypes.POSSUM, 0x938686, 0xc68787, new Item.Properties()));

View file

@ -2,8 +2,6 @@ package dev.zontreck.otemod.items;
import dev.zontreck.libzontreck.chat.ChatColor; import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.items.lore.LoreContainer;
import dev.zontreck.libzontreck.items.lore.LoreEntry;
import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException; import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
@ -12,7 +10,6 @@ import dev.zontreck.otemod.chat.ChatServerOverride;
import dev.zontreck.otemod.configs.OTEServerConfig; import dev.zontreck.otemod.configs.OTEServerConfig;
import dev.zontreck.otemod.events.LoreHandlers; import dev.zontreck.otemod.events.LoreHandlers;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.world.InteractionHand; import net.minecraft.world.InteractionHand;
import net.minecraft.world.InteractionResultHolder; import net.minecraft.world.InteractionResultHolder;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -57,12 +54,12 @@ public class VaultItem extends Item
{ {
if(p.available_vaults >= OTEServerConfig.MAX_VAULTS.get()) if(p.available_vaults >= OTEServerConfig.MAX_VAULTS.get())
{ {
ChatHelpers.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); ChatHelpers.broadcastTo(pPlayer.getUUID(), ChatHelpers.macro(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); return InteractionResultHolder.pass(is);
} else { } else {
p.available_vaults++; p.available_vaults++;
p.commit(); p.commit();
ChatHelpers.broadcastTo(pPlayer.getUUID(), new TextComponent(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Green!You now have "+String.valueOf(p.available_vaults)+" available vaults")), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(pPlayer.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Green!You now have "+String.valueOf(p.available_vaults)+" available vaults"), OTEMod.THE_SERVER);
pPlayer.setItemInHand(pUsedHand, new ItemStack(Items.AIR)); pPlayer.setItemInHand(pUsedHand, new ItemStack(Items.AIR));
return InteractionResultHolder.consume(is); return InteractionResultHolder.consume(is);
@ -70,7 +67,7 @@ public class VaultItem extends Item
}else { }else {
p.available_vaults++; p.available_vaults++;
p.commit(); p.commit();
ChatHelpers.broadcastTo(pPlayer.getUUID(), new TextComponent(ChatColor.doColors(OTEMod.OTEPrefix+" !Dark_Green!You now have "+String.valueOf(p.available_vaults)+" available vaults")), OTEMod.THE_SERVER); ChatHelpers.broadcastTo(pPlayer.getUUID(), ChatHelpers.macro(OTEMod.OTEPrefix+" !Dark_Green!You now have "+String.valueOf(p.available_vaults)+" available vaults"), OTEMod.THE_SERVER);
pPlayer.setItemInHand(pUsedHand, new ItemStack(Items.AIR)); pPlayer.setItemInHand(pUsedHand, new ItemStack(Items.AIR));
return InteractionResultHolder.consume(is); return InteractionResultHolder.consume(is);

View file

@ -32,13 +32,13 @@ public class ModMessages {
net.messageBuilder(OpenVaultC2SPacket.class, id(), NetworkDirection.PLAY_TO_SERVER) net.messageBuilder(OpenVaultC2SPacket.class, id(), NetworkDirection.PLAY_TO_SERVER)
.decoder(OpenVaultC2SPacket::new) .decoder(OpenVaultC2SPacket::new)
.encoder(OpenVaultC2SPacket::toBytes) .encoder(OpenVaultC2SPacket::toBytes)
.consumer(OpenVaultC2SPacket::handle) .consumerMainThread(OpenVaultC2SPacket::handle)
.add(); .add();
net.messageBuilder(EnergySyncS2CPacket.class, id(), NetworkDirection.PLAY_TO_CLIENT) net.messageBuilder(EnergySyncS2CPacket.class, id(), NetworkDirection.PLAY_TO_CLIENT)
.decoder(EnergySyncS2CPacket::new) .decoder(EnergySyncS2CPacket::new)
.encoder(EnergySyncS2CPacket::toBytes) .encoder(EnergySyncS2CPacket::toBytes)
.consumer(EnergySyncS2CPacket::handle) .consumerMainThread(EnergySyncS2CPacket::handle)
.add(); .add();
} }

View file

@ -1,25 +1,8 @@
package dev.zontreck.otemod.ore; 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 class OreGenerator {
/*
public static final List<ConfiguredFeature<OreConfiguration, OreFeature>> OVERWORLD_ORES = new ArrayList(); public static final List<ConfiguredFeature<OreConfiguration, OreFeature>> OVERWORLD_ORES = new ArrayList();
@ -61,5 +44,5 @@ public class OreGenerator {
base.add(VAULT_STEEL_ORE_PLACED); base.add(VAULT_STEEL_ORE_PLACED);
base.add(NETHER_VAULTSTEEL_ORE_PLACED); base.add(NETHER_VAULTSTEEL_ORE_PLACED);
//base.add(DEEPSLATE_AION_ORE_PLACED); //base.add(DEEPSLATE_AION_ORE_PLACED);
} }*/
} }

View file

@ -6,29 +6,30 @@ import java.util.Map;
import dev.zontreck.libzontreck.vectors.Vector3; import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.libzontreck.vectors.WorldPosition; import dev.zontreck.libzontreck.vectors.WorldPosition;
import dev.zontreck.otemod.configs.OTEServerConfig; import dev.zontreck.otemod.configs.OTEServerConfig;
import net.minecraft.client.telemetry.events.WorldLoadEvent;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraftforge.event.TickEvent; import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.level.ExplosionEvent;
import net.minecraftforge.event.level.LevelEvent;
import net.minecraftforge.event.server.ServerStoppingEvent; import net.minecraftforge.event.server.ServerStoppingEvent;
import net.minecraftforge.event.world.ExplosionEvent;
import net.minecraftforge.event.world.WorldEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
public class EventHandler { public class EventHandler {
@SubscribeEvent @SubscribeEvent
public void onDetonate(ExplosionEvent.Detonate ev) public void onDetonate(ExplosionEvent ev)
{ {
if(ev.getWorld().isClientSide)return; if(ev.getLevel().isClientSide)return;
//Entity explodes = ev.getExplosion().getSourceMob(); //Entity explodes = ev.getExplosion().getSourceMob();
// Register blocks to be healed // Register blocks to be healed
WorldPosition wpos = new WorldPosition(new Vector3(ev.getExplosion().getPosition()), (ServerLevel) ev.getWorld()); WorldPosition wpos = new WorldPosition(new Vector3(ev.getExplosion().getPosition()), (ServerLevel) ev.getLevel());
if(OTEServerConfig.EXCLUDE_DIMS.get().contains(wpos.Dimension)){ if(OTEServerConfig.EXCLUDE_DIMS.get().contains(wpos.Dimension)){
// Dimension is on the exclusion list. Do not process. // Dimension is on the exclusion list. Do not process.
return; return;
} }
WorldProp wp = WorldProp.acquire((ServerLevel)ev.getWorld()); WorldProp wp = WorldProp.acquire((ServerLevel)ev.getLevel());
if(wp!=null){ if(wp!=null){
wp.onDetonate(ev); wp.onDetonate(ev);
@ -44,21 +45,21 @@ public class EventHandler {
} }
@SubscribeEvent @SubscribeEvent
public void onLoadLevel(WorldEvent.Load ev) public void onLoadLevel(LevelEvent.Load ev)
{ {
if(!ev.getWorld().isClientSide() && ev.getWorld() instanceof ServerLevel) if(!ev.getLevel().isClientSide() && ev.getLevel() instanceof ServerLevel)
{ {
healers.put((ServerLevel)ev.getWorld(), WorldProp.acquire((ServerLevel)ev.getWorld())); healers.put((ServerLevel)ev.getLevel(), WorldProp.acquire((ServerLevel)ev.getLevel()));
} }
} }
@SubscribeEvent @SubscribeEvent
public void onUnload(WorldEvent.Unload ev) public void onUnload(LevelEvent.Unload ev)
{ {
if(!ev.getWorld().isClientSide()) if(!ev.getLevel().isClientSide())
{ {
healers.remove(ev.getWorld()); healers.remove(ev.getLevel());
} }
} }
@ -69,16 +70,16 @@ public class EventHandler {
} }
@SubscribeEvent @SubscribeEvent
public void onSaving(WorldEvent.Save ev) public void onSaving(LevelEvent.Save ev)
{ {
WorldProp.SaveAll(); WorldProp.SaveAll();
} }
@SubscribeEvent @SubscribeEvent
public void onLevelTick(TickEvent.WorldTickEvent ev) public void onLevelTick(TickEvent.LevelTickEvent ev)
{ {
if(!ev.world.isClientSide){ if(!ev.level.isClientSide){
WorldProp wp = WorldProp.acquire((ServerLevel)ev.world); WorldProp wp = WorldProp.acquire((ServerLevel)ev.level);
if(wp!=null){ if(wp!=null){
wp.onTick(); wp.onTick();
} }

View file

@ -13,7 +13,6 @@ import dev.zontreck.libzontreck.chat.ChatColor;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
import dev.zontreck.libzontreck.vectors.Vector3; import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.otemod.OTEMod; import dev.zontreck.otemod.OTEMod;
import net.minecraft.network.chat.TextComponent;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.entity.player.Player; import net.minecraft.world.entity.player.Player;
@ -85,7 +84,7 @@ public class MemoryHolder {
if(c.isExpired()){ if(c.isExpired()){
imeuc.remove(); imeuc.remove();
ChatHelpers.broadcastTo(entry.getKey(), new TextComponent(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!ZSchem Session expired")), c.lvl.getServer()); ChatHelpers.broadcastTo(entry.getKey(), ChatHelpers.macro(OTEMod.OTEPrefix+ChatColor.doColors(" !Dark_Red!ZSchem Session expired")), c.lvl.getServer());
} }
} }
}finally{ }finally{

View file

@ -4,12 +4,19 @@ import dev.zontreck.libzontreck.exceptions.InvalidDeserialization;
import dev.zontreck.libzontreck.vectors.Vector3; import dev.zontreck.libzontreck.vectors.Vector3;
import dev.zontreck.libzontreck.vectors.WorldPosition; import dev.zontreck.libzontreck.vectors.WorldPosition;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.HolderGetter;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.core.registries.Registries;
import net.minecraft.nbt.CompoundTag; import net.minecraft.nbt.CompoundTag;
import net.minecraft.nbt.NbtUtils; import net.minecraft.nbt.NbtUtils;
import net.minecraft.nbt.Tag; import net.minecraft.nbt.Tag;
import net.minecraft.server.Bootstrap;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.entity.BlockEntity; import net.minecraft.world.level.block.entity.BlockEntity;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.client.model.generators.BlockStateProvider;
import net.minecraftforge.registries.RegistryManager;
public class StoredBlock public class StoredBlock
{ {
@ -143,8 +150,10 @@ public class StoredBlock
e.printStackTrace(); e.printStackTrace();
} }
HolderGetter<Block> hg = position.getActualDimension().holderLookup(Registries.BLOCK);
state = NbtUtils.readBlockState(tag.getCompound("state"));
state = NbtUtils.readBlockState(hg, tag.getCompound("state"));
final CompoundTag tmp = tag.getCompound("entity"); final CompoundTag tmp = tag.getCompound("entity");
blockEntity = tmp.isEmpty() ? null : tmp; blockEntity = tmp.isEmpty() ? null : tmp;

View file

@ -15,7 +15,7 @@ import net.minecraft.tags.BlockTags;
import net.minecraft.world.level.Level; import net.minecraft.world.level.Level;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraftforge.event.world.ExplosionEvent; import net.minecraftforge.event.level.ExplosionEvent;
public class WorldProp implements Supplier<Object> public class WorldProp implements Supplier<Object>
{ {
@ -32,12 +32,12 @@ public class WorldProp implements Supplier<Object>
task.tick(); task.tick();
} }
public void onDetonate(ExplosionEvent.Detonate ev) public void onDetonate(ExplosionEvent ev)
{ {
Level w = ev.getWorld(); Level w = ev.getLevel();
//int maxTicks = 0; //int maxTicks = 0;
for(BlockPos p : ev.getAffectedBlocks()) for(BlockPos p : ev.getExplosion().getToBlow())
{ {
BlockState bsExplode = w.getBlockState(p); BlockState bsExplode = w.getBlockState(p);
if(!isValid(bsExplode))continue; if(!isValid(bsExplode))continue;

View file

@ -1,7 +1,7 @@
{ {
"type": "minecraft:ore", "type": "minecraft:ore",
"config": { "config": {
"size": 8, "size": 4,
"discard_chance_on_air_exposure": 0, "discard_chance_on_air_exposure": 0,
"targets": [ "targets": [
{ {

View file

@ -3,7 +3,7 @@
"placement": [ "placement": [
{ {
"type": "minecraft:count", "type": "minecraft:count",
"count": 2 "count": 4
}, },
{ {
"type": "minecraft:in_square" "type": "minecraft:in_square"
@ -16,7 +16,7 @@
"absolute": -63 "absolute": -63
}, },
"max_inclusive": { "max_inclusive": {
"absolute": -59 "absolute": -50
} }
} }
} }