net.minecraft.block.entity.BlockEntityType Java Examples

The following examples show how to use net.minecraft.block.entity.BlockEntityType. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SandboxHooks.java    From Sandbox with GNU Lesser General Public License v3.0 6 votes vote down vote up
public static void setupGlobal() {
    Set<String> supportedMods = Sets.newHashSet("minecraft", "sandbox", "sandboxapi", "fabricloader");
    Sandbox.unsupportedModsLoaded = FabricLoader.getInstance().getAllMods().stream()
            .map(ModContainer::getMetadata)
            .map(ModMetadata::getId)
            .anyMatch(((Predicate<String>) supportedMods::contains).negate());
    Policy.setPolicy(new AddonSecurityPolicy());

    Registry.REGISTRIES.add(new Identifier("sandbox", "container"), SandboxRegistries.CONTAINER_FACTORIES);

    ((SandboxInternal.Registry) Registry.BLOCK).set(new BasicRegistry<>(Registry.BLOCK, Block.class, WrappingUtil::convert, WrappingUtil::convert));
    ((SandboxInternal.Registry) Registry.ITEM).set(new BasicRegistry<>(Registry.ITEM, Item.class, WrappingUtil::convert, WrappingUtil::convert));
    ((SandboxInternal.Registry) Registry.ENCHANTMENT).set(new BasicRegistry<>((SimpleRegistry<net.minecraft.enchantment.Enchantment>) Registry.ENCHANTMENT, Enchantment.class, WrappingUtil::convert, b -> (Enchantment) b));
    ((SandboxInternal.Registry) Registry.FLUID).set(new BasicRegistry<>(Registry.FLUID, Fluid.class, WrappingUtil::convert, WrappingUtil::convert));
    ((SandboxInternal.Registry) Registry.ENTITY_TYPE).set(new BasicRegistry<>(Registry.ENTITY_TYPE, Entity.Type.class, WrappingUtil::convert, WrappingUtil::convert));
    ((SandboxInternal.Registry) Registry.BLOCK_ENTITY).set(new BasicRegistry((SimpleRegistry) Registry.BLOCK_ENTITY, BlockEntity.Type.class, (Function<BlockEntity.Type, BlockEntityType>) WrappingUtil::convert, (Function<BlockEntityType, BlockEntity.Type>) WrappingUtil::convert, true)); // DONT TOUCH THIS FOR HEAVENS SAKE PLEASE GOD NO
    ((SandboxInternal.Registry) SandboxRegistries.CONTAINER_FACTORIES).set(new BasicRegistry<>(SandboxRegistries.CONTAINER_FACTORIES, ContainerFactory.class, a -> a, a -> a));
}
 
Example #2
Source File: Protocol_1_13_2.java    From multiconnect with MIT License 5 votes vote down vote up
private void mutateBlockEntityRegistry(ISimpleRegistry<BlockEntityType<?>> registry) {
    registry.unregister(BlockEntityType.BARREL);
    registry.unregister(BlockEntityType.SMOKER);
    registry.unregister(BlockEntityType.BLAST_FURNACE);
    registry.unregister(BlockEntityType.LECTERN);
    registry.unregister(BlockEntityType.BELL);
    registry.unregister(BlockEntityType.JIGSAW);
    registry.unregister(BlockEntityType.CAMPFIRE);
}
 
Example #3
Source File: LibGuiTest.java    From LibGui with MIT License 5 votes vote down vote up
@Override
public void onInitialize() {
	Registry.register(Registry.ITEM, new Identifier(MODID, "client_gui"), new GuiItem());
	
	GUI_BLOCK = new GuiBlock();
	Registry.register(Registry.BLOCK, new Identifier(MODID, "gui"), GUI_BLOCK);
	GUI_BLOCK_ITEM = new BlockItem(GUI_BLOCK, new Item.Settings().group(ItemGroup.MISC));
	Registry.register(Registry.ITEM, new Identifier(MODID, "gui"), GUI_BLOCK_ITEM);
	GUI_BLOCKENTITY_TYPE = BlockEntityType.Builder.create(GuiBlockEntity::new, GUI_BLOCK).build(null);
	Registry.register(Registry.BLOCK_ENTITY_TYPE, new Identifier(MODID, "gui"), GUI_BLOCKENTITY_TYPE);
	
	GUI_SCREEN_HANDLER_TYPE = ScreenHandlerRegistry.registerSimple(new Identifier(MODID, "gui"), (int syncId, PlayerInventory inventory) -> {
		return new TestDescription(GUI_SCREEN_HANDLER_TYPE, syncId, inventory, ScreenHandlerContext.EMPTY);
	});

	Optional<ModContainer> containerOpt = FabricLoader.getInstance().getModContainer("jankson");
	if (containerOpt.isPresent()) {
		ModContainer jankson = containerOpt.get();
		System.out.println("Jankson root path: "+jankson.getRootPath());
		try {
			Files.list(jankson.getRootPath()).forEach((path)->{
				path.getFileSystem().getFileStores().forEach((store)->{
					System.out.println("        Filestore: "+store.name());
				});
				System.out.println("    "+path.toAbsolutePath());
			});
		} catch (IOException e) {
			e.printStackTrace();
		}
		Path modJson = jankson.getPath("/fabric.mod.json");
		System.out.println("Jankson fabric.mod.json path: "+modJson);
		System.out.println(Files.exists(modJson) ? "Exists" : "Does Not Exist");
	} else {
		System.out.println("Container isn't present!");
	}
}
 
Example #4
Source File: MixinBlockEntityType.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
@Override
public IForgeRegistryEntry<BlockEntityType> setRegistryName(Identifier name) {
	this.registryName = name;

	return this;
}
 
Example #5
Source File: PonySkullRenderer.java    From MineLittlePony with MIT License 4 votes vote down vote up
public static void resolve(boolean ponySkulls) {
    Mson.getInstance().getEntityRendererRegistry().registerBlockRenderer(BlockEntityType.SKULL,
            ponySkulls ? PonySkullRenderer::new : SkullBlockEntityRenderer::new
    );
}
 
Example #6
Source File: AbstractFurnaceBlockEntityMixin_RealTime.java    From Galaxy with GNU Affero General Public License v3.0 4 votes vote down vote up
public AbstractFurnaceBlockEntityMixin_RealTime(BlockEntityType<?> blockEntityType_1) {
    super(blockEntityType_1);
}
 
Example #7
Source File: BrewingStandBlockEntityMixin_RealTime.java    From Galaxy with GNU Affero General Public License v3.0 4 votes vote down vote up
public BrewingStandBlockEntityMixin_RealTime(BlockEntityType<?> blockEntityType_1) {
    super(blockEntityType_1);
}
 
Example #8
Source File: HopperBlockEntityMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
protected HopperBlockEntityMixin(BlockEntityType<?> blockEntityType_1) {
    super(blockEntityType_1);
}
 
Example #9
Source File: PistonBlockEntity_movableTEMixin.java    From fabric-carpet with MIT License 4 votes vote down vote up
public PistonBlockEntity_movableTEMixin(BlockEntityType<?> blockEntityType_1)
{
    super(blockEntityType_1);
}
 
Example #10
Source File: MixinBlockEntity.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Shadow
public abstract BlockEntityType<?> getType();
 
Example #11
Source File: MixinHopperBlockEntity.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
public MixinHopperBlockEntity(BlockEntityType<?> blockEntityType_1) {
    super(blockEntityType_1);
}
 
Example #12
Source File: FunctionsImpl.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public <T extends BlockEntity> BlockEntity.Type<T> blockEntityTypeFunction(Supplier<T> s, Block[] b) {
    return (BlockEntity.Type) BlockEntityType.Builder.create((Supplier) () -> WrappingUtil.convert(s.get()), WrappingUtil.convert(b)).build(null);
}
 
Example #13
Source File: WrappingUtil.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static BlockEntity.Type convert(BlockEntityType type) {
    return cast(type, BlockEntity.Type.class);
}
 
Example #14
Source File: WrappingUtil.java    From Sandbox with GNU Lesser General Public License v3.0 4 votes vote down vote up
public static BlockEntityType convert(BlockEntity.Type type) {
    return cast(type, BlockEntityType.class);
}
 
Example #15
Source File: MixinBlockEntityType.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Class<BlockEntityType> getRegistryType() {
	return BlockEntityType.class;
}
 
Example #16
Source File: MixinBlockEntityType.java    From patchwork-api with GNU Lesser General Public License v2.1 4 votes vote down vote up
public Identifier getRegistryName() {
	BlockEntityType<?> blockEntityType = (BlockEntityType<?>) (Object) this;

	return Identifiers.getOrFallback(Registry.BLOCK_ENTITY, blockEntityType, registryName);
}
 
Example #17
Source File: ConfigurableElectricMachineBlockEntity.java    From Galacticraft-Rewoven with MIT License 4 votes vote down vote up
public ConfigurableElectricMachineBlockEntity(BlockEntityType<? extends ConfigurableElectricMachineBlockEntity> blockEntityType) {
    super(blockEntityType);
    capacitorComponent.getListeners().add(this::markDirty);
    this.inventory.getListeners().add(this::markDirty);
}
 
Example #18
Source File: DispenserBlockEntity_craftingMixin.java    From carpet-extra with GNU Lesser General Public License v3.0 4 votes vote down vote up
protected DispenserBlockEntity_craftingMixin(BlockEntityType<?> blockEntityType_1)
{
    super(blockEntityType_1);
}
 
Example #19
Source File: MixinSkullBlockEntity.java    From multiconnect with MIT License 4 votes vote down vote up
public MixinSkullBlockEntity(BlockEntityType<?> type) {
    super(type);
}
 
Example #20
Source File: MixinBedBlockEntity.java    From multiconnect with MIT License 4 votes vote down vote up
public MixinBedBlockEntity(BlockEntityType<?> type) {
    super(type);
}
 
Example #21
Source File: MixinBannerBlockEntity.java    From multiconnect with MIT License 4 votes vote down vote up
public MixinBannerBlockEntity(BlockEntityType<?> type) {
    super(type);
}
 
Example #22
Source File: BlockEntities_1_12_2.java    From multiconnect with MIT License 4 votes vote down vote up
public static void registerBlockEntities(ISimpleRegistry<BlockEntityType<?>> registry) {
    registry.unregister(BlockEntityType.CONDUIT);
    AbstractProtocol.insertAfter(registry, BlockEntityType.MOB_SPAWNER, NOTE_BLOCK, "noteblock");
    AbstractProtocol.insertAfter(registry, BlockEntityType.COMPARATOR, FLOWER_POT, "flower_pot");
}
 
Example #23
Source File: Protocol_1_14_4.java    From multiconnect with MIT License 4 votes vote down vote up
private void mutateBlockEntityTypeRegistry(ISimpleRegistry<BlockEntityType<?>> registry) {
    registry.unregister(BlockEntityType.BEEHIVE);
}
 
Example #24
Source File: Protocol_1_10.java    From multiconnect with MIT License 4 votes vote down vote up
private void mutateBlockEntityTypeRegistry(ISimpleRegistry<BlockEntityType<?>> registry) {
    registry.purge(BlockEntityType.SHULKER_BOX);
}
 
Example #25
Source File: SignBlockEntityMixin.java    From Wurst7 with GNU General Public License v3.0 4 votes vote down vote up
public SignBlockEntityMixin(WurstClient wurst, BlockEntityType<?> type)
{
	super(type);
}
 
Example #26
Source File: BlockEntityTypeMixin.java    From the-hallow with MIT License 4 votes vote down vote up
@Inject(method = "supports(Lnet/minecraft/block/Block;)Z", at = @At("HEAD"), cancellable = true)
private void supports(Block block, CallbackInfoReturnable<Boolean> info) {
	if (BlockEntityType.SIGN.equals((Object) this) && block instanceof HallowedSign) {
		info.setReturnValue(true);
	}
}
 
Example #27
Source File: HallowedBlockEntities.java    From the-hallow with MIT License 4 votes vote down vote up
private static <B extends BlockEntity> BlockEntityType<B> register(String name, Supplier<B> supplier, Block... supportedBlocks) {
	return Registry.register(Registry.BLOCK_ENTITY_TYPE, TheHallow.id(name), BlockEntityType.Builder.create(supplier, supportedBlocks).build(null));
}