Decoration by default now uses grass sounds and a random offset, fixed an issue with weighted generators causing config files to not load (they're being a pain)
This commit is contained in:
parent
9c9037e6d3
commit
308f24378c
10 changed files with 27 additions and 64 deletions
|
@ -67,7 +67,7 @@ public final class GeneratorWeightedEntry extends WeightedRandom.Item implements
|
|||
public void readFromJson(JsonObject json, JsonDeserializationContext context)
|
||||
{
|
||||
this.itemWeight = json.get("weight").getAsInt();
|
||||
this.wrappedGenerator = GeneratorUtils.deserializeGenerator(json, "wrapped_generator", context);
|
||||
this.wrappedGenerator = context.deserialize(json.get("wrapped_generator"), IGenerator.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -88,15 +88,6 @@ public class BlockBOPFlower1 extends BlockDecoration {
|
|||
return ((FlowerType) state.getValue(VARIANT)).ordinal();
|
||||
}
|
||||
|
||||
|
||||
// give the flowers a random XZ offset so they're not spaced in a perfect grid
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Block.EnumOffsetType getOffsetType()
|
||||
{
|
||||
return Block.EnumOffsetType.XZ;
|
||||
}
|
||||
|
||||
// set the size of the different flowers' bounding boxes
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos)
|
||||
|
|
|
@ -77,15 +77,6 @@ public class BlockBOPFlower2 extends BlockDecoration {
|
|||
return ((FlowerType) state.getValue(VARIANT)).ordinal();
|
||||
}
|
||||
|
||||
|
||||
// give the flowers a random XZ offset so they're not spaced in a perfect grid
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Block.EnumOffsetType getOffsetType()
|
||||
{
|
||||
return Block.EnumOffsetType.XZ;
|
||||
}
|
||||
|
||||
// set the size of the different flowers' bounding boxes
|
||||
@Override
|
||||
public void setBlockBoundsBasedOnState(IBlockAccess world, BlockPos pos)
|
||||
|
|
|
@ -82,15 +82,6 @@ public class BlockBOPMushroom extends BlockDecoration
|
|||
return ((MushroomType) state.getValue(VARIANT)).ordinal();
|
||||
}
|
||||
|
||||
|
||||
// give the mushrooms a random XZ offset so they're not spaced in a perfect grid
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Block.EnumOffsetType getOffsetType()
|
||||
{
|
||||
return Block.EnumOffsetType.XZ;
|
||||
}
|
||||
|
||||
// glowshrooms emit light
|
||||
@Override
|
||||
public int getLightValue(IBlockAccess world, BlockPos pos)
|
||||
|
|
|
@ -26,6 +26,8 @@ import net.minecraft.world.World;
|
|||
import net.minecraft.world.gen.feature.WorldGenAbstractTree;
|
||||
import net.minecraft.world.gen.feature.WorldGenTrees;
|
||||
import net.minecraft.world.gen.feature.WorldGenerator;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public abstract class BlockBOPSapling extends BlockDecoration implements IGrowable {
|
||||
|
||||
|
@ -139,7 +141,12 @@ public abstract class BlockBOPSapling extends BlockDecoration implements IGrowab
|
|||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Block.EnumOffsetType getOffsetType()
|
||||
{
|
||||
return Block.EnumOffsetType.NONE;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -20,6 +20,8 @@ import net.minecraft.init.Blocks;
|
|||
import net.minecraft.util.AxisAlignedBB;
|
||||
import net.minecraft.util.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.relauncher.Side;
|
||||
import net.minecraftforge.fml.relauncher.SideOnly;
|
||||
|
||||
public class BlockBamboo extends BlockDecoration
|
||||
{
|
||||
|
@ -117,4 +119,11 @@ public class BlockBamboo extends BlockDecoration
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Block.EnumOffsetType getOffsetType()
|
||||
{
|
||||
return Block.EnumOffsetType.NONE;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -89,15 +89,6 @@ public class BlockCoral extends BlockDecoration
|
|||
{
|
||||
return ((CoralType) state.getValue(VARIANT)).ordinal();
|
||||
}
|
||||
|
||||
|
||||
// give the corals a random XZ offset so they're not spaced in a perfect grid
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Block.EnumOffsetType getOffsetType()
|
||||
{
|
||||
return Block.EnumOffsetType.XZ;
|
||||
}
|
||||
|
||||
// glowing_coral emits light
|
||||
@Override
|
||||
|
|
|
@ -54,7 +54,7 @@ public class BlockDecoration extends Block implements IBOPBlock
|
|||
// set some defaults
|
||||
this.setTickRandomly(true);
|
||||
this.setHardness(0.0F);
|
||||
this.setStepSound(Block.soundTypePiston);
|
||||
this.setStepSound(Block.soundTypeGrass);
|
||||
this.setBlockBoundsByRadiusAndHeight(0.3F, 0.6F);
|
||||
|
||||
this.setDefaultState(this.blockState.getBaseState());
|
||||
|
@ -141,6 +141,13 @@ public class BlockDecoration extends Block implements IBOPBlock
|
|||
return EnumWorldBlockLayer.CUTOUT;
|
||||
}
|
||||
|
||||
|
||||
//decoration should be randomly offset by default
|
||||
@Override
|
||||
@SideOnly(Side.CLIENT)
|
||||
public Block.EnumOffsetType getOffsetType()
|
||||
{
|
||||
return Block.EnumOffsetType.XZ;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -185,8 +185,6 @@ public class BlockFoliage extends BlockDecoration implements IShearable
|
|||
return this.getRenderColor(state);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
// different variants have different sizes
|
||||
@Override
|
||||
|
|
|
@ -72,28 +72,6 @@ public class GeneratorUtils
|
|||
|
||||
return state;
|
||||
}
|
||||
|
||||
public static IGenerator deserializeGenerator(JsonObject json, String memberName, JsonDeserializationContext context)
|
||||
{
|
||||
return deserializeGeneratorOfType(json, memberName, context, IGenerator.class);
|
||||
}
|
||||
|
||||
public static <T extends IGenerator> T deserializeGeneratorOfType(JsonObject json, String memberName, JsonDeserializationContext context, Class<T> type)
|
||||
{
|
||||
T generator = context.deserialize(json.get(memberName), type);
|
||||
|
||||
if (generator == null)
|
||||
{
|
||||
throw new JsonSyntaxException("Property " + memberName + " doesn't exist");
|
||||
}
|
||||
|
||||
if (!(generator.getClass().isAssignableFrom(type)))
|
||||
{
|
||||
throw new JsonSyntaxException("Property " + memberName + " is of an invalid type");
|
||||
}
|
||||
|
||||
return generator;
|
||||
}
|
||||
|
||||
public static boolean isBlockTreeReplacable(Block block)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue