Skip to content

Commit

Permalink
Allow addons to extend GridBlock (#2666)
Browse files Browse the repository at this point in the history
* create GridBlocks with static initializer

* Make constructor take RL instead.
  • Loading branch information
Darkere authored Aug 30, 2020
1 parent 9f2fab6 commit d9d5616
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
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;
Expand All @@ -23,12 +24,11 @@
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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
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;
Expand Down Expand Up @@ -158,10 +159,10 @@ public void onRegisterBlocks(RegistryEvent.Register<Block> e) {
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));
Expand Down

0 comments on commit d9d5616

Please sign in to comment.