Jump to content

Recommended Posts

Posted
18 hours ago, MrNoodles75 said:

surly you would just overwrite a method in Blocks.java, right?

 

What? What are you trying to do? Create your own block or edit vanilla blocks?

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
10 hours ago, kaydogz said:

you can use the interface IWaterLoggable

This is only true for creating your own blocks, the OP seems to be looking for something else. Also this is not sufficient. You also have to add the WATERLOGGED property to your block's blockstatecontainer.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted
On 9/22/2019 at 10:10 AM, Draco18s said:

This is only true for creating your own blocks, the OP seems to be looking for something else. Also this is not sufficient. You also have to add the WATERLOGGED property to your block's blockstatecontainer.

@Draco18s sorry that I couldn't say earlier as I was away for the weekend and couldn't look at my posts.

but I am trying to create my own blocks and I want to make them waterloggable

Posted

I had to ask because of the portion I bolded earlier.

 

Water logged blocks are easy. Implement the interface and add the property to the blockstatecontainer.

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/block/SluiceOutput.java#L22

 

Note that blocks can only contain water sources currently, even though they can return any fluid state:

https://github.com/Draco18s/ReasonableRealism/blob/1.14.4/src/main/java/com/draco18s/harderores/block/SluiceOutput.java#L40

Returning anything else results in a block that is not waterlogged.

 

(Do note that my block there is always waterlogged and can't exist in a non-waterlogged state, as I'm using that property to fake a water source block without it actually *being* a water source block.)

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)

Here is what happens:

1111098521_ScreenShot2019-09-23at10_56_09AM.png.ab269366f45d70a819b4942210daf756.png

and here is my code so far i don't know what is wrong:

 
 
0
 Advanced issues found
 
 
Spoiler

package com.runningmanstudios.extrablocks.blocks;

import net.minecraft.block.Block;
import net.minecraft.block.BlockState;
import net.minecraft.block.IWaterLoggable;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.fluid.Fluid;
import net.minecraft.fluid.Fluids;
import net.minecraft.fluid.IFluidState;
import net.minecraft.inventory.container.INamedContainerProvider;
import net.minecraft.item.ItemStack;
import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction;
import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World;
import net.minecraftforge.common.ToolType;
import net.minecraftforge.fml.network.NetworkHooks;

import javax.annotation.Nullable;

public class NautilusStatue extends Block implements IWaterLoggable {
    public static AxisAlignedBB blocksize = new AxisAlignedBB(1 - 0.125, 0.600, 1 - 0.125, 0.125, 0, 0.125);


    public NautilusStatue() {
        super(Properties.create(Material.WATER)
                .sound(SoundType.WOOD)
                .hardnessAndResistance(20.0f)
                .lightValue(10)
                .harvestTool(ToolType.PICKAXE)
        );
        setDefaultState(stateContainer.getBaseState().with(BlockStateProperties.WATERLOGGED, true));
    }

    @Override
    public void onBlockPlacedBy(World world, BlockPos pos, BlockState state, @Nullable LivingEntity entity, ItemStack stack) {
        if (entity != null) {
            world.setBlockState(pos, state.with(BlockStateProperties.FACING, getFacingFromEntity(pos, entity)), 2);
        }
    }

    @Override
    public boolean onBlockActivated(BlockState state, World world, BlockPos pos, PlayerEntity player, Hand hand, BlockRayTraceResult result) {
        if (!world.isRemote) {
            TileEntity tileEntity = world.getTileEntity(pos);
            if (tileEntity instanceof INamedContainerProvider) {
                NetworkHooks.openGui((ServerPlayerEntity) player, (INamedContainerProvider) tileEntity, tileEntity.getPos());
            } else {
                throw new IllegalStateException("Our named container provider is missing!");
            }
            return true;
        }
        return super.onBlockActivated(state, world, pos, player, hand, result);
    }

    public static Direction getFacingFromEntity(BlockPos clickedBlock, LivingEntity entity) {
        return Direction.getFacingFromVector((float) (entity.posX - clickedBlock.getX()), (float) (entity.posY - clickedBlock.getY()), (float) (entity.posZ - clickedBlock.getZ()));
    }

    protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
        builder.add(BlockStateProperties.WATERLOGGED, BlockStateProperties.FACING);
    }

    @Override
    @Deprecated
    public BlockRenderLayer getRenderLayer() {
        return BlockRenderLayer.CUTOUT;
    }

    public IFluidState getFluidState(BlockState state) {
        return Fluids.WATER.getStillFluidState(false);
    }

    public boolean receiveFluid(IWorld worldIn, BlockPos pos, BlockState state, IFluidState fluidStateIn) {
        return IWaterLoggable.super.receiveFluid(worldIn, pos, state, fluidStateIn);
    }

    public boolean canContainFluid(IBlockReader worldIn, BlockPos pos, BlockState state, Fluid fluidIn) {
        return true;//state.get(TYPE) != SlabType.DOUBLE ? IWaterLoggable.super.canContainFluid(worldIn, pos, state, fluidIn) : false;
    }

    @Deprecated
    public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld worldIn, BlockPos currentPos, BlockPos facingPos) {
        if (!stateIn.get(BlockStateProperties.WATERLOGGED)) {
            this.receiveFluid(worldIn, currentPos, stateIn, Fluids.WATER.getStillFluidState(false));
        }
        worldIn.getPendingFluidTicks().scheduleTick(currentPos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn));
        return super.updatePostPlacement(stateIn, facing, facingState, worldIn, currentPos, facingPos);
    }
    @Override
    public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
        return VoxelShapes.create(blocksize);
    }

    public void onBlockAdded(BlockState state, World worldIn, BlockPos pos, BlockState oldState, boolean isMoving) {
        worldIn.getPendingFluidTicks().scheduleTick(pos, Fluids.WATER, Fluids.WATER.getTickRate(worldIn));
    }

    public Fluid pickupFluid(IWorld worldIn, BlockPos pos, BlockState state) {
        return Fluids.EMPTY;
    }

   /*@Override
   @Deprecated
   public boolean isReplaceable(BlockState state, BlockItemUseContext useContext) {
      return true;
   }*/
}

 

Edited by MrNoodles75
Posted

1) What does the log say about the error?

2) Looks like you just copied my entire class without regards to what I said regarding what I was using it for that is entirely non-standard.

3) You haven't shown your registration code.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Posted (edited)
1 hour ago, Draco18s said:

1) What does the log say about the error?

2) Looks like you just copied my entire class without regards to what I said regarding what I was using it for that is entirely non-standard.

3) You haven't shown your registration code.

@Draco18s

 

1) I don't know I didn't check, sorry

2) Yes, I did because you said just add it your blockstatecontainer but in your class that you showed and from what I could find from vanilla classes is that they all had stuff like onBlockActivated, canContainFluid and updatePostPlacement and I became unsure.

3) if you mean setRegistryName then I saw that and I added it and now it works and the game opens. and I may seem stupid scince I don't know if you said this already so I'll say sorry in advance, but now it's always waterlogged.

Edited by MrNoodles75
Posted
2 hours ago, MrNoodles75 said:

2) Yes, I did because you said just add it your blockstatecontainer but in your class that you showed and from what I could find from vanilla classes is that they all had stuff like onBlockActivated, canContainFluid and updatePostPlacement and I became unsure.

Look at the vanilla blocks for standard implementation.

 

2 hours ago, MrNoodles75 said:

but now it's always waterlogged.

...yes:

6 hours ago, Draco18s said:

my block there is always waterlogged

 

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • Also check the worldsave / serverconfig folder If there is no such file, make a test without this mod  
    • Hi, I've been having trouble trying to use forge as it shows a black screen when I open the game, but I can still interact with it and hear the music.  I've done all of the step by steps and most common fixes like updating drivers, keeping up to date with Java, deleting and reinstalling minecraft, restarting my computer MANY times, even smaller things like splash.properties (I didn't have that file so I added it and set it to false thinking it would do something, definitely not) and making sure to prioritize my rtx 3070 in the settings but with no luck. Minecraft works as intended when I uninstall forge and I also don't have any mods currently, it just gives me this issue when I install forge. I also increased the ram usage, made sure my hardware isn't full or anything, and even changed the resolution in hopes it would fix things. I checked my antivirus and firewall but that isn't the issue either. Trust me, I've done everything I can think of. For some reason the black screen does flicker a little into the main menu, but obviously unplayable. I couldn't even make my way to the settings with how little it flickered. I'm not sure if it flickered randomly or if it was because I was messing around moving and clicking a bunch, I didn't really test it that much.  
    • I've had a really weird issue recently,  I wanted to add the Depper and Darker mod on my dedicated server (MC 1.21 with Fabric 0.16.9, hosted on nitroserv.com) but whenever I do add the mod the sever stops doing anything after listing the mods, and I get no crash or error or anything, just a stuck server. Here's a normal log of the server booting up: https://pastebin.com/JipFF2Eh and here's the log of the server doing the weird thing: https://pastebin.com/W4JBh3eX I just don't understand it. I've tried removing other mods (somewhat randomly) but deeper and darker still breaks my server whenever I add it. NitroServ support staff is about as confused as I am and I've had no response from the Deeper and Darker support staff... Now I know this is the Forge support not the Fabric support but I'm just trying to know if anyone has any kind of idea to fix this (aside from not using the mod obviously) Also I still have a bunch of errors and warnings whenever the server does start properly, are there any of them I should be worried about?
  • Topics

×
×
  • Create New...

Important Information

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