Allow addons to extend GridBlock (#2666)

* create GridBlocks with static initializer

* Make constructor take RL instead.
This commit is contained in:
Darkere
2020-08-30 19:48:49 +02:00
committed by GitHub
parent 9f2fab67a5
commit d9d5616469
2 changed files with 8 additions and 7 deletions

View File

@@ -13,6 +13,7 @@ import net.minecraft.entity.player.ServerPlayerEntity;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.ActionResultType;
import net.minecraft.util.Hand;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.world.IBlockReader;
@@ -23,12 +24,11 @@ import javax.annotation.Nullable;
public class GridBlock extends NetworkNodeBlock {
private final GridType type;
public GridBlock(GridType type) {
public GridBlock(GridType type, ResourceLocation registryName) {
super(BlockUtils.DEFAULT_ROCK_PROPERTIES);
this.type = type;
this.setRegistryName(RS.ID, type == GridType.NORMAL ? "grid" : type.getString() + "_grid");
setRegistryName(registryName);
}
@Override

View File

@@ -51,6 +51,7 @@ import net.minecraft.item.crafting.IRecipeSerializer;
import net.minecraft.nbt.CompoundNBT;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.common.extensions.IForgeContainerType;
import net.minecraftforge.event.RegistryEvent;
@@ -158,10 +159,10 @@ public class CommonSetup {
e.getRegistry().register(new MachineCasingBlock());
e.getRegistry().register(new CableBlock());
e.getRegistry().register(new DiskDriveBlock());
e.getRegistry().register(new GridBlock(GridType.NORMAL));
e.getRegistry().register(new GridBlock(GridType.CRAFTING));
e.getRegistry().register(new GridBlock(GridType.PATTERN));
e.getRegistry().register(new GridBlock(GridType.FLUID));
e.getRegistry().register(new GridBlock(GridType.NORMAL, new ResourceLocation(RS.ID, "grid")));
e.getRegistry().register(new GridBlock(GridType.CRAFTING, new ResourceLocation(RS.ID, GridType.CRAFTING.getString() + "_grid")));
e.getRegistry().register(new GridBlock(GridType.PATTERN, new ResourceLocation(RS.ID, GridType.PATTERN.getString() + "_grid")));
e.getRegistry().register(new GridBlock(GridType.FLUID, new ResourceLocation(RS.ID, GridType.FLUID.getString() + "_grid")));
for (ItemStorageType type : ItemStorageType.values()) {
e.getRegistry().register(new StorageBlock(type));