-
-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for predicates in BlockResourceCreator, make empty models…
… prefer "best" blockstate
- Loading branch information
Showing
4 changed files
with
126 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
47 changes: 47 additions & 0 deletions
47
polymer-core/src/testmod/java/eu/pb4/polymertest/DynamicItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package eu.pb4.polymertest; | ||
|
||
import eu.pb4.polymer.core.api.item.PolymerItem; | ||
import eu.pb4.polymer.core.api.item.SimplePolymerItem; | ||
import net.minecraft.component.DataComponentTypes; | ||
import net.minecraft.component.type.ConsumableComponent; | ||
import net.minecraft.entity.player.PlayerEntity; | ||
import net.minecraft.item.Item; | ||
import net.minecraft.item.ItemStack; | ||
import net.minecraft.item.ItemUsageContext; | ||
import net.minecraft.item.Items; | ||
import net.minecraft.item.consume.UseAction; | ||
import net.minecraft.item.tooltip.TooltipType; | ||
import net.minecraft.registry.Registries; | ||
import net.minecraft.sound.SoundEvents; | ||
import net.minecraft.text.Text; | ||
import net.minecraft.util.ActionResult; | ||
import net.minecraft.util.Hand; | ||
import net.minecraft.util.Identifier; | ||
import net.minecraft.util.Rarity; | ||
import net.minecraft.util.math.random.Random; | ||
import net.minecraft.world.World; | ||
import xyz.nucleoid.packettweaker.PacketContext; | ||
|
||
import java.util.List; | ||
|
||
public class DynamicItem extends Item implements PolymerItem { | ||
public DynamicItem(Settings settings) { | ||
super(settings); | ||
} | ||
|
||
@Override | ||
public Identifier getPolymerItemModel(ItemStack stack, PacketContext context) { | ||
return null; | ||
} | ||
|
||
@Override | ||
public ActionResult use(World world, PlayerEntity user, Hand hand) { | ||
user.sendMessage(Text.literal("Used!" + hand), false); | ||
return super.use(world, user, hand); | ||
} | ||
|
||
@Override | ||
public Item getPolymerItem(ItemStack itemStack, PacketContext context) { | ||
return itemStack.getOrDefault(TestMod.CLIENT_ITEM, Items.STICK); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters