Begin resolving compile errors

This commit is contained in:
zontreck 2023-11-19 20:33:43 -07:00
parent 8f15eb0dfc
commit 222d78d401
12 changed files with 38 additions and 29 deletions

View file

@ -11,6 +11,7 @@ import java.util.Map;
import java.util.Set; import java.util.Set;
import com.mojang.logging.LogUtils; import com.mojang.logging.LogUtils;
import dev.zontreck.otemod.integrations.KeyBindings;
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;
@ -115,6 +116,8 @@ public class OTEMod
ModEnchantments.register(bus); ModEnchantments.register(bus);
ModEntityTypes.register(bus); ModEntityTypes.register(bus);
MinecraftForge.EVENT_BUS.register(new KeyBindings());
GeckoLib.initialize(); GeckoLib.initialize();
//MenuInitializer.register(bus); //MenuInitializer.register(bus);
} }
@ -192,7 +195,7 @@ public class OTEMod
@SubscribeEvent @SubscribeEvent
public void onItemExpire(final ItemExpireEvent ev) public void onItemExpire(final ItemExpireEvent ev)
{ {
if(ev.getEntity().level.isClientSide)return; if(ev.getEntity().level().isClientSide)return;
if(OTEServerConfig.ITEM_DESPAWN_TIMER.get()<=0)return; if(OTEServerConfig.ITEM_DESPAWN_TIMER.get()<=0)return;

View file

@ -5,17 +5,18 @@ 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.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour; import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.block.state.properties.BlockSetType;
public class AuroraDoorBlock extends DoorBlock public class AuroraDoorBlock extends DoorBlock
{ {
public static final BlockBehaviour.Properties DOOR_PROPS; public static final BlockBehaviour.Properties DOOR_PROPS;
static static
{ {
DOOR_PROPS = BlockBehaviour.Properties.of(Blocks.IRON_DOOR.defaultBlockState().getMaterial()).requiresCorrectToolForDrops().strength(10, 100000f).sound(SoundType.NETHERITE_BLOCK); DOOR_PROPS = BlockBehaviour.Properties.copy(Blocks.IRON_DOOR).requiresCorrectToolForDrops().strength(10, 100000f).sound(SoundType.NETHERITE_BLOCK);
} }
public AuroraDoorBlock() { public AuroraDoorBlock() {
super(DOOR_PROPS, SoundEvents.IRON_DOOR_CLOSE, SoundEvents.IRON_DOOR_OPEN); super(DOOR_PROPS, BlockSetType.IRON);
} }

View file

@ -10,7 +10,6 @@ import net.minecraft.world.level.block.Blocks;
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.BlockState; import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.material.Material;
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;
@ -26,30 +25,30 @@ public class ModBlocks {
OTEMod.LOGGER.info("Registering all blocks..."); OTEMod.LOGGER.info("Registering all blocks...");
} }
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().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())); 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().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())); 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().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())); 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().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())); 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().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())); 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().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())); public static final RegistryObject<Item> AURORA_BLOCK_I = ITEMS.register("aurora_block", () -> new BlockItem(AURORA_BLOCK.get(), new Item.Properties()));

View file

@ -81,7 +81,7 @@ public class ChatServerOverride {
@SubscribeEvent @SubscribeEvent
public void onClone(final PlayerEvent.Clone ev) public void onClone(final PlayerEvent.Clone ev)
{ {
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.getEntity(); Player n = ev.getEntity();
@ -92,7 +92,7 @@ public class ChatServerOverride {
@SubscribeEvent @SubscribeEvent
public void onChat(final ServerChatEvent ev){ public void onChat(final ServerChatEvent ev){
if(ev.getPlayer().level.isClientSide)return; if(ev.getPlayer().level().isClientSide)return;
// Player has chatted, apply override // Player has chatted, apply override
if(!OTEServerConfig.USE_CUSTOM_CHATREPLACER.get()) return; if(!OTEServerConfig.USE_CUSTOM_CHATREPLACER.get()) return;

View file

@ -29,7 +29,7 @@ public class FlightEnchantment extends Enchantment
{ {
if(ev.getEntity() instanceof Player) if(ev.getEntity() instanceof Player)
{ {
if(ev.getEntity().level.isClientSide)return; if(ev.getEntity().level().isClientSide)return;
ServerPlayer sp = (ServerPlayer)ev.getEntity(); ServerPlayer sp = (ServerPlayer)ev.getEntity();
@ -68,7 +68,7 @@ public class FlightEnchantment extends Enchantment
@SubscribeEvent @SubscribeEvent
public static void onGameModeChange(PlayerEvent.PlayerChangeGameModeEvent ev) public static void onGameModeChange(PlayerEvent.PlayerChangeGameModeEvent ev)
{ {
if(ev.getEntity().level.isClientSide)return; if(ev.getEntity().level().isClientSide)return;
recheck((ServerPlayer)ev.getEntity()); recheck((ServerPlayer)ev.getEntity());
} }

View file

@ -92,7 +92,7 @@ public class EventHandler {
} }
try { try {
ChatHelpers.broadcast(Component.literal(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();
@ -101,7 +101,7 @@ public class EventHandler {
@SubscribeEvent @SubscribeEvent
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.getEntity(); Entity killedentity = ev.getEntity();
Entity ent = ev.getSource().getEntity(); Entity ent = ev.getSource().getEntity();
@ -127,7 +127,7 @@ public class EventHandler {
int level = ItemUtils.getEnchantmentLevel (Enchantments.MOB_LOOTING,stack); int level = ItemUtils.getEnchantmentLevel (Enchantments.MOB_LOOTING,stack);
if(level==3){ if(level==3){
ItemStack egg = new ItemStack(ForgeSpawnEggItem.fromEntityType(killed.getType())); ItemStack egg = new ItemStack(ForgeSpawnEggItem.fromEntityType(killed.getType()));
ev.getDrops().add(new ItemEntity(killed.level, killed.getX(), killed.getY(), killed.getZ(), egg)); ev.getDrops().add(new ItemEntity(killed.level(), killed.getX(), killed.getY(), killed.getZ(), egg));
LoreHandlers.updateItem(stack, ItemStatType.EGGING); LoreHandlers.updateItem(stack, ItemStatType.EGGING);
} }
}else{ }else{

View file

@ -115,7 +115,7 @@ public class LoreHandlers {
@SubscribeEvent @SubscribeEvent
public void onEntityKilled(LivingDeathEvent ev) public void onEntityKilled(LivingDeathEvent ev)
{ {
if(ev.getEntity().level.isClientSide)return; if(ev.getEntity().level().isClientSide)return;
// Handle two things // Handle two things

View file

@ -7,6 +7,7 @@ import java.util.Random;
import dev.zontreck.libzontreck.profiles.Profile; import dev.zontreck.libzontreck.profiles.Profile;
import dev.zontreck.libzontreck.util.ChatHelpers; import dev.zontreck.libzontreck.util.ChatHelpers;
import net.minecraft.world.damagesource.DamageSource; import net.minecraft.world.damagesource.DamageSource;
import net.minecraft.world.damagesource.DamageTypes;
import net.minecraft.world.entity.Entity; import net.minecraft.world.entity.Entity;
public class DeathMessages { public class DeathMessages {
@ -34,7 +35,7 @@ public class DeathMessages {
{ {
sourceName = "A godlike player"; sourceName = "A godlike player";
} }
if(source.isFall()) if(source.is(DamageTypes.FALL))
{ {
msg = rng.nextInt(0,messages_falling.size()-1); msg = rng.nextInt(0,messages_falling.size()-1);
return ChatHelpers.macroize(messages_falling.get(msg), String.valueOf(playerWhoDied.deaths), playerWhoDied.name_color + playerWhoDied.nickname); return ChatHelpers.macroize(messages_falling.get(msg), String.valueOf(playerWhoDied.deaths), playerWhoDied.name_color + playerWhoDied.nickname);

View file

@ -22,7 +22,7 @@ public class ItemScrubberMenu extends AbstractContainerMenu
public ItemScrubberMenu(int id, Inventory inv, FriendlyByteBuf buf) public ItemScrubberMenu(int id, Inventory inv, FriendlyByteBuf buf)
{ {
this(id, inv, inv.player.level.getBlockEntity(buf.readBlockPos()), new SimpleContainerData(1)); this(id, inv, inv.player.level().getBlockEntity(buf.readBlockPos()), new SimpleContainerData(1));
} }
public ItemScrubberMenu(int id, Inventory inv, BlockEntity entity, ContainerData data){ public ItemScrubberMenu(int id, Inventory inv, BlockEntity entity, ContainerData data){
@ -31,7 +31,7 @@ public class ItemScrubberMenu extends AbstractContainerMenu
checkContainerSize(inv, 1); checkContainerSize(inv, 1);
this.entity = (ItemScrubberBlockEntity)entity; this.entity = (ItemScrubberBlockEntity)entity;
this.data=data; this.data=data;
this.level = inv.player.level; this.level = inv.player.level();
addPlayerInventory(inv); addPlayerInventory(inv);
addPlayerHotbar(inv); addPlayerHotbar(inv);

View file

@ -22,7 +22,7 @@ public class MagicalScrubberMenu extends AbstractContainerMenu
public MagicalScrubberMenu(int id, Inventory inv, FriendlyByteBuf buf) public MagicalScrubberMenu(int id, Inventory inv, FriendlyByteBuf buf)
{ {
this(id, inv, inv.player.level.getBlockEntity(buf.readBlockPos()), new SimpleContainerData(1)); this(id, inv, inv.player.level().getBlockEntity(buf.readBlockPos()), new SimpleContainerData(1));
} }
public MagicalScrubberMenu(int id, Inventory inv, BlockEntity entity, ContainerData data){ public MagicalScrubberMenu(int id, Inventory inv, BlockEntity entity, ContainerData data){
@ -31,7 +31,7 @@ public class MagicalScrubberMenu extends AbstractContainerMenu
checkContainerSize(inv, 1); checkContainerSize(inv, 1);
this.entity = (MagicalScrubberBlockEntity)entity; this.entity = (MagicalScrubberBlockEntity)entity;
this.data=data; this.data=data;
this.level = inv.player.level; this.level = inv.player.level();
addPlayerInventory(inv); addPlayerInventory(inv);
addPlayerHotbar(inv); addPlayerHotbar(inv);

View file

@ -16,7 +16,7 @@ public class VaultWatcher {
@SubscribeEvent @SubscribeEvent
public void onClosedContainer(PlayerContainerEvent.Close ev) public void onClosedContainer(PlayerContainerEvent.Close ev)
{ {
if(ev.getEntity().level.isClientSide)return; if(ev.getEntity().level().isClientSide)return;
//OTEMod.LOGGER.info("Player closed a container"); //OTEMod.LOGGER.info("Player closed a container");
// Player closed the container // Player closed the container
// Check if it is a vault Container // Check if it is a vault Container

View file

@ -5,18 +5,23 @@ 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.client.multiplayer.ClientRegistryLayer;
import net.minecraft.core.registries.Registries; import net.minecraft.core.registries.Registries;
import net.minecraftforge.client.ClientRegistry; import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent;
public class KeyBindings { public class KeyBindings {
public static final String KEY_CATEGORY_OTEMOD = "key.category.otemod"; public static final String KEY_CATEGORY_OTEMOD = "key.category.otemod";
public static final String KEY_OPEN_VAULT = "key.otemod.open_vault"; public static final String KEY_OPEN_VAULT = "key.otemod.open_vault";
public static final KeyMapping OPEN_VAULT = registerKeyMapping(KEY_OPEN_VAULT, InputConstants.KEY_V, KEY_CATEGORY_OTEMOD); public static final KeyMapping OPEN_VAULT = createKeyMapping(KEY_OPEN_VAULT, InputConstants.KEY_V, KEY_CATEGORY_OTEMOD);
private static KeyMapping registerKeyMapping(String name, int keycode, String category){ private static KeyMapping createKeyMapping(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);
return key; return key;
} }
@SubscribeEvent
public static void registerKeyMappings(RegisterKeyMappingsEvent event)
{
event.register(OPEN_VAULT);
}
} }