Merge 1.19 updates with 1.20 codebase
This commit is contained in:
parent
1fbd10471f
commit
0ba1e6e73e
344 changed files with 5441 additions and 2787 deletions
|
@ -17,6 +17,8 @@ import dev.zontreck.libzontreck.profiles.UserProfileNotYetExistsException;
|
|||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import dev.zontreck.libzontreck.vectors.Vector3;
|
||||
import dev.zontreck.otemod.effects.ModEffects;
|
||||
import dev.zontreck.otemod.enchantments.FlightEnchantment;
|
||||
import dev.zontreck.otemod.enchantments.NightVisionEnchantment;
|
||||
import dev.zontreck.otemod.implementation.CreativeModeTabs;
|
||||
import dev.zontreck.otemod.implementation.InventoryBackup;
|
||||
import dev.zontreck.otemod.implementation.Messages;
|
||||
|
@ -126,6 +128,8 @@ public class OTEMod
|
|||
MinecraftForge.EVENT_BUS.register(new VaultWatcher());
|
||||
MinecraftForge.EVENT_BUS.register(new dev.zontreck.otemod.zschem.EventHandler());
|
||||
ModMenuTypes.CONTAINERS.register(bus);
|
||||
MinecraftForge.EVENT_BUS.register(FlightEnchantment.class);
|
||||
MinecraftForge.EVENT_BUS.register(NightVisionEnchantment.class);
|
||||
|
||||
ModBlocks.register(bus);
|
||||
CreativeModeTabs.REGISTER.register(bus);
|
||||
|
|
|
@ -131,6 +131,219 @@ public class ModBlocks {
|
|||
public static final RegistryObject<Item> LIMINAL_WINDOW_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("liminal_window", () -> new BlockItem(LIMINAL_WINDOW.get(), new Item.Properties())));
|
||||
|
||||
|
||||
|
||||
public static final RegistryObject<Block> VOID_BLOCK = BLOCKS.register("void", ()->new Block(BlockBehaviour.Properties.copy(Blocks.OBSIDIAN).lightLevel((X)->{
|
||||
return 15;
|
||||
}).noCollission()));
|
||||
|
||||
public static final RegistryObject<Item> VOID_BLOCK_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("void", ()-> new BlockItem(VOID_BLOCK.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> WHITE = BLOCKS.register("whiteout", ()->new Block(BlockBehaviour.Properties.copy(Blocks.WHITE_WOOL)));
|
||||
|
||||
public static final RegistryObject<Item> WHITE_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("whiteout", ()->new BlockItem(WHITE.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_BLOOD_RED = BLOCKS.register("blood_red", ()->new Block(BlockBehaviour.Properties.copy(Blocks.OBSIDIAN).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_BLOOD_RED_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("blood_red", ()-> new BlockItem(T_BLOOD_RED.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_RED_TILE = BLOCKS.register("red_tile", ()->new Block(BlockBehaviour.Properties.copy(T_BLOOD_RED.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
}).noOcclusion()));
|
||||
|
||||
public static final RegistryObject<Item> T_RED_TILE_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("red_tile", ()->new BlockItem(T_RED_TILE.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_RED_STAIRS = BLOCKS.register("red_stairs", ()->new StairBlock(T_BLOOD_RED.get()::defaultBlockState, BlockBehaviour.Properties.copy(T_BLOOD_RED.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_RED_STAIRS_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("red_stairs", ()->new BlockItem(T_RED_STAIRS.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_RED_TILE_TRANSITON_BR = BLOCKS.register("red_tile_br", ()->new RotatableBlock(BlockBehaviour.Properties.copy(T_BLOOD_RED.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_RED_TILE_TRANSITION_BR_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("red_tile_br", ()->new BlockItem(T_RED_TILE_TRANSITON_BR.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_RED_TILE_WALL = BLOCKS.register("red_tile_to_wall", ()->new Block(BlockBehaviour.Properties.copy(T_RED_TILE.get())));
|
||||
|
||||
public static final RegistryObject<Item> T_RED_TILE_WALL_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("red_tile_to_wall", ()->new BlockItem(T_RED_TILE_WALL.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_RED_WALL = BLOCKS.register("red_wall_variant_1", ()->new Block(BlockBehaviour.Properties.copy(T_RED_TILE.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_RED_WALL_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("red_wall_variant_1", ()->new BlockItem(T_RED_WALL.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_RED_WALL2 = BLOCKS.register("red_wall_variant_2", ()->new Block(BlockBehaviour.Properties.copy(T_RED_TILE.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_RED_WALL2_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("red_wall_variant_2", ()->new BlockItem(T_RED_WALL2.get(), new Item.Properties())));
|
||||
|
||||
|
||||
public static final RegistryObject<Block> T_CYAN = BLOCKS.register("cyan", ()->new Block(BlockBehaviour.Properties.copy(Blocks.OBSIDIAN).lightLevel((X)->{
|
||||
return 15;
|
||||
}).noOcclusion()));
|
||||
|
||||
public static final RegistryObject<Item> T_CYAN_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("cyan", ()-> new BlockItem(T_CYAN.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_CYAN_TILE = BLOCKS.register("cyan_tile", ()->new Block(BlockBehaviour.Properties.copy(T_CYAN.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_CYAN_TILE_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("cyan_tile", ()->new BlockItem(T_CYAN_TILE.get(), new Item.Properties())));
|
||||
|
||||
|
||||
public static final RegistryObject<Block> T_CYAN_STAIRS = BLOCKS.register("cyan_stairs", ()->new StairBlock(T_CYAN.get()::defaultBlockState, BlockBehaviour.Properties.copy(T_CYAN.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_CYAN_STAIRS_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("cyan_stairs", ()->new BlockItem(T_CYAN_STAIRS.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_CYAN_TILE_TRANSITON_BR = BLOCKS.register("cyan_tile_br", ()->new RotatableBlock(BlockBehaviour.Properties.copy(T_CYAN.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_CYAN_TILE_TRANSITION_BR_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("cyan_tile_br", ()->new BlockItem(T_CYAN_TILE_TRANSITON_BR.get(), new Item.Properties())));
|
||||
|
||||
|
||||
public static final RegistryObject<Block> T_CYAN_TILE_WALL = BLOCKS.register("cyan_tile_to_wall", ()->new Block(BlockBehaviour.Properties.copy(T_CYAN_TILE.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_CYAN_TILE_WALL_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("cyan_tile_to_wall", ()->new BlockItem(T_CYAN_TILE_WALL.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_CYAN_WALL = BLOCKS.register("cyan_wall_variant_1", ()->new Block(BlockBehaviour.Properties.copy(T_CYAN_TILE.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_CYAN_WALL_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("cyan_wall_variant_1", ()->new BlockItem(T_CYAN_WALL.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_CYAN_WALL2 = BLOCKS.register("cyan_wall_variant_2", ()->new Block(BlockBehaviour.Properties.copy(T_CYAN_TILE.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_CYAN_WALL2_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("cyan_wall_variant_2", ()->new BlockItem(T_CYAN_WALL2.get(), new Item.Properties())));
|
||||
|
||||
|
||||
|
||||
public static final RegistryObject<Block> T_LIME = BLOCKS.register("lime", ()->new Block(BlockBehaviour.Properties.copy(Blocks.OBSIDIAN).lightLevel((X)->{
|
||||
return 15;
|
||||
}).noOcclusion()));
|
||||
|
||||
public static final RegistryObject<Item> T_LIME_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("lime", ()-> new BlockItem(T_LIME.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_LIME_TILE = BLOCKS.register("lime_tile", ()->new Block(BlockBehaviour.Properties.copy(T_LIME.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_LIME_TILE_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("lime_tile", ()->new BlockItem(T_LIME_TILE.get(), new Item.Properties())));
|
||||
|
||||
|
||||
public static final RegistryObject<Block> T_LIME_STAIRS = BLOCKS.register("lime_stairs", ()->new StairBlock(T_LIME.get()::defaultBlockState, BlockBehaviour.Properties.copy(T_LIME.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_LIME_STAIRS_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("lime_stairs", ()->new BlockItem(T_LIME_STAIRS.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_LIME_TILE_TRANSITON_BR = BLOCKS.register("lime_tile_br", ()->new RotatableBlock(BlockBehaviour.Properties.copy(T_LIME.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_LIME_TILE_TRANSITION_BR_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("lime_tile_br", ()->new BlockItem(T_LIME_TILE_TRANSITON_BR.get(), new Item.Properties())));
|
||||
|
||||
|
||||
public static final RegistryObject<Block> T_LIME_TILE_WALL = BLOCKS.register("lime_tile_to_wall", ()->new Block(BlockBehaviour.Properties.copy(T_LIME_TILE.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_LIME_TILE_WALL_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("lime_tile_to_wall", ()->new BlockItem(T_LIME_TILE_WALL.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_LIME_WALL = BLOCKS.register("lime_wall_variant_1", ()->new Block(BlockBehaviour.Properties.copy(T_LIME_TILE.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_LIME_WALL_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("lime_wall_variant_1", ()->new BlockItem(T_LIME_WALL.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_LIME_WALL2 = BLOCKS.register("lime_wall_variant_2", ()->new Block(BlockBehaviour.Properties.copy(T_LIME_TILE.get()).lightLevel((X)->{
|
||||
return 15;
|
||||
})));
|
||||
|
||||
public static final RegistryObject<Item> T_LIME_WALL2_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("lime_wall_variant_2", ()->new BlockItem(T_LIME_WALL2.get(), new Item.Properties())));
|
||||
|
||||
|
||||
public static final RegistryObject<Block> T_POOL_TILE = BLOCKS.register("pool_tile", ()->new Block(BlockBehaviour.Properties.copy(Blocks.COBBLESTONE)));
|
||||
public static final RegistryObject<Item> T_POOL_TILE_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("pool_tile", ()->new BlockItem(T_POOL_TILE.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_POOL_TILE_STAIRS = BLOCKS.register("pool_tile_stairs", ()->new StairBlock(T_POOL_TILE.get()::defaultBlockState, BlockBehaviour.Properties.copy(Blocks.COBBLESTONE)));
|
||||
public static final RegistryObject<Item> T_POOL_TILE_STAIRS_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("pool_tile_stairs", ()->new BlockItem(T_POOL_TILE_STAIRS.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_POOL_LIGHT = BLOCKS.register("pool_light", ()->new Block(BlockBehaviour.Properties.copy(Blocks.STONE).lightLevel((X)->15).sound(SoundType.GLASS)));
|
||||
public static final RegistryObject<Item> T_POOL_LIGHT_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("pool_light", ()->new BlockItem(T_POOL_LIGHT.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_DIRTY_POOL_TILE = BLOCKS.register("dirty_pool_tile", ()->new Block(BlockBehaviour.Properties.copy(Blocks.COBBLESTONE)));
|
||||
public static final RegistryObject<Item> T_DIRTY_POOL_TILE_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("dirty_pool_tile", ()-> new BlockItem(T_DIRTY_POOL_TILE.get(), new Item.Properties())));
|
||||
|
||||
|
||||
public static final RegistryObject<Block> T_DIRTY_POOL_TILE_STAIRS = BLOCKS.register("dirty_pool_tile_stairs", ()->new StairBlock(T_DIRTY_POOL_TILE.get()::defaultBlockState, BlockBehaviour.Properties.copy(Blocks.COBBLESTONE)));
|
||||
public static final RegistryObject<Item> T_DIRTY_POOL_TILE_STAIRS_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("dirty_pool_tile_stairs", ()->new BlockItem(T_DIRTY_POOL_TILE_STAIRS.get(), new Item.Properties())));
|
||||
|
||||
|
||||
public static final RegistryObject<Block> T_DIRTY_POOL_LIGHT = BLOCKS.register("dirty_pool_light", ()->new Block(BlockBehaviour.Properties.copy(Blocks.STONE).lightLevel((X)->15).sound(SoundType.GLASS)));
|
||||
public static final RegistryObject<Item> T_DIRTY_POOL_LIGHT_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("dirty_pool_light", ()->new BlockItem(T_DIRTY_POOL_LIGHT.get(), new Item.Properties())));
|
||||
public static final RegistryObject<Block> T_FILTHY_POOL_LIGHT = BLOCKS.register("filthy_pool_light", ()->new Block(BlockBehaviour.Properties.copy(Blocks.STONE).lightLevel((X)->8).sound(SoundType.GLASS)));
|
||||
public static final RegistryObject<Item> T_FILTHY_POOL_LIGHT_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("filthy_pool_light", ()->new BlockItem(T_FILTHY_POOL_LIGHT.get(), new Item.Properties())));
|
||||
|
||||
|
||||
public static final RegistryObject<Block> T_DARK_POOL_TILE = BLOCKS.register("dark_pool_tile", ()->new Block(BlockBehaviour.Properties.copy(Blocks.COBBLESTONE)));
|
||||
public static final RegistryObject<Item> T_DARK_POOL_TILE_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("dark_pool_tile", ()->new BlockItem(T_DARK_POOL_TILE.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_DARK_POOL_LIGHT = BLOCKS.register("dark_pool_light", ()->new Block(BlockBehaviour.Properties.copy(Blocks.STONE).lightLevel((X)->15).sound(SoundType.GLASS)));
|
||||
public static final RegistryObject<Item> T_DARK_POOL_LIGHT_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("dark_pool_light", ()->new BlockItem(T_DARK_POOL_LIGHT.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_DARK_POOL_TILE_STAIRS = BLOCKS.register("dark_pool_tile_stairs", ()->new StairBlock(T_DARK_POOL_TILE.get()::defaultBlockState, BlockBehaviour.Properties.copy(Blocks.COBBLESTONE)));
|
||||
public static final RegistryObject<Item> T_DARK_POOL_TILE_STAIRS_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("dark_pool_tile_stairs", ()->new BlockItem(T_DARK_POOL_TILE_STAIRS.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_BLUE_POOL_TILE = BLOCKS.register("blue_pool_tile", ()->new Block(BlockBehaviour.Properties.copy(Blocks.COBBLESTONE)));
|
||||
public static final RegistryObject<Item> T_BLUE_POOL_TILE_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("blue_pool_tile", ()->new BlockItem(T_BLUE_POOL_TILE.get(), new Item.Properties())));
|
||||
public static final RegistryObject<Block> T_BLUE_POOL_TILE_STAIRS = BLOCKS.register("blue_pool_tile_stairs", ()->new StairBlock(T_BLUE_POOL_TILE.get()::defaultBlockState, BlockBehaviour.Properties.copy(Blocks.COBBLESTONE)));
|
||||
public static final RegistryObject<Item> T_BLUE_POOL_TILE_STAIRS_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("blue_pool_tile_stairs", ()->new BlockItem(T_BLUE_POOL_TILE_STAIRS.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_BLUE_POOL_LIGHT = BLOCKS.register("blue_pool_light", ()->new Block(BlockBehaviour.Properties.copy(Blocks.STONE).lightLevel((X)->15).sound(SoundType.GLASS)));
|
||||
public static final RegistryObject<Item> T_BLUE_POOL_LIGHT_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("blue_pool_light", ()->new BlockItem(T_BLUE_POOL_LIGHT.get(), new Item.Properties())));
|
||||
|
||||
|
||||
public static final RegistryObject<Block> T_RED_POOL_TILE = BLOCKS.register("red_pool_tile", ()->new Block(BlockBehaviour.Properties.copy(Blocks.COBBLESTONE)));
|
||||
public static final RegistryObject<Item> T_RED_POOL_TILE_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("red_pool_tile", ()->new BlockItem(T_RED_POOL_TILE.get(), new Item.Properties())));
|
||||
public static final RegistryObject<Block> T_RED_POOL_TILE_STAIRS = BLOCKS.register("red_pool_tile_stairs", ()->new StairBlock(T_RED_POOL_TILE.get()::defaultBlockState, BlockBehaviour.Properties.copy(Blocks.COBBLESTONE)));
|
||||
public static final RegistryObject<Item> T_RED_POOL_TILE_STAIRS_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("red_pool_tile_stairs", ()->new BlockItem(T_RED_POOL_TILE_STAIRS.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_RED_POOL_LIGHT = BLOCKS.register("red_pool_light", ()->new Block(BlockBehaviour.Properties.copy(Blocks.STONE).lightLevel((X)->15).sound(SoundType.GLASS)));
|
||||
public static final RegistryObject<Item> T_RED_POOL_LIGHT_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("red_pool_light", ()->new BlockItem(T_RED_POOL_LIGHT.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_DIRTY_RED_POOL_TILE = BLOCKS.register("dirty_red_pool_tile", ()->new Block(BlockBehaviour.Properties.copy(Blocks.COBBLESTONE)));
|
||||
public static final RegistryObject<Item> T_DIRTY_RED_POOL_TILE_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("dirty_red_pool_tile", ()->new BlockItem(T_DIRTY_RED_POOL_TILE.get(), new Item.Properties())));
|
||||
public static final RegistryObject<Block> T_DIRTY_RED_POOL_TILE_STAIRS = BLOCKS.register("dirty_red_pool_tile_stairs", ()->new StairBlock(T_DIRTY_RED_POOL_TILE.get()::defaultBlockState, BlockBehaviour.Properties.copy(Blocks.COBBLESTONE)));
|
||||
public static final RegistryObject<Item> T_DIRTY_RED_POOL_TILE_STAIRS_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("dirty_red_pool_tile_stairs", ()->new BlockItem(T_DIRTY_RED_POOL_TILE_STAIRS.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_DIRTY_RED_POOL_LIGHT = BLOCKS.register("dirty_red_pool_light", ()->new Block(BlockBehaviour.Properties.copy(Blocks.STONE).lightLevel((X)->15).sound(SoundType.GLASS)));
|
||||
public static final RegistryObject<Item> T_DIRTY_RED_POOL_LIGHT_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("dirty_red_pool_light", ()->new BlockItem(T_DIRTY_RED_POOL_LIGHT.get(), new Item.Properties())));
|
||||
public static final RegistryObject<Block> T_FILTHY_RED_POOL_LIGHT = BLOCKS.register("filthy_red_pool_light", ()->new Block(BlockBehaviour.Properties.copy(Blocks.STONE).lightLevel((X)->8).sound(SoundType.GLASS)));
|
||||
public static final RegistryObject<Item> T_FILTHY_RED_POOL_LIGHT_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("filthy_red_pool_light", ()->new BlockItem(T_FILTHY_RED_POOL_LIGHT.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_DIRTY_BLUE_POOL_TILE = BLOCKS.register("dirty_blue_pool_tile", ()->new Block(BlockBehaviour.Properties.copy(Blocks.COBBLESTONE)));
|
||||
public static final RegistryObject<Item> T_DIRTY_BLUE_POOL_TILE_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("dirty_blue_pool_tile", ()->new BlockItem(T_DIRTY_BLUE_POOL_TILE.get(), new Item.Properties())));
|
||||
public static final RegistryObject<Block> T_DIRTY_BLUE_POOL_TILE_STAIRS = BLOCKS.register("dirty_blue_pool_tile_stairs", ()->new StairBlock(T_DIRTY_BLUE_POOL_TILE.get()::defaultBlockState, BlockBehaviour.Properties.copy(Blocks.COBBLESTONE)));
|
||||
public static final RegistryObject<Item> T_DIRTY_BLUE_POOL_TILE_STAIRS_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("dirty_blue_pool_tile_stairs", ()->new BlockItem(T_DIRTY_BLUE_POOL_TILE_STAIRS.get(), new Item.Properties())));
|
||||
|
||||
public static final RegistryObject<Block> T_DIRTY_BLUE_POOL_LIGHT = BLOCKS.register("dirty_blue_pool_light", ()->new Block(BlockBehaviour.Properties.copy(Blocks.STONE).lightLevel((X)->15).sound(SoundType.GLASS)));
|
||||
public static final RegistryObject<Item> T_DIRTY_BLUE_POOL_LIGHT_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("dirty_blue_pool_light", ()->new BlockItem(T_DIRTY_BLUE_POOL_LIGHT.get(), new Item.Properties())));
|
||||
public static final RegistryObject<Block> T_FILTHY_BLUE_POOL_LIGHT = BLOCKS.register("filthy_blue_pool_light", ()->new Block(BlockBehaviour.Properties.copy(Blocks.STONE).lightLevel((X)->8).sound(SoundType.GLASS)));
|
||||
public static final RegistryObject<Item> T_FILTHY_BLUE_POOL_LIGHT_I = CreativeModeTabs.addToOTEModTab(ITEMS.register("filthy_blue_pool_light", ()->new BlockItem(T_FILTHY_BLUE_POOL_LIGHT.get(), new Item.Properties())));
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
|
26
src/main/java/dev/zontreck/otemod/blocks/RotatableBlock.java
Normal file
26
src/main/java/dev/zontreck/otemod/blocks/RotatableBlock.java
Normal file
|
@ -0,0 +1,26 @@
|
|||
package dev.zontreck.otemod.blocks;
|
||||
|
||||
import net.minecraft.world.item.context.BlockPlaceContext;
|
||||
import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.HorizontalDirectionalBlock;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.block.state.StateDefinition;
|
||||
|
||||
public class RotatableBlock extends HorizontalDirectionalBlock
|
||||
{
|
||||
protected RotatableBlock(Properties pProperties) {
|
||||
super(pProperties);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> pBuilder) {
|
||||
super.createBlockStateDefinition(pBuilder);
|
||||
pBuilder.add(FACING);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public BlockState getStateForPlacement(BlockPlaceContext pContext) {
|
||||
return defaultBlockState().setValue(FACING, pContext.getHorizontalDirection());
|
||||
}
|
||||
}
|
12
src/main/java/dev/zontreck/otemod/blocks/VoidBlock.java
Normal file
12
src/main/java/dev/zontreck/otemod/blocks/VoidBlock.java
Normal file
|
@ -0,0 +1,12 @@
|
|||
package dev.zontreck.otemod.blocks;
|
||||
|
||||
import net.minecraft.world.level.block.Block;
|
||||
|
||||
public class VoidBlock extends Block
|
||||
{
|
||||
public VoidBlock(Properties pProperties) {
|
||||
super(pProperties);
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package dev.zontreck.otemod.blocks.entity;
|
||||
|
||||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import dev.zontreck.otemod.implementation.OutputItemStackHandler;
|
||||
import dev.zontreck.otemod.implementation.compressor.CompressionChamberMenu;
|
||||
import dev.zontreck.otemod.implementation.energy.OTEEnergy;
|
||||
|
@ -109,7 +110,7 @@ public class CompressionChamberBlockEntity extends BlockEntity implements MenuPr
|
|||
|
||||
@Override
|
||||
public Component getDisplayName() {
|
||||
return Component.literal("Compression Chamber");
|
||||
return ChatHelpers.macro("Compression Chamber");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -48,11 +48,23 @@ public class ChatServerOverride {
|
|||
ItemStack feet = play.getItemBySlot(EquipmentSlot.FEET);
|
||||
if(ItemUtils.getEnchantmentLevel(ModEnchantments.FLIGHT_ENCHANTMENT.get(), feet)>0)mayFly = true;
|
||||
|
||||
playerAbilities.mayfly=mayFly;
|
||||
PlayerFlyCache c = PlayerFlyCache.cachePlayer(play);
|
||||
c.Flying=prof.flying;
|
||||
c.FlyEnabled = mayFly;
|
||||
c.Assert(play);
|
||||
if(play.gameMode.isCreative())
|
||||
{
|
||||
// Skip all this!
|
||||
playerAbilities.mayfly=true;
|
||||
playerAbilities.flying=true;
|
||||
|
||||
play.onUpdateAbilities();
|
||||
}else{
|
||||
|
||||
playerAbilities.mayfly=mayFly;
|
||||
PlayerFlyCache c = PlayerFlyCache.cachePlayer(play);
|
||||
c.Flying=prof.flying;
|
||||
c.FlyEnabled = mayFly;
|
||||
c.Assert(play);
|
||||
}
|
||||
|
||||
|
||||
|
||||
if(StarterProvider.exists())
|
||||
OTEMod.checkFirstJoin(ev.player);
|
||||
|
@ -126,7 +138,7 @@ public class ChatServerOverride {
|
|||
hover=hover.withFont(Style.DEFAULT_FONT).withHoverEvent(HoverTip.get(ChatColor.MINECOIN_GOLD+"User Name: "+XD.username));
|
||||
ev.setCanceled(true);
|
||||
|
||||
ChatHelpers.broadcast(Component.literal(prefixStr + nameStr + message).setStyle(hover), ev.getPlayer().server);
|
||||
ChatHelpers.broadcast(ChatHelpers.macro(prefixStr + nameStr + message).setStyle(hover), ev.getPlayer().server);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,165 @@
|
|||
package dev.zontreck.otemod.enchantments;
|
||||
|
||||
import dev.zontreck.libzontreck.util.ItemUtils;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraft.sounds.SoundEvents;
|
||||
import net.minecraft.sounds.SoundSource;
|
||||
import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.damagesource.DamageSource;
|
||||
import net.minecraft.world.entity.EquipmentSlot;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.SwordItem;
|
||||
import net.minecraft.world.item.enchantment.Enchantment;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentCategory;
|
||||
import net.minecraft.world.item.enchantment.EnchantmentHelper;
|
||||
import net.minecraft.world.item.enchantment.MendingEnchantment;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class ConsumptionMending extends Enchantment
|
||||
{
|
||||
protected ConsumptionMending(EquipmentSlot... slots) {
|
||||
super(Rarity.RARE, EnchantmentCategory.BREAKABLE, slots);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxLevel() {
|
||||
return 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTradeable() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isTreasureOnly() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isCurse() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMinCost(int pLevel) {
|
||||
return 25 + (pLevel-1);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxCost(int pLevel) {
|
||||
return pLevel * 23;
|
||||
}
|
||||
|
||||
private static List<ItemStack> append(ServerPlayer player, List<ItemStack> items)
|
||||
{
|
||||
List<ItemStack> enchanted = new ArrayList<>();
|
||||
|
||||
for(ItemStack stack : player.getInventory().items)
|
||||
{
|
||||
if(ItemUtils.getEnchantmentLevel(ModEnchantments.CONSUMPTION_MENDING.get(), stack) > 0)
|
||||
{
|
||||
enchanted.add(stack);
|
||||
}
|
||||
}
|
||||
|
||||
return enchanted;
|
||||
}
|
||||
|
||||
public static void onEntityTick(ServerPlayer player)
|
||||
{
|
||||
// Check what items have this enchantment
|
||||
// If any, check for like-items that lack the enchant.
|
||||
|
||||
List<ItemStack> enchanted = new ArrayList<>();
|
||||
enchanted.addAll(append(player, player.getInventory().items));
|
||||
enchanted.addAll(append(player, player.getInventory().armor));
|
||||
|
||||
List<ItemStack> procList = new ArrayList<>();
|
||||
procList.addAll(append(player, player.getInventory().offhand));
|
||||
procList.addAll(append(player, player.getInventory().items));
|
||||
|
||||
for(ItemStack stack : enchanted)
|
||||
{
|
||||
for(ItemStack item : player.getInventory().items)
|
||||
{
|
||||
// Is this a like item, and does it have the enchant?
|
||||
boolean eligible = false;
|
||||
if(!(ItemUtils.getEnchantmentLevel(ModEnchantments.CONSUMPTION_MENDING.get(), item)>0))
|
||||
{
|
||||
eligible=true;
|
||||
if(!item.isDamageableItem())
|
||||
{
|
||||
eligible=false;
|
||||
}
|
||||
}
|
||||
|
||||
if(stack.getDamageValue()==0)
|
||||
{
|
||||
eligible=false;
|
||||
}
|
||||
|
||||
if(eligible)
|
||||
{
|
||||
// Let's eat
|
||||
int iDamage = stack.getDamageValue();
|
||||
int iMax = stack.getMaxDamage();
|
||||
|
||||
int iNeeds = iDamage * 2;
|
||||
|
||||
// The stack we are inspecting:
|
||||
int nDamage = item.getDamageValue();
|
||||
int nMax = item.getMaxDamage();
|
||||
|
||||
int iRemain = nMax - nDamage;
|
||||
|
||||
if(iRemain == iNeeds)
|
||||
{
|
||||
nDamage = nMax;
|
||||
iDamage=0;
|
||||
} else {
|
||||
if(iRemain > iNeeds)
|
||||
{
|
||||
iDamage -= iNeeds;
|
||||
nDamage += iNeeds;
|
||||
} else {
|
||||
iDamage -= iRemain;
|
||||
nDamage = nMax;
|
||||
}
|
||||
}
|
||||
|
||||
if(nDamage == nMax){
|
||||
// Check for curses on the item
|
||||
if(item.isEnchanted())
|
||||
{
|
||||
Map<Enchantment, Integer> enchantments = ItemUtils.getEnchantments(item);
|
||||
for(Map.Entry<Enchantment,Integer> entry : enchantments.entrySet())
|
||||
{
|
||||
Enchantment id = entry.getKey();
|
||||
int dice = player.getRandom().nextInt(0,20);
|
||||
|
||||
if(id.isCurse() && ((dice >= 13) && (dice <= 18)))
|
||||
{
|
||||
stack.enchant(id, entry.getValue());
|
||||
player.serverLevel().playSound(null, player.getOnPos(), SoundEvents.ANVIL_USE, SoundSource.NEUTRAL,1, player.getRandom().nextFloat());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
item.shrink(1);
|
||||
player.serverLevel().playSound(null, player.getOnPos(), SoundEvents.PLAYER_BURP, SoundSource.NEUTRAL,1, player.getRandom().nextFloat());
|
||||
}
|
||||
else item.setDamageValue(nDamage);
|
||||
|
||||
stack.setDamageValue(iDamage);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,39 @@
|
|||
package dev.zontreck.otemod.enchantments;
|
||||
|
||||
import net.minecraft.server.MinecraftServer;
|
||||
import net.minecraft.server.level.ServerPlayer;
|
||||
import net.minecraftforge.event.TickEvent;
|
||||
import net.minecraftforge.event.entity.living.LivingEvent;
|
||||
import net.minecraftforge.eventbus.api.SubscribeEvent;
|
||||
import net.minecraftforge.fml.common.Mod;
|
||||
import net.minecraftforge.server.ServerLifecycleHooks;
|
||||
|
||||
@Mod.EventBusSubscriber
|
||||
public class EnchantmentEvents
|
||||
{
|
||||
private static boolean canTick = false;
|
||||
@SubscribeEvent
|
||||
public static void onServerTick(TickEvent.ServerTickEvent event)
|
||||
{
|
||||
if(event.phase == TickEvent.Phase.START)
|
||||
{
|
||||
MinecraftServer server = ServerLifecycleHooks.getCurrentServer();
|
||||
canTick = server!=null && server.getTickCount()%20==0;
|
||||
}
|
||||
}
|
||||
|
||||
@SubscribeEvent
|
||||
public static void onTick(LivingEvent.LivingTickEvent tick)
|
||||
{
|
||||
if(canTick)
|
||||
{
|
||||
// Process Enchantments
|
||||
|
||||
if(tick.getEntity() instanceof ServerPlayer sp)
|
||||
{
|
||||
FlightEnchantment.runEntityTick(sp);
|
||||
ConsumptionMending.onEntityTick(sp);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,6 +1,7 @@
|
|||
package dev.zontreck.otemod.enchantments;
|
||||
|
||||
import dev.zontreck.libzontreck.util.ItemUtils;
|
||||
import dev.zontreck.libzontreck.util.ServerUtilities;
|
||||
import dev.zontreck.otemod.OTEMod;
|
||||
import dev.zontreck.otemod.configs.OTEServerConfig;
|
||||
import dev.zontreck.otemod.effects.ModEffects;
|
||||
|
@ -28,7 +29,6 @@ import net.minecraftforge.fml.common.Mod;
|
|||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = OTEMod.MOD_ID)
|
||||
public class FlightEnchantment extends Enchantment
|
||||
{
|
||||
|
||||
|
@ -75,10 +75,10 @@ public class FlightEnchantment extends Enchantment
|
|||
|
||||
|
||||
public static AtomicInteger TICKS = new AtomicInteger(0);
|
||||
@SubscribeEvent
|
||||
public static void onEnchantmentTick(TickEvent.PlayerTickEvent event)
|
||||
|
||||
public static void runEntityTick(ServerPlayer sp)
|
||||
{
|
||||
if(event.side == LogicalSide.CLIENT) return;
|
||||
if(ServerUtilities.isClient()) return;
|
||||
|
||||
if(TICKS.getAndIncrement() >= (5*20))
|
||||
{
|
||||
|
@ -91,23 +91,17 @@ public class FlightEnchantment extends Enchantment
|
|||
OTEMod.LOGGER.info("> Flight Enchantment Tick <");
|
||||
}
|
||||
|
||||
if(event.phase == TickEvent.Phase.END)
|
||||
ItemStack feet = sp.getItemBySlot(EquipmentSlot.FEET);
|
||||
|
||||
boolean hasFlight = false;
|
||||
|
||||
if(ItemUtils.getEnchantmentLevel(ModEnchantments.FLIGHT_ENCHANTMENT.get(), feet)>0)hasFlight=true;
|
||||
|
||||
if(hasFlight)
|
||||
{
|
||||
MobEffectInstance inst = new MobEffectInstance(ModEffects.FLIGHT.get(), -1, 0, false, false, true);
|
||||
|
||||
ServerPlayer sp = (ServerPlayer) event.player;
|
||||
|
||||
ItemStack feet = sp.getItemBySlot(EquipmentSlot.FEET);
|
||||
|
||||
boolean hasFlight = false;
|
||||
|
||||
if(ItemUtils.getEnchantmentLevel(ModEnchantments.FLIGHT_ENCHANTMENT.get(), feet)>0)hasFlight=true;
|
||||
|
||||
if(hasFlight)
|
||||
{
|
||||
MobEffectInstance inst = new MobEffectInstance(ModEffects.FLIGHT.get(), -1, 0, false, false, true);
|
||||
|
||||
event.player.addEffect(inst);
|
||||
}
|
||||
sp.addEffect(inst);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -20,6 +20,11 @@ public class ModEnchantments {
|
|||
|
||||
public static final RegistryObject<Enchantment> BORROWED_PROTECTION = REGISTERS.register("borrowed_protection", ()->new BorrowedProtectionEnchantment(Enchantment.Rarity.UNCOMMON, EnchantmentCategory.ARMOR, ARMOR_SLOTS));
|
||||
|
||||
|
||||
public static final RegistryObject<Enchantment> CONSUMPTION_MENDING = REGISTERS.register("consumption_mending", ()->new ConsumptionMending(EquipmentSlot.HEAD, EquipmentSlot.CHEST, EquipmentSlot.FEET, EquipmentSlot.LEGS, EquipmentSlot.MAINHAND, EquipmentSlot.OFFHAND));
|
||||
|
||||
|
||||
|
||||
public static final RegistryObject<Enchantment> NIGHT_VISION_ENCHANT = REGISTERS.register("night_vision", ()->new NightVisionEnchantment(EquipmentSlot.HEAD));
|
||||
|
||||
public static void register(IEventBus bus){
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
package dev.zontreck.otemod.enchantments;
|
||||
|
||||
import dev.zontreck.libzontreck.util.ItemUtils;
|
||||
import dev.zontreck.libzontreck.util.ServerUtilities;
|
||||
import dev.zontreck.otemod.OTEMod;
|
||||
import dev.zontreck.otemod.configs.OTEServerConfig;
|
||||
import dev.zontreck.otemod.effects.ModEffects;
|
||||
|
@ -19,7 +20,6 @@ import net.minecraftforge.fml.common.Mod;
|
|||
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
|
||||
@Mod.EventBusSubscriber(modid = OTEMod.MOD_ID)
|
||||
public class NightVisionEnchantment extends Enchantment
|
||||
{
|
||||
|
||||
|
@ -53,10 +53,10 @@ public class NightVisionEnchantment extends Enchantment
|
|||
}
|
||||
|
||||
public static AtomicInteger TICKS = new AtomicInteger(0);
|
||||
@SubscribeEvent
|
||||
public static void onEnchantmentTick(TickEvent.PlayerTickEvent event)
|
||||
|
||||
public static void runEntityTick(ServerPlayer sp)
|
||||
{
|
||||
if(event.side == LogicalSide.CLIENT) return;
|
||||
if(ServerUtilities.isClient()) return;
|
||||
|
||||
if(TICKS.getAndIncrement() >= (2*20))
|
||||
{
|
||||
|
@ -69,23 +69,18 @@ public class NightVisionEnchantment extends Enchantment
|
|||
OTEMod.LOGGER.info("> NVision Enchantment Tick <");
|
||||
}
|
||||
|
||||
if(event.phase == TickEvent.Phase.END)
|
||||
|
||||
ItemStack feet = sp.getItemBySlot(EquipmentSlot.HEAD);
|
||||
|
||||
boolean hasNV = false;
|
||||
|
||||
if(ItemUtils.getEnchantmentLevel(ModEnchantments.NIGHT_VISION_ENCHANT.get(), feet)>0)hasNV=true;
|
||||
|
||||
if(hasNV)
|
||||
{
|
||||
MobEffectInstance inst = new MobEffectInstance(MobEffects.NIGHT_VISION, 60*20, 4, false, false, true);
|
||||
|
||||
ServerPlayer sp = (ServerPlayer) event.player;
|
||||
|
||||
ItemStack feet = sp.getItemBySlot(EquipmentSlot.HEAD);
|
||||
|
||||
boolean hasNV = false;
|
||||
|
||||
if(ItemUtils.getEnchantmentLevel(ModEnchantments.NIGHT_VISION_ENCHANT.get(), feet)>0)hasNV=true;
|
||||
|
||||
if(hasNV)
|
||||
{
|
||||
MobEffectInstance inst = new MobEffectInstance(MobEffects.NIGHT_VISION, 60*20, 4, false, false, true);
|
||||
|
||||
event.player.addEffect(inst);
|
||||
}
|
||||
sp.addEffect(inst);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ public class PossBallItem extends Item
|
|||
}
|
||||
@Override
|
||||
public boolean isFoil(ItemStack pStack) {
|
||||
if(!pStack.hasTag())
|
||||
if(!pStack.hasTag() || pStack.getTag()==null)
|
||||
{
|
||||
pStack.setTag(new CompoundTag());
|
||||
}
|
||||
|
@ -31,26 +31,20 @@ public class PossBallItem extends Item
|
|||
} else return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDamageable(ItemStack stack) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getMaxDamage(ItemStack stack) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
@Override
|
||||
public InteractionResultHolder<ItemStack> use(Level pLevel, Player pPlayer, InteractionHand pUsedHand) {
|
||||
ItemStack stack = pPlayer.getItemInHand(pUsedHand);
|
||||
pLevel.playSound((Player) null, pPlayer.getX(), pPlayer.getY(), pPlayer.getZ(), SoundEvents.EGG_THROW, SoundSource.PLAYERS, 0.5F, 0.4F / (pLevel.random.nextFloat() * 0.4f + 0.8f));
|
||||
if(!pLevel.isClientSide)
|
||||
{
|
||||
ThrownPossBall TPB = new ThrownPossBall(pLevel, pPlayer);
|
||||
if(pPlayer.getAbilities().instabuild) TPB.setItem(stack.copy());
|
||||
else
|
||||
TPB.setItem(stack);
|
||||
ItemStack single = stack.copy();
|
||||
single.setCount(1);
|
||||
|
||||
stack.shrink(1);
|
||||
|
||||
ThrownPossBall TPB = new ThrownPossBall(pLevel, pPlayer, single);
|
||||
|
||||
|
||||
TPB.shootFromRotation(pPlayer, pPlayer.getXRot(), pPlayer.getYRot(), 0.0F, 1.5F, 1.0F);
|
||||
pLevel.addFreshEntity(TPB);
|
||||
}
|
||||
|
|
|
@ -5,6 +5,7 @@ import dev.zontreck.libzontreck.lore.ExtraLore;
|
|||
import dev.zontreck.libzontreck.lore.LoreContainer;
|
||||
import dev.zontreck.libzontreck.lore.LoreEntry;
|
||||
import dev.zontreck.libzontreck.util.ChatHelpers;
|
||||
import dev.zontreck.libzontreck.util.ServerUtilities;
|
||||
import net.minecraft.core.particles.ItemParticleOption;
|
||||
import net.minecraft.core.particles.ParticleTypes;
|
||||
import net.minecraft.nbt.CompoundTag;
|
||||
|
@ -31,20 +32,22 @@ public class ThrownPossBall extends ThrowableItemProjectile
|
|||
{
|
||||
boolean captured = false;
|
||||
LivingEntity shooter;
|
||||
ItemStack self;
|
||||
|
||||
public ThrownPossBall(EntityType<? extends ThrownPossBall> entity, Level level)
|
||||
{
|
||||
super(entity, level);
|
||||
}
|
||||
public ThrownPossBall(Level level, LivingEntity shooter)
|
||||
public ThrownPossBall(Level level, LivingEntity shooter, ItemStack item)
|
||||
{
|
||||
super(EntityType.SNOWBALL, shooter, level);
|
||||
|
||||
this.shooter = shooter;
|
||||
}
|
||||
|
||||
public ThrownPossBall(Level pLevel, double pX, double pY, double pZ)
|
||||
{
|
||||
super(EntityType.SNOWBALL, pX, pY, pZ, pLevel);
|
||||
if(item.getTag() == null)
|
||||
{
|
||||
item.setTag(new CompoundTag());
|
||||
}
|
||||
self=item;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,6 +56,18 @@ public class ThrownPossBall extends ThrowableItemProjectile
|
|||
return ModItems.POSS_BALL.get();
|
||||
}
|
||||
|
||||
void returnBall()
|
||||
{
|
||||
|
||||
ItemEntity x;
|
||||
|
||||
if(shooter!=null)
|
||||
x = new ItemEntity(level(), shooter.position().x, shooter.position().y, shooter.position().z, self, 0, 0, 0);
|
||||
else
|
||||
x = new ItemEntity(level(), position().x, position().y, position().z, self, 0, 0, 0);
|
||||
level().addFreshEntity(x);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void handleEntityEvent(byte pId) {
|
||||
if(pId == 3)
|
||||
|
@ -69,31 +84,52 @@ public class ThrownPossBall extends ThrowableItemProjectile
|
|||
@Override
|
||||
protected void onHitEntity(EntityHitResult pResult) {
|
||||
super.onHitEntity(pResult);
|
||||
if(getItem().getTag().contains("entity"))
|
||||
if(ServerUtilities.isServer())
|
||||
{
|
||||
// Don't capture the entity
|
||||
|
||||
pResult.getEntity().hurt(this.damageSources().thrown(this, this.getOwner()), 0.1F);
|
||||
} else {
|
||||
if(pResult.getEntity() instanceof LivingEntity le && !(le instanceof Player))
|
||||
CompoundTag tag = self.getTag();
|
||||
if(tag == null)tag = new CompoundTag();
|
||||
if(tag.contains(ItemStack.TAG_DAMAGE))
|
||||
{
|
||||
// We don't want to capture players
|
||||
// Store the entity in the entity tag, then kill the entity
|
||||
CompoundTag tag = new CompoundTag();
|
||||
String entityName = le.getName().getString();
|
||||
le.save(tag);
|
||||
tag.remove(ItemStack.TAG_DAMAGE);
|
||||
}
|
||||
|
||||
getItem().getTag().put("entity", tag);
|
||||
captured=true;
|
||||
|
||||
LoreContainer cont = new LoreContainer(getItem());
|
||||
cont.miscData.loreData.clear();
|
||||
LoreEntry entry = new LoreEntry.Builder().bold(true).text(ChatColor.doColors("!Dark_Green!Captured Mob: !Dark_Purple!" + entityName)).build();
|
||||
cont.miscData.loreData.add(entry);
|
||||
if(self.getTag() == null || !self.getTag().contains("entity"))
|
||||
{
|
||||
/*
|
||||
|
||||
cont.commitLore();
|
||||
Ensure the tag is not null
|
||||
|
||||
le.remove(RemovalReason.DISCARDED);
|
||||
*/
|
||||
|
||||
if(pResult.getEntity() instanceof LivingEntity le && !(le instanceof Player player))
|
||||
{
|
||||
// We don't want to capture players
|
||||
// Store the entity in the entity tag, then kill the entity
|
||||
|
||||
|
||||
CompoundTag store = new CompoundTag();
|
||||
String entityName = le.getName().getString();
|
||||
le.save(store);
|
||||
|
||||
self.getTag().put("entity", store);
|
||||
self.setCount(1);
|
||||
captured=true;
|
||||
|
||||
LoreContainer cont = new LoreContainer(self);
|
||||
cont.miscData.loreData.clear();
|
||||
LoreEntry entry = new LoreEntry.Builder().bold(true).text(ChatColor.doColors("!Dark_Green!Captured Mob: !Dark_Purple!" + entityName)).build();
|
||||
cont.miscData.loreData.add(entry);
|
||||
|
||||
cont.commitLore();
|
||||
|
||||
le.remove(RemovalReason.DISCARDED);
|
||||
}
|
||||
} else {
|
||||
|
||||
// Don't capture the entity
|
||||
|
||||
//pResult.getEntity().hurt(this.shooter.getLastDamageSource().thrown(this, this.getOwner()), 0.1F);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -101,7 +137,8 @@ public class ThrownPossBall extends ThrowableItemProjectile
|
|||
@Override
|
||||
protected void onHit(HitResult pResult) {
|
||||
super.onHit(pResult);
|
||||
if(!this.level().isClientSide)
|
||||
|
||||
if(ServerUtilities.isServer())
|
||||
{
|
||||
// We do two things here
|
||||
|
||||
|
@ -109,19 +146,22 @@ public class ThrownPossBall extends ThrowableItemProjectile
|
|||
// 2. If no entity, and none was captured, decrease the durability a little
|
||||
// 3. Drop the PossBall with entity, or without
|
||||
|
||||
ItemStack item = getItem();
|
||||
ItemStack item = self;
|
||||
CompoundTag tag = item.getTag();
|
||||
|
||||
if(tag==null)tag=new CompoundTag();
|
||||
|
||||
if(tag.contains(ItemStack.TAG_DAMAGE))
|
||||
{
|
||||
tag.remove(ItemStack.TAG_DAMAGE); // Migrate existing poss balls to remove the obsolete damage tag
|
||||
}
|
||||
|
||||
if(tag.contains("entity"))
|
||||
{
|
||||
if(captured)
|
||||
{
|
||||
// Spawn poss ball item with the entity NBT
|
||||
ItemEntity entity;
|
||||
if(shooter != null)
|
||||
entity = new ItemEntity(level(), shooter.position().x, shooter.position().y, shooter.position().z, item, 0, 0, 0);
|
||||
else
|
||||
entity = new ItemEntity(level(), shooter.position().x, shooter.position().y, shooter.position().z, item, 0, 0, 0);
|
||||
level().addFreshEntity(entity);
|
||||
returnBall();
|
||||
} else {
|
||||
// Spawn the real entity
|
||||
Optional<Entity> entity = EntityType.create(tag.getCompound("entity"), level());
|
||||
|
@ -144,13 +184,8 @@ public class ThrownPossBall extends ThrowableItemProjectile
|
|||
tag.remove("entity");
|
||||
}
|
||||
|
||||
ItemEntity x;
|
||||
|
||||
if(shooter!=null)
|
||||
x = new ItemEntity(level(), shooter.position().x, shooter.position().y, shooter.position().z, item, 0, 0, 0);
|
||||
else
|
||||
x = new ItemEntity(level(), position().x, position().y, position().z, item, 0, 0, 0);
|
||||
level().addFreshEntity(x);
|
||||
returnBall();
|
||||
}
|
||||
} else {
|
||||
// No capture
|
||||
|
@ -161,18 +196,18 @@ public class ThrownPossBall extends ThrowableItemProjectile
|
|||
// Ensure no entity tag!
|
||||
tag.remove("entity");
|
||||
|
||||
if(tag.size()==0)
|
||||
{
|
||||
tag=null;
|
||||
item.setTag(new CompoundTag());
|
||||
}
|
||||
|
||||
|
||||
//if(item.getDamageValue() >= item.getMaxDamage())
|
||||
// return;
|
||||
|
||||
ItemEntity entity;
|
||||
|
||||
if(shooter!= null)
|
||||
entity = new ItemEntity(level(),shooter.position().x, shooter.position().y, shooter.position().z, item, 0, 0, 0);
|
||||
else
|
||||
|
||||
entity = new ItemEntity(level(), position().x, position().y, position().z, item, 0, 0, 0);
|
||||
level().addFreshEntity(entity);
|
||||
returnBall();
|
||||
}
|
||||
|
||||
this.level().broadcastEntityEvent(this, (byte)3);
|
||||
|
|
Reference in a new issue