Support
Quality
Security
License
Reuse
kandi has reviewed MinecraftForge and discovered the below as its top functions. This is intended to give you an instant insight into MinecraftForge implemented functionality, and help decide if they suit your requirements.
Modifications to the Minecraft base files to assist in compatibility between mods.
no instance(s) of type variable(s) T exist so that Block conforms to Supplier<T>
public static RegistryObject<Block> SMOOTH_BRICK = register("smooth_brick",
new Block(BlockBehaviour.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2f,6f)));
public static RegistryObject<Block> SMOOTH_BRICK = register("smooth_brick",
() -> new Block(BlockBehaviour.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2f,6f)));
-----------------------
public static RegistryObject<Block> SMOOTH_BRICK = register("smooth_brick",
new Block(BlockBehaviour.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2f,6f)));
public static RegistryObject<Block> SMOOTH_BRICK = register("smooth_brick",
() -> new Block(BlockBehaviour.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2f,6f)));
Missing type arguments for generic class in Java?
public class SpiderRenderer<T extends SpiderEntity>
public class VariantSpiderRenderer<T> extends SpiderRenderer<T>
public class VariantSpiderRenderer<T extends SpiderEntity> extends SpiderRenderer<T>
-----------------------
public class SpiderRenderer<T extends SpiderEntity>
public class VariantSpiderRenderer<T> extends SpiderRenderer<T>
public class VariantSpiderRenderer<T extends SpiderEntity> extends SpiderRenderer<T>
-----------------------
public class SpiderRenderer<T extends SpiderEntity>
public class VariantSpiderRenderer<T> extends SpiderRenderer<T>
public class VariantSpiderRenderer<T extends SpiderEntity> extends SpiderRenderer<T>
building mod does not include mcmod.info (1.12.2)
apply plugin: 'idea'
idea {
module {
inheritOutputDirs = true
}
}
subprojects {
apply plugin: 'idea'
}
task prepareAssets(type: Copy) {
group = 'build'
from project.file('src/main/resources')
into project.file('build/classes/java/main')
}
classes.dependsOn(prepareAssets)
Registering entity rendering handler with Minecraft Forge 1.16.5
RenderingRegistry.registerEntityRenderingHandler(GlowCowEntity.class, new GlowCowRender.RenderFactory());
RenderingRegistry.registerEntityRenderingHandler((EntityType<GlowCowEntity>) MyEntities.GLOW_COW_ENTITY, GlowCowRender::new);
-----------------------
RenderingRegistry.registerEntityRenderingHandler(GlowCowEntity.class, new GlowCowRender.RenderFactory());
RenderingRegistry.registerEntityRenderingHandler((EntityType<GlowCowEntity>) MyEntities.GLOW_COW_ENTITY, GlowCowRender::new);
Capabilities stopped saving forge 1.12.2
//somewhere global variable
public static final EnumFacing capaSide = EnumFacing.UP;
public class StatusStorage implements Capability.IStorage<IStatus>
{
@Override
public NBTBase writeNBT(Capability<IStatus> capability, IStatus instance, EnumFacing side)
{
if(side == capaSide){
//regular logic
} else
return new NBTTagCompound(); //otherwise empty, null is not supported
}
@Override
public void readNBT(Capability<IStatus> capability, IStatus instance, EnumFacing side, NBTBase nbt)
{
if(side == capaSide){
//regular logic
} //otherwise ignore
}
}
public class StatusProvider implements ICapabilitySerializable<NBTBase>
{
@CapabilityInject(IStatus.class)
public static final Capability<IStatus> STATUS_CAP = null;
private IStatus instance = STATUS_CAP.getDefaultInstance();
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
{
return capability == STATUS_CAP && facing == capaSide; //check side
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
{ //check side
return hasCapability(capability, facing) ? STATUS_CAP.<T> cast(this.instance) : null;
}
@Override
public NBTBase serializeNBT()
{ //pass valid side
return STATUS_CAP.getStorage().writeNBT(STATUS_CAP, this.instance, capaSide);
}
@Override
public void deserializeNBT(NBTBase nbt)
{ //pass valid side
STATUS_CAP.getStorage().readNBT(STATUS_CAP, this.instance, capaSide, nbt);
}
}
public class EventHandler
{
@SubscribeEvent
public void onPlayerAttack(AttackEntityEvent event)
{
... //pass valid side
IStatus status = player.getCapability(StatusProvider.STATUS_CAP, capaSide);
...
}
}
-----------------------
//somewhere global variable
public static final EnumFacing capaSide = EnumFacing.UP;
public class StatusStorage implements Capability.IStorage<IStatus>
{
@Override
public NBTBase writeNBT(Capability<IStatus> capability, IStatus instance, EnumFacing side)
{
if(side == capaSide){
//regular logic
} else
return new NBTTagCompound(); //otherwise empty, null is not supported
}
@Override
public void readNBT(Capability<IStatus> capability, IStatus instance, EnumFacing side, NBTBase nbt)
{
if(side == capaSide){
//regular logic
} //otherwise ignore
}
}
public class StatusProvider implements ICapabilitySerializable<NBTBase>
{
@CapabilityInject(IStatus.class)
public static final Capability<IStatus> STATUS_CAP = null;
private IStatus instance = STATUS_CAP.getDefaultInstance();
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
{
return capability == STATUS_CAP && facing == capaSide; //check side
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
{ //check side
return hasCapability(capability, facing) ? STATUS_CAP.<T> cast(this.instance) : null;
}
@Override
public NBTBase serializeNBT()
{ //pass valid side
return STATUS_CAP.getStorage().writeNBT(STATUS_CAP, this.instance, capaSide);
}
@Override
public void deserializeNBT(NBTBase nbt)
{ //pass valid side
STATUS_CAP.getStorage().readNBT(STATUS_CAP, this.instance, capaSide, nbt);
}
}
public class EventHandler
{
@SubscribeEvent
public void onPlayerAttack(AttackEntityEvent event)
{
... //pass valid side
IStatus status = player.getCapability(StatusProvider.STATUS_CAP, capaSide);
...
}
}
-----------------------
//somewhere global variable
public static final EnumFacing capaSide = EnumFacing.UP;
public class StatusStorage implements Capability.IStorage<IStatus>
{
@Override
public NBTBase writeNBT(Capability<IStatus> capability, IStatus instance, EnumFacing side)
{
if(side == capaSide){
//regular logic
} else
return new NBTTagCompound(); //otherwise empty, null is not supported
}
@Override
public void readNBT(Capability<IStatus> capability, IStatus instance, EnumFacing side, NBTBase nbt)
{
if(side == capaSide){
//regular logic
} //otherwise ignore
}
}
public class StatusProvider implements ICapabilitySerializable<NBTBase>
{
@CapabilityInject(IStatus.class)
public static final Capability<IStatus> STATUS_CAP = null;
private IStatus instance = STATUS_CAP.getDefaultInstance();
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
{
return capability == STATUS_CAP && facing == capaSide; //check side
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
{ //check side
return hasCapability(capability, facing) ? STATUS_CAP.<T> cast(this.instance) : null;
}
@Override
public NBTBase serializeNBT()
{ //pass valid side
return STATUS_CAP.getStorage().writeNBT(STATUS_CAP, this.instance, capaSide);
}
@Override
public void deserializeNBT(NBTBase nbt)
{ //pass valid side
STATUS_CAP.getStorage().readNBT(STATUS_CAP, this.instance, capaSide, nbt);
}
}
public class EventHandler
{
@SubscribeEvent
public void onPlayerAttack(AttackEntityEvent event)
{
... //pass valid side
IStatus status = player.getCapability(StatusProvider.STATUS_CAP, capaSide);
...
}
}
-----------------------
//somewhere global variable
public static final EnumFacing capaSide = EnumFacing.UP;
public class StatusStorage implements Capability.IStorage<IStatus>
{
@Override
public NBTBase writeNBT(Capability<IStatus> capability, IStatus instance, EnumFacing side)
{
if(side == capaSide){
//regular logic
} else
return new NBTTagCompound(); //otherwise empty, null is not supported
}
@Override
public void readNBT(Capability<IStatus> capability, IStatus instance, EnumFacing side, NBTBase nbt)
{
if(side == capaSide){
//regular logic
} //otherwise ignore
}
}
public class StatusProvider implements ICapabilitySerializable<NBTBase>
{
@CapabilityInject(IStatus.class)
public static final Capability<IStatus> STATUS_CAP = null;
private IStatus instance = STATUS_CAP.getDefaultInstance();
@Override
public boolean hasCapability(Capability<?> capability, EnumFacing facing)
{
return capability == STATUS_CAP && facing == capaSide; //check side
}
@Override
public <T> T getCapability(Capability<T> capability, EnumFacing facing)
{ //check side
return hasCapability(capability, facing) ? STATUS_CAP.<T> cast(this.instance) : null;
}
@Override
public NBTBase serializeNBT()
{ //pass valid side
return STATUS_CAP.getStorage().writeNBT(STATUS_CAP, this.instance, capaSide);
}
@Override
public void deserializeNBT(NBTBase nbt)
{ //pass valid side
STATUS_CAP.getStorage().readNBT(STATUS_CAP, this.instance, capaSide, nbt);
}
}
public class EventHandler
{
@SubscribeEvent
public void onPlayerAttack(AttackEntityEvent event)
{
... //pass valid side
IStatus status = player.getCapability(StatusProvider.STATUS_CAP, capaSide);
...
}
}
-----------------------
public abstract class MessageBase<REQ extends IMessage> implements IMessage, IMessageHandler<REQ, REQ>{
@Override
public REQ onMessage(REQ message, MessageContext ctx){
if(ctx.side == Side.SERVER)
{
handleServerSide(message, ctx.getServerHandler().player);
} else
{
EntityPlayer player = ClientThings.getPlayer();
if(player != null)
{
handleClientSide(message, player);
}
}
return null;
}
public abstract void handleClientSide(REQ message, EntityPlayer player);
public abstract void handleServerSide(REQ message, EntityPlayer player);
}
public class MessageCap extends MessageBase<MessageCap>
{
private IExampleCapability capability = new Capability();
private EntityPlayer player;
@Override
public void handleClientSide(MessageCap message, EntityPlayer player)
{
IExampleCapability capability = message.cap;
if (player != null)
{
IExampleCapability old = player.getCapability(CapabilityProvider.CAPABILITY_CAP, Capability.capSide);
old.setSomeInt(capability.getSomeInt(0));
}
}
@Override
public void handleServerSide(MessageCap message, EntityPlayer player)
{
EntityPlayerMP playerMP = (EntityPlayerMP)player;
IExampleCapability capibility = message.cap;
IExampleCapability old = playerMP.getCapability(CapabilityProvider.CAPABILITY_CAP, Capability.capSide);
old.setSomeInt(capability.getSomeInt());
}
@Override
public void fromBytes(ByteBuf buf)
{
if(buf.isReadable())
{
cap.setSomeInt = buf.readInt();
}
}
public MessageCap(IExampleCapability cap, EntityPlayer player)
{
this.cap = cap;
this.player = player;
}
public MessageCap()
{
}
}
public class NetworkHandler
{
private static SimpleNetworkWrapper INSTANCE;
private static SimpleNetworkWrapper INSTANCE_2;
public static void init()
{
INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID);
INSTANCE.registerMessage(MessageCap.class, MessageCap.class, 0, Side.SERVER);
INSTANCE_2 = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID + "_client");
INSTANCE_2.registerMessage(MessageCap.class, MessageCap.class, 0, Side.CLIENT);
}
public static void sendToServer(IMessage message)
{
INSTANCE.sendToServer(message);
}
public static void refreshThing(IMessage message, EntityPlayerMP player)
{
INSTANCE_2.sendTo(message, player);
}
}
-----------------------
public abstract class MessageBase<REQ extends IMessage> implements IMessage, IMessageHandler<REQ, REQ>{
@Override
public REQ onMessage(REQ message, MessageContext ctx){
if(ctx.side == Side.SERVER)
{
handleServerSide(message, ctx.getServerHandler().player);
} else
{
EntityPlayer player = ClientThings.getPlayer();
if(player != null)
{
handleClientSide(message, player);
}
}
return null;
}
public abstract void handleClientSide(REQ message, EntityPlayer player);
public abstract void handleServerSide(REQ message, EntityPlayer player);
}
public class MessageCap extends MessageBase<MessageCap>
{
private IExampleCapability capability = new Capability();
private EntityPlayer player;
@Override
public void handleClientSide(MessageCap message, EntityPlayer player)
{
IExampleCapability capability = message.cap;
if (player != null)
{
IExampleCapability old = player.getCapability(CapabilityProvider.CAPABILITY_CAP, Capability.capSide);
old.setSomeInt(capability.getSomeInt(0));
}
}
@Override
public void handleServerSide(MessageCap message, EntityPlayer player)
{
EntityPlayerMP playerMP = (EntityPlayerMP)player;
IExampleCapability capibility = message.cap;
IExampleCapability old = playerMP.getCapability(CapabilityProvider.CAPABILITY_CAP, Capability.capSide);
old.setSomeInt(capability.getSomeInt());
}
@Override
public void fromBytes(ByteBuf buf)
{
if(buf.isReadable())
{
cap.setSomeInt = buf.readInt();
}
}
public MessageCap(IExampleCapability cap, EntityPlayer player)
{
this.cap = cap;
this.player = player;
}
public MessageCap()
{
}
}
public class NetworkHandler
{
private static SimpleNetworkWrapper INSTANCE;
private static SimpleNetworkWrapper INSTANCE_2;
public static void init()
{
INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID);
INSTANCE.registerMessage(MessageCap.class, MessageCap.class, 0, Side.SERVER);
INSTANCE_2 = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID + "_client");
INSTANCE_2.registerMessage(MessageCap.class, MessageCap.class, 0, Side.CLIENT);
}
public static void sendToServer(IMessage message)
{
INSTANCE.sendToServer(message);
}
public static void refreshThing(IMessage message, EntityPlayerMP player)
{
INSTANCE_2.sendTo(message, player);
}
}
-----------------------
public abstract class MessageBase<REQ extends IMessage> implements IMessage, IMessageHandler<REQ, REQ>{
@Override
public REQ onMessage(REQ message, MessageContext ctx){
if(ctx.side == Side.SERVER)
{
handleServerSide(message, ctx.getServerHandler().player);
} else
{
EntityPlayer player = ClientThings.getPlayer();
if(player != null)
{
handleClientSide(message, player);
}
}
return null;
}
public abstract void handleClientSide(REQ message, EntityPlayer player);
public abstract void handleServerSide(REQ message, EntityPlayer player);
}
public class MessageCap extends MessageBase<MessageCap>
{
private IExampleCapability capability = new Capability();
private EntityPlayer player;
@Override
public void handleClientSide(MessageCap message, EntityPlayer player)
{
IExampleCapability capability = message.cap;
if (player != null)
{
IExampleCapability old = player.getCapability(CapabilityProvider.CAPABILITY_CAP, Capability.capSide);
old.setSomeInt(capability.getSomeInt(0));
}
}
@Override
public void handleServerSide(MessageCap message, EntityPlayer player)
{
EntityPlayerMP playerMP = (EntityPlayerMP)player;
IExampleCapability capibility = message.cap;
IExampleCapability old = playerMP.getCapability(CapabilityProvider.CAPABILITY_CAP, Capability.capSide);
old.setSomeInt(capability.getSomeInt());
}
@Override
public void fromBytes(ByteBuf buf)
{
if(buf.isReadable())
{
cap.setSomeInt = buf.readInt();
}
}
public MessageCap(IExampleCapability cap, EntityPlayer player)
{
this.cap = cap;
this.player = player;
}
public MessageCap()
{
}
}
public class NetworkHandler
{
private static SimpleNetworkWrapper INSTANCE;
private static SimpleNetworkWrapper INSTANCE_2;
public static void init()
{
INSTANCE = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID);
INSTANCE.registerMessage(MessageCap.class, MessageCap.class, 0, Side.SERVER);
INSTANCE_2 = NetworkRegistry.INSTANCE.newSimpleChannel(Reference.MODID + "_client");
INSTANCE_2.registerMessage(MessageCap.class, MessageCap.class, 0, Side.CLIENT);
}
public static void sendToServer(IMessage message)
{
INSTANCE.sendToServer(message);
}
public static void refreshThing(IMessage message, EntityPlayerMP player)
{
INSTANCE_2.sendTo(message, player);
}
}
'Annotations are not allowed here'
@SidedProxy(...)
public static CommonProxy proxy;
Forge 1.12.2 Coremodding: java.lang.StringIndexOutOfBoundsException
toInsert.add(
new MethodInsnNode(INVOKEVIRTUAL, "mcjty/lostcities/dimensions/world/lost/BuildingInfo",
"floorsBelowGround", "I", false));
How can I add a margin between a li and the border of a container div?
#projects {
margin: 25px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
border: 2px solid #FF7F00;
max-width: 50%;
padding-right: 3%;
}
li.projects {
padding: 20px;
}
#projects-title {
margin-top: 20px;
}
<div id="projects">
<h3 id="projects-title">Some of my projects!</h3>
<ul>
<Project name="RubyMod" href="https://github.com/theonlytails/rubymod">
An free and open source mod for <a href="https://minecraft.net">Minecraft</a> 1.16, written in Kotlin using the <a href="https://github.com/MinecraftForge/MinecraftForge">Minecraft Forge API</a>.
</Project>
<Project name="LootTables" href="https://github.com/theonlytails/loottables">
A Kotlin DSL for creating loot tables in Minecraft mods (using Forge).
</Project>
<Project name="Cryptic Cosmos" href="https://github.com/Team-Cryptic-Cosmos/Cryptic-Cosmos">
Minecraft mod for 1.16 that introduces exciting new dimensions, mobs, and blocks, made by the <a href="https://github.com/Team-Cryptic-Cosmos">Cryptic Cosmos Team</a>.
</Project>
<Project name="This website" href="https://github.com/theonlytails/theonlytails.com">
<i>You are looking at it</i>. Built with <a href="https://svelte.dev">Svelte</a>, <a href="https://www.typescriptlang.org/">TypeScript</a>, and <a href="https://sass-lang.com/">Sass</a>.
</Project>
</ul>
</div>
-----------------------
#projects {
margin: 25px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
border: 2px solid #FF7F00;
max-width: 50%;
padding-right: 3%;
}
li.projects {
padding: 20px;
}
#projects-title {
margin-top: 20px;
}
<div id="projects">
<h3 id="projects-title">Some of my projects!</h3>
<ul>
<Project name="RubyMod" href="https://github.com/theonlytails/rubymod">
An free and open source mod for <a href="https://minecraft.net">Minecraft</a> 1.16, written in Kotlin using the <a href="https://github.com/MinecraftForge/MinecraftForge">Minecraft Forge API</a>.
</Project>
<Project name="LootTables" href="https://github.com/theonlytails/loottables">
A Kotlin DSL for creating loot tables in Minecraft mods (using Forge).
</Project>
<Project name="Cryptic Cosmos" href="https://github.com/Team-Cryptic-Cosmos/Cryptic-Cosmos">
Minecraft mod for 1.16 that introduces exciting new dimensions, mobs, and blocks, made by the <a href="https://github.com/Team-Cryptic-Cosmos">Cryptic Cosmos Team</a>.
</Project>
<Project name="This website" href="https://github.com/theonlytails/theonlytails.com">
<i>You are looking at it</i>. Built with <a href="https://svelte.dev">Svelte</a>, <a href="https://www.typescriptlang.org/">TypeScript</a>, and <a href="https://sass-lang.com/">Sass</a>.
</Project>
</ul>
</div>
-----------------------
#projects {
margin: 25px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
border: 2px solid #FF7F00;
max-width: 50%;
}
li.projects {
padding: 20px;
}
#projects-title {
margin-top: 20px;
}
#projects-list {
padding: 10px
}
<div id="projects">
<h3 id="projects-title">Some of my projects!</h3>
<ul id='projects-list'>
<Project name="RubyMod" href="https://github.com/theonlytails/rubymod">
An free and open source mod for <a href="https://minecraft.net">Minecraft</a> 1.16, written in Kotlin using the <a href="https://github.com/MinecraftForge/MinecraftForge">Minecraft Forge API</a>.
</Project>
<Project name="LootTables" href="https://github.com/theonlytails/loottables">
A Kotlin DSL for creating loot tables in Minecraft mods (using Forge).
</Project>
<Project name="Cryptic Cosmos" href="https://github.com/Team-Cryptic-Cosmos/Cryptic-Cosmos">
Minecraft mod for 1.16 that introduces exciting new dimensions, mobs, and blocks, made by the <a href="https://github.com/Team-Cryptic-Cosmos">Cryptic Cosmos Team</a>.
</Project>
<Project name="This website" href="https://github.com/theonlytails/theonlytails.com">
<i>You are looking at it</i>. Built with <a href="https://svelte.dev">Svelte</a>, <a href="https://www.typescriptlang.org/">TypeScript</a>, and <a href="https://sass-lang.com/">Sass</a>.
</Project>
</ul>
</div>
-----------------------
#projects {
margin: 25px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
border: 2px solid #FF7F00;
max-width: 50%;
}
li.projects {
padding: 20px;
}
#projects-title {
margin-top: 20px;
}
#projects-list {
padding: 10px
}
<div id="projects">
<h3 id="projects-title">Some of my projects!</h3>
<ul id='projects-list'>
<Project name="RubyMod" href="https://github.com/theonlytails/rubymod">
An free and open source mod for <a href="https://minecraft.net">Minecraft</a> 1.16, written in Kotlin using the <a href="https://github.com/MinecraftForge/MinecraftForge">Minecraft Forge API</a>.
</Project>
<Project name="LootTables" href="https://github.com/theonlytails/loottables">
A Kotlin DSL for creating loot tables in Minecraft mods (using Forge).
</Project>
<Project name="Cryptic Cosmos" href="https://github.com/Team-Cryptic-Cosmos/Cryptic-Cosmos">
Minecraft mod for 1.16 that introduces exciting new dimensions, mobs, and blocks, made by the <a href="https://github.com/Team-Cryptic-Cosmos">Cryptic Cosmos Team</a>.
</Project>
<Project name="This website" href="https://github.com/theonlytails/theonlytails.com">
<i>You are looking at it</i>. Built with <a href="https://svelte.dev">Svelte</a>, <a href="https://www.typescriptlang.org/">TypeScript</a>, and <a href="https://sass-lang.com/">Sass</a>.
</Project>
</ul>
</div>
-----------------------
#projects {
margin: 25px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
border: 2px solid #ff7f00;
max-width: 50%;
}
ul {
padding: 0 20px;
}
#projects-title {
margin-top: 20px;
}
<div id="projects">
<h3 id="projects-title">Some of my projects!</h3>
<ul>
<Project name="RubyMod" href="https://github.com/theonlytails/rubymod">
An free and open source mod for <a href="https://minecraft.net">Minecraft</a> 1.16, written in Kotlin using the <a href="https://github.com/MinecraftForge/MinecraftForge">Minecraft Forge API</a>.
</Project>
<Project name="LootTables" href="https://github.com/theonlytails/loottables">
A Kotlin DSL for creating loot tables in Minecraft mods (using Forge).
</Project>
<Project name="Cryptic Cosmos" href="https://github.com/Team-Cryptic-Cosmos/Cryptic-Cosmos">
Minecraft mod for 1.16 that introduces exciting new dimensions, mobs, and blocks, made by the <a href="https://github.com/Team-Cryptic-Cosmos">Cryptic Cosmos Team</a>.
</Project>
<Project name="This website" href="https://github.com/theonlytails/theonlytails.com">
<i>You are looking at it</i>. Built with <a href="https://svelte.dev">Svelte</a>, <a href="https://www.typescriptlang.org/">TypeScript</a>, and <a href="https://sass-lang.com/">Sass</a>.
</Project>
</ul>
</div>
import * as svelte from "https://cdn.skypack.dev/svelte@3.37.0";
-----------------------
#projects {
margin: 25px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
border: 2px solid #ff7f00;
max-width: 50%;
}
ul {
padding: 0 20px;
}
#projects-title {
margin-top: 20px;
}
<div id="projects">
<h3 id="projects-title">Some of my projects!</h3>
<ul>
<Project name="RubyMod" href="https://github.com/theonlytails/rubymod">
An free and open source mod for <a href="https://minecraft.net">Minecraft</a> 1.16, written in Kotlin using the <a href="https://github.com/MinecraftForge/MinecraftForge">Minecraft Forge API</a>.
</Project>
<Project name="LootTables" href="https://github.com/theonlytails/loottables">
A Kotlin DSL for creating loot tables in Minecraft mods (using Forge).
</Project>
<Project name="Cryptic Cosmos" href="https://github.com/Team-Cryptic-Cosmos/Cryptic-Cosmos">
Minecraft mod for 1.16 that introduces exciting new dimensions, mobs, and blocks, made by the <a href="https://github.com/Team-Cryptic-Cosmos">Cryptic Cosmos Team</a>.
</Project>
<Project name="This website" href="https://github.com/theonlytails/theonlytails.com">
<i>You are looking at it</i>. Built with <a href="https://svelte.dev">Svelte</a>, <a href="https://www.typescriptlang.org/">TypeScript</a>, and <a href="https://sass-lang.com/">Sass</a>.
</Project>
</ul>
</div>
import * as svelte from "https://cdn.skypack.dev/svelte@3.37.0";
-----------------------
#projects {
margin: 25px;
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
border: 2px solid #ff7f00;
max-width: 50%;
}
ul {
padding: 0 20px;
}
#projects-title {
margin-top: 20px;
}
<div id="projects">
<h3 id="projects-title">Some of my projects!</h3>
<ul>
<Project name="RubyMod" href="https://github.com/theonlytails/rubymod">
An free and open source mod for <a href="https://minecraft.net">Minecraft</a> 1.16, written in Kotlin using the <a href="https://github.com/MinecraftForge/MinecraftForge">Minecraft Forge API</a>.
</Project>
<Project name="LootTables" href="https://github.com/theonlytails/loottables">
A Kotlin DSL for creating loot tables in Minecraft mods (using Forge).
</Project>
<Project name="Cryptic Cosmos" href="https://github.com/Team-Cryptic-Cosmos/Cryptic-Cosmos">
Minecraft mod for 1.16 that introduces exciting new dimensions, mobs, and blocks, made by the <a href="https://github.com/Team-Cryptic-Cosmos">Cryptic Cosmos Team</a>.
</Project>
<Project name="This website" href="https://github.com/theonlytails/theonlytails.com">
<i>You are looking at it</i>. Built with <a href="https://svelte.dev">Svelte</a>, <a href="https://www.typescriptlang.org/">TypeScript</a>, and <a href="https://sass-lang.com/">Sass</a>.
</Project>
</ul>
</div>
import * as svelte from "https://cdn.skypack.dev/svelte@3.37.0";
How would I make a custom pickaxe in forge for 1.16.5?
public class CustomTier implements IItemTier {
@Override public int getMaxUses() { return 1000;}
@Override public float getEfficiency() { return 10; }
@Override public float getAttackDamage() { return 10; }
@Override public int getHarvestLevel() { return 3; }
@Override public int getEnchantability() { return 5; }
@Override public Ingredient getRepairMaterial() { return Ingredient.fromStacks(new ItemStack(FIERY_INGOT.get())); }
}
public static final RegistryObject<PickaxeItem> FIERY_PICK = ITEMS.register("fiery_pick",
new PickaxeItem(new CustomTier(), 0, 0, new Properties().maxStackSize(1)));
-----------------------
public class CustomTier implements IItemTier {
@Override public int getMaxUses() { return 1000;}
@Override public float getEfficiency() { return 10; }
@Override public float getAttackDamage() { return 10; }
@Override public int getHarvestLevel() { return 3; }
@Override public int getEnchantability() { return 5; }
@Override public Ingredient getRepairMaterial() { return Ingredient.fromStacks(new ItemStack(FIERY_INGOT.get())); }
}
public static final RegistryObject<PickaxeItem> FIERY_PICK = ITEMS.register("fiery_pick",
new PickaxeItem(new CustomTier(), 0, 0, new Properties().maxStackSize(1)));
How do I get a JSON request but get a certain part of it?
import request
import json
response = json.loads(requests.get("https://meta.multimc.org/v1/net.minecraftforge/index.json").text)
versions=[]
for i in range(len(response['versions'])):
versions.append(response['versions'][i]['version'])
QUESTION
no instance(s) of type variable(s) T exist so that Block conforms to Supplier<T>
Asked 2022-Feb-07 at 15:45I was just coding from a course, when there was this error:
no instance(s) of type variable(s) T exist so that Block conforms to Supplier<T>
I don't know what it is, but here is my code:
package com.berriz44.breloaded.block;
import com.berriz44.breloaded.util.Registration;
import net.minecraft.world.item.BlockItem;
import net.minecraft.world.item.CreativeModeTab;
import net.minecraft.world.item.Item;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.SoundType;
import net.minecraft.world.level.block.state.BlockBehaviour;
import net.minecraft.world.level.material.Material;
import net.minecraftforge.registries.RegistryObject;
import java.util.function.Supplier;
public class ModBlocks {
public static RegistryObject<Block> SMOOTH_BRICK = register("smooth_brick", new Block(BlockBehaviour.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2f,6f)));
private static <T extends Block>RegistryObject<T> register(String name, Supplier<T> block) {
RegistryObject<T> toReturn = Registration.BLOCKS.register(name, block);
Registration.ITEMS.register(name, () -> new BlockItem(toReturn.get(), new Item.Properties().tab(CreativeModeTab.TAB_BUILDING_BLOCKS)));
return toReturn;
}
}
Send help.
ANSWER
Answered 2022-Feb-07 at 15:45The method register
takes a Supplier<Block>
, not a Block
.
You are trying to pass it a Block
here instead of a Supplier<Block>
:
public static RegistryObject<Block> SMOOTH_BRICK = register("smooth_brick",
new Block(BlockBehaviour.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2f,6f)));
You can implement Supplier<Block>
with a lambda expression:
public static RegistryObject<Block> SMOOTH_BRICK = register("smooth_brick",
() -> new Block(BlockBehaviour.Properties.of(Material.STONE).sound(SoundType.STONE).strength(2f,6f)));
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
No vulnerabilities reported
Save this library and start creating your kit
Explore Related Topics
Save this library and start creating your kit