Jump to content

Sq3xd

Members
  • Posts

    31
  • Joined

  • Last visited

Converted

  • Gender
    Male

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Sq3xd's Achievements

Tree Puncher

Tree Puncher (2/8)

0

Reputation

  1. My idea was that it will be obtainable by killing mob, and if there's a jar nearby it would be filled with that mob soul
  2. It's like a spawn egg, but you interact with special block and then it will make a copy of entity
  3. I created an SOUL_JAR Item that has been registered for each mob like - mod:soul_jar_minecraft_cow etc.. but it all has different registry names, i have a model file name soul_jar.json and i want to know how to bind each of those items to this class (When mod iterates through all of vanilla mobs and registering items for them). I didn't found any info about it because all of info is outdated, and forge docs is complicated asf (i wish there would be more examples) i also used AI but it showing me only outdated info, but theres some code where i registering my item and trying to bind it to model -> public static void register(IEventBus eventBus){ ITEMS.register(eventBus); Set<ResourceLocation> entityKeyList = ForgeRegistries.ENTITY_TYPES.getKeys(); for (ResourceLocation k : entityKeyList) { EntityType<?> entityType = ForgeRegistries.ENTITY_TYPES.getValue(k); if (!entityType.getCategory().equals(MobCategory.MISC)) { RegistryObject<Item> SOUL_JAR = ITEMS.register("soul_jar" + '_' + k.toString().replace(':', '_').replace('.', '_'), () -> new JarItem(new Item.Properties().rarity(Rarity.RARE).tab(ModTabs.MAGICAL_OBSESSION_JARS), entityType)); if (Thread.currentThread().getThreadGroup() == SidedThreadGroups.CLIENT) { ItemModelShaper itemModelShaper = Minecraft.getInstance().getItemRenderer().getItemModelShaper(); itemModelShaper.register(SOUL_JAR.get().asItem(), new ModelResourceLocation("item.soul_jar", "inventory")); } } } } I also have more questions like how to iterate through all other mods mobs also, or render mob inside of a jar in inventory, but i will try to figure it out.
  4. It's probably a stupid question, but i can't find a way to get list of all entities. I want to register Item for each Mob Entity but i cant find method to get list of all entities, that's why it's a stupid question but maybe someone call tell me where's that method.
  5. I making a pipe that can change it state if other pipe is placed to it, but just setting state value doesn't work. Here's my pipe code -> public class MagicPipeBlockEntity extends BlockEntity { public MagicPipeBlockEntity(BlockPos pos, BlockState state) { super(ModBlockEntities.MAGIC_PIPE.get(), pos, state); } // Tick public static void tick(Level level, BlockPos pos, BlockState state, MagicPipeBlockEntity entity) { if (level.isClientSide){ if (level.getBlockState(pos.above()).is(ModBlocks.MAGIC_PIPE.get())){ entity.getBlockState().setValue(BlockStateProperties.UP, true); state.setValue(BlockStateProperties.UP, true); System.out.println("YES"); } } if (!level.isClientSide) { if (level.getBlockState(pos.above()).is(ModBlocks.MAGIC_PIPE.get())){ entity.getBlockState().setValue(BlockStateProperties.UP, true); } } } } Also MagicPipeBlock code -> public class MagicPipeBlock extends Block implements EntityBlock { public static final BooleanProperty UP = BlockStateProperties.UP; public static final BooleanProperty DOWN = BlockStateProperties.DOWN; public static final BooleanProperty NORTH = BlockStateProperties.NORTH; public static final BooleanProperty SOUTH = BlockStateProperties.SOUTH; public static final BooleanProperty EAST = BlockStateProperties.EAST; public static final BooleanProperty WEST = BlockStateProperties.WEST; public MagicPipeBlock(Properties properties){ super(properties); this.registerDefaultState(this.stateDefinition.any().setValue(UP, false)); this.registerDefaultState(this.stateDefinition.any().setValue(DOWN, false)); this.registerDefaultState(this.stateDefinition.any().setValue(NORTH, false)); this.registerDefaultState(this.stateDefinition.any().setValue(SOUTH, false)); this.registerDefaultState(this.stateDefinition.any().setValue(EAST, false)); this.registerDefaultState(this.stateDefinition.any().setValue(WEST, false)); } public BlockState getStateForPlacement(BlockPlaceContext p_48689_) { return this.defaultBlockState().setValue(UP, false).setValue(DOWN, false).setValue(NORTH, false).setValue(SOUTH, false).setValue(EAST, false).setValue(WEST, false); } protected void createBlockStateDefinition(StateDefinition.Builder<Block, BlockState> p_48725_) { p_48725_.add(UP, DOWN, NORTH, SOUTH, EAST, WEST); } @Override public RenderShape getRenderShape(BlockState p_60550_) { return RenderShape.MODEL; } // ENTITY @Nullable @Override public BlockEntity newBlockEntity(BlockPos pos, BlockState state) { return new MagicPipeBlockEntity(pos, state); } @Nullable @Override public <T extends BlockEntity> BlockEntityTicker<T> getTicker(Level level, BlockState state, BlockEntityType<T> type) { return createTickerHelper(type, ModBlockEntities.MAGIC_PIPE.get(), MagicPipeBlockEntity::tick); } @javax.annotation.Nullable protected static <E extends BlockEntity, A extends BlockEntity> BlockEntityTicker<A> createTickerHelper(BlockEntityType<A> p_152133_, BlockEntityType<E> p_152134_, BlockEntityTicker<? super E> p_152135_) { return p_152134_ == p_152133_ ? (BlockEntityTicker<A>)p_152135_ : null; } }
  6. Is there's anyway i can sync both Server/Client side random numbers? Only way i found it's by using NBT's but i don't think it's the right way.
  7. Ok, thank you for advice, i think i figured it out!
  8. I think the reason why this names like this is not because of Intellij, it's because of decompiling Minecraft source code by Forge. Parchment will rename this variables and also some other methods. Kaupenjoe made video about this. The same can be done with the newest versions.
  9. Intellij doesn't know how to name this variables, use Parchment or just don't use it.
  10. I just wanna know how can i fix this problem, it doesn't crashes game or anything, but when i'm breaking my block it just giving warning. [Server thread/WARN] [minecraft/LevelChunk]: Block entity magical_obsession:special_cauldron @ BlockPos{x=-64, y=69, z=67} state Block{minecraft:air} invalid for ticking:
  11. The problem is, i got block with custom inventory and json recipes, it also has it's own item inside renderer. But when i'm triyng to get item in slot for Client side (For Server side it's fine) i also need to check if recipe.isPresent(). But it doesn't return anything for client side, without this method the game will crash. Here's some code for crafting -> public static void tick(Level level, BlockPos pos, BlockState state, SpecialCauldronBlockEntity entity) { if (level.isClientSide) { if (!entity.itemStackHandler.getStackInSlot(0).is(ItemStack.EMPTY.getItem())) { entity.progress++; if (entity.progress >= entity.maxProgress) { //entity.itemStackHandler.setStackInSlot(0, Items.DIAMOND.getDefaultInstance()); craftItem(entity, level); level.playLocalSound(pos.getX(), pos.getY(), pos.getZ(), SoundEvents.END_PORTAL_SPAWN, SoundSource.BLOCKS, 1.0f, 1.0f, true); entity.resetProgress(); } } else { entity.resetProgress(); } } if (!level.isClientSide) { if (!entity.itemStackHandler.getStackInSlot(0).is(ItemStack.EMPTY.getItem())) { entity.progress++; if (entity.progress >= entity.maxProgress) { //entity.itemStackHandler.setStackInSlot(0, Items.DIAMOND.getDefaultInstance()); craftItem(entity, level); entity.resetProgress(); } } else { entity.resetProgress(); } } } // Craft private static void craftItem(SpecialCauldronBlockEntity pEntity, Level level) { SimpleContainer inventory = new SimpleContainer(pEntity.itemStackHandler.getStackInSlot(0)); if (level.isClientSide) { Optional<SpecialCauldronRecipe> recipe = level.getRecipeManager() .getRecipeFor(SpecialCauldronRecipe.Type.INSTANCE, inventory, level); System.out.println(level.isClientSide); if (recipe.isPresent()) { pEntity.itemStackHandler.setStackInSlot(0, new ItemStack(recipe.get().getResultItem().getItem())); } } if (!level.isClientSide) { Optional<SpecialCauldronRecipe> recipe = level.getRecipeManager() .getRecipeFor(SpecialCauldronRecipe.Type.INSTANCE, inventory, level); if (recipe.isPresent()) { pEntity.itemStackHandler.setStackInSlot(0, new ItemStack(recipe.get().getResultItem().getItem())); } } }
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.