Jump to content

Recommended Posts

Posted
1 minute ago, xXiNightXx said:

this is what I get when i created the breakpoint and stepped on the block while in debug mode.

 

16 minutes ago, Animefan8888 said:

Now go to your slabs class and set the breakpoint just after your call setSoundType.

 

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
7 minutes ago, Animefan8888 said:

Try "blockSoundType = SoundType.CLOTH" instead of setSoundType and your breakpoint is not after you call setSoundType could you move it down a line.

nope, still the stone block sound.

Posted (edited)
15 minutes ago, Animefan8888 said:

And you are sure your breakpoint is below the line where you change the sound type?

Yes

I double clicked on it and changed it to cloth while in debug mode in that little triangle area.  It did changed the sound to wool, but on my concrete slab block, not the cloth slab blocks.

Edited by xXiNightXx
Posted
2 minutes ago, Animefan8888 said:

Are you doing it in the right class?

Yes, the sound is set in the woolslab, not in the concrete one. Here is the code between the 3 slab files.

 

BlockSlabCustom.java

package simplexdesigns.bkproject.block;

import net.minecraft.block.BlockSlab;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.state.BlockStateContainer;
import net.minecraft.block.state.IBlockState;
import net.minecraft.creativetab.CreativeTabs;
import net.minecraft.entity.Entity;
import net.minecraft.item.Item;
import net.minecraft.item.ItemSlab;
import net.minecraft.item.ItemStack;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.NonNullList;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.fml.relauncher.Side;
import net.minecraftforge.fml.relauncher.SideOnly;
import simplexdesigns.bkproject.BkProject;
import simplexdesigns.bkproject.util.Constants;

import java.util.Optional;
import java.util.Random;
import java.util.stream.Collectors;

import javax.annotation.Nullable;

/**
 * Base class for this mod's slab blocks.
 *
 * @param <VARIANT>  The variant type
 * @param <VARIANTS> The variant collection type
 * @param <SLAB>     The slab type
 * @author Choonster
 */
public abstract class BlockSlabCustom<
		VARIANT extends Enum<VARIANT> & IStringSerializable,
		VARIANTS extends Iterable<VARIANT> & IStringSerializable,
		SLAB extends BlockSlabCustom<VARIANT, VARIANTS, SLAB>
		> extends BlockSlab {

	/**
	 * The group this slab belongs to
	 */
	protected final SlabGroup<VARIANT, VARIANTS, SLAB> slabGroup;

	/**
	 * The variants of this slab
	 */
	protected final VARIANTS variants;

	/**
	 * Create a slab block.
	 *
	 * @param material  The Material of this slab
	 * @param slabGroup The group this slab belongs to
	 * @param variants  The variants of this slab
	 */
	public BlockSlabCustom(final Material material, final SlabGroup<VARIANT, VARIANTS, SLAB> slabGroup, final VARIANTS variants) {
		super(material);
		this.slabGroup = slabGroup;
		this.variants = variants;

		// Vanilla sets this for anything that extends BlockSlab in Block.registerBlocks,
		// but this is run before mods are loaded; so we need to set it manually.
		// Thanks to HappyKiller1O1 for pointing out this field to me:
		// http://www.minecraftforge.net/forum/index.php/topic,36125.msg190252.html#msg190252
		this.useNeighborBrightness = true;

		String name = slabGroup.groupName + "_" + variants.getName();
		if (isDouble()) {
			name = "double_" + name;
		}

		setRegistryName(BkProject.MODID, name);
		setUnlocalizedName(Constants.RESOURCE_PREFIX + slabGroup.groupName);

		IBlockState iblockstate = this.blockState.getBaseState();

		if (!isDouble()) {
			iblockstate = iblockstate.withProperty(HALF, BlockSlab.EnumBlockHalf.BOTTOM);
		}

		final Optional<VARIANT> defaultVariant = getVariantProperty().getAllowedValues().stream().findFirst();
		if (defaultVariant.isPresent()) {
			iblockstate = iblockstate.withProperty(getVariantProperty(), defaultVariant.get());
		}

		setDefaultState(iblockstate);

		setCreativeTab(BkProject.creativeTab2);
	}

	/**
	 * Get the metadata value for the specified variant
	 *
	 * @param variant The variant
	 * @return The metadata value
	 */
	public abstract int getMetadata(VARIANT variant);

	/**
	 * Get the variant for the specified metadata value
	 *
	 * @param meta The metadata value
	 * @return The variant
	 */
	protected abstract VARIANT getVariant(int meta);

	@Override
	public Item getItemDropped(final IBlockState state, final Random rand, final int fortune) {
		return slabGroup.item;
	}

	@Override
	public abstract IProperty<VARIANT> getVariantProperty();

	@SideOnly(Side.CLIENT)
	@Override
	public void getSubBlocks(final CreativeTabs tab, final NonNullList<ItemStack> list) {
		list.addAll(getVariantProperty().getAllowedValues().stream()
				.map(variant -> new ItemStack(this, 1, getMetadata(variant)))
				.collect(Collectors.toList()));
	}

	@SuppressWarnings("deprecation")
	@Override
	public IBlockState getStateFromMeta(final int meta) {
		final VARIANT variant = getVariant(meta & 7);
		IBlockState state = this.getDefaultState().withProperty(getVariantProperty(), variant);

		if (!this.isDouble()) {
			state = state.withProperty(HALF, (meta & 8) == 0 ? EnumBlockHalf.BOTTOM : EnumBlockHalf.TOP);
		}

		return state;
	}

	@Override
	public int getMetaFromState(final IBlockState state) {
		int meta = getMetadata(state.getValue(getVariantProperty()));

		if (!this.isDouble() && state.getValue(HALF) == EnumBlockHalf.TOP) {
			meta |= 8;
		}

		return meta;
	}

	@Override
	protected BlockStateContainer createBlockState() {
		return isDouble() ? new BlockStateContainer(this, getVariantProperty()) : new BlockStateContainer(this, HALF, getVariantProperty());
	}

	@Override
	public int damageDropped(final IBlockState state) {
		return getMetadata(state.getValue(getVariantProperty()));
	}

	/**
	 * A group consisting of a single and a double slab.
	 *
	 * @param <VARIANT>  The variant type
	 * @param <VARIANTS> The variant collection type
	 * @param <SLAB>     The slab type
	 */
	public static abstract class SlabGroup<
			VARIANT extends Enum<VARIANT> & IStringSerializable,
			VARIANTS extends Iterable<VARIANT> & IStringSerializable,
			SLAB extends BlockSlabCustom<VARIANT, VARIANTS, SLAB>
			> {

		public final SLAB singleSlab;
		public final SLAB doubleSlab;
		public final String groupName;
		public final ItemSlab item;

		/**
		 * Create a slab group.
		 *
		 * @param groupName The group's name
		 * @param material  The Material of the slabs
		 * @param variants  The variants of the slabs
		 */
		public SlabGroup(final String groupName, final Material material, final VARIANTS variants) {
			this.groupName = groupName;
			this.singleSlab = createSlab(material, false, variants);
			this.doubleSlab = createSlab(material, true, variants);
			this.item = new ItemSlab(singleSlab, singleSlab, doubleSlab);
		}

		/**
		 * Create a slab block.
		 *
		 * @param material The Material
		 * @param isDouble Is this a double slab?
		 * @param variants The variants
		 * @return The slab block
		 */
		public abstract SLAB createSlab(Material material, boolean isDouble, VARIANTS variants);
	}

}

 

 

BlockWoolSlab.java

package simplexdesigns.bkproject.block;

import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.Entity;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.init.SoundEvents;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.SoundEvent;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import simplexdesigns.bkproject.util.OreDictUtils;

import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Optional;
import java.util.function.Predicate;

public abstract class BlockWoolSlab extends BlockSlabCustom<EnumDyeColor, BlockWoolSlab.EnumColourGroup, BlockWoolSlab> {
	
	public BlockWoolSlab(final Material material, final EnumColourGroup colourGroup, final SlabGroup<EnumDyeColor, EnumColourGroup, BlockWoolSlab> slabGroup) {
		super(material, slabGroup, colourGroup);
		blockSoundType = SoundType.SLIME;
		this.setHardness(0.5F);
	}
	


	@SuppressWarnings("deprecation")
	@Override
	public MapColor getMapColor(final IBlockState state, final IBlockAccess world, final BlockPos pos) {
		return MapColor.getBlockColor(state.getValue(getVariantProperty()));
	}

	@Override
	public String getUnlocalizedName(final int meta) {
		return getUnlocalizedName() + "." + getVariant(meta).getUnlocalizedName();
	}

	@Override
	public int getMetadata(final EnumDyeColor colour) {
		return variants.getOffsetMetadata(colour);
		
	}

	@Override
	protected EnumDyeColor getVariant(final int meta) {
		return variants.byOffsetMetadata(meta);
	}

	@Override
	public boolean recolorBlock(final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor colour) {
		final IBlockState currentState = world.getBlockState(pos);
		return variants.isColourInGroup(colour) &&
				currentState.getValue(getVariantProperty()) != colour &&
				world.setBlockState(pos, currentState.withProperty(getVariantProperty(), colour));
		
	}

	@Override
	public boolean onBlockActivated(final World worldIn, final BlockPos pos, final IBlockState state, final EntityPlayer playerIn, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
		final ItemStack heldItem = playerIn.getHeldItem(hand);

		if (!heldItem.isEmpty()) {
			final Optional<EnumDyeColor> dyeColour = OreDictUtils.INSTANCE.getDyeColour(heldItem);
			if (dyeColour.isPresent()) {
				final boolean success = recolorBlock(worldIn, pos, side, dyeColour.get());
				if (success) {
					heldItem.shrink(1);
					return true;
				}
			}
		}
		

		return false;
	}

	@Override
	public Comparable<?> getTypeForItem(final ItemStack stack) {
		return variants.byOffsetMetadata(stack.getMetadata());
	}

	public enum EnumColourGroup implements Iterable<EnumDyeColor>, IStringSerializable {
		LOW("low", colour -> colour.getMetadata() < 8, 0),
		HIGH("high", colour -> colour.getMetadata() >= 8, 8);

		public final IProperty<EnumDyeColor> property;

		private final int metaOffset;

		private final String name;

		private final Collection<EnumDyeColor> values;

		EnumColourGroup(final String name, final Predicate<EnumDyeColor> colourFilter, final int metaOffset) {
			this.name = name;
			this.property = PropertyEnum.create("colour", EnumDyeColor.class, colourFilter::test);
			this.metaOffset = metaOffset;
			this.values = this.property.getAllowedValues();
			
		}

		public int getOffsetMetadata(final EnumDyeColor colour) {
			return colour.getMetadata() - metaOffset;
		}

		public EnumDyeColor byOffsetMetadata(final int meta) {
			return EnumDyeColor.byMetadata(meta + metaOffset);
		}

		@Override
		public Iterator<EnumDyeColor> iterator() {
			return values.iterator();
			
		}

		@Override
		public String getName() {
			return name;
			
		}

		public boolean isColourInGroup(final EnumDyeColor colour) {
			return values.contains(colour);
		}

		@Nullable
		public static EnumColourGroup getGroupForColour(final EnumDyeColor colour) {
			for (final EnumColourGroup colourGroup : values()) {
				if (colourGroup.isColourInGroup(colour)) {
					return colourGroup;
				}
			}

			return null;
			
		}
	}

	public static class ColouredSlabGroup {
		public final SlabGroup<EnumDyeColor, EnumColourGroup, BlockWoolSlab> low;
		public final SlabGroup<EnumDyeColor, EnumColourGroup, BlockWoolSlab> high;

		public ColouredSlabGroup(final String groupName, final Material material) {
			low = createGroup(groupName, material, EnumColourGroup.LOW);
			high = createGroup(groupName, material, EnumColourGroup.HIGH);
			
			
		}

		private SlabGroup<EnumDyeColor, EnumColourGroup, BlockWoolSlab> createGroup(final String groupName, final Material material, final EnumColourGroup colourGroup) {
			return new SlabGroup<EnumDyeColor, EnumColourGroup, BlockWoolSlab>(groupName, material, colourGroup) {
				@Override
				public BlockWoolSlab createSlab(final Material material, final boolean isDouble, final EnumColourGroup colourGroup) {
					return new BlockWoolSlab(material, colourGroup, this) {
						@Override
						public boolean isDouble() {
							return isDouble;
						}

						@Override
						public IProperty<EnumDyeColor> getVariantProperty() {
							return colourGroup.property;
						}
					};
				}
			};
			
		}


		public SlabGroup<EnumDyeColor, EnumColourGroup, BlockWoolSlab> getSlabGroupByColourGroup(final EnumColourGroup colourGroup) {
			return colourGroup == EnumColourGroup.LOW ? low : high;
		}
		
		
	}
	
}

 

BlockConcreteSlab.java

package simplexdesigns.bkproject.block;

import net.minecraft.block.material.MapColor;
import net.minecraft.block.material.Material;
import net.minecraft.block.properties.IProperty;
import net.minecraft.block.properties.PropertyEnum;
import net.minecraft.block.state.IBlockState;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.EnumDyeColor;
import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumHand;
import net.minecraft.util.IStringSerializable;
import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World;
import simplexdesigns.bkproject.util.OreDictUtils;

import javax.annotation.Nullable;
import java.util.Collection;
import java.util.Iterator;
import java.util.Optional;
import java.util.function.Predicate;

/**
 * A slab that uses vanilla's dye colours.
 * <p>
 * Test for this thread:
 * http://www.minecraftforum.net/forums/mapping-and-modding/minecraft-mods/modification-development/2597500-how-do-you-create-a-halfslab
 *
 * @author Choonster
 */
public abstract class BlockConcreteSlab extends BlockSlabCustom<EnumDyeColor, BlockConcreteSlab.EnumColourGroup, BlockConcreteSlab> {

	/**
	 * Create a coloured slab block.
	 *
	 * @param material    The Material of this slab
	 * @param colourGroup This slab's colour group
	 * @param slabGroup   The group this slab belongs to
	 */
	public BlockConcreteSlab(final Material material, final EnumColourGroup colourGroup, final SlabGroup<EnumDyeColor, EnumColourGroup, BlockConcreteSlab> slabGroup) {
		super(material, slabGroup, colourGroup);
	}

	@SuppressWarnings("deprecation")
	@Override
	public MapColor getMapColor(final IBlockState state, final IBlockAccess world, final BlockPos pos) {
		return MapColor.getBlockColor(state.getValue(getVariantProperty()));
	}

	@Override
	public String getUnlocalizedName(final int meta) {
		return getUnlocalizedName() + "." + getVariant(meta).getUnlocalizedName();
	}

	/**
	 * Get the metadata value for the specified colour
	 *
	 * @param colour The colour
	 * @return The metadata value
	 */
	@Override
	public int getMetadata(final EnumDyeColor colour) {
		return variants.getOffsetMetadata(colour);
	}

	/**
	 * Get the colour for the specified metadata value
	 *
	 * @param meta The metadata value
	 * @return The colour
	 */
	@Override
	protected EnumDyeColor getVariant(final int meta) {
		return variants.byOffsetMetadata(meta);
	}

	@Override
	public boolean recolorBlock(final World world, final BlockPos pos, final EnumFacing side, final EnumDyeColor colour) {
		final IBlockState currentState = world.getBlockState(pos);
		return variants.isColourInGroup(colour) &&
				currentState.getValue(getVariantProperty()) != colour &&
				world.setBlockState(pos, currentState.withProperty(getVariantProperty(), colour));
	}

	@Override
	public boolean onBlockActivated(final World worldIn, final BlockPos pos, final IBlockState state, final EntityPlayer playerIn, final EnumHand hand, final EnumFacing side, final float hitX, final float hitY, final float hitZ) {
		final ItemStack heldItem = playerIn.getHeldItem(hand);

		if (!heldItem.isEmpty()) {
			final Optional<EnumDyeColor> dyeColour = OreDictUtils.INSTANCE.getDyeColour(heldItem);
			if (dyeColour.isPresent()) {
				final boolean success = recolorBlock(worldIn, pos, side, dyeColour.get());
				if (success) {
					heldItem.shrink(1);
					return true;
				}
			}
		}

		return false;
	}

	@Override
	public Comparable<?> getTypeForItem(final ItemStack stack) {
		return variants.byOffsetMetadata(stack.getMetadata());
	}

	/**
	 * A group of {@link EnumDyeColor} values.
	 */
	public enum EnumColourGroup implements Iterable<EnumDyeColor>, IStringSerializable {
		LOW("low", colour -> colour.getMetadata() < 8, 0),
		HIGH("high", colour -> colour.getMetadata() >= 8, 8);

		/**
		 * The property with this group's colours as the allowed values
		 */
		public final IProperty<EnumDyeColor> property;

		/**
		 * The offset to subtract from each colour's metadata value
		 */
		private final int metaOffset;

		/**
		 * The name of this group
		 */
		private final String name;

		/**
		 * The colours in this group
		 */
		private final Collection<EnumDyeColor> values;

		/**
		 * Create a colour group
		 *
		 * @param name         The name of this group
		 * @param colourFilter A filter to obtain the colours in this group
		 * @param metaOffset   The offset to subtract from each colour's metadata value
		 */
		EnumColourGroup(final String name, final Predicate<EnumDyeColor> colourFilter, final int metaOffset) {
			this.name = name;
			this.property = PropertyEnum.create("colour", EnumDyeColor.class, colourFilter::test);
			this.metaOffset = metaOffset;
			this.values = this.property.getAllowedValues();
		}

		/**
		 * Get the metadata value of the specified colour with this group's offset.
		 *
		 * @param colour The colour
		 * @return The offset metadata value
		 */
		public int getOffsetMetadata(final EnumDyeColor colour) {
			return colour.getMetadata() - metaOffset;
		}

		/**
		 * Get the colour of the specified metadata value with this group's offset
		 *
		 * @param meta The offset metadata value
		 * @return The colour
		 */
		public EnumDyeColor byOffsetMetadata(final int meta) {
			return EnumDyeColor.byMetadata(meta + metaOffset);
		}

		/**
		 * Returns an iterator over elements of type {@code T}.
		 *
		 * @return an Iterator.
		 */
		@Override
		public Iterator<EnumDyeColor> iterator() {
			return values.iterator();
		}

		@Override
		public String getName() {
			return name;
		}

		/**
		 * Is the specified colour in this group?
		 *
		 * @param colour The colour
		 * @return True if the colour is in this group
		 */
		public boolean isColourInGroup(final EnumDyeColor colour) {
			return values.contains(colour);
		}

		/**
		 * Get the first group containing the specified colour.
		 *
		 * @param colour The colour
		 * @return A group containing the colour, or null if there isn't one
		 */
		@Nullable
		public static EnumColourGroup getGroupForColour(final EnumDyeColor colour) {
			for (final EnumColourGroup colourGroup : values()) {
				if (colourGroup.isColourInGroup(colour)) {
					return colourGroup;
				}
			}

			return null;
		}
	}

	public static class ColouredSlabGroup {
		public final SlabGroup<EnumDyeColor, EnumColourGroup, BlockConcreteSlab> low;
		public final SlabGroup<EnumDyeColor, EnumColourGroup, BlockConcreteSlab> high;

		/**
		 * Create a coloured slab group.
		 *
		 * @param groupName The group's name
		 * @param material  The Material of the slabs
		 */
		public ColouredSlabGroup(final String groupName, final Material material) {
			low = createGroup(groupName, material, EnumColourGroup.LOW);
			high = createGroup(groupName, material, EnumColourGroup.HIGH);
		}

		/**
		 * Create a slab group.
		 *
		 * @param groupName   The group's name
		 * @param material    The Material of the slabs
		 * @param colourGroup The colour group
		 * @return The slab group
		 */
		private SlabGroup<EnumDyeColor, EnumColourGroup, BlockConcreteSlab> createGroup(final String groupName, final Material material, final EnumColourGroup colourGroup) {
			return new SlabGroup<EnumDyeColor, EnumColourGroup, BlockConcreteSlab>(groupName, material, colourGroup) {
				@Override
				public BlockConcreteSlab createSlab(final Material material, final boolean isDouble, final EnumColourGroup colourGroup) {
					return new BlockConcreteSlab(material, colourGroup, this) {
						@Override
						public boolean isDouble() {
							return isDouble;
						}

						@Override
						public IProperty<EnumDyeColor> getVariantProperty() {
							return colourGroup.property;
						}
					};
				}
			};
		}

		/**
		 * Get the slab group for the specified colour group.
		 *
		 * @param colourGroup The colour group
		 * @return The slab group
		 */
		public SlabGroup<EnumDyeColor, EnumColourGroup, BlockConcreteSlab> getSlabGroupByColourGroup(final EnumColourGroup colourGroup) {
			return colourGroup == EnumColourGroup.LOW ? low : high;
		}
	}
}

 

Posted
5 minutes ago, xXiNightXx said:

Yes, the sound is set in the woolslab, not in the concrete one. Here is the code between the 3 slab files.

I'm sorry I just don't see the problem if it isn't solved by the time I get back on I will take another look, but for now I am off to bed.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted (edited)
1 hour ago, xXiNightXx said:

BCQHO4V.png

 

You didn't set a condition for the breakpoint, so it was hit for a BlockStone instance, which uses SoundType.STONE.

 

Set the condition of a breakpoint by doing the following:

  • Show the Breakpoints view (Window > Show View > Other... > Debug > Breakpoints)
  • In the Breakpoints view, right click on the exception breakpoint and select Breakpoint Properties...
  • In the Properties window, check the Conditional checkbox
  • In the large textbox, enter the condition this instanceof BlockWoolSlab
  • Click OK in the Properties window.
Edited by Choonster
  • Like 1

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted (edited)
8 minutes ago, Choonster said:

 

You didn't set a condition for the breakpoint, so it was hit for a BlockStone instance.

 

Set the condition of a breakpoint by doing the following:

  • Show the Breakpoints view (Window > Show View > Other... > Debug > Breakpoints)
  • In the Breakpoints view, right click on the exception breakpoint and select Breakpoint Properties...
  • In the Properties window, check the Conditional checkbox
  • In the large textbox, enter the condition this instanceof BlockWoolSlab
  • Click OK in the Properties window.

ok i did, so it pauses when i step on the wool slab but the property in the variables tab is loading it as BlockConreteSlab. When i step on the Concrete Slab, it shows it as the wool slab block.

http://i.imgur.com/AWLeuxa.png

Edited by xXiNightXx
Posted (edited)
1 hour ago, xXiNightXx said:

ok i did, so it pauses when i step on the wool slab but the property in the variables tab is loading it as BlockConreteSlab. When i step on the Concrete Slab, it shows it as the wool slab block.

http://i.imgur.com/AWLeuxa.png

 

That's strange. Please post the latest version of your ModBlocks class.

 

It looks like you added the condition to the breakpoint in the BlockWoolSlab constructor, which is pointless since this will always be an instance of BlockWoolSlab in that context. Please add the condition to the breakpoint in Block#getSoundType instead.

Edited by Choonster

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted
2 minutes ago, Choonster said:

 

That's strange. Please post the latest version of your ModBlocks class.

 

It looks like you added the condition to the breakpoint in the BlockWoolSlab constructor, which is pointless since this will always be an instance of BlockWoolSlab in that context. Please add the condition to the breakpoint in Block#getSoundType instead.

package simplexdesigns.bkproject.init;

import java.util.HashSet;
import java.util.Set;

import com.google.common.base.Preconditions;

import net.minecraft.block.Block;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material;
import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.block.model.ModelResourceLocation;
import net.minecraft.item.Item;
import net.minecraft.item.ItemBlock;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
import net.minecraftforge.fml.common.registry.GameRegistry;
import net.minecraftforge.fml.common.registry.GameRegistry.ObjectHolder;
import net.minecraftforge.registries.IForgeRegistry;
import simplexdesigns.bkproject.BkProject;
import simplexdesigns.bkproject.block.*;
import simplexdesigns.bkproject.util.Constants;

@SuppressWarnings("WeakerAccess")
@ObjectHolder(BkProject.MODID)

public class ModBlocks {
	
	public static final BlockBlackout BLOCK_BLACKOUT = new BlockBlackout(Material.ROCK, "block_blackout");


	
	public static final BlockStoneStairs BLOCK_STONE_STAIRS = new BlockStoneStairs(Material.ROCK, "stone_stairs");
	public static final BlockStoneAndesiteStairs BLOCK_STONE_ANDESITE_STAIRS = new BlockStoneAndesiteStairs(Material.ROCK, "stone_andesite_stairs");
	public static final BlockStoneDioriteStairs BLOCK_STONE_DIORITE_STAIRS = new BlockStoneDioriteStairs(Material.ROCK, "stone_diorite_stairs");
	public static final BlockStoneGraniteStairs BLOCK_STONE_GRANITE_STAIRS = new BlockStoneGraniteStairs(Material.ROCK, "stone_granite_stairs");
	public static final BlockSandStairs BLOCK_SAND_STAIRS = new BlockSandStairs(Material.ROCK, "sand_stairs");
	public static final BlockRedSandStairs BLOCK_RED_SAND_STAIRS = new BlockRedSandStairs(Material.ROCK, "red_sand_stairs");
	public static final BlockGravelStairs BLOCK_GRAVEL_STAIRS = new BlockGravelStairs(Material.ROCK, "gravel_stairs");
	public static final BlockBedrockStairs BLOCK_BEDROCK_STAIRS = new BlockBedrockStairs(Material.ROCK, "bedrock_stairs");
	public static final BlockObsidianStairs BLOCK_OBSIDIAN_STAIRS = new BlockObsidianStairs(Material.ROCK, "obsidian_stairs");
	public static final BlockMossyCobblestoneStairs BLOCK_MOSSYCOBBLESTONE_STAIRS = new BlockMossyCobblestoneStairs(Material.ROCK, "mossy_cobblestone_stairs");
	public static final BlockNetherrackStairs BLOCK_NETHERRACK_STAIRS = new BlockNetherrackStairs(Material.ROCK, "netherrack_stairs");
	public static final BlockSoulSandStairs BLOCK_SOULSAND_STAIRS = new BlockSoulSandStairs(Material.ROCK, "soulsand_stairs");
	public static final BlockGlowstoneStairs BLOCK_GLOWSTONE_STAIRS = new BlockGlowstoneStairs(Material.ROCK, "glowstone_stairs");
	public static final BlockBookshelfStairs BLOCK_BOOKSHELF_STAIRS = new BlockBookshelfStairs(Material.ROCK, "bookshelf_stairs");
	public static final BlockRedNetherbrickStairs BLOCK_REDNETHERRACK_STAIRS = new BlockRedNetherbrickStairs(Material.ROCK, "red_nether_brick_stairs");
	public static final BlockNetherwartStairs BLOCK_NETHERWAR_STAIRS = new BlockNetherwartStairs(Material.ROCK, "nether_wart_stairs");
	public static final BlockMagmaBlockStairs BLOCK_MAGMABLOCK_STAIRS = new BlockMagmaBlockStairs(Material.ROCK, "magma_block_stairs");
	public static final BlockEndbrickStairs BLOCK_ENDBRICK_STAIRS = new BlockEndbrickStairs(Material.ROCK, "end_brick_stairs");
	public static final BlockDarkPrismarineStairs BLOCK_DARKPRISMARINE_STAIRS = new BlockDarkPrismarineStairs(Material.ROCK, "dark_prismarine_stairs");
	public static final BlockPrismarineStairs BLOCK_PRISMARINE_STAIRS = new BlockPrismarineStairs(Material.ROCK, "prismarine_stairs");
	public static final BlockPrismarineBrickStairs BLOCK_PRISMARINEBRICK_STAIRS = new BlockPrismarineBrickStairs(Material.ROCK, "prismarine_brick_stairs");
	public static final BlockEndStoneStairs BLOCK_ENDSTONE_STAIRS = new BlockEndStoneStairs(Material.ROCK, "end_stone_stairs");
	public static final BlockGrassStairs BLOCK_GRASS_STAIRS = new BlockGrassStairs(Material.ROCK, "grass_stairs");
	public static final BlockDirtStairs BLOCK_DIRT_STAIRS = new BlockDirtStairs(Material.ROCK, "dirt_stairs");
	public static final BlockCoarseDirtStairs BLOCK_COARSEDIRT_STAIRS = new BlockCoarseDirtStairs(Material.ROCK, "coarse_dirt_stairs");
	
	
	public static class Slabs {
		public static final BlockClaySlab.ColouredSlabGroup STAINED_CLAY_SLABS = new BlockClaySlab.ColouredSlabGroup("stained_clay_slab", Material.ROCK);
		public static final BlockConcreteSlab.ColouredSlabGroup CONCRETE_SLABS = new BlockConcreteSlab.ColouredSlabGroup("wool_slab", Material.ROCK);
		public static final BlockWoolSlab.ColouredSlabGroup WOOL_SLABS = new BlockWoolSlab.ColouredSlabGroup("concrete_slab", Material.ROCK);
		public static final BlockStoneSlabs.ColouredSlabGroup STONE_SLABS = new BlockStoneSlabs.ColouredSlabGroup("stone_slab", Material.ROCK);
		
	}
	@Mod.EventBusSubscriber(modid = BkProject.MODID)
	public static class RegistrationHandler {
		public static final Set<ItemBlock> ITEM_BLOCKS = new HashSet<>();

		/**
		 * Register this mod's {@link Block}s.
		 *
		 * @param event The event
		 */
		@SubscribeEvent
		public static void registerBlocks(final RegistryEvent.Register<Block> event) {
			final IForgeRegistry<Block> registry = event.getRegistry();

			final Block[] blocks = {
					BLOCK_BLACKOUT,

					BLOCK_STONE_STAIRS,
					BLOCK_STONE_ANDESITE_STAIRS,
					BLOCK_STONE_DIORITE_STAIRS,
					BLOCK_STONE_GRANITE_STAIRS,
					BLOCK_SAND_STAIRS,
					BLOCK_RED_SAND_STAIRS,
					BLOCK_GRAVEL_STAIRS,
					BLOCK_BEDROCK_STAIRS,
					BLOCK_OBSIDIAN_STAIRS,
					BLOCK_MOSSYCOBBLESTONE_STAIRS,
					BLOCK_NETHERRACK_STAIRS,
					BLOCK_SOULSAND_STAIRS,
					BLOCK_GLOWSTONE_STAIRS,
					BLOCK_BOOKSHELF_STAIRS,
					BLOCK_REDNETHERRACK_STAIRS,
					BLOCK_NETHERWAR_STAIRS,
					BLOCK_MAGMABLOCK_STAIRS,
					BLOCK_ENDBRICK_STAIRS,
					BLOCK_DARKPRISMARINE_STAIRS,
					BLOCK_PRISMARINE_STAIRS,
					BLOCK_PRISMARINEBRICK_STAIRS,
					BLOCK_ENDSTONE_STAIRS,
					BLOCK_GRASS_STAIRS,
					BLOCK_DIRT_STAIRS,
					BLOCK_COARSEDIRT_STAIRS,
			};

			registry.registerAll(blocks);

			registerSlabGroup(registry, Slabs.STAINED_CLAY_SLABS.high);
			registerSlabGroup(registry, Slabs.STAINED_CLAY_SLABS.low);
			registerSlabGroup(registry, Slabs.CONCRETE_SLABS.high);
			registerSlabGroup(registry, Slabs.CONCRETE_SLABS.low);
			registerSlabGroup(registry, Slabs.WOOL_SLABS.high);
			registerSlabGroup(registry, Slabs.WOOL_SLABS.low);
			registerSlabGroup(registry, Slabs.STONE_SLABS.high);
			registerSlabGroup(registry, Slabs.STONE_SLABS.low);
		}

		/**
		 * Register the {@link Block}s of a {@link BlockSlabCustom.SlabGroup}.
		 *
		 * @param registry  The registry
		 * @param slabGroup The slab group
		 */
		private static void registerSlabGroup(final IForgeRegistry<Block> registry, final BlockSlabCustom.SlabGroup<?, ?, ?> slabGroup) {
			registry.register(slabGroup.singleSlab);
			registry.register(slabGroup.doubleSlab);
		}


		/**
		 * Register this mod's {@link ItemBlock}s.
		 *
		 * @param event The event
		 */
		@SubscribeEvent
		public static void registerItemBlocks(final RegistryEvent.Register<Item> event) {
			final ItemBlock[] items = {
					/*new ItemBlock(WATER_GRASS),*/
					new ItemBlock(BLOCK_BLACKOUT),
					
					new ItemBlock(BLOCK_STONE_STAIRS),
					new ItemBlock(BLOCK_STONE_ANDESITE_STAIRS),
					new ItemBlock(BLOCK_STONE_DIORITE_STAIRS),
					new ItemBlock(BLOCK_STONE_GRANITE_STAIRS),
					new ItemBlock(BLOCK_SAND_STAIRS),
					new ItemBlock(BLOCK_RED_SAND_STAIRS),
					new ItemBlock(BLOCK_GRAVEL_STAIRS),
					new ItemBlock(BLOCK_BEDROCK_STAIRS),
					new ItemBlock(BLOCK_OBSIDIAN_STAIRS),
					new ItemBlock(BLOCK_MOSSYCOBBLESTONE_STAIRS),
					new ItemBlock(BLOCK_NETHERRACK_STAIRS),
					new ItemBlock(BLOCK_SOULSAND_STAIRS),
					new ItemBlock(BLOCK_GLOWSTONE_STAIRS),
					new ItemBlock(BLOCK_BOOKSHELF_STAIRS),
					new ItemBlock(BLOCK_REDNETHERRACK_STAIRS),
					new ItemBlock(BLOCK_NETHERWAR_STAIRS),
					new ItemBlock(BLOCK_MAGMABLOCK_STAIRS),
					new ItemBlock(BLOCK_ENDBRICK_STAIRS),
					new ItemBlock(BLOCK_DARKPRISMARINE_STAIRS),
					new ItemBlock(BLOCK_PRISMARINE_STAIRS),
					new ItemBlock(BLOCK_PRISMARINEBRICK_STAIRS),
					new ItemBlock(BLOCK_ENDSTONE_STAIRS),
					new ItemBlock(BLOCK_GRASS_STAIRS),
					new ItemBlock(BLOCK_DIRT_STAIRS),
					new ItemBlock(BLOCK_COARSEDIRT_STAIRS),
					
					Slabs.STAINED_CLAY_SLABS.low.item,
					Slabs.STAINED_CLAY_SLABS.high.item,
					Slabs.CONCRETE_SLABS.low.item,
					Slabs.CONCRETE_SLABS.high.item,
					Slabs.WOOL_SLABS.low.item,
					Slabs.WOOL_SLABS.high.item,
					Slabs.STONE_SLABS.low.item,
					Slabs.STONE_SLABS.high.item,
			};

			final IForgeRegistry<Item> registry = event.getRegistry();

			for (final ItemBlock item : items) {
				final Block block = item.getBlock();
				final ResourceLocation registryName = Preconditions.checkNotNull(block.getRegistryName(), "Block %s has null registry name", block);
				registry.register(item.setRegistryName(registryName));
				ITEM_BLOCKS.add(item);
			}

			registerTileEntities();
		}
	}

	private static void registerTileEntities() {

	}

	private static void registerTileEntity(final Class<? extends TileEntity> tileEntityClass, final String name) {
		GameRegistry.registerTileEntity(tileEntityClass, Constants.RESOURCE_PREFIX + name);
	}

}
	

 

Posted
1 minute ago, xXiNightXx said:

public static final BlockConcreteSlab.ColouredSlabGroup CONCRETE_SLABS = new BlockConcreteSlab.ColouredSlabGroup("wool_slab", Material.ROCK);
public static final BlockWoolSlab.ColouredSlabGroup WOOL_SLABS = new BlockWoolSlab.ColouredSlabGroup("concrete_slab", Material.ROCK);

 

As I suspected, you've reversed the group names of your wool and concrete slabs.

 

CONCRETE_SLABS should use "concrete_slab" and WOOL_SLABS should use "wool_slab".

Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future.

Posted (edited)
7 minutes ago, Choonster said:

 

As I suspected, you've reversed the group names of your wool and concrete slabs.

 

CONCRETE_SLABS should use "concrete_slab" and WOOL_SLABS should use "wool_slab".

haha woops. Did not even notice that. That fixed the sounds xD  Thank you!

Edited by xXiNightXx

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



×
×
  • Create New...

Important Information

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