Skip to content

Commit

Permalink
Move Blocks to DeferredRegister
Browse files Browse the repository at this point in the history
Also fix #97 and #96
  • Loading branch information
Andromander committed Mar 23, 2021
1 parent 4c28cf1 commit 81ed6e8
Show file tree
Hide file tree
Showing 73 changed files with 1,358 additions and 1,211 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"trigger": "minecraft:location",
"conditions": {
"location": {
"feature": "malachite_watchtower"
"feature": "gaiadimension:malachite_watchtower"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"trigger": "minecraft:location",
"conditions": {
"location": {
"feature": "mini_tower"
"feature": "gaiadimension:mini_tower"
}
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,47 +1,64 @@
{
"type": "minecraft:block",
"pools": [{
"rolls": 1,
"entries": [{
"type": "minecraft:alternatives",
"children": [{
"type": "minecraft:item",
"conditions": [{
"condition": "minecraft:alternative",
"terms": [{
"condition": "minecraft:match_tool",
"predicate": {
"item": "minecraft:shears"
}
}, {
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
"pools": [
{
"rolls": 1,
"entries": [
{
"type": "minecraft:alternatives",
"children": [
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:alternative",
"terms": [
{
"condition": "minecraft:match_tool",
"predicate": {
"item": "minecraft:shears"
}
},
{
"condition": "minecraft:match_tool",
"predicate": {
"enchantments": [
{
"enchantment": "minecraft:silk_touch",
"levels": {
"min": 1
}
}
]
}
}
]
}
],
"name": "gaiadimension:pink_agate_leaves"
},
{
"type": "minecraft:item",
"conditions": [
{
"condition": "minecraft:survives_explosion"
},
{
"condition": "minecraft:table_bonus",
"enchantment": "minecraft:fortune",
"chances": [
0.05,
0.0625,
0.083333336,
0.1
]
}
}]
],
"name": "gaiadimension:pink_agate_sapling"
}
}]
}],
"name": "gaiadimension:pink_agate_leaves"
}, {
"type": "minecraft:item",
"conditions": [{
"condition": "minecraft:survives_explosion"
}, {
"condition": "minecraft:table_bonus",
"enchantment": "minecraft:fortune",
"chances": [
0.05,
0.0625,
0.083333336,
0.1
]
}],
"name": "gaiadimension:pink_agate_sapling"
}]
}]
}]
}
]
}
]
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "minecraft:smelting",
"ingredient": {
"item": "gaiadimension:opal_block_green"
"item": "gaiadimension:opal_ore_green"
},
"result": "gaiadimension:green_opal",
"experience": 0.3,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"type": "minecraft:smelting",
"ingredient": {
"item": "gaiadimension:opal_block_red"
"item": "gaiadimension:opal_ore_red"
},
"result": "gaiadimension:red_opal",
"experience": 0.3,
Expand Down
7 changes: 4 additions & 3 deletions src/main/java/androsa/gaiadimension/GaiaDimensionMod.java
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,9 @@ public GaiaDimensionMod() {
ModRecipes.registerRecipeTypes();

ModBiomes.BIOMES.register(modEventBus);
// ModBlocks.BLOCKS.register(modEventBus);
ModBlocks.BLOCKS.register(modEventBus);
ModContainers.CONTAINERS.register(modEventBus);
ModDimensions.POI_TYPES.register(modEventBus);
// ModEffects.POTIONS.register(modEventBus);
// ModEntities.ENTITIES.register(modEventBus);
ModFluids.FLUIDS.register(modEventBus);
Expand All @@ -86,8 +87,8 @@ public GaiaDimensionMod() {

public void setup(FMLCommonSetupEvent event) {
event.enqueueWork(() -> {
PointOfInterestType.registerBlockStates(ModDimensions.GAIA_PORTAL);
PointOfInterestType.BLOCKS_OF_INTEREST.addAll(ModDimensions.GAIA_PORTAL.blockStates);
PointOfInterestType.registerBlockStates(ModDimensions.GAIA_PORTAL.get());
PointOfInterestType.BLOCKS_OF_INTEREST.addAll(ModDimensions.GAIA_PORTAL.get().blockStates);

// needs to be in enqueue as vanilla WorldGen registry maps arent threadsafe.
GaiaBiomeFeatures.registerConfiguredWorldgen();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
public class CorruptGrassBlock extends AbstractGaiaGrassBlock {

public CorruptGrassBlock(Properties props) {
super(props, ModBlocks.corrupt_soil);
super(props, ModBlocks.corrupt_soil.get());
}

@Override
public void grow(ServerWorld worldIn, Random rand, BlockPos pos, BlockState state) {
BlockPos blockpos = pos.up();
BlockState blackGrowth = ModBlocks.crystal_growth_black.getDefaultState();
BlockState redGrowth = ModBlocks.crystal_growth_red.getDefaultState();
BlockState blackGrowth = ModBlocks.crystal_growth_black.get().getDefaultState();
BlockState redGrowth = ModBlocks.crystal_growth_red.get().getDefaultState();

label48:
for(int i = 0; i < 128; ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ public CrystalFungusBlock(Properties props, boolean isCave) {
@Override
protected boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos){
if (cavernous) {
return state.getBlock() == ModBlocks.gaia_stone ||
state.getBlock() == ModBlocks.primal_mass ||
state.getBlock() == ModBlocks.wasteland_stone ||
state.getBlock() == ModBlocks.volcanic_rock;
return state.getBlock() == ModBlocks.gaia_stone.get() ||
state.getBlock() == ModBlocks.primal_mass.get() ||
state.getBlock() == ModBlocks.wasteland_stone.get() ||
state.getBlock() == ModBlocks.volcanic_rock.get();
} else {
return state.getBlock() instanceof AbstractGaiaGrassBlock;
}
Expand Down
14 changes: 7 additions & 7 deletions src/main/java/androsa/gaiadimension/block/GaiaFluidBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public boolean reactWithNeighbors(World world, BlockPos pos, BlockState state) {
FluidState offset = world.getFluidState(pos.offset(side));

if (offset.isTagged(FluidTags.LAVA) && (!(offset.getFluid() instanceof SuperhotMagmaFluid) && !(offset.getFluid() instanceof LiquidBismuthFluid))) {
world.setBlockState(pos, ForgeEventFactory.fireFluidPlaceBlockEvent(world, pos, pos, ModBlocks.sparkling_rock.getDefaultState()));
world.setBlockState(pos, ForgeEventFactory.fireFluidPlaceBlockEvent(world, pos, pos, ModBlocks.sparkling_rock.get().getDefaultState()));
this.triggerMixEffects(world, pos);
return false;
}
Expand All @@ -48,15 +48,15 @@ public boolean reactWithNeighbors(World world, BlockPos pos, BlockState state) {
FluidState offset = world.getFluidState(pos.offset(side));

if (offset.getFluid() instanceof SweetMuckFluid) {
world.setBlockState(pos, ForgeEventFactory.fireFluidPlaceBlockEvent(world, pos, pos, ModBlocks.primal_mass.getDefaultState()));
world.setBlockState(pos, ForgeEventFactory.fireFluidPlaceBlockEvent(world, pos, pos, ModBlocks.primal_mass.get().getDefaultState()));
this.triggerMixEffects(world, pos);
return false;
} else if (offset.getFluid() == ModFluids.liquid_aura_still.get() || offset.getFluid() == ModFluids.liquid_aura_flow.get()) {
world.setBlockState(pos, ForgeEventFactory.fireFluidPlaceBlockEvent(world, pos, pos, ModBlocks.aura_block.getDefaultState()));
world.setBlockState(pos, ForgeEventFactory.fireFluidPlaceBlockEvent(world, pos, pos, ModBlocks.aura_block.get().getDefaultState()));
this.triggerMixEffects(world, pos);
return false;
} else if (offset.isTagged(FluidTags.WATER)) {
world.setBlockState(pos, ForgeEventFactory.fireFluidPlaceBlockEvent(world, pos, pos, ModBlocks.gaia_cobblestone.getDefaultState()));
world.setBlockState(pos, ForgeEventFactory.fireFluidPlaceBlockEvent(world, pos, pos, ModBlocks.gaia_cobblestone.get().getDefaultState()));
this.triggerMixEffects(world, pos);
return false;
}
Expand All @@ -70,15 +70,15 @@ public boolean reactWithNeighbors(World world, BlockPos pos, BlockState state) {
FluidState offset = world.getFluidState(pos.offset(side));

if (offset.getFluid() instanceof SweetMuckFluid || offset.getFluid() instanceof SuperhotMagmaFluid) {
world.setBlockState(pos, ForgeEventFactory.fireFluidPlaceBlockEvent(world, pos, pos, ModBlocks.active_rock.getDefaultState()));
world.setBlockState(pos, ForgeEventFactory.fireFluidPlaceBlockEvent(world, pos, pos, ModBlocks.active_rock.get().getDefaultState()));
this.triggerMixEffects(world, pos);
return false;
} else if (offset.getFluid() == ModFluids.liquid_aura_still.get() || offset.getFluid() == ModFluids.liquid_aura_flow.get()) {
world.setBlockState(pos, ForgeEventFactory.fireFluidPlaceBlockEvent(world, pos, pos, ModBlocks.tektite_block.getDefaultState()));
world.setBlockState(pos, ForgeEventFactory.fireFluidPlaceBlockEvent(world, pos, pos, ModBlocks.tektite_block.get().getDefaultState()));
this.triggerMixEffects(world, pos);
return false;
} else if (offset.isTagged(FluidTags.WATER)) {
world.setBlockState(pos, ForgeEventFactory.fireFluidPlaceBlockEvent(world, pos, pos, ModBlocks.impure_rock.getDefaultState()));
world.setBlockState(pos, ForgeEventFactory.fireFluidPlaceBlockEvent(world, pos, pos, ModBlocks.impure_rock.get().getDefaultState()));
this.triggerMixEffects(world, pos);
return false;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,8 @@ public static class Size {
private BlockPos bottomLeft;
private int height;
private int width;
private final Block KEYSTONE = ModBlocks.keystone_block;
private final Block KEYSTONE = ModBlocks.keystone_block.get();
private final Block PORTAL = ModBlocks.gaia_portal.get();

public Size(IWorld worldIn, BlockPos pos, Direction.Axis facing) {
world = worldIn;
Expand Down Expand Up @@ -333,7 +334,7 @@ int calculatePortalHeight() {
break label56;
}

if (blockstate.getBlock() == ModBlocks.gaia_portal) {
if (blockstate.getBlock() == PORTAL) {
++this.portalBlockCount;
}

Expand Down Expand Up @@ -373,7 +374,7 @@ int calculatePortalHeight() {
boolean isEmptyBlock(BlockState state) {
Block block = state.getBlock();

return state.isAir() || block == ModBlocks.gold_fire || block == ModBlocks.gaia_portal;
return state.isAir() || block == ModBlocks.gold_fire.get() || block == PORTAL;
}

public boolean isValid() {
Expand All @@ -385,7 +386,7 @@ void placePortalBlocks() {
BlockPos blockpos = bottomLeft.offset(rightDir, i);

for (int j = 0; j < height; ++j) {
world.setBlockState(blockpos.up(j), ModBlocks.gaia_portal.getDefaultState().with(AXIS, axis), 2);
world.setBlockState(blockpos.up(j), PORTAL.getDefaultState().with(AXIS, axis), 2);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@
public class GlitterGrassBlock extends AbstractGaiaGrassBlock {

public GlitterGrassBlock(Properties props) {
super(props, ModBlocks.heavy_soil);
super(props, ModBlocks.heavy_soil.get());
}

@Override
public void grow(ServerWorld worldIn, Random rand, BlockPos pos, BlockState state) {
BlockPos blockpos = pos.up();
BlockState normalGrowth = ModBlocks.crystal_growth.getDefaultState();
BlockState mutantGrowth = ModBlocks.crystal_growth_mutant.getDefaultState();
BlockState normalGrowth = ModBlocks.crystal_growth.get().getDefaultState();
BlockState mutantGrowth = ModBlocks.crystal_growth_mutant.get().getDefaultState();

label48:
for(int i = 0; i < 128; ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ protected boolean canDie(World worldIn, BlockPos pos) {
@Deprecated
public void onBlockAdded(BlockState state1, World worldIn, BlockPos pos, BlockState state2, boolean flag) {
if (state2.getBlock() != state1.getBlock()) {
if (worldIn.getDimensionKey() != World.OVERWORLD && worldIn.getDimensionKey() != ModDimensions.gaia_world || !ModBlocks.gaia_portal.tryToCreatePortal(worldIn, pos)) {
if (worldIn.getDimensionKey() != World.OVERWORLD && worldIn.getDimensionKey() != ModDimensions.gaia_world || !ModBlocks.gaia_portal.get().tryToCreatePortal(worldIn, pos)) {
if (!state1.isValidPosition(worldIn, pos)) {
worldIn.removeBlock(pos, false);
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
public class MurkyGrassBlock extends AbstractGaiaGrassBlock {

public MurkyGrassBlock(Properties props) {
super(props, ModBlocks.boggy_soil);
super(props, ModBlocks.boggy_soil.get());
}

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/androsa/gaiadimension/block/SoftGrassBlock.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
public class SoftGrassBlock extends AbstractGaiaGrassBlock {

public SoftGrassBlock(Properties props) {
super(props, ModBlocks.light_soil);
super(props, ModBlocks.light_soil.get());
}

@Override
public void grow(ServerWorld worldIn, Random rand, BlockPos pos, BlockState state) {
BlockPos blockpos = pos.up();
BlockState growth = ModBlocks.crystal_growth_aura.getDefaultState();
BlockState growth = ModBlocks.crystal_growth_aura.get().getDefaultState();

label48:
for(int i = 0; i < 128; ++i) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import javax.annotation.Nullable;
import java.util.List;
import java.util.Map;
import java.util.function.Supplier;

public class PurifierTileEntity extends LockableTileEntity implements ISidedInventory, IRecipeHolder, IRecipeHelperPopulator, ITickableTileEntity {

Expand Down Expand Up @@ -115,10 +114,10 @@ public static Map<Item, Integer> getThirdFuelBurnTime() {
Map<Item, Integer> map = Maps.newLinkedHashMap();
addItemToMap(map, ModItems.bismuth_residue.get(), 200);
addItemToMap(map, ModItems.bismuth_crystal.get(), 1800);
addItemToMap(map, ModBlocks.bismuth_block, 16200);
addItemToMap(map, ModBlocks.bismuth_block.get(), 16200);
addItemToMap(map, ModItems.black_residue.get(), 100);
addItemToMap(map, ModItems.tektite.get(), 900);
addItemToMap(map, ModBlocks.tektite_block, 8100);
addItemToMap(map, ModBlocks.tektite_block.get(), 8100);
return map;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,11 @@ public static Map<Item, Integer> getFuelBurnTime() {
addItemToMap(map, Blocks.GOLD_BLOCK, 2000);
addItemToMap(map, Blocks.GOLD_ORE, 150);
addItemToMap(map, ModItems.pyrite.get(), 500);
addItemToMap(map, ModBlocks.pyrite_block, 5000);
addItemToMap(map, ModBlocks.pyrite_block.get(), 5000);
addItemToMap(map, ModItems.sweet_muckball.get(), 250);
addItemToMap(map, ModBlocks.frail_glitter_block, 1000);
addItemToMap(map, ModBlocks.thick_glitter_block, 2000);
addItemToMap(map, ModBlocks.gummy_glitter_block, 4000);
addItemToMap(map, ModBlocks.frail_glitter_block.get(), 1000);
addItemToMap(map, ModBlocks.thick_glitter_block.get(), 2000);
addItemToMap(map, ModBlocks.gummy_glitter_block.get(), 4000);
addItemToMap(map, Items.BLAZE_POWDER, 1200);
addItemToMap(map, Items.BLAZE_ROD, 2400);
return map;
Expand All @@ -144,10 +144,10 @@ public static Map<Item, Integer> getSecondFuelBurnTime() {
Map<Item, Integer> map = Maps.newLinkedHashMap();
addItemToMap(map, ModItems.pink_essence.get(), 100);
addItemToMap(map, ModItems.pink_goo.get(), 900);
addItemToMap(map, ModBlocks.pink_sludge_block, 8100);
addItemToMap(map, ModBlocks.pink_sludge_block.get(), 8100);
addItemToMap(map, ModItems.aura_residue.get(), 200);
addItemToMap(map, ModItems.aura_cluster.get(), 1800);
addItemToMap(map, ModBlocks.aura_block, 16200);
addItemToMap(map, ModBlocks.aura_block.get(), 16200);
return map;
}

Expand Down
Loading

0 comments on commit 81ed6e8

Please sign in to comment.