mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-25 22:44:32 +00:00
26.3 - Initial update
This commit is contained in:
614 files changed
+5650
-9403
No files matched your search
@@ -1,129 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "minecraft:acacia_leaves"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chances": [
|
||||
0.05,
|
||||
0.0625,
|
||||
0.083333336,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:acacia_sapling"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chances": [
|
||||
0.02,
|
||||
0.022222223,
|
||||
0.025,
|
||||
0.033333335,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": {
|
||||
"type": "minecraft:uniform",
|
||||
"max": 2.0,
|
||||
"min": 1.0
|
||||
},
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:stick"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/acacia_leaves"
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "minecraft:azalea_leaves"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chances": [
|
||||
0.05,
|
||||
0.0625,
|
||||
0.083333336,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:azalea"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chances": [
|
||||
0.02,
|
||||
0.022222223,
|
||||
0.025,
|
||||
0.033333335,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": {
|
||||
"type": "minecraft:uniform",
|
||||
"max": 2.0,
|
||||
"min": 1.0
|
||||
},
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:stick"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/azalea_leaves"
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "minecraft:birch_leaves"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chances": [
|
||||
0.05,
|
||||
0.0625,
|
||||
0.083333336,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:birch_sapling"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chances": [
|
||||
0.02,
|
||||
0.022222223,
|
||||
0.025,
|
||||
0.033333335,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": {
|
||||
"type": "minecraft:uniform",
|
||||
"max": 2.0,
|
||||
"min": 1.0
|
||||
},
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:stick"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/birch_leaves"
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "minecraft:bush"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/bush"
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "minecraft:cherry_leaves"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chances": [
|
||||
0.05,
|
||||
0.0625,
|
||||
0.083333336,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:cherry_sapling"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chances": [
|
||||
0.02,
|
||||
0.022222223,
|
||||
0.025,
|
||||
0.033333335,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": {
|
||||
"type": "minecraft:uniform",
|
||||
"max": 2.0,
|
||||
"min": 1.0
|
||||
},
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:stick"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/cherry_leaves"
|
||||
}
|
||||
@@ -1,55 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "minecraft:cobweb"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:string"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/cobweb"
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "minecraft:dark_oak_leaves"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chances": [
|
||||
0.05,
|
||||
0.0625,
|
||||
0.083333336,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:dark_oak_sapling"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chances": [
|
||||
0.02,
|
||||
0.022222223,
|
||||
0.025,
|
||||
0.033333335,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": {
|
||||
"type": "minecraft:uniform",
|
||||
"max": 2.0,
|
||||
"min": 1.0
|
||||
},
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:stick"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chances": [
|
||||
0.005,
|
||||
0.0055555557,
|
||||
0.00625,
|
||||
0.008333334,
|
||||
0.025
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:apple"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/dark_oak_leaves"
|
||||
}
|
||||
@@ -1,43 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:dead_bush"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"functions": [
|
||||
{
|
||||
"count": {
|
||||
"type": "minecraft:uniform",
|
||||
"max": 2.0,
|
||||
"min": 0.0
|
||||
},
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:stick"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/dead_bush"
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:fern"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chance": 0.125,
|
||||
"condition": "minecraft:random_chance"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"enchantment": "minecraft:fortune",
|
||||
"formula": "minecraft:uniform_bonus_count",
|
||||
"function": "minecraft:apply_bonus",
|
||||
"parameters": {
|
||||
"bonusMultiplier": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:wheat_seeds"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/fern"
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "minecraft:flowering_azalea_leaves"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chances": [
|
||||
0.05,
|
||||
0.0625,
|
||||
0.083333336,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:flowering_azalea"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chances": [
|
||||
0.02,
|
||||
0.022222223,
|
||||
0.025,
|
||||
0.033333335,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": {
|
||||
"type": "minecraft:uniform",
|
||||
"max": 2.0,
|
||||
"min": 1.0
|
||||
},
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:stick"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/flowering_azalea_leaves"
|
||||
}
|
||||
@@ -1,115 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"add": true,
|
||||
"conditions": [
|
||||
{
|
||||
"block": "minecraft:glow_lichen",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"down": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"count": 1.0,
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"add": true,
|
||||
"conditions": [
|
||||
{
|
||||
"block": "minecraft:glow_lichen",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"up": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"count": 1.0,
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"add": true,
|
||||
"conditions": [
|
||||
{
|
||||
"block": "minecraft:glow_lichen",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"north": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"count": 1.0,
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"add": true,
|
||||
"conditions": [
|
||||
{
|
||||
"block": "minecraft:glow_lichen",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"south": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"count": 1.0,
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"add": true,
|
||||
"conditions": [
|
||||
{
|
||||
"block": "minecraft:glow_lichen",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"west": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"count": 1.0,
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"add": true,
|
||||
"conditions": [
|
||||
{
|
||||
"block": "minecraft:glow_lichen",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"east": "true"
|
||||
}
|
||||
}
|
||||
],
|
||||
"count": 1.0,
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"add": true,
|
||||
"count": -1.0,
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:glow_lichen"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/glow_lichen"
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "minecraft:hanging_roots"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/hanging_roots"
|
||||
}
|
||||
@@ -1,130 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "minecraft:jungle_leaves"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chances": [
|
||||
0.025,
|
||||
0.027777778,
|
||||
0.03125,
|
||||
0.041666668,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:jungle_sapling"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chances": [
|
||||
0.02,
|
||||
0.022222223,
|
||||
0.025,
|
||||
0.033333335,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": {
|
||||
"type": "minecraft:uniform",
|
||||
"max": 2.0,
|
||||
"min": 1.0
|
||||
},
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:stick"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/jungle_leaves"
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"block": "minecraft:large_fern",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"half": "lower"
|
||||
}
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:location_check",
|
||||
"offsetY": 1,
|
||||
"predicate": {
|
||||
"block": {
|
||||
"blocks": "minecraft:large_fern",
|
||||
"state": {
|
||||
"half": "upper"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": 2.0,
|
||||
"function": "minecraft:set_count"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:fern"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chance": 0.125,
|
||||
"condition": "minecraft:random_chance"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:wheat_seeds"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"block": "minecraft:large_fern",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"half": "upper"
|
||||
}
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:location_check",
|
||||
"offsetY": -1,
|
||||
"predicate": {
|
||||
"block": {
|
||||
"blocks": "minecraft:large_fern",
|
||||
"state": {
|
||||
"half": "lower"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": 2.0,
|
||||
"function": "minecraft:set_count"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:fern"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chance": 0.125,
|
||||
"condition": "minecraft:random_chance"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:wheat_seeds"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/large_fern"
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "minecraft:mangrove_leaves"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chances": [
|
||||
0.02,
|
||||
0.022222223,
|
||||
0.025,
|
||||
0.033333335,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": {
|
||||
"type": "minecraft:uniform",
|
||||
"max": 2.0,
|
||||
"min": 1.0
|
||||
},
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:stick"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/mangrove_leaves"
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "minecraft:nether_sprouts"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/nether_sprouts"
|
||||
}
|
||||
@@ -1,183 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "minecraft:oak_leaves"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chances": [
|
||||
0.05,
|
||||
0.0625,
|
||||
0.083333336,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:oak_sapling"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chances": [
|
||||
0.02,
|
||||
0.022222223,
|
||||
0.025,
|
||||
0.033333335,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": {
|
||||
"type": "minecraft:uniform",
|
||||
"max": 2.0,
|
||||
"min": 1.0
|
||||
},
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:stick"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chances": [
|
||||
0.005,
|
||||
0.0055555557,
|
||||
0.00625,
|
||||
0.008333334,
|
||||
0.025
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:apple"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/oak_leaves"
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "minecraft:pale_hanging_moss"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/pale_hanging_moss"
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "minecraft:pale_oak_leaves"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chances": [
|
||||
0.05,
|
||||
0.0625,
|
||||
0.083333336,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:pale_oak_sapling"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chances": [
|
||||
0.02,
|
||||
0.022222223,
|
||||
0.025,
|
||||
0.033333335,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": {
|
||||
"type": "minecraft:uniform",
|
||||
"max": 2.0,
|
||||
"min": 1.0
|
||||
},
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:stick"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/pale_oak_leaves"
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "minecraft:seagrass"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/seagrass"
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "minecraft:short_dry_grass"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/short_dry_grass"
|
||||
}
|
||||
@@ -1,49 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:short_grass"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chance": 0.125,
|
||||
"condition": "minecraft:random_chance"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"enchantment": "minecraft:fortune",
|
||||
"formula": "minecraft:uniform_bonus_count",
|
||||
"function": "minecraft:apply_bonus",
|
||||
"parameters": {
|
||||
"bonusMultiplier": 2
|
||||
}
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:wheat_seeds"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/short_grass"
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "minecraft:small_dripleaf"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/small_dripleaf"
|
||||
}
|
||||
@@ -1,129 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "minecraft:spruce_leaves"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chances": [
|
||||
0.05,
|
||||
0.0625,
|
||||
0.083333336,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:spruce_sapling"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:inverted",
|
||||
"term": {
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chances": [
|
||||
0.02,
|
||||
0.022222223,
|
||||
0.025,
|
||||
0.033333335,
|
||||
0.1
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": {
|
||||
"type": "minecraft:uniform",
|
||||
"max": 2.0,
|
||||
"min": 1.0
|
||||
},
|
||||
"function": "minecraft:set_count"
|
||||
},
|
||||
{
|
||||
"function": "minecraft:explosion_decay"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:stick"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/spruce_leaves"
|
||||
}
|
||||
@@ -1,41 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "minecraft:tall_dry_grass"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/tall_dry_grass"
|
||||
}
|
||||
@@ -1,126 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"block": "minecraft:tall_grass",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"half": "lower"
|
||||
}
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:location_check",
|
||||
"offsetY": 1,
|
||||
"predicate": {
|
||||
"block": {
|
||||
"blocks": "minecraft:tall_grass",
|
||||
"state": {
|
||||
"half": "upper"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": 2.0,
|
||||
"function": "minecraft:set_count"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:short_grass"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chance": 0.125,
|
||||
"condition": "minecraft:random_chance"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:wheat_seeds"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
},
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"block": "minecraft:tall_grass",
|
||||
"condition": "minecraft:block_state_property",
|
||||
"properties": {
|
||||
"half": "upper"
|
||||
}
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:location_check",
|
||||
"offsetY": -1,
|
||||
"predicate": {
|
||||
"block": {
|
||||
"blocks": "minecraft:tall_grass",
|
||||
"state": {
|
||||
"half": "lower"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
}
|
||||
],
|
||||
"functions": [
|
||||
{
|
||||
"count": 2.0,
|
||||
"function": "minecraft:set_count"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:short_grass"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:survives_explosion"
|
||||
},
|
||||
{
|
||||
"chance": 0.125,
|
||||
"condition": "minecraft:random_chance"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:wheat_seeds"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/tall_grass"
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"functions": [
|
||||
{
|
||||
"count": 2.0,
|
||||
"function": "minecraft:set_count"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:seagrass"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/tall_seagrass"
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "minecraft:twisting_vines"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chances": [
|
||||
0.33,
|
||||
0.55,
|
||||
0.77,
|
||||
1.0
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:twisting_vines"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/twisting_vines"
|
||||
}
|
||||
@@ -1,21 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"conditions": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
}
|
||||
],
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"name": "minecraft:vine"
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/vine"
|
||||
}
|
||||
@@ -1,62 +0,0 @@
|
||||
{
|
||||
"type": "minecraft:block",
|
||||
"pools": [
|
||||
{
|
||||
"entries": [
|
||||
{
|
||||
"type": "minecraft:alternatives",
|
||||
"children": [
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"condition": "minecraft:any_of",
|
||||
"terms": [
|
||||
{
|
||||
"action": "shears_dig",
|
||||
"condition": "forge:can_tool_perform_action"
|
||||
},
|
||||
{
|
||||
"condition": "minecraft:match_tool",
|
||||
"predicate": {
|
||||
"predicates": {
|
||||
"minecraft:enchantments": [
|
||||
{
|
||||
"enchantments": "minecraft:silk_touch",
|
||||
"levels": {
|
||||
"min": 1
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"name": "minecraft:weeping_vines"
|
||||
},
|
||||
{
|
||||
"type": "minecraft:item",
|
||||
"conditions": [
|
||||
{
|
||||
"chances": [
|
||||
0.33,
|
||||
0.55,
|
||||
0.77,
|
||||
1.0
|
||||
],
|
||||
"condition": "minecraft:table_bonus",
|
||||
"enchantment": "minecraft:fortune"
|
||||
}
|
||||
],
|
||||
"name": "minecraft:weeping_vines"
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"rolls": 1.0
|
||||
}
|
||||
],
|
||||
"random_sequence": "minecraft:blocks/weeping_vines"
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
{
|
||||
"type": "forge:can_tool_perform_action",
|
||||
"action": "shears_dig"
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shapeless",
|
||||
"group": "chest_boat",
|
||||
"ingredients": [
|
||||
"#c:chests/wooden",
|
||||
"minecraft:poplar_boat"
|
||||
],
|
||||
"result": {
|
||||
"id": "minecraft:poplar_chest_boat"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"group": "wooden_fence",
|
||||
"key": {
|
||||
"#": "#c:rods/wooden",
|
||||
"W": "minecraft:poplar_planks"
|
||||
},
|
||||
"pattern": [
|
||||
"W#W",
|
||||
"W#W"
|
||||
],
|
||||
"result": {
|
||||
"count": 3,
|
||||
"id": "minecraft:poplar_fence"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"category": "redstone",
|
||||
"group": "wooden_fence_gate",
|
||||
"key": {
|
||||
"#": "#c:rods/wooden",
|
||||
"W": "minecraft:poplar_planks"
|
||||
},
|
||||
"pattern": [
|
||||
"#W#",
|
||||
"#W#"
|
||||
],
|
||||
"result": {
|
||||
"id": "minecraft:poplar_fence_gate"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
{
|
||||
"type": "minecraft:crafting_shaped",
|
||||
"group": "wooden_sign",
|
||||
"key": {
|
||||
"#": "minecraft:poplar_planks",
|
||||
"X": "#c:rods/wooden"
|
||||
},
|
||||
"pattern": [
|
||||
"###",
|
||||
"###",
|
||||
" X "
|
||||
],
|
||||
"result": {
|
||||
"count": 3,
|
||||
"id": "minecraft:poplar_sign"
|
||||
}
|
||||
}
|
||||
@@ -3,10 +3,7 @@
|
||||
"description": {
|
||||
"translate": "pack.forge.description"
|
||||
},
|
||||
"max_format": 107,
|
||||
"min_format": [
|
||||
107,
|
||||
1
|
||||
]
|
||||
"max_format": 121,
|
||||
"min_format": 121
|
||||
}
|
||||
}
|
||||
@@ -128,8 +128,6 @@ public class ClientCommandHandler {
|
||||
player.position(),
|
||||
player.getRotationVector(),
|
||||
player.permissions(),
|
||||
player.getName().getString(),
|
||||
player.getDisplayName(),
|
||||
player
|
||||
);
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ import java.util.stream.Collectors;
|
||||
* overrides for {@link CommandSourceStack} so that the methods will run successfully client side
|
||||
*/
|
||||
public class ClientCommandSourceStack extends CommandSourceStack {
|
||||
public ClientCommandSourceStack(CommandSource source, Vec3 position, Vec2 rotation, PermissionSet permission, String plainTextName, Component displayName, Entity executing) {
|
||||
super(source, position, rotation, null, permission, plainTextName, displayName, null, executing);
|
||||
public ClientCommandSourceStack(CommandSource source, Vec3 position, Vec2 rotation, PermissionSet permission, Entity executing) {
|
||||
super(source, position, rotation, null, permission, null, executing);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -51,6 +51,7 @@ import net.minecraft.client.renderer.extract.LevelExtractor;
|
||||
import net.minecraft.client.renderer.fog.FogData;
|
||||
import net.minecraft.client.renderer.state.gui.pip.PictureInPictureRenderState;
|
||||
import net.minecraft.client.renderer.state.level.LevelRenderState;
|
||||
import net.minecraft.client.renderer.state.level.PlayerRenderState;
|
||||
import net.minecraft.client.renderer.texture.SpriteContents;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlas;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
@@ -111,6 +112,9 @@ import net.minecraftforge.client.event.RegisterColorHandlersEvent;
|
||||
import net.minecraftforge.client.event.RegisterKeyMappingsEvent;
|
||||
import net.minecraftforge.client.event.RegisterParticleProvidersEvent;
|
||||
import net.minecraftforge.client.event.RenderBlockScreenEffectEvent;
|
||||
import net.minecraftforge.client.event.RenderBlockScreenEffectEvent.BlockOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderBlockScreenEffectEvent.FireOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderBlockScreenEffectEvent.WaterOverlayEvent;
|
||||
import net.minecraftforge.client.event.RenderHandEvent;
|
||||
import net.minecraftforge.client.event.RenderHighlightEvent;
|
||||
import net.minecraftforge.client.event.RenderTooltipEvent;
|
||||
@@ -128,6 +132,7 @@ import net.minecraftforge.client.textures.ForgeTextureMetadata;
|
||||
import net.minecraftforge.client.textures.TextureAtlasSpriteLoaderManager;
|
||||
import net.minecraftforge.common.ForgeI18n;
|
||||
import net.minecraftforge.common.ForgeMod;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.fml.IExtensionPoint;
|
||||
import net.minecraftforge.fml.ModList;
|
||||
import net.minecraftforge.network.NetworkContext;
|
||||
@@ -163,7 +168,7 @@ import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public class ForgeHooksClient {
|
||||
public final class ForgeHooksClient {
|
||||
private static final Logger LOGGER = LogManager.getLogger();
|
||||
private static final Marker CLIENTHOOKS = MarkerManager.getMarker("CLIENTHOOKS");
|
||||
|
||||
@@ -646,16 +651,19 @@ public class ForgeHooksClient {
|
||||
return font.split(text, maxWidth).stream().map(ClientTooltipComponent::create);
|
||||
}
|
||||
|
||||
public static boolean renderFireOverlay(Player player, PoseStack mat) {
|
||||
return renderBlockOverlay(player, mat, RenderBlockScreenEffectEvent.OverlayType.FIRE, Blocks.FIRE.defaultBlockState(), player.blockPosition());
|
||||
public static @Nullable IRenderCallback renderFireOverlay(Player player) {
|
||||
var event = new FireOverlayEvent(player, Blocks.FIRE.defaultBlockState(), player.blockPosition());
|
||||
return FireOverlayEvent.BUS.post(event) ? event.getCustomRenderer() : null;
|
||||
}
|
||||
|
||||
public static boolean renderWaterOverlay(Player player, PoseStack mat) {
|
||||
return renderBlockOverlay(player, mat, RenderBlockScreenEffectEvent.OverlayType.WATER, Blocks.WATER.defaultBlockState(), player.blockPosition());
|
||||
public static @Nullable IRenderCallback renderWaterOverlay(Player player, PlayerRenderState state) {
|
||||
var event = new WaterOverlayEvent(player, Blocks.WATER.defaultBlockState(), player.blockPosition(), state);
|
||||
return WaterOverlayEvent.BUS.post(event) ? event.getCustomRenderer() : null;
|
||||
}
|
||||
|
||||
public static boolean renderBlockOverlay(Player player, PoseStack mat, RenderBlockScreenEffectEvent.OverlayType type, BlockState block, BlockPos pos) {
|
||||
return RenderBlockScreenEffectEvent.BUS.post(new RenderBlockScreenEffectEvent(player, mat, type, block, pos));
|
||||
public static @Nullable IRenderCallback renderBlockOverlay(Player player, BlockState state, BlockPos pos) {
|
||||
var event = new BlockOverlayEvent(player, state, pos);
|
||||
return BlockOverlayEvent.BUS.post(event) ? event.getCustomRenderer() : null;
|
||||
}
|
||||
|
||||
public static int getMaxMipmapLevel(int width, int height) {
|
||||
|
||||
@@ -5,15 +5,15 @@
|
||||
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import com.mojang.blaze3d.GpuFormat;
|
||||
import com.mojang.blaze3d.pipeline.BlendFunction;
|
||||
import com.mojang.blaze3d.pipeline.ColorTargetState;
|
||||
import com.mojang.blaze3d.pipeline.RenderPipeline;
|
||||
import com.mojang.blaze3d.platform.BlendFactor;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.blaze3d.textures.AddressMode;
|
||||
import com.mojang.blaze3d.textures.FilterMode;
|
||||
import com.mojang.blaze3d.textures.GpuSampler;
|
||||
import com.mojang.renderpearl.api.GpuFormat;
|
||||
import com.mojang.renderpearl.api.pipeline.BlendFactor;
|
||||
import com.mojang.renderpearl.api.pipeline.BlendFunction;
|
||||
import com.mojang.renderpearl.api.pipeline.ColorTargetState;
|
||||
import com.mojang.renderpearl.api.pipeline.RenderPipeline;
|
||||
import com.mojang.renderpearl.api.textures.AddressMode;
|
||||
import com.mojang.renderpearl.api.textures.FilterMode;
|
||||
import com.mojang.renderpearl.api.textures.GpuSampler;
|
||||
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
|
||||
@@ -7,13 +7,11 @@ package net.minecraftforge.client;
|
||||
|
||||
import com.mojang.blaze3d.framegraph.FrameGraphBuilder;
|
||||
import com.mojang.blaze3d.framegraph.FramePass;
|
||||
import net.minecraft.client.DeltaTracker;
|
||||
import net.minecraft.client.renderer.LevelTargetBundle;
|
||||
import net.minecraft.client.renderer.state.level.LevelRenderState;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -31,11 +29,11 @@ public class FramePassManager {
|
||||
|
||||
// Note: Pass order is determined automatically within FrameGraphBuilder. It's unclear what must be done to guarantee ordering.
|
||||
@ApiStatus.Internal
|
||||
public static void insertForgePasses(FrameGraphBuilder graphBuilder, LevelTargetBundle bundle, LevelRenderState state, DeltaTracker deltaTracker) {
|
||||
public static void insertForgePasses(FrameGraphBuilder graphBuilder, LevelTargetBundle bundle, LevelRenderState state) {
|
||||
for (PassInfo info : addedPasses) {
|
||||
FramePass pass = graphBuilder.addPass(info.name);
|
||||
PassDefinition forgePass = info.pass;
|
||||
forgePass.extracts(bundle, pass, deltaTracker);
|
||||
forgePass.extracts(bundle, pass, state);
|
||||
pass.executes(() -> forgePass.executes(state));
|
||||
}
|
||||
}
|
||||
@@ -71,7 +69,7 @@ public class FramePassManager {
|
||||
/// if you want to take a crack at it.
|
||||
///
|
||||
/// Satisfying #2 is simple. Any state information you need to extract
|
||||
/// should be done during {@linkplain PassDefinition#extracts(LevelTargetBundle, FramePass, DeltaTracker)}.
|
||||
/// should be done during {@linkplain PassDefinition#extracts(LevelTargetBundle, FramePass, LevelRenderState)}.
|
||||
/// No actual rendering should be done at this time. This can happen before or after binding to a target.
|
||||
/// The specific implementation of your render state is up to you, it can even be done with some instance variables.
|
||||
///
|
||||
@@ -79,23 +77,13 @@ public class FramePassManager {
|
||||
/// during the extracts phase.
|
||||
@NullMarked
|
||||
public interface PassDefinition {
|
||||
|
||||
/**
|
||||
* @deprecated Prefer {@linkplain PassDefinition#extracts(LevelTargetBundle, FramePass, DeltaTracker)}
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since="26.2")
|
||||
default void extracts(LevelTargetBundle bundle, FramePass pass) {};
|
||||
|
||||
/**
|
||||
* This method exists to do render state extraction. Your instance of a PassDefinition should have
|
||||
* locals or some filled record instance that represents the render state created.
|
||||
* The resulting render state should be consumed by {@linkplain PassDefinition#executes(LevelRenderState)}
|
||||
* You must also use this to define which targets your pass will bind against. See PassDefinition javadocs for details.
|
||||
*/
|
||||
|
||||
default void extracts(LevelTargetBundle bundle, FramePass pass, DeltaTracker deltaTracker) {
|
||||
extracts(bundle, pass);
|
||||
};
|
||||
void extracts(LevelTargetBundle bundle, FramePass pass, LevelRenderState deltaTracker);
|
||||
|
||||
/**
|
||||
* Use to define what your pass does during the render stage. This should consume the render state created
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.client;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
|
||||
/**
|
||||
* Simple callback for the 'submit' stage of the renderer.
|
||||
* Used for fluid/fire overlays
|
||||
*/
|
||||
@FunctionalInterface
|
||||
public interface IRenderCallback {
|
||||
void render(PoseStack pose, SubmitNodeCollector collector);
|
||||
}
|
||||
@@ -15,8 +15,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
/**
|
||||
* Fired during the construction of {@linkplain net.minecraft.client.renderer.LevelRenderer}.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain net.minecraftforge.common.MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain net.minecraftforge.fml.LogicalSide#CLIENT logical client}.
|
||||
* <p>This event is fired only on the {@linkplain net.minecraftforge.fml.LogicalSide#CLIENT logical client}.
|
||||
*/
|
||||
@NullMarked
|
||||
public record AddFramePassEvent() implements RecordEvent {
|
||||
|
||||
@@ -21,8 +21,7 @@ import org.jspecify.annotations.Nullable;
|
||||
* <p>This event is {@linkplain Cancellable cancellable}.
|
||||
* If the event is cancelled, the chat message will not be sent to the server.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
**/
|
||||
@NullMarked
|
||||
public final class ClientChatEvent extends MutableEvent implements Cancellable {
|
||||
|
||||
@@ -8,7 +8,6 @@ package net.minecraftforge.client.event;
|
||||
import net.minecraft.network.chat.ChatType;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.network.chat.PlayerChatMessage;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
@@ -24,8 +23,7 @@ import java.util.UUID;
|
||||
* <p>This event is {@linkplain Cancellable cancellable}.
|
||||
* If the event is cancelled, the message is not displayed in the chat message window.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see ChatType
|
||||
*/
|
||||
@@ -80,8 +78,7 @@ public sealed class ClientChatReceivedEvent extends MutableEvent implements Canc
|
||||
* <p>This event is {@linkplain Cancellable cancellable}.
|
||||
* If the event is cancelled, the message is not displayed in the chat message window.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see ChatType
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,6 @@ package net.minecraftforge.client.event;
|
||||
import net.minecraft.client.multiplayer.MultiPlayerGameMode;
|
||||
import net.minecraft.client.player.LocalPlayer;
|
||||
import net.minecraft.network.Connection;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
@@ -20,8 +19,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
* Fired for different client connectivity events.
|
||||
* See the various subclasses to listen for specific events.
|
||||
*
|
||||
* <p>These events are fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>These events are fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see LoggingIn
|
||||
* @see LoggingOut
|
||||
@@ -48,8 +46,7 @@ public sealed interface ClientPlayerNetworkEvent extends InheritableEvent {
|
||||
/**
|
||||
* Fired when the client player logs in to the server. The player should be initialized.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@NullMarked
|
||||
record LoggingIn(MultiPlayerGameMode getMultiPlayerGameMode, LocalPlayer getPlayer, Connection getConnection)
|
||||
@@ -63,8 +60,7 @@ public sealed interface ClientPlayerNetworkEvent extends InheritableEvent {
|
||||
/**
|
||||
* Fired when the client player logs out. This event may also fire when a new integrated server is being created.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@SuppressWarnings("NullableProblems")
|
||||
// Shush IntelliJ, we override non-nullables as nullables in this specific event; see later comment
|
||||
@@ -117,8 +113,7 @@ public sealed interface ClientPlayerNetworkEvent extends InheritableEvent {
|
||||
/**
|
||||
* Fired when the client player respawns, creating a new player instance to replace the old player instance.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @param getOldPlayer the previous player instance
|
||||
* @param getNewPlayer the newly created player instance
|
||||
|
||||
@@ -7,7 +7,6 @@ package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
@@ -17,8 +16,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
/**
|
||||
* Fired after the field of vision (FOV) modifier for the player is calculated to allow developers to adjust it further.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see ViewportEvent.ComputeFov
|
||||
*/
|
||||
|
||||
@@ -17,8 +17,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* Fired for hooking into {@link AbstractContainerScreen} events.
|
||||
* See the subclasses to listen for specific events.
|
||||
*
|
||||
* <p>These events are fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>These events are fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see Render.Foreground
|
||||
* @see Render.Background
|
||||
@@ -33,8 +32,7 @@ public sealed interface ContainerScreenEvent {
|
||||
* Fired every time an {@link AbstractContainerScreen} renders.
|
||||
* See the two subclasses to listen for foreground or background rendering.
|
||||
*
|
||||
* <p>These events are fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>These events are fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see Foreground
|
||||
* @see Background
|
||||
@@ -62,8 +60,7 @@ public sealed interface ContainerScreenEvent {
|
||||
* <p>This can be used for rendering elements that must be above other screen elements, but
|
||||
* below tooltips and the dragged stack, such as slot or item stack specific overlays.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Foreground(
|
||||
AbstractContainerScreen<?> getContainerScreen,
|
||||
@@ -81,8 +78,7 @@ public sealed interface ContainerScreenEvent {
|
||||
* Fired after the container screen's background layer and elements are drawn.
|
||||
* This can be used for rendering new background elements.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Background(
|
||||
AbstractContainerScreen<?> getContainerScreen,
|
||||
|
||||
@@ -39,8 +39,7 @@ public sealed interface CustomizeGuiOverlayEvent {
|
||||
* <p>This event is {@linkplain Cancellable cancellable}.
|
||||
* Cancelling this event will prevent the given bar from rendering.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
final class BossEventProgress extends MutableEvent implements Cancellable, CustomizeGuiOverlayEvent {
|
||||
public static final CancellableEventBus<BossEventProgress> BUS = CancellableEventBus.create(BossEventProgress.class);
|
||||
@@ -121,8 +120,7 @@ public sealed interface CustomizeGuiOverlayEvent {
|
||||
* Fired <b>before</b> textual information is rendered to the debug screen.
|
||||
* This can be used to add or remove text information.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @param getText the modifiable list of text to render on the side
|
||||
* @param getSide the side of the text getting rendered
|
||||
@@ -148,8 +146,7 @@ public sealed interface CustomizeGuiOverlayEvent {
|
||||
/**
|
||||
* Fired <b>before</b> the chat messages overlay is rendered to the screen.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
final class Chat extends MutableEvent implements CustomizeGuiOverlayEvent {
|
||||
public static final EventBus<Chat> BUS = EventBus.create(Chat.class);
|
||||
|
||||
@@ -162,8 +162,8 @@ public final class ForgeEventFactoryClient {
|
||||
}
|
||||
|
||||
public static boolean onClickInputPickBlock(KeyMapping keyBinding) {
|
||||
var event = new InputEvent.InteractionKeyMappingTriggered(2, keyBinding, InteractionHand.MAIN_HAND);
|
||||
return InputEvent.InteractionKeyMappingTriggered.BUS.post(event);
|
||||
var event = new InputEvent.InteractionKeyMappingTriggered.PickBlock(keyBinding, InteractionHand.MAIN_HAND);
|
||||
return InputEvent.InteractionKeyMappingTriggered.PickBlock.BUS.post(event);
|
||||
}
|
||||
|
||||
public static void onContainerRenderBackground(AbstractContainerScreen<?> screen, GuiGraphicsExtractor graphics, int mouseX, int mouseY) {
|
||||
|
||||
@@ -18,7 +18,6 @@ import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
/**
|
||||
* Fired when an input is detected from the user's input devices.
|
||||
@@ -174,19 +173,6 @@ public sealed interface InputEvent {
|
||||
return getInfo().key();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the platform-specific scan code}
|
||||
* <p>
|
||||
* The scan code is unique for every key, regardless of whether it has a key code.
|
||||
* Scan codes are platform-specific but consistent over time, so keys will have different scan codes depending
|
||||
* on the platform but they are safe to save to disk as custom key bindings.
|
||||
*
|
||||
* @see InputConstants#getKey(int, int)
|
||||
*/
|
||||
public int getScanCode() {
|
||||
return getInfo().scancode();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the mouse button's action}
|
||||
*
|
||||
@@ -214,35 +200,31 @@ public sealed interface InputEvent {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when a keymapping that by default involves clicking the mouse buttons is triggered.
|
||||
*
|
||||
* <p>The key bindings that trigger this event are:</p>
|
||||
* <ul>
|
||||
* <li><b>Use Item</b> - defaults to <em>left mouse click</em></li>
|
||||
* <li><b>Pick Block</b> - defaults to <em>middle mouse click</em></li>
|
||||
* <li><b>Attack</b> - defaults to <em>right mouse click</em></li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>If this event is cancelled, then the keymapping's action is not processed further, and the hand will be swung
|
||||
* according to {@link #shouldSwingHand()}.</p>
|
||||
*
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
// TODO: Change the 'button' to sub events. - Lex 0422202
|
||||
final class InteractionKeyMappingTriggered extends MutableEvent implements Cancellable, InputEvent {
|
||||
public static final CancellableEventBus<InteractionKeyMappingTriggered> BUS = CancellableEventBus.create(InteractionKeyMappingTriggered.class);
|
||||
|
||||
private final int button;
|
||||
/// Fired when a keymapping that by default involves clicking the mouse buttons is triggered.
|
||||
///
|
||||
/// The key bindings that trigger this event are:
|
||||
/// - **Use Item** - defaults to _left mouse click_
|
||||
/// - **Pick Block** - defaults to _middle mouse click_
|
||||
/// - **Attack** - defaults to _right mouse click_
|
||||
///
|
||||
/// If this event is cancelled, then the keymapping's action is not processed further, and the hand will be swung
|
||||
/// according to [#shouldSwingHand()].
|
||||
///
|
||||
/// This event is fired only on the [logical client][LogicalSide#CLIENT].
|
||||
///
|
||||
/// @see InteractionKeyMappingTriggered.Attack
|
||||
/// @see InteractionKeyMappingTriggered.UseItem
|
||||
/// @see InteractionKeyMappingTriggered.PickBlock
|
||||
sealed abstract class InteractionKeyMappingTriggered extends MutableEvent implements Cancellable, InputEvent {
|
||||
private final KeyMapping keyMapping;
|
||||
private final InteractionHand hand;
|
||||
private boolean handSwing = true;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public InteractionKeyMappingTriggered(int button, KeyMapping keyMapping, InteractionHand hand) {
|
||||
this.button = button;
|
||||
protected InteractionKeyMappingTriggered(KeyMapping keyMapping, InteractionHand hand) {
|
||||
this.keyMapping = keyMapping;
|
||||
this.hand = hand;
|
||||
super();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -272,32 +254,53 @@ public sealed interface InputEvent {
|
||||
return hand;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return {@code true} if the mouse button is the left mouse button}
|
||||
*/
|
||||
public boolean isAttack() {
|
||||
return button == 0;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return {@code true} if the mouse button is the right mouse button}
|
||||
*/
|
||||
public boolean isUseItem() {
|
||||
return button == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return {@code true} if the mouse button is the middle mouse button}
|
||||
*/
|
||||
public boolean isPickBlock() {
|
||||
return button == 2;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the key mapping which triggered this event}
|
||||
*/
|
||||
public KeyMapping getKeyMapping() {
|
||||
return keyMapping;
|
||||
}
|
||||
|
||||
/// The mouse button or input for attacking, typically the left mouse button
|
||||
public static final class Attack extends InteractionKeyMappingTriggered {
|
||||
public static final CancellableEventBus<Attack> BUS = CancellableEventBus.create(Attack.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Attack(KeyMapping keyMapping, InteractionHand hand) {
|
||||
super(keyMapping, hand);
|
||||
}
|
||||
}
|
||||
|
||||
/// The mouse button or input for using an item, typically the right mouse button
|
||||
public static final class UseItem extends InteractionKeyMappingTriggered {
|
||||
public static final CancellableEventBus<UseItem> BUS = CancellableEventBus.create(UseItem.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public UseItem(KeyMapping keyMapping, InteractionHand hand) {
|
||||
super(keyMapping, hand);
|
||||
}
|
||||
}
|
||||
|
||||
/// The mouse button or input for picking a block, typically the middle mouse button (scroll wheel click)
|
||||
public static final class PickBlock extends InteractionKeyMappingTriggered {
|
||||
public static final CancellableEventBus<PickBlock> BUS = CancellableEventBus.create(PickBlock.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public PickBlock(KeyMapping keyMapping, InteractionHand hand) {
|
||||
super(keyMapping, hand);
|
||||
}
|
||||
|
||||
/// @return Always false, as picking a block does not swing the hand and this event doesn't support changing
|
||||
/// that behaviour
|
||||
@Override
|
||||
public boolean shouldSwingHand() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setSwingHand(boolean value) {
|
||||
throw new UnsupportedOperationException("Cannot change hand swing behaviour for pick block input");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import net.minecraft.client.ClientRecipeBook;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.RecordEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
@@ -15,8 +14,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
/**
|
||||
* Fired when the {@link ClientRecipeBook} has updated information about recipes from the server to the client.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @param getRecipeBook the recipe manager
|
||||
*/
|
||||
|
||||
@@ -22,6 +22,8 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* <p>This event is {@linkplain Cancellable cancellable}. If this event is cancelled, then the arm will not be rendered.</p>
|
||||
*
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @param getPackedLight the amount of packed (sky and block) light for rendering
|
||||
*/
|
||||
public record RenderArmEvent(
|
||||
PoseStack getPoseStack,
|
||||
@@ -33,13 +35,4 @@ public record RenderArmEvent(
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RenderArmEvent {}
|
||||
|
||||
/**
|
||||
* {@return the amount of packed (sky and block) light for rendering}
|
||||
*
|
||||
* @see LightTexture
|
||||
*/
|
||||
public int getPackedLight() {
|
||||
return getPackedLight;
|
||||
}
|
||||
}
|
||||
@@ -5,56 +5,101 @@
|
||||
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import net.minecraft.client.renderer.state.level.PlayerRenderState;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.world.entity.player.Player;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraftforge.client.IRenderCallback;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.event.RecordEvent;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
import net.minecraftforge.eventbus.api.event.characteristic.Cancellable;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Fired before a block texture will be overlaid on the player's view.
|
||||
*
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @param getPlayer The player which the overlay will apply to
|
||||
* @param getPoseStack The pose stack used for rendering
|
||||
* @param getOverlayType The type of the overlay
|
||||
* @param getBlockState The block which the overlay is gotten from
|
||||
* @param getBlockPos The position of the block which the overlay is gotten from
|
||||
*/
|
||||
public record RenderBlockScreenEffectEvent(
|
||||
Player getPlayer,
|
||||
PoseStack getPoseStack,
|
||||
OverlayType getOverlayType,
|
||||
BlockState getBlockState,
|
||||
BlockPos getBlockPos
|
||||
) implements Cancellable, RecordEvent {
|
||||
public static final CancellableEventBus<RenderBlockScreenEffectEvent> BUS = CancellableEventBus.create(RenderBlockScreenEffectEvent.class);
|
||||
|
||||
/**
|
||||
* The type of the block overlay to be rendered.
|
||||
*
|
||||
* @see RenderBlockScreenEffectEvent
|
||||
*/
|
||||
public enum OverlayType {
|
||||
/**
|
||||
* The type of the overlay when the player is burning / on fire.
|
||||
*/
|
||||
FIRE,
|
||||
/**
|
||||
* The type of overlay when the player is suffocating inside a solid block.
|
||||
*/
|
||||
BLOCK,
|
||||
/**
|
||||
* The type of overlay when the player is underwater.
|
||||
*/
|
||||
WATER
|
||||
}
|
||||
public abstract sealed class RenderBlockScreenEffectEvent extends MutableEvent implements Cancellable permits
|
||||
RenderBlockScreenEffectEvent.FireOverlayEvent,
|
||||
RenderBlockScreenEffectEvent.BlockOverlayEvent,
|
||||
RenderBlockScreenEffectEvent.WaterOverlayEvent
|
||||
{
|
||||
private final Player player;
|
||||
private final BlockState blockState;
|
||||
private final BlockPos blockPos;
|
||||
private @Nullable IRenderCallback renderer;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RenderBlockScreenEffectEvent {}
|
||||
protected RenderBlockScreenEffectEvent(Player player, BlockState blockState, BlockPos blockPos) {
|
||||
this.player = player;
|
||||
this.blockState = blockState;
|
||||
this.blockPos = blockPos;
|
||||
}
|
||||
|
||||
/** The player which the overlay will apply to */
|
||||
public Player getPlayer() { return this.player; }
|
||||
|
||||
/** The block which the overlay is gotten from */
|
||||
public BlockState getBlockSate() { return this.blockState; }
|
||||
|
||||
/** The position of the block which the overlay is gotten from */
|
||||
public BlockPos getBlockPos() { return this.blockPos; }
|
||||
|
||||
/** Returns the custom renderer, if any, that an event handler has registered for this event. */
|
||||
public @Nullable IRenderCallback getCustomRenderer() {
|
||||
return this.renderer;
|
||||
}
|
||||
|
||||
/** Registers a custom renderer for this event, combine with canceling the event to take effect */
|
||||
public void setCustomRenderer(IRenderCallback renderer) {
|
||||
this.renderer = renderer;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Fired when the player is burning / on fire.
|
||||
*/
|
||||
public static final class FireOverlayEvent extends RenderBlockScreenEffectEvent {
|
||||
public static final CancellableEventBus<FireOverlayEvent> BUS = CancellableEventBus.create(FireOverlayEvent.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public FireOverlayEvent(Player player, BlockState blockState, BlockPos blockPos) {
|
||||
super(player, blockState, blockPos);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player is suffocating inside a solid block.
|
||||
*/
|
||||
public static final class BlockOverlayEvent extends RenderBlockScreenEffectEvent {
|
||||
public static final CancellableEventBus<BlockOverlayEvent> BUS = CancellableEventBus.create(BlockOverlayEvent.class);
|
||||
|
||||
@ApiStatus.Internal
|
||||
public BlockOverlayEvent(Player player, BlockState blockState, BlockPos blockPos) {
|
||||
super(player, blockState, blockPos);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired when the player is under normal Water.
|
||||
*/
|
||||
public static final class WaterOverlayEvent extends RenderBlockScreenEffectEvent {
|
||||
public static final CancellableEventBus<WaterOverlayEvent> BUS = CancellableEventBus.create(WaterOverlayEvent.class);
|
||||
|
||||
private final PlayerRenderState renderState;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public WaterOverlayEvent(Player player, BlockState blockState, BlockPos blockPos, PlayerRenderState renderState) {
|
||||
super(player, blockState, blockPos);
|
||||
this.renderState = renderState;
|
||||
}
|
||||
|
||||
/** The current computed render state, waterOverlay is accessible. */
|
||||
public PlayerRenderState getRenderState() {
|
||||
return this.renderState;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,91 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
/** Forge 1.20.5 - Removed, Mojang created a layered rendering system that should make this all obsolete finally.. - Lex 042724
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
/**
|
||||
* Fired when the HUD is rendered to the screen.
|
||||
* See the two subclasses for listening to the two possible phases.
|
||||
*
|
||||
* @see Pre
|
||||
* @see Post
|
||||
* /
|
||||
public abstract class RenderGuiEvent extends Event
|
||||
{
|
||||
private final Window window;
|
||||
private final GuiGraphics guiGraphics;
|
||||
private final float partialTick;
|
||||
|
||||
@ApiStatus.Internal
|
||||
protected RenderGuiEvent(Window window, GuiGraphics guiGraphics, float partialTick)
|
||||
{
|
||||
this.window = window;
|
||||
this.guiGraphics = guiGraphics;
|
||||
this.partialTick = partialTick;
|
||||
}
|
||||
|
||||
public Window getWindow()
|
||||
{
|
||||
return window;
|
||||
}
|
||||
|
||||
public GuiGraphics getGuiGraphics()
|
||||
{
|
||||
return guiGraphics;
|
||||
}
|
||||
|
||||
public float getPartialTick()
|
||||
{
|
||||
return partialTick;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired <b>before</b> the HUD is rendered to the screen.
|
||||
*
|
||||
* <p>This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
|
||||
* If this event is cancelled, then the overlay will not be rendered, and the corresponding {@link Post} event will
|
||||
* not be fired.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see Post
|
||||
* /
|
||||
@Cancelable
|
||||
public static class Pre extends RenderGuiEvent
|
||||
{
|
||||
@ApiStatus.Internal
|
||||
public Pre(Window window, GuiGraphics guiGraphics, float partialTick)
|
||||
{
|
||||
super(window, guiGraphics, partialTick);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired <b>after</b> the HUD is rendered to the screen, if the corresponding {@link Pre} is not cancelled.
|
||||
*
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* /
|
||||
public static class Post extends RenderGuiEvent
|
||||
{
|
||||
@ApiStatus.Internal
|
||||
public Post(Window window, GuiGraphics guiGraphics, float partialTick)
|
||||
{
|
||||
super(window, guiGraphics, partialTick);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,102 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
/** Forge 1.20.5 - Removed, Mojang created a layered rendering system that should make this all obsolete finally.. - Lex 042724
|
||||
package net.minecraftforge.client.event;
|
||||
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraftforge.client.gui.overlay.NamedGuiOverlay;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.Cancelable;
|
||||
import net.minecraftforge.eventbus.api.Event;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Fired when an overlay is rendered to the screen.
|
||||
* See the two subclasses for listening to the two possible phases.
|
||||
*
|
||||
* <p>An overlay that is not normally active cannot be forced to render. In such cases, this event will not fire.</p>
|
||||
*
|
||||
* @see Pre
|
||||
* @see Post
|
||||
* /
|
||||
public abstract class RenderGuiOverlayEvent extends Event
|
||||
{
|
||||
private final Window window;
|
||||
private final GuiGraphics guiGraphics;
|
||||
private final float partialTick;
|
||||
private final NamedGuiOverlay overlay;
|
||||
|
||||
@ApiStatus.Internal
|
||||
protected RenderGuiOverlayEvent(Window window, GuiGraphics guiGraphics, float partialTick, NamedGuiOverlay overlay)
|
||||
{
|
||||
this.window = window;
|
||||
this.guiGraphics = guiGraphics;
|
||||
this.partialTick = partialTick;
|
||||
this.overlay = overlay;
|
||||
}
|
||||
|
||||
public Window getWindow()
|
||||
{
|
||||
return window;
|
||||
}
|
||||
|
||||
public GuiGraphics getGuiGraphics()
|
||||
{
|
||||
return guiGraphics;
|
||||
}
|
||||
|
||||
public float getPartialTick()
|
||||
{
|
||||
return partialTick;
|
||||
}
|
||||
|
||||
public NamedGuiOverlay getOverlay()
|
||||
{
|
||||
return overlay;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired <b>before</b> a GUI overlay is rendered to the screen.
|
||||
*
|
||||
* <p>This event is {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.
|
||||
* If this event is cancelled, then the overlay will not be rendered, and the corresponding {@link Post} event will
|
||||
* not be fired.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see Post
|
||||
* /
|
||||
@Cancelable
|
||||
public static class Pre extends RenderGuiOverlayEvent
|
||||
{
|
||||
@ApiStatus.Internal
|
||||
public Pre(Window window, GuiGraphics guiGraphics, float partialTick, NamedGuiOverlay overlay)
|
||||
{
|
||||
super(window, guiGraphics, partialTick, overlay);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Fired <b>after</b> an GUI overlay is rendered to the screen, if the corresponding {@link Pre} is not cancelled.
|
||||
*
|
||||
* <p>This event is not {@linkplain Cancelable cancellable}, and does not {@linkplain HasResult have a result}.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* /
|
||||
public static class Post extends RenderGuiOverlayEvent
|
||||
{
|
||||
@ApiStatus.Internal
|
||||
public Post(Window window, GuiGraphics guiGraphics, float partialTick, NamedGuiOverlay overlay)
|
||||
{
|
||||
super(window, guiGraphics, partialTick, overlay);
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -24,7 +24,6 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*
|
||||
* @param getHand The hand being rendered
|
||||
* @param getPoseStack The pose stack used for rendering
|
||||
* @param getMultiBufferSource The source of rendering buffers
|
||||
* @param getPartialTick The partial tick
|
||||
* @param getInterpolatedPitch The interpolated pitch of the player entity
|
||||
* @param getSwingProgress The swing progress of the hand being rendered
|
||||
@@ -51,8 +50,6 @@ public record RenderHandEvent(
|
||||
|
||||
/**
|
||||
* {@return the amount of packed (sky and block) light for rendering}
|
||||
*
|
||||
* @see LightTexture
|
||||
*/
|
||||
public int getPackedLight() {
|
||||
return getPackedLight;
|
||||
|
||||
@@ -23,6 +23,8 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
*
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @param getPackedLight the amount of packed (sky and block) light for rendering
|
||||
*
|
||||
* @see ItemFrameRenderer
|
||||
*/
|
||||
public record RenderItemInFrameEvent(
|
||||
@@ -36,13 +38,4 @@ public record RenderItemInFrameEvent(
|
||||
|
||||
@ApiStatus.Internal
|
||||
public RenderItemInFrameEvent {}
|
||||
|
||||
/**
|
||||
* {@return the amount of packed (sky and block) light for rendering}
|
||||
*
|
||||
* @see LightTexture
|
||||
*/
|
||||
public int getPackedLight() {
|
||||
return getPackedLight;
|
||||
}
|
||||
}
|
||||
@@ -68,8 +68,7 @@ public sealed interface RenderLivingEvent<T extends LivingEntity, S extends Livi
|
||||
* If this event is cancelled, then the entity will not be rendered and the corresponding
|
||||
* {@link RenderLivingEvent.Post} will not be fired.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @param <T> the living entity that is being rendered
|
||||
* @param <M> the model for the living entity
|
||||
@@ -90,8 +89,7 @@ public sealed interface RenderLivingEvent<T extends LivingEntity, S extends Livi
|
||||
/**
|
||||
* Fired <b>after</b> an entity is rendered, if the corresponding {@link RenderLivingEvent.Post} is not cancelled.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @param <T> the living entity that was rendered
|
||||
* @param <M> the model for the living entity
|
||||
|
||||
@@ -111,8 +111,7 @@ public abstract sealed class RenderTooltipEvent extends MutableEvent implements
|
||||
* If this event is cancelled, then the list of components will be empty, causing the tooltip to not be rendered and
|
||||
* the corresponding {@link RenderTooltipEvent.Pre} to not be fired.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class GatherComponents extends MutableEvent implements Cancellable {
|
||||
public static final CancellableEventBus<GatherComponents> BUS = CancellableEventBus.create(GatherComponents.class);
|
||||
@@ -192,8 +191,7 @@ public abstract sealed class RenderTooltipEvent extends MutableEvent implements
|
||||
* <p>This event is {@linkplain Cancellable cancellable}.
|
||||
* If this event is cancelled, then the tooltip will not be rendered
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Pre extends RenderTooltipEvent implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
@@ -204,7 +202,7 @@ public abstract sealed class RenderTooltipEvent extends MutableEvent implements
|
||||
@Nullable
|
||||
private Identifier background;
|
||||
@Nullable
|
||||
private Identifier originalBackground;
|
||||
private final Identifier originalBackground;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Pre(ItemStack stack, GuiGraphicsExtractor graphics, int x, int y, int screenWidth, int screenHeight, Font font, List<ClientTooltipComponent> components, ClientTooltipPositioner positioner, @Nullable Identifier background) {
|
||||
|
||||
@@ -12,7 +12,6 @@ import net.minecraft.client.gui.screens.Screen;
|
||||
import net.minecraft.client.input.CharacterEvent;
|
||||
import net.minecraft.client.input.KeyEvent;
|
||||
import net.minecraft.client.input.MouseButtonEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.common.util.HasResult;
|
||||
import net.minecraftforge.common.util.Result;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
@@ -25,7 +24,6 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.jspecify.annotations.NonNull;
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
@@ -35,8 +33,7 @@ import java.util.function.Consumer;
|
||||
* Fired on different events/actions when a {@link Screen} is active and visible.
|
||||
* See the various subclasses for listening to different events.
|
||||
*
|
||||
* <p>These events are fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>These events are fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see Init
|
||||
* @see Render
|
||||
@@ -115,8 +112,7 @@ public sealed interface ScreenEvent {
|
||||
* If the event is cancelled, the initialization method will not be called, and the widgets and children lists
|
||||
* will not be cleared.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Pre extends Init implements Cancellable {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
@@ -130,8 +126,7 @@ public sealed interface ScreenEvent {
|
||||
/**
|
||||
* Fired <b>after</b> the screen's overridable initialization method is called.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public static final class Post extends Init {
|
||||
public static final EventBus<Post> BUS = EventBus.create(Post.class);
|
||||
@@ -177,8 +172,7 @@ public sealed interface ScreenEvent {
|
||||
* <p>This event is {@linkplain Cancellable cancellable}.
|
||||
* If the event is cancelled, the screen will not be drawn.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Pre(Screen getScreen, GuiGraphicsExtractor getGuiGraphics, int getMouseX, int getMouseY, float getPartialTick)
|
||||
implements Cancellable, Render, RecordEvent {
|
||||
@@ -191,8 +185,7 @@ public sealed interface ScreenEvent {
|
||||
/**
|
||||
* Fired <b>after</b> the screen is drawn.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Post(Screen getScreen, GuiGraphicsExtractor getGuiGraphics, int getMouseX, int getMouseY, float getPartialTick)
|
||||
implements Render, RecordEvent {
|
||||
@@ -207,8 +200,7 @@ public sealed interface ScreenEvent {
|
||||
* Fired directly after the background of the screen is drawn.
|
||||
* Can be used for drawing above the background but below the tooltips.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @param getGuiGraphics the gui graphics used for rendering
|
||||
*/
|
||||
@@ -226,8 +218,7 @@ public sealed interface ScreenEvent {
|
||||
*
|
||||
* <p>This event is {@linkplain Cancellable cancellable}. Cancelling this event will prevent vanilla rendering.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
final class RenderInventoryMobEffects extends MutableEvent implements Cancellable, ScreenEvent {
|
||||
public static final CancellableEventBus<RenderInventoryMobEffects> BUS = CancellableEventBus.create(RenderInventoryMobEffects.class);
|
||||
@@ -344,8 +335,7 @@ public sealed interface ScreenEvent {
|
||||
* If the event is cancelled, the screen's mouse click handler will be bypassed
|
||||
* and the corresponding {@link MouseButtonPressed.Post} will not be fired.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Pre(Screen getScreen, double getMouseX, double getMouseY, MouseButtonEvent getInfo)
|
||||
implements Cancellable, MouseButtonPressed, RecordEvent {
|
||||
@@ -367,8 +357,7 @@ public sealed interface ScreenEvent {
|
||||
* <li>{@link Result#DENY} - forcibly sets the mouse click as not handled.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Post(
|
||||
Screen getScreen,
|
||||
@@ -416,8 +405,7 @@ public sealed interface ScreenEvent {
|
||||
* If the event is cancelled, the screen's mouse release handler will be bypassed
|
||||
* and the corresponding {@link MouseButtonReleased.Post} will not be fired.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Pre(Screen getScreen, double getMouseX, double getMouseY, int getButton)
|
||||
implements Cancellable, MouseButtonReleased, RecordEvent {
|
||||
@@ -439,8 +427,7 @@ public sealed interface ScreenEvent {
|
||||
* <li>{@link Result#DENY} - forcibly sets the mouse release as not handled.</li>
|
||||
* </ul>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Post(
|
||||
Screen getScreen,
|
||||
@@ -500,8 +487,7 @@ public sealed interface ScreenEvent {
|
||||
* If the event is cancelled, the screen's mouse drag handler will be bypassed
|
||||
* and the corresponding {@link MouseDragged.Post} will not be fired.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Pre(
|
||||
Screen getScreen,
|
||||
@@ -524,8 +510,7 @@ public sealed interface ScreenEvent {
|
||||
* <p>This event is not {@linkplain Cancellable cancellable}, and does not {@linkplain HasResult have a result}.
|
||||
* If the event is cancelled, the mouse drag will be set as handled.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Post(
|
||||
Screen getScreen,
|
||||
@@ -568,8 +553,7 @@ public sealed interface ScreenEvent {
|
||||
* If the event is cancelled, the screen's mouse scroll handler will be bypassed
|
||||
* and the corresponding {@link MouseScrolled.Post} will not be fired.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Pre(Screen getScreen, double getMouseX, double getMouseY, double getDeltaX, double getDeltaY)
|
||||
implements Cancellable, MouseScrolled, RecordEvent {
|
||||
@@ -586,8 +570,7 @@ public sealed interface ScreenEvent {
|
||||
* <p>This event is not {@linkplain Cancellable cancellable}, and does not {@linkplain HasResult have a result}.
|
||||
* If the event is cancelled, the mouse scroll will be set as handled.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Post(Screen getScreen, double getMouseX, double getMouseY, double getDeltaX, double getDeltaY)
|
||||
implements MouseScrolled, RecordEvent {
|
||||
@@ -625,19 +608,6 @@ public sealed interface ScreenEvent {
|
||||
return getInfo().key();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return the platform-specific scan code}
|
||||
* <p>
|
||||
* The scan code is unique for every key, regardless of whether it has a key code.
|
||||
* Scan codes are platform-specific but consistent over time, so keys will have different scan codes depending
|
||||
* on the platform but they are safe to save to disk as custom key bindings.
|
||||
*
|
||||
* @see InputConstants#getKey(int, int)
|
||||
*/
|
||||
default int getScanCode() {
|
||||
return getInfo().scancode();
|
||||
}
|
||||
|
||||
/**
|
||||
* {@return a bit field representing the active modifier keys}
|
||||
*
|
||||
@@ -669,8 +639,7 @@ public sealed interface ScreenEvent {
|
||||
* If the event is cancelled, the screen's key press handler will be bypassed
|
||||
* and the corresponding {@link KeyPressed.Post} will not be fired.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Pre(Screen getScreen, KeyEvent getInfo) implements Cancellable, KeyPressed, RecordEvent {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
@@ -686,8 +655,7 @@ public sealed interface ScreenEvent {
|
||||
* <p>This event is {@linkplain Cancellable cancellable}.
|
||||
* If the event is cancelled, the key press will be set as handled.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Post(Screen getScreen, KeyEvent getInfo) implements Cancellable, KeyPressed, RecordEvent {
|
||||
public static final CancellableEventBus<Post> BUS = CancellableEventBus.create(Post.class);
|
||||
@@ -712,8 +680,7 @@ public sealed interface ScreenEvent {
|
||||
* If the event is cancelled, the screen's key release handler will be bypassed
|
||||
* and the corresponding {@link KeyReleased.Post} will not be fired.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Pre(Screen getScreen, KeyEvent getInfo) implements Cancellable, KeyReleased, RecordEvent {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
@@ -729,8 +696,7 @@ public sealed interface ScreenEvent {
|
||||
* <p>This event is {@linkplain Cancellable cancellable}.
|
||||
* If the event is cancelled, the key release will be set as handled.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Post(Screen getScreen, KeyEvent getInfo) implements Cancellable, KeyReleased, RecordEvent {
|
||||
public static final CancellableEventBus<Post> BUS = CancellableEventBus.create(Post.class);
|
||||
@@ -769,8 +735,7 @@ public sealed interface ScreenEvent {
|
||||
* If the event is cancelled, the screen's character input handler will be bypassed
|
||||
* and the corresponding {@link CharacterTyped.Post} will not be fired.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Pre(Screen getScreen, CharacterEvent getInfo) implements Cancellable, CharacterTyped, RecordEvent {
|
||||
public static final CancellableEventBus<Pre> BUS = CancellableEventBus.create(Pre.class);
|
||||
@@ -786,8 +751,7 @@ public sealed interface ScreenEvent {
|
||||
* <p>This event is {@linkplain Cancellable cancellable}.
|
||||
* If the event is cancelled, the character input will be set as handled.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Post(Screen getScreen, CharacterEvent getInfo) implements CharacterTyped, RecordEvent {
|
||||
public static final EventBus<Post> BUS = EventBus.create(Post.class);
|
||||
@@ -806,15 +770,14 @@ public sealed interface ScreenEvent {
|
||||
* will remain open. However, cancelling this event will not prevent the closing of screen layers which happened before
|
||||
* this event fired.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
final class Opening extends MutableEvent implements Cancellable, ScreenEvent {
|
||||
public static final CancellableEventBus<Opening> BUS = CancellableEventBus.create(Opening.class);
|
||||
|
||||
private final Screen screen;
|
||||
private final @Nullable Screen currentScreen;
|
||||
private Screen newScreen;
|
||||
private @Nullable Screen newScreen;
|
||||
|
||||
@ApiStatus.Internal
|
||||
public Opening(@Nullable Screen currentScreen, Screen screen) {
|
||||
@@ -849,7 +812,7 @@ public sealed interface ScreenEvent {
|
||||
/**
|
||||
* Sets the new screen to be opened if the event is not cancelled. May be null.
|
||||
*/
|
||||
public void setNewScreen(Screen newScreen) {
|
||||
public void setNewScreen(@Nullable Screen newScreen) {
|
||||
this.newScreen = newScreen;
|
||||
}
|
||||
}
|
||||
@@ -858,8 +821,7 @@ public sealed interface ScreenEvent {
|
||||
* Fired before a {@link Screen} is closed.
|
||||
* All screen layers on the screen are closed before this event is fired.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record Closing(Screen getScreen) implements ScreenEvent, RecordEvent {
|
||||
public static final EventBus<Closing> BUS = EventBus.create(Closing.class);
|
||||
|
||||
@@ -27,8 +27,7 @@ import java.io.IOException;
|
||||
* If this event is cancelled, then the screenshot is not written to disk, and the message in the event will be posted
|
||||
* to the player's chat.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see Screenshot
|
||||
*/
|
||||
|
||||
@@ -19,8 +19,7 @@ import net.minecraftforge.fml.LogicalSide;
|
||||
* <p>This event is {@linkplain Cancellable cancellable}.
|
||||
* Cancelling the event stops the toast from being queued, which means it never renders.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
public record ToastAddEvent(Toast getToast) implements Cancellable, RecordEvent {
|
||||
public static final CancellableEventBus<ToastAddEvent> BUS = CancellableEventBus.create(ToastAddEvent.class);
|
||||
|
||||
@@ -10,7 +10,6 @@ import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.renderer.GameRenderer;
|
||||
import net.minecraft.client.renderer.fog.FogData;
|
||||
import net.minecraft.world.level.material.FogType;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.bus.CancellableEventBus;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.MutableEvent;
|
||||
@@ -26,8 +25,7 @@ import org.jspecify.annotations.NullMarked;
|
||||
* These can be used for customizing the visual features visible to the player.
|
||||
* See the various subclasses for listening to different features.
|
||||
*
|
||||
* <p>These events are fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>These events are fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see RenderFog
|
||||
* @see ComputeFogColor
|
||||
@@ -56,8 +54,7 @@ public sealed interface ViewportEvent {
|
||||
* <p>This event is {@linkplain Cancellable cancellable}.<br>
|
||||
* The event must be cancelled for any changes to the plane distances to take effect.</p>
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
record RenderFog(
|
||||
GameRenderer getRenderer,
|
||||
@@ -141,8 +138,7 @@ public sealed interface ViewportEvent {
|
||||
/**
|
||||
* Fired for customizing the <b>color</b> of the fog visible to the player.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
final class ComputeFogColor extends MutableEvent implements ViewportEvent {
|
||||
public static final EventBus<ComputeFogColor> BUS = EventBus.create(ComputeFogColor.class);
|
||||
@@ -233,8 +229,7 @@ public sealed interface ViewportEvent {
|
||||
* Fired to allow altering the angles of the player's camera.
|
||||
* This can be used to alter the player's view for different effects, such as applying roll.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*/
|
||||
@NullMarked
|
||||
final class ComputeCameraAngles extends MutableEvent implements ViewportEvent {
|
||||
@@ -325,8 +320,7 @@ public sealed interface ViewportEvent {
|
||||
* Fired for altering the raw field of view (FOV).
|
||||
* This is after the FOV settings are applied, and before modifiers such as the Nausea effect.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see ComputeFovModifierEvent
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.mojang.blaze3d.audio.Channel;
|
||||
import net.minecraft.client.resources.sounds.SoundInstance;
|
||||
import net.minecraft.client.sounds.SoundEngine;
|
||||
import net.minecraftforge.client.event.sound.SoundEvent.SoundSourceEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -19,8 +18,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* in a buffer before being played, and used for most sounds of short length such as sound effects for clicking
|
||||
* buttons.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see PlayStreamingSourceEvent
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.mojang.blaze3d.audio.Channel;
|
||||
import net.minecraft.client.resources.sounds.SoundInstance;
|
||||
import net.minecraft.client.sounds.SoundEngine;
|
||||
import net.minecraftforge.client.event.sound.SoundEvent.SoundSourceEvent;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
@@ -19,8 +18,7 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* (such as a file), and used for sounds of long length which are unsuitable to keep fully loaded in-memory in a buffer
|
||||
* (as is done for regular non-streaming sounds), such as background music or music discs.
|
||||
*
|
||||
* <p>This event is fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>This event is fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see PlayStreamingSourceEvent
|
||||
*/
|
||||
|
||||
@@ -8,7 +8,6 @@ package net.minecraftforge.client.event.sound;
|
||||
import net.minecraft.client.resources.sounds.SoundInstance;
|
||||
import net.minecraft.client.sounds.SoundEngine;
|
||||
import com.mojang.blaze3d.audio.Channel;
|
||||
import net.minecraftforge.common.MinecraftForge;
|
||||
import net.minecraftforge.eventbus.api.bus.EventBus;
|
||||
import net.minecraftforge.eventbus.api.event.InheritableEvent;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
@@ -16,8 +15,7 @@ import net.minecraftforge.fml.LogicalSide;
|
||||
/**
|
||||
* Superclass for sound related events.
|
||||
*
|
||||
* <p>These events are fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>These events are fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see SoundSourceEvent
|
||||
* @see PlaySoundEvent
|
||||
@@ -32,8 +30,7 @@ public sealed interface SoundEvent permits PlaySoundEvent, SoundEngineLoadEvent,
|
||||
/**
|
||||
* Superclass for when a sound has started to play on an audio channel.
|
||||
*
|
||||
* <p>These events are fired on the {@linkplain MinecraftForge#EVENT_BUS main Forge event bus},
|
||||
* only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
* <p>These events are fired only on the {@linkplain LogicalSide#CLIENT logical client}.</p>
|
||||
*
|
||||
* @see PlaySoundSourceEvent
|
||||
* @see PlayStreamingSourceEvent
|
||||
@@ -47,7 +44,7 @@ public sealed interface SoundEvent permits PlaySoundEvent, SoundEngineLoadEvent,
|
||||
SoundInstance getSound();
|
||||
|
||||
/**
|
||||
* {@return the audio channel on which the sound is playing on}
|
||||
* {@return the audio channel on which the sound is playing}
|
||||
*/
|
||||
Channel getChannel();
|
||||
|
||||
|
||||
@@ -5,14 +5,7 @@
|
||||
|
||||
package net.minecraftforge.client.extensions;
|
||||
|
||||
import com.mojang.blaze3d.textures.GpuTexture;
|
||||
|
||||
public interface IForgeGpuTexture {
|
||||
@SuppressWarnings("unused")
|
||||
private GpuTexture self() {
|
||||
return (GpuTexture) this;
|
||||
}
|
||||
|
||||
default boolean isStencilEnabled() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -29,11 +29,11 @@ public interface IForgePoseStack {
|
||||
var trans = transformation.translation();
|
||||
self.translate(trans.x(), trans.y(), trans.z());
|
||||
|
||||
self.mulPose(transformation.leftRotation());
|
||||
self.last().rotate(transformation.leftRotation());
|
||||
|
||||
var scale = transformation.scale();
|
||||
self.scale(scale.x(), scale.y(), scale.z());
|
||||
|
||||
self.mulPose(transformation.rightRotation());
|
||||
self.last().rotate(transformation.rightRotation());
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -8,6 +8,7 @@ package net.minecraftforge.client.extensions.common;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.particle.ParticleEngine;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.core.Direction;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.tags.FluidTags;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
@@ -21,7 +22,6 @@ import net.minecraft.world.level.block.Block;
|
||||
import net.minecraft.world.level.block.Blocks;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.phys.HitResult;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
import org.joml.Vector3d;
|
||||
|
||||
@@ -51,11 +51,11 @@ public interface IClientBlockExtensions {
|
||||
*
|
||||
* @param state The current state
|
||||
* @param level The current level
|
||||
* @param target The target the player is looking at {x/y/z/side/sub}
|
||||
* @param direction The side of the block the player is breaking
|
||||
* @param manager A reference to the current particle manager.
|
||||
* @return True to prevent vanilla digging particles form spawning.
|
||||
*/
|
||||
default boolean addHitEffects(BlockState state, Level level, HitResult target, ParticleEngine manager) {
|
||||
default boolean addHitEffects(BlockState state, Level level, Direction direction, ParticleEngine manager) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
+7
-4
@@ -5,23 +5,23 @@
|
||||
|
||||
package net.minecraftforge.client.extensions.common;
|
||||
|
||||
import com.mojang.blaze3d.vertex.PoseStack;
|
||||
import java.util.function.Consumer;
|
||||
import net.minecraft.client.Camera;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.multiplayer.ClientLevel;
|
||||
import net.minecraft.client.renderer.ScreenEffectRenderer;
|
||||
import net.minecraft.client.renderer.SubmitNodeCollector;
|
||||
import net.minecraft.client.renderer.block.BlockAndTintGetter;
|
||||
import net.minecraft.client.renderer.block.FluidModel;
|
||||
import net.minecraft.client.renderer.block.FluidRenderer;
|
||||
import net.minecraft.client.renderer.fog.FogData;
|
||||
import net.minecraft.client.renderer.state.level.PlayerRenderState;
|
||||
import net.minecraft.core.BlockPos;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.world.level.material.Fluid;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.level.material.FogType;
|
||||
import net.minecraftforge.client.IRenderCallback;
|
||||
import net.minecraftforge.fluids.FluidStack;
|
||||
import net.minecraftforge.fluids.FluidType;
|
||||
import net.minecraftforge.fml.LogicalSide;
|
||||
@@ -138,12 +138,15 @@ public interface IClientFluidTypeExtensions {
|
||||
* @param mc the client instance
|
||||
* @param poseStack the transformations representing the current rendering position
|
||||
*/
|
||||
default void renderOverlay(Minecraft mc, PoseStack poseStack, SubmitNodeCollector buffer) {
|
||||
default @Nullable IRenderCallback renderOverlay(Minecraft mc, PlayerRenderState state) {
|
||||
Identifier texture = this.getRenderOverlayTexture(mc);
|
||||
if (texture != null)
|
||||
ScreenEffectRenderer.renderFluid(mc, poseStack, buffer, texture);
|
||||
return (pose, collector) -> ScreenEffectRenderer.submitFluid(state.waterOverlay, pose, collector, texture);
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Modifies the color of the fog when the camera is within the fluid.
|
||||
*
|
||||
|
||||
+1
-1
@@ -66,7 +66,7 @@ public interface IClientItemExtensions {
|
||||
*/
|
||||
@Nullable
|
||||
default HumanoidModel.ArmPose getArmPose(LivingEntity entityLiving, InteractionHand hand, ItemStack itemStack) {
|
||||
return null;
|
||||
return HumanoidModel.ArmPose.ITEM;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,13 +6,15 @@
|
||||
package net.minecraftforge.client.gui;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.mojang.blaze3d.Blaze3D;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.Font;
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
import net.minecraft.client.gui.screens.ErrorScreen;
|
||||
import net.minecraft.client.gui.components.Button.OnPress;
|
||||
import net.minecraft.client.gui.components.ObjectSelectionList;
|
||||
import net.minecraft.util.FormattedCharSequence;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraftforge.common.ForgeI18n;
|
||||
@@ -56,18 +58,27 @@ public class LoadingErrorScreen extends ErrorScreen {
|
||||
this.warningHeader = Component.literal(ChatFormatting.YELLOW + ForgeI18n.parseMessage("fml.loadingerrorscreen.warningheader", this.modLoadWarnings.size()) + ChatFormatting.RESET);
|
||||
|
||||
int yOffset = 46;
|
||||
this.addRenderableWidget(new ExtendedButton(50, this.height - yOffset, this.width / 2 - 55, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.mods.folder")), _ -> Util.getPlatform().openFile(modsDir.toFile())));
|
||||
this.addRenderableWidget(new ExtendedButton(this.width / 2 + 5, this.height - yOffset, this.width / 2 - 55, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), _ -> Util.getPlatform().openFile(logFile.toFile())));
|
||||
this.addRenderableWidget(new ExtendedButton(50, this.height - yOffset, this.width / 2 - 55, 20, text("fml.button.open.mods.folder"), open(modsDir)));
|
||||
this.addRenderableWidget(new ExtendedButton(this.width / 2 + 5, this.height - yOffset, this.width / 2 - 55, 20, text("fml.button.open.file", logFile.getFileName()), open(logFile)));
|
||||
if (this.modLoadErrors.isEmpty())
|
||||
this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, Component.literal(ForgeI18n.parseMessage("fml.button.continue.launch")), _ -> this.minecraft.gui.setScreen(null)));
|
||||
this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, text("fml.button.continue.launch"), _ -> this.minecraft.gui.setScreen(null)));
|
||||
else
|
||||
this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, Component.literal(ForgeI18n.parseMessage("fml.button.open.file", dumpedLocation.getFileName())), _ -> Util.getPlatform().openFile(dumpedLocation.toFile())));
|
||||
this.addRenderableWidget(new ExtendedButton(this.width / 4, this.height - 24, this.width / 2, 20, text("fml.button.open.file", dumpedLocation.getFileName()), open(dumpedLocation)));
|
||||
|
||||
this.entryList = new LoadingEntryList(this, this.modLoadErrors, this.modLoadWarnings);
|
||||
this.addWidget(this.entryList);
|
||||
this.setFocused(this.entryList);
|
||||
}
|
||||
|
||||
|
||||
private static Component text(String key, Object... args) {
|
||||
return Component.literal(ForgeI18n.parseMessage(key, args));
|
||||
}
|
||||
|
||||
private static OnPress open(Path path) {
|
||||
return _ -> Blaze3D.openPath(path);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void extractRenderState(GuiGraphicsExtractor guiGraphics, int mouseX, int mouseY, float partialTick) {
|
||||
this.entryList.extractRenderState(guiGraphics, mouseX, mouseY, partialTick);
|
||||
|
||||
@@ -36,11 +36,12 @@ import net.minecraft.client.gui.components.ObjectSelectionList;
|
||||
import net.minecraft.client.gui.components.StringWidget;
|
||||
|
||||
import net.minecraft.client.renderer.texture.DynamicTexture;
|
||||
|
||||
import com.mojang.blaze3d.Blaze3D;
|
||||
import com.mojang.blaze3d.platform.NativeImage;
|
||||
import net.minecraft.client.renderer.texture.TextureManager;
|
||||
import net.minecraft.util.FormattedCharSequence;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.util.Size2i;
|
||||
import net.minecraftforge.common.ForgeI18n;
|
||||
@@ -232,7 +233,7 @@ public class ModListScreen extends Screen {
|
||||
.bounds(((listWidth + PADDING + this.width - doneButtonWidth) / 2), y, doneButtonWidth, BUTTON_HEIGHT)
|
||||
.build();
|
||||
|
||||
openModsFolderButton = Button.builder(Component.translatable("fml.menu.mods.openmodsfolder"), _ -> Util.getPlatform().openFile(FMLPaths.MODSDIR.get().toFile()))
|
||||
openModsFolderButton = Button.builder(Component.translatable("fml.menu.mods.openmodsfolder"), _ -> Blaze3D.openPath(FMLPaths.MODSDIR.get()))
|
||||
.bounds(6, y, this.listWidth, BUTTON_HEIGHT)
|
||||
.build();
|
||||
|
||||
|
||||
@@ -17,8 +17,9 @@ import java.util.stream.Collectors;
|
||||
import net.minecraftforge.client.gui.widget.ScrollPanel;
|
||||
import org.apache.commons.lang3.tuple.Pair;
|
||||
|
||||
import com.mojang.blaze3d.Blaze3D;
|
||||
|
||||
import net.minecraft.ChatFormatting;
|
||||
import net.minecraft.util.Util;
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
import net.minecraft.client.gui.TextAlignment;
|
||||
@@ -86,10 +87,10 @@ public class ModMismatchDisconnectedScreen extends Screen {
|
||||
this.addRenderableWidget(new MismatchInfoPanel(minecraft, listWidth, listHeight, (this.height - this.listHeight) / 2, listLeft));
|
||||
|
||||
int buttonWidth = Math.min(210, this.width / 2 - 20);
|
||||
this.addRenderableWidget(Button.builder(Component.literal(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), _ -> Util.getPlatform().openFile(logFile.toFile()))
|
||||
this.addRenderableWidget(Button.builder(Component.literal(ForgeI18n.parseMessage("fml.button.open.file", logFile.getFileName())), _ -> Blaze3D.openPath(logFile))
|
||||
.bounds(Math.max(this.width / 4 - buttonWidth / 2, listLeft), upperButtonHeight, buttonWidth, 20)
|
||||
.build());
|
||||
this.addRenderableWidget(Button.builder(Component.literal(ForgeI18n.parseMessage("fml.button.open.mods.folder")), _ -> Util.getPlatform().openFile(modsDir.toFile()))
|
||||
this.addRenderableWidget(Button.builder(Component.literal(ForgeI18n.parseMessage("fml.button.open.mods.folder")), _ -> Blaze3D.openPath(modsDir))
|
||||
.bounds(Math.min(this.width * 3 / 4 - buttonWidth / 2, listLeft + listWidth - buttonWidth), upperButtonHeight, buttonWidth, 20)
|
||||
.build());
|
||||
this.addRenderableWidget(Button.builder(Component.translatable("gui.toMenu"), _ -> this.minecraft.gui.setScreen(this.parent))
|
||||
|
||||
@@ -1,21 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
/** Forge 1.20.5 - Removed, Mojang created a layered rendering system that should make this all obsolete finally.. - Lex 042724
|
||||
package net.minecraftforge.client.gui.overlay;
|
||||
|
||||
import net.minecraft.client.gui.GuiGraphics;
|
||||
import net.minecraftforge.client.event.RegisterGuiOverlaysEvent;
|
||||
|
||||
/**
|
||||
* A HUD overlay.
|
||||
*
|
||||
* @see RegisterGuiOverlaysEvent
|
||||
* /
|
||||
@FunctionalInterface
|
||||
public interface IGuiOverlay {
|
||||
void render(ForgeGui gui, GuiGraphics guiGraphics, float partialTick, int screenWidth, int screenHeight);
|
||||
}
|
||||
*/
|
||||
@@ -12,10 +12,11 @@ import net.minecraft.client.input.MouseButtonEvent;
|
||||
import net.minecraft.client.renderer.RenderPipelines;
|
||||
import net.minecraft.network.chat.Component;
|
||||
import net.minecraft.util.Mth;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
|
||||
import com.mojang.blaze3d.platform.InputConstants;
|
||||
|
||||
/**
|
||||
* Slider widget implementation which allows inputting values in a certain range with optional step size.
|
||||
*/
|
||||
@@ -134,8 +135,8 @@ public class ForgeSlider extends AbstractSliderButton {
|
||||
|
||||
@Override
|
||||
public boolean keyPressed(KeyEvent info) {
|
||||
boolean flag = info.key() == GLFW.GLFW_KEY_LEFT;
|
||||
if (flag || info.key() == GLFW.GLFW_KEY_RIGHT) {
|
||||
boolean flag = info.key() == InputConstants.KEY_LEFT;
|
||||
if (flag || info.key() == InputConstants.KEY_RIGHT) {
|
||||
if (this.minValue > this.maxValue)
|
||||
flag = !flag;
|
||||
float f = flag ? -1F : 1F;
|
||||
|
||||
@@ -5,8 +5,9 @@
|
||||
|
||||
package net.minecraftforge.client.loading;
|
||||
|
||||
import com.mojang.blaze3d.opengl.GlTexture;
|
||||
import com.mojang.blaze3d.systems.RenderSystem;
|
||||
import com.mojang.renderpearl.backend.opengl.GlTexture;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.GuiGraphicsExtractor;
|
||||
import net.minecraft.client.gui.screens.LoadingOverlay;
|
||||
|
||||
@@ -7,26 +7,28 @@ package net.minecraftforge.client.loading;
|
||||
|
||||
import com.mojang.blaze3d.platform.Monitor;
|
||||
import com.mojang.blaze3d.platform.Window;
|
||||
import com.mojang.blaze3d.systems.GpuBackend;
|
||||
import com.mojang.renderpearl.api.device.GpuBackend;
|
||||
|
||||
import net.minecraft.client.Minecraft;
|
||||
import net.minecraft.client.gui.screens.LoadingOverlay;
|
||||
import net.minecraft.server.packs.resources.ReloadInstance;
|
||||
|
||||
import static org.lwjgl.sdl.SDLVideo.SDL_GL_CONTEXT_MAJOR_VERSION;
|
||||
import static org.lwjgl.sdl.SDLVideo.SDL_GL_CONTEXT_MINOR_VERSION;
|
||||
import static org.lwjgl.sdl.SDLVideo.SDL_GL_GetAttribute;
|
||||
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.IntConsumer;
|
||||
import java.util.function.LongSupplier;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public final class NoVizFallback {
|
||||
private static long WINDOW;
|
||||
public static LongSupplier windowHandoff(int width, int height, String title, long monitor, Supplier<Object> backend) {
|
||||
public static LongSupplier windowHandoff(int width, int height, String title, Supplier<Object> backend) {
|
||||
return () -> {
|
||||
try {
|
||||
return WINDOW = Window.createGlfwWindow(width, height, title, monitor, (GpuBackend)backend.get());
|
||||
return WINDOW = Window.createWindowStatic((GpuBackend)backend.get(), width, height, title);
|
||||
} catch (Throwable e) {
|
||||
return sneak(e);
|
||||
}
|
||||
@@ -49,9 +51,13 @@ public final class NoVizFallback {
|
||||
|
||||
public static String glVersion() {
|
||||
if (WINDOW != 0) {
|
||||
var maj = GLFW.glfwGetWindowAttrib(WINDOW, GLFW.GLFW_CONTEXT_VERSION_MAJOR);
|
||||
var min = GLFW.glfwGetWindowAttrib(WINDOW, GLFW.GLFW_CONTEXT_VERSION_MINOR);
|
||||
return maj+"."+min;
|
||||
try (var stack = org.lwjgl.system.MemoryStack.stackPush()) {
|
||||
var majBuf = stack.mallocInt(1);
|
||||
var minBuf = stack.mallocInt(1);
|
||||
SDL_GL_GetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, majBuf);
|
||||
SDL_GL_GetAttribute(SDL_GL_CONTEXT_MINOR_VERSION, minBuf);
|
||||
return majBuf.get(0) + "." + minBuf.get(0);
|
||||
}
|
||||
} else {
|
||||
return "3.2";
|
||||
}
|
||||
|
||||
@@ -147,7 +147,7 @@ public class DynamicFluidContainerModel implements UnbakedGeometry {
|
||||
|
||||
private static MaterialInfo info(final ModelBaker baker, final Material.Baked material, final int tintIndex) {
|
||||
return baker.interner().materialInfo(
|
||||
MaterialInfo.of(material, material.sprite().transparency(), tintIndex, true, 0)
|
||||
MaterialInfo.of(material, material.sprite().transparency(), tintIndex, null, 0)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,6 @@ import java.io.IOException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Map;
|
||||
import java.util.NoSuchElementException;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* An OBJ material library (MTL), composed of named {@link Material materials}.
|
||||
@@ -37,7 +36,7 @@ public class ObjMaterialLibrary
|
||||
{
|
||||
case "newmtl":
|
||||
{
|
||||
String name = Arrays.asList(Arrays.copyOfRange(line, 1, line.length)).stream().collect(Collectors.joining(" "));
|
||||
String name = String.join(" ", Arrays.copyOfRange(line, 1, line.length));
|
||||
currentMaterial = new Material(name);
|
||||
materials.put(name, currentMaterial);
|
||||
break;
|
||||
|
||||
@@ -316,9 +316,9 @@ public class ObjModel {
|
||||
if (emissiveAmbient) {
|
||||
int fakeLight = (int) ((ambientColor.x() + ambientColor.y() + ambientColor.z()) * 15 / 3.0f);
|
||||
uv2 = LightCoordsUtil.pack(fakeLight, fakeLight);
|
||||
quadBaker.setShade(fakeLight == 0 && shadeQuads);
|
||||
quadBaker.setShade(fakeLight == 0 && shadeQuads ? Direction.UP : null);
|
||||
} else
|
||||
quadBaker.setShade(shadeQuads);
|
||||
quadBaker.setShade(shadeQuads ? Direction.UP : null);
|
||||
|
||||
boolean hasTransform = !transform.isIdentity();
|
||||
// The incoming transform is referenced on the center of the block, but our coords are referenced on the corner
|
||||
|
||||
@@ -18,6 +18,7 @@ import net.minecraftforge.client.textures.UnitTextureAtlasSprite;
|
||||
import java.util.function.Consumer;
|
||||
|
||||
import org.joml.Vector3f;
|
||||
import org.jspecify.annotations.Nullable;
|
||||
|
||||
/**
|
||||
* Vertex consumer that outputs {@linkplain BakedQuad baked quads}.
|
||||
@@ -36,7 +37,7 @@ public class BakedQuadBuilder implements VertexConsumer {
|
||||
private int tintIndex;
|
||||
private Direction direction = Direction.DOWN;
|
||||
private TextureAtlasSprite sprite = UnitTextureAtlasSprite.INSTANCE;
|
||||
private boolean shade;
|
||||
private @Nullable Direction shade;
|
||||
private int lightEmission;
|
||||
|
||||
public BakedQuadBuilder(Consumer<BakedQuad> quadConsumer) {
|
||||
@@ -104,6 +105,13 @@ public class BakedQuadBuilder implements VertexConsumer {
|
||||
return this;
|
||||
}
|
||||
|
||||
/** Will not actually do anything, vanilla implementations ignore if passed invalid data so we do as well */
|
||||
@Override
|
||||
public VertexConsumer setUv3(float u, float v) {
|
||||
//throw new IllegalStateException("UV2 is not supported in BakedQuads anymore, you can't bake lighting per vertex anymore");
|
||||
return this;
|
||||
}
|
||||
|
||||
private void setup() {
|
||||
this.positions = new Vector3f[]{ new Vector3f(), new Vector3f(), new Vector3f(), new Vector3f() };
|
||||
this.uvs = new long[4];
|
||||
@@ -139,7 +147,7 @@ public class BakedQuadBuilder implements VertexConsumer {
|
||||
this.sprite = sprite;
|
||||
}
|
||||
|
||||
public void setShade(boolean shade) {
|
||||
public void setShade(@Nullable Direction shade) {
|
||||
this.shade = shade;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,6 +55,12 @@ public class VertexConsumerWrapper implements VertexConsumer {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexConsumer setUv3(float u, float v) {
|
||||
parent.setUv3(u, v);
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public VertexConsumer setNormal(float x, float y, float z) {
|
||||
parent.setNormal(x, y, z);
|
||||
|
||||
@@ -39,13 +39,9 @@ public class CompositeRenderable implements IRenderable<CompositeRenderable.Tran
|
||||
return new Builder();
|
||||
}
|
||||
|
||||
private static class Component {
|
||||
private final String name;
|
||||
private final List<Component> children = new ArrayList<>();
|
||||
private final List<Mesh> meshes = new ArrayList<>();
|
||||
|
||||
public Component(String name) {
|
||||
this.name = name;
|
||||
private record Component(String name, List<Component> children, List<Mesh> meshes) {
|
||||
private Component(String name) {
|
||||
this(name, new ArrayList<>(), new ArrayList<>());
|
||||
}
|
||||
|
||||
public void render(PoseStack poseStack, ITextureRenderTypeLookup textureRenderTypeLookup, int lightmap, int overlay, Transforms context) {
|
||||
@@ -66,13 +62,12 @@ public class CompositeRenderable implements IRenderable<CompositeRenderable.Tran
|
||||
}
|
||||
}
|
||||
|
||||
private static class Mesh {
|
||||
private final Identifier texture;
|
||||
private final List<BakedQuad> quads = new ArrayList<>();
|
||||
private final QuadInstance quadInstance = new QuadInstance();
|
||||
private record Mesh(List<BakedQuad> quads, QuadInstance quadInstance) {
|
||||
// private final Identifier texture;
|
||||
|
||||
public Mesh(Identifier texture) {
|
||||
this.texture = texture;
|
||||
private Mesh(Identifier texture) {
|
||||
// this.texture = texture;
|
||||
this(new ArrayList<>(), new QuadInstance());
|
||||
}
|
||||
|
||||
public void render(PoseStack poseStack, ITextureRenderTypeLookup textureRenderTypeLookup, int lightmap, int overlay) {
|
||||
@@ -85,20 +80,16 @@ public class CompositeRenderable implements IRenderable<CompositeRenderable.Tran
|
||||
}
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private final CompositeRenderable renderable = new CompositeRenderable();
|
||||
|
||||
private Builder() { }
|
||||
public record Builder(CompositeRenderable get) {
|
||||
private Builder() {
|
||||
this(new CompositeRenderable());
|
||||
}
|
||||
|
||||
public PartBuilder<Builder> child(String name) {
|
||||
var child = new Component(name);
|
||||
renderable.components.add(child);
|
||||
get.components.add(child);
|
||||
return new PartBuilder<>(this, child);
|
||||
}
|
||||
|
||||
public CompositeRenderable get() {
|
||||
return renderable;
|
||||
}
|
||||
}
|
||||
|
||||
public static class PartBuilder<T> {
|
||||
|
||||
@@ -15,7 +15,6 @@ import com.mojang.blaze3d.platform.InputConstants;
|
||||
|
||||
import net.minecraft.network.chat.Component;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
import org.lwjgl.glfw.GLFW;
|
||||
|
||||
public enum KeyModifier {
|
||||
CONTROL {
|
||||
@@ -40,7 +39,7 @@ public enum KeyModifier {
|
||||
SHIFT {
|
||||
@Override
|
||||
public boolean matches(InputConstants.Key key) {
|
||||
return key.getValue() == GLFW.GLFW_KEY_LEFT_SHIFT || key.getValue() == GLFW.GLFW_KEY_RIGHT_SHIFT;
|
||||
return key.getValue() == InputConstants.KEY_LSHIFT || key.getValue() == InputConstants.KEY_RSHIFT;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -56,7 +55,7 @@ public enum KeyModifier {
|
||||
ALT {
|
||||
@Override
|
||||
public boolean matches(InputConstants.Key key) {
|
||||
return key.getValue() == GLFW.GLFW_KEY_LEFT_ALT || key.getValue() == GLFW.GLFW_KEY_RIGHT_ALT;
|
||||
return key.getValue() == InputConstants.KEY_LALT || key.getValue() == InputConstants.KEY_RALT;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -35,7 +35,6 @@ import com.mojang.serialization.Decoder;
|
||||
import com.mojang.serialization.DynamicOps;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import com.mojang.serialization.Lifecycle;
|
||||
|
||||
import io.netty.handler.codec.DecoderException;
|
||||
import it.unimi.dsi.fastutil.objects.ObjectArrayList;
|
||||
import net.minecraft.commands.CommandSourceStack;
|
||||
@@ -68,6 +67,7 @@ import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.util.CrudeIncrementalIntIdentityHashBiMap;
|
||||
import net.minecraft.util.GsonHelper;
|
||||
import net.minecraft.util.Mth;
|
||||
import net.minecraft.util.Prediction;
|
||||
import net.minecraft.util.datafix.fixes.StructuresBecomeConfiguredFix;
|
||||
import net.minecraft.world.InteractionHand;
|
||||
import net.minecraft.world.InteractionResult;
|
||||
@@ -91,7 +91,6 @@ import net.minecraft.world.level.material.Fluids;
|
||||
import net.minecraft.world.level.storage.LevelStorageSource;
|
||||
import net.minecraft.world.level.storage.WorldData;
|
||||
import net.minecraft.world.level.storage.loot.LootContext;
|
||||
import net.minecraft.world.level.storage.loot.LootDataType;
|
||||
import net.minecraft.world.level.storage.loot.LootPool;
|
||||
import net.minecraft.world.level.storage.loot.LootTable;
|
||||
import net.minecraft.world.level.block.state.BlockState;
|
||||
@@ -133,8 +132,8 @@ import net.minecraftforge.event.BuildCreativeModeTabContentsEvent;
|
||||
import net.minecraftforge.event.ForgeEventFactory;
|
||||
import net.minecraftforge.event.GrindstoneEvent;
|
||||
import net.minecraftforge.event.ModMismatchEvent;
|
||||
import net.minecraftforge.event.ServerChatEvent;
|
||||
import net.minecraftforge.event.RegisterStructureConversionsEvent;
|
||||
import net.minecraftforge.event.ServerChatEvent;
|
||||
import net.minecraftforge.event.entity.EntityAttributeCreationEvent;
|
||||
import net.minecraftforge.event.entity.EntityAttributeModificationEvent;
|
||||
import net.minecraftforge.event.entity.item.ItemTossEvent;
|
||||
@@ -168,11 +167,11 @@ import net.minecraftforge.network.NetworkDirection;
|
||||
import net.minecraftforge.network.NetworkInitialization;
|
||||
import net.minecraftforge.network.NetworkRegistry;
|
||||
import net.minecraftforge.network.packets.SpawnEntity;
|
||||
import net.minecraftforge.resource.ResourcePackLoader;
|
||||
import net.minecraftforge.registries.ForgeRegistries;
|
||||
import net.minecraftforge.registries.ForgeRegistry;
|
||||
import net.minecraftforge.registries.GameData;
|
||||
import net.minecraftforge.registries.RegistryManager;
|
||||
import net.minecraftforge.resource.ResourcePackLoader;
|
||||
import net.minecraftforge.server.permission.PermissionAPI;
|
||||
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
@@ -307,9 +306,12 @@ public final class ForgeHooks {
|
||||
|
||||
@SuppressWarnings("resource")
|
||||
@Nullable
|
||||
public static ItemEntity onPlayerTossEvent(@NotNull Player player, @NotNull ItemStack item, boolean includeName) {
|
||||
public static ItemEntity onPlayerTossEvent(@NotNull Player player, @NotNull ItemStack item, boolean thrownFromHand, Prediction prediction) {
|
||||
if (item.isEmpty())
|
||||
return null;
|
||||
|
||||
player.captureDrops(new ArrayList<>());
|
||||
ItemEntity ret = player.drop(item, false, includeName);
|
||||
ItemEntity ret = player.drop(item, thrownFromHand, prediction);
|
||||
player.captureDrops(null);
|
||||
|
||||
if (ret == null)
|
||||
@@ -1213,7 +1215,7 @@ public final class ForgeHooks {
|
||||
buf.writeVarInt(-1); // Our Marker
|
||||
buf.writeIdentifier(key);
|
||||
}
|
||||
serializer.write(buf, value);
|
||||
serializer.streamCodec().encode(buf, value);
|
||||
},
|
||||
(buf) -> {
|
||||
buf.markReaderIndex();
|
||||
@@ -1227,7 +1229,7 @@ public final class ForgeHooks {
|
||||
if (serializer == null)
|
||||
throw new DecoderException("Could not read ingredient of type: " + key);
|
||||
}
|
||||
return serializer.read(buf);
|
||||
return serializer.streamCodec().decode(buf);
|
||||
}
|
||||
);
|
||||
}
|
||||
@@ -1254,7 +1256,7 @@ public final class ForgeHooks {
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public static <T> T onJsonDataParsed(Codec<T> codec, Identifier key, T value) {
|
||||
if (codec == LootDataType.TABLE.codec()) {
|
||||
if (codec == LootTable.DIRECT_CODEC) {
|
||||
var table = (LootTable)value;
|
||||
table.setLootTableId(key);
|
||||
value = (T)net.minecraftforge.event.ForgeEventFactory.onLoadLootTable(key, table);
|
||||
|
||||
@@ -36,6 +36,7 @@ import net.minecraft.sounds.SoundEvent;
|
||||
import net.minecraft.world.level.material.FluidState;
|
||||
import net.minecraft.world.level.pathfinder.PathType;
|
||||
import net.minecraft.world.level.storage.loot.predicates.LootItemCondition;
|
||||
import net.minecraft.world.level.storage.loot.predicates.LootPredicates;
|
||||
import net.minecraft.world.phys.Vec3;
|
||||
import net.minecraftforge.api.distmarker.Dist;
|
||||
import net.minecraftforge.client.ForgeAtlasProvider;
|
||||
@@ -47,9 +48,9 @@ import net.minecraftforge.common.data.ForgeEnchantmentTagsProvider;
|
||||
import net.minecraftforge.common.data.ForgeEntityTypeTagsProvider;
|
||||
import net.minecraftforge.common.data.ForgeFluidTagsProvider;
|
||||
import net.minecraftforge.common.data.ForgeItemTagsProvider;
|
||||
import net.minecraftforge.common.data.ForgeLootTableProvider;
|
||||
import net.minecraftforge.common.data.ForgeRecipeProvider;
|
||||
import net.minecraftforge.common.data.ForgeStructureTagsProvider;
|
||||
import net.minecraftforge.common.data.RegistryDataBuilder;
|
||||
import net.minecraftforge.common.data.VanillaSoundDefinitionsProvider;
|
||||
import net.minecraftforge.common.loot.CanToolPerformAction;
|
||||
import net.minecraftforge.common.loot.LootTableIdCondition;
|
||||
@@ -428,6 +429,16 @@ public class ForgeMod {
|
||||
PackOutput packOutput = gen.getPackOutput();
|
||||
CompletableFuture<HolderLookup.Provider> lookupProvider = event.getLookupProvider();
|
||||
|
||||
var dataLayers = RegistryDataBuilder.of()
|
||||
.name("forge")
|
||||
.reloadable(set -> set
|
||||
.add(Registries.PREDICATE, ctx ->
|
||||
// Replace vanilla's MatchTool(shears) -> CanToolPerformAction(SHEARS_DIG)
|
||||
ctx.register(LootPredicates.TOOL_CAN_SHEAR, CanToolPerformAction.canToolPerformAction(ToolActions.SHEARS_DIG).build())
|
||||
)
|
||||
.add(ForgeRecipeProvider.create())
|
||||
);
|
||||
|
||||
ExistingFileHelper existingFileHelper = event.getExistingFileHelper();
|
||||
gen.addProvider(true, new PackMetadataGenerator(packOutput)
|
||||
.add(PackMetadataSection.SERVER_TYPE, new PackMetadataSection(
|
||||
@@ -441,8 +452,7 @@ public class ForgeMod {
|
||||
gen.addProvider(event.includeServer(), new ForgeEntityTypeTagsProvider(packOutput, lookupProvider, existingFileHelper));
|
||||
gen.addProvider(event.includeServer(), new ForgeFluidTagsProvider(packOutput, lookupProvider, existingFileHelper));
|
||||
gen.addProvider(event.includeServer(), new ForgeEnchantmentTagsProvider(packOutput, lookupProvider, existingFileHelper));
|
||||
gen.addProvider(event.includeServer(), new ForgeRecipeProvider.Runner(packOutput, lookupProvider));
|
||||
gen.addProvider(event.includeServer(), new ForgeLootTableProvider(packOutput, lookupProvider));
|
||||
gen.addProvider(event.includeServer(), dataLayers.reloadableGenerator(packOutput));
|
||||
gen.addProvider(event.includeServer(), new ForgeBiomeTagsProvider(packOutput, lookupProvider, existingFileHelper));
|
||||
gen.addProvider(event.includeServer(), new ForgeStructureTagsProvider(packOutput, lookupProvider, existingFileHelper));
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import net.minecraft.tags.TagKey;
|
||||
import net.minecraft.world.effect.MobEffects;
|
||||
import net.minecraft.world.entity.EntityType;
|
||||
import net.minecraft.world.entity.decoration.ItemFrame;
|
||||
import net.minecraft.world.entity.monster.EnderMan;
|
||||
import net.minecraft.world.item.DyeColor;
|
||||
import net.minecraft.world.item.Item;
|
||||
import net.minecraft.world.item.ItemUseAnimation;
|
||||
@@ -269,9 +268,6 @@ public class Tags {
|
||||
* This is patched into the following method: {@link EnderMan.EndermanLeaveBlockGoal#canPlaceBlock(Level, BlockPos, BlockState, BlockState, BlockState, BlockPos)}
|
||||
*/
|
||||
public static final TagKey<Block> ENDERMAN_PLACE_ON_BLACKLIST = forgeTag("enderman_place_on_blacklist");
|
||||
public static final TagKey<Block> NEEDS_WOOD_TOOL = forgeTag("needs_wood_tool");
|
||||
public static final TagKey<Block> NEEDS_GOLD_TOOL = forgeTag("needs_gold_tool");
|
||||
public static final TagKey<Block> NEEDS_NETHERITE_TOOL = forgeTag("needs_netherite_tool");
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_AMETHYST = BlockItems.STORAGE_BLOCKS_AMETHYST.block();
|
||||
public static final TagKey<Block> STORAGE_BLOCKS_QUARTZ = BlockItems.STORAGE_BLOCKS_QUARTZ.block();
|
||||
//endregion
|
||||
@@ -1224,10 +1220,6 @@ public class Tags {
|
||||
private static TagKey<Fluid> cTag(String name) {
|
||||
return FluidTags.create(Identifier.fromNamespaceAndPath("c", name));
|
||||
}
|
||||
|
||||
private static TagKey<Fluid> forgeTag(String name) {
|
||||
return FluidTags.create(Identifier.fromNamespaceAndPath("forge", name));
|
||||
}
|
||||
}
|
||||
|
||||
public static class Enchantments {
|
||||
@@ -1513,10 +1505,6 @@ public class Tags {
|
||||
private static TagKey<Biome> cTag(String name) {
|
||||
return TagKey.create(Registries.BIOME, Identifier.fromNamespaceAndPath("c", name));
|
||||
}
|
||||
|
||||
private static TagKey<Biome> forgeTag(String name) {
|
||||
return TagKey.create(Registries.BIOME, Identifier.fromNamespaceAndPath("forge", name));
|
||||
}
|
||||
}
|
||||
|
||||
public static class Structures {
|
||||
|
||||
@@ -6,65 +6,19 @@
|
||||
package net.minecraftforge.common;
|
||||
|
||||
import com.google.common.collect.Sets;
|
||||
import net.minecraftforge.common.extensions.IForgeBlock;
|
||||
import net.minecraftforge.common.extensions.IForgeItem;
|
||||
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
public class ToolActions
|
||||
{
|
||||
/**
|
||||
* Exposed by axes to allow querying tool behaviours
|
||||
*/
|
||||
public static final ToolAction AXE_DIG = ToolAction.get("axe_dig");
|
||||
|
||||
/**
|
||||
* Exposed by pickaxes to allow querying tool behaviours
|
||||
*/
|
||||
public static final ToolAction PICKAXE_DIG = ToolAction.get("pickaxe_dig");
|
||||
|
||||
/**
|
||||
* Exposed by shovels to allow querying tool behaviours
|
||||
*/
|
||||
public static final ToolAction SHOVEL_DIG = ToolAction.get("shovel_dig");
|
||||
|
||||
/**
|
||||
* Exposed by hoes to allow querying tool behaviours
|
||||
*/
|
||||
public static final ToolAction HOE_DIG = ToolAction.get("hoe_dig");
|
||||
|
||||
/**
|
||||
* Exposed by swords to allow querying tool behaviours
|
||||
*/
|
||||
public static final ToolAction SWORD_DIG = ToolAction.get("sword_dig");
|
||||
public class ToolActions {
|
||||
|
||||
/**
|
||||
* Exposed by shears to allow querying tool behaviours
|
||||
*/
|
||||
public static final ToolAction SHEARS_DIG = ToolAction.get("shears_dig");
|
||||
|
||||
/**
|
||||
* Passed onto {@link IForgeBlock#getToolModifiedState} when an axe wants to strip a log
|
||||
*/
|
||||
public static final ToolAction AXE_STRIP = ToolAction.get("axe_strip");
|
||||
|
||||
/**
|
||||
* Passed onto {@link IForgeBlock#getToolModifiedState} when an axe wants to scrape oxidization off copper
|
||||
*/
|
||||
public static final ToolAction AXE_SCRAPE = ToolAction.get("axe_scrape");
|
||||
|
||||
/**
|
||||
* Passed onto {@link IForgeBlock#getToolModifiedState} when an axe wants to remove wax out of copper
|
||||
*/
|
||||
public static final ToolAction AXE_WAX_OFF = ToolAction.get("axe_wax_off");
|
||||
|
||||
/**
|
||||
* Passed onto {@link IForgeBlock#getToolModifiedState} when a shovel wants to turn dirt into path
|
||||
*/
|
||||
public static final ToolAction SHOVEL_FLATTEN = ToolAction.get("shovel_flatten");
|
||||
|
||||
/**
|
||||
* Used during player attack to figure out if a sweep attack should be performed
|
||||
*
|
||||
@@ -90,24 +44,12 @@ public class ToolActions
|
||||
*/
|
||||
public static final ToolAction SHEARS_DISARM = ToolAction.get("shears_disarm");
|
||||
|
||||
/**
|
||||
* Passed onto {@link IForgeBlock#getToolModifiedState} when a hoe wants to turn dirt into soil
|
||||
*/
|
||||
public static final ToolAction HOE_TILL = ToolAction.get("till");
|
||||
|
||||
/**
|
||||
* This action corresponds to right-clicking the fishing rod.
|
||||
*/
|
||||
public static final ToolAction FISHING_ROD_CAST = ToolAction.get("fishing_rod_cast");
|
||||
|
||||
// Default actions supported by each tool type
|
||||
public static final Set<ToolAction> DEFAULT_AXE_ACTIONS = of(AXE_DIG, AXE_STRIP, AXE_SCRAPE, AXE_WAX_OFF);
|
||||
public static final Set<ToolAction> DEFAULT_HOE_ACTIONS = of(HOE_DIG, HOE_TILL);
|
||||
public static final Set<ToolAction> DEFAULT_SHOVEL_ACTIONS = of(SHOVEL_DIG, SHOVEL_FLATTEN);
|
||||
@Deprecated(since = "1.21.5")
|
||||
public static final Set<ToolAction> DEFAULT_PICKAXE_ACTIONS = of(PICKAXE_DIG);
|
||||
@Deprecated(since = "1.21.5")
|
||||
public static final Set<ToolAction> DEFAULT_SWORD_ACTIONS = of(SWORD_DIG, SWORD_SWEEP);
|
||||
public static final Set<ToolAction> DEFAULT_SHEARS_ACTIONS = of(SHEARS_DIG, SHEARS_HARVEST, SHEARS_CARVE, SHEARS_DISARM);
|
||||
public static final Set<ToolAction> DEFAULT_FISHING_ROD_ACTIONS = of(FISHING_ROD_CAST);
|
||||
|
||||
|
||||
@@ -1,49 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.brewing;
|
||||
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
public class BrewingRecipe implements IBrewingRecipe {
|
||||
@NotNull private final Ingredient input;
|
||||
@NotNull private final Ingredient ingredient;
|
||||
@NotNull private final ItemStack output;
|
||||
|
||||
public BrewingRecipe(Ingredient input, Ingredient ingredient, ItemStack output) {
|
||||
this.input = input;
|
||||
this.ingredient = ingredient;
|
||||
this.output = output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInput(@NotNull ItemStack stack) {
|
||||
return this.input.test(stack);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack getOutput(ItemStack input, ItemStack ingredient) {
|
||||
return isInput(input) && isIngredient(ingredient) ? getOutput().copy() : ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
public Ingredient getInput() {
|
||||
return input;
|
||||
}
|
||||
|
||||
public Ingredient getIngredient() {
|
||||
return ingredient;
|
||||
}
|
||||
|
||||
public ItemStack getOutput() {
|
||||
return output;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isIngredient(ItemStack ingredient) {
|
||||
return this.ingredient.test(ingredient);
|
||||
}
|
||||
}
|
||||
@@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.brewing;
|
||||
|
||||
/*
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.core.NonNullList;
|
||||
|
||||
public class BrewingRecipeRegistry {
|
||||
|
||||
/**
|
||||
* Returns the output ItemStack obtained by brewing the passed input and
|
||||
* ingredient.
|
||||
* /
|
||||
public static ItemStack getOutput(ItemStack input, ItemStack ingredient) {
|
||||
if (input.isEmpty() || input.getCount() != 1) return ItemStack.EMPTY;
|
||||
if (ingredient.isEmpty()) return ItemStack.EMPTY;
|
||||
|
||||
for (IBrewingRecipe recipe : recipes) {
|
||||
ItemStack output = recipe.getOutput(input, ingredient);
|
||||
if (!output.isEmpty()) {
|
||||
return output;
|
||||
}
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if the passed input and ingredient have an output
|
||||
* /
|
||||
public static boolean hasOutput(ItemStack input, ItemStack ingredient) {
|
||||
return !getOutput(input, ingredient).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the brewing stand to determine if its contents can be brewed.
|
||||
* Extra parameters exist to allow modders to create bigger brewing stands
|
||||
* without much hassle
|
||||
* /
|
||||
public static boolean canBrew(NonNullList<ItemStack> inputs, ItemStack ingredient, int[] inputIndexes) {
|
||||
if (ingredient.isEmpty()) return false;
|
||||
|
||||
for (int i : inputIndexes) {
|
||||
if (hasOutput(inputs.get(i), ingredient)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Used by the brewing stand to brew its inventory Extra parameters exist to
|
||||
* allow modders to create bigger brewing stands without much hassle
|
||||
* /
|
||||
public static void brewPotions(NonNullList<ItemStack> inputs, ItemStack ingredient, int[] inputIndexes) {
|
||||
for (int i : inputIndexes) {
|
||||
ItemStack output = getOutput(inputs.get(i), ingredient);
|
||||
if (!output.isEmpty()) {
|
||||
inputs.set(i, output);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
@@ -1,31 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.brewing;
|
||||
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
|
||||
public interface IBrewingRecipe {
|
||||
|
||||
/**
|
||||
* Returns true is the passed ItemStack is an input for this recipe. "Input"
|
||||
* being the item that goes in one of the three bottom slots of the brewing
|
||||
* stand (e.g: water bottle)
|
||||
*/
|
||||
boolean isInput(ItemStack input);
|
||||
|
||||
/**
|
||||
* Returns true if the passed ItemStack is an ingredient for this recipe.
|
||||
* "Ingredient" being the item that goes in the top slot of the brewing
|
||||
* stand (e.g: nether wart)
|
||||
*/
|
||||
boolean isIngredient(ItemStack ingredient);
|
||||
|
||||
/**
|
||||
* Returns the output when the passed input is brewed with the passed
|
||||
* ingredient. Empty if invalid input or ingredient.
|
||||
*/
|
||||
ItemStack getOutput(ItemStack input, ItemStack ingredient);
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
package net.minecraftforge.common.brewing;
|
||||
|
||||
import java.util.function.BiFunction;
|
||||
|
||||
import net.minecraft.world.inventory.BrewingStandMenu;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.alchemy.PotionBrewing;
|
||||
|
||||
/**
|
||||
* Used in BrewingRecipeRegistry to maintain the vanilla behaviour.
|
||||
*
|
||||
* Most of the code was simply adapted from net.minecraft.tileentity.TileEntityBrewingStand
|
||||
*/
|
||||
public class VanillaBrewingRecipe implements IBrewingRecipe {
|
||||
private final PotionBrewing vanilla;
|
||||
private final BiFunction<ItemStack, ItemStack, ItemStack> vanillaMix;
|
||||
|
||||
public VanillaBrewingRecipe(PotionBrewing vanilla, BiFunction<ItemStack, ItemStack, ItemStack> vanillaMix) {
|
||||
this.vanilla = vanilla;
|
||||
this.vanillaMix = vanillaMix;
|
||||
}
|
||||
|
||||
/**
|
||||
* Code adapted from TileEntityBrewingStand.isItemValidForSlot(int index, ItemStack stack)
|
||||
*/
|
||||
@Override
|
||||
public boolean isInput(ItemStack stack) {
|
||||
return BrewingStandMenu.PotionSlot.mayPlaceItem(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Code adapted from TileEntityBrewingStand.isItemValidForSlot(int index, ItemStack stack)
|
||||
*/
|
||||
@Override
|
||||
public boolean isIngredient(ItemStack stack) {
|
||||
return vanilla.isContainerIngredient(stack) || vanilla.isPotionIngredient(stack);
|
||||
}
|
||||
|
||||
/**
|
||||
* Code copied from TileEntityBrewingStand.brewPotions()
|
||||
* It brews the potion by doing the bit-shifting magic and then checking if the new PotionEffect list is different to the old one,
|
||||
* or if the new potion is a splash potion when the old one wasn't.
|
||||
*/
|
||||
@Override
|
||||
public ItemStack getOutput(ItemStack input, ItemStack ingredient) {
|
||||
if (!input.isEmpty() && !ingredient.isEmpty() && isIngredient(ingredient)) {
|
||||
ItemStack result = vanillaMix.apply(ingredient, input);
|
||||
if (result != input) {
|
||||
return result;
|
||||
}
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
|
||||
return ItemStack.EMPTY;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) Forge Development LLC and contributors
|
||||
* SPDX-License-Identifier: LGPL-2.1-only
|
||||
*/
|
||||
|
||||
@NullMarked
|
||||
package net.minecraftforge.common.brewing;
|
||||
|
||||
import org.jspecify.annotations.NullMarked;
|
||||
@@ -7,20 +7,30 @@ package net.minecraftforge.common.crafting;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.atomic.AtomicInteger;
|
||||
import java.util.function.Consumer;
|
||||
import com.google.gson.JsonArray;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import com.mojang.serialization.DynamicOps;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import com.mojang.serialization.MapDecoder;
|
||||
import com.mojang.serialization.MapEncoder;
|
||||
import com.mojang.serialization.MapLike;
|
||||
import com.mojang.serialization.RecordBuilder;
|
||||
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementHolder;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraftforge.common.ForgeHooks;
|
||||
import net.minecraftforge.common.crafting.conditions.ConditionCodec;
|
||||
import net.minecraftforge.common.crafting.conditions.ICondition;
|
||||
|
||||
/**
|
||||
* A `ConditionalAdvancement` is a single advancment file that contains multiple advancements, each having a condition.
|
||||
* A `ConditionalAdvancement` is a single advancement file that contains multiple advancements, each having a condition.
|
||||
* When loaded it will return the first advancement that the conditions pass.
|
||||
*
|
||||
* This allows for multiple variants of an advancement to share the same name in the registry. Which allows dependents
|
||||
@@ -29,7 +39,7 @@ import net.minecraftforge.common.crafting.conditions.ICondition;
|
||||
* This is most likely useful when you have variants of a recipe based on what mods/resources are installed but want
|
||||
* to maintain the same 'entry' in the advancement book.
|
||||
*/
|
||||
public class ConditionalAdvancement {
|
||||
public record ConditionalAdvancement(ICondition condition, Optional<Advancement> child) {
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
}
|
||||
@@ -37,7 +47,7 @@ public class ConditionalAdvancement {
|
||||
public static class Builder {
|
||||
private static final Identifier DOESNT_MATTER = Identifier.fromNamespaceAndPath("doesnt", "matter");
|
||||
|
||||
private List<Adv> advancements = new ArrayList<>();
|
||||
private List<ConditionalAdvancement> advancements = new ArrayList<>();
|
||||
private ICondition condition;
|
||||
|
||||
public Builder condition(ICondition value) {
|
||||
@@ -58,50 +68,132 @@ public class ConditionalAdvancement {
|
||||
return advancement(holder.value());
|
||||
}
|
||||
|
||||
public Builder advancement(JsonObject value) {
|
||||
return advancement(null, value);
|
||||
}
|
||||
|
||||
private Builder advancement(Advancement value) {
|
||||
return advancement(value, null);
|
||||
}
|
||||
|
||||
private Builder advancement(Advancement value, JsonObject json) {
|
||||
if (condition == null)
|
||||
throw new IllegalStateException("Can not add a advancement with no conditions.");
|
||||
|
||||
if (value == null)
|
||||
throw new IllegalStateException("Can not add a null advancement");
|
||||
|
||||
this.advancements.add(new Adv(this.condition, value, json));
|
||||
this.advancements.add(new ConditionalAdvancement(this.condition, Optional.of(value)));
|
||||
this.condition = null;
|
||||
|
||||
return this;
|
||||
}
|
||||
|
||||
public JsonObject build(HolderLookup.Provider lookup) {
|
||||
var json = new JsonObject();
|
||||
var array = new JsonArray();
|
||||
json.add("forge:conditional", array);
|
||||
public AdvancementHolder build(final Identifier id) {
|
||||
if (this.advancements.isEmpty())
|
||||
throw new IllegalStateException("Can not build an empty ConditionalAdvancement");
|
||||
|
||||
var ops = lookup.createSerializationContext(JsonOps.INSTANCE);
|
||||
|
||||
for (var pair : advancements) {
|
||||
JsonObject holder = null;
|
||||
if (pair.json != null)
|
||||
holder = pair.json;
|
||||
else
|
||||
holder = (JsonObject)Advancement.CODEC.encodeStart(ops, pair.adv()).getOrThrow(IllegalStateException::new);
|
||||
|
||||
if (holder.has(ICondition.DEFAULT_FIELD))
|
||||
throw new IllegalStateException("Recipe already serialized conditions!");
|
||||
ForgeHooks.writeCondition(pair.condition(), holder);
|
||||
|
||||
array.add(holder);
|
||||
var list = new ArrayList<ConditionalAdvancement>();
|
||||
Advancement root = null;
|
||||
for (var child : advancements) {
|
||||
if (root == null) {
|
||||
var adv = child.child.get();
|
||||
root = new Advancement(
|
||||
adv.parent(),
|
||||
adv.display(),
|
||||
adv.rewards(),
|
||||
adv.criteria(),
|
||||
adv.requirements(),
|
||||
adv.sendsTelemetryEvent(),
|
||||
adv.name(),
|
||||
Optional.of(list)
|
||||
);
|
||||
list.add(new ConditionalAdvancement(child.condition, Optional.empty()));
|
||||
} else {
|
||||
list.add(child);
|
||||
}
|
||||
}
|
||||
return json;
|
||||
|
||||
return new AdvancementHolder(id, root);
|
||||
}
|
||||
}
|
||||
|
||||
private record Adv(ICondition condition, Advancement adv, JsonObject json) {}
|
||||
|
||||
|
||||
private static final String KEY = "forge:children";
|
||||
public static final Codec<Advancement> wrapCodec(MapCodec<Advancement> vanilla) {
|
||||
var vanillaCodec = vanilla.codec();
|
||||
var childCodec = RecordCodecBuilder.<ConditionalAdvancement>create(i -> i.group(
|
||||
ICondition.SAFE_CODEC.fieldOf(ICondition.DEFAULT_FIELD).forGetter(ConditionalAdvancement::condition),
|
||||
vanillaCodec.optionalFieldOf("child").forGetter(ConditionalAdvancement::child)
|
||||
).apply(i, ConditionalAdvancement::new)).listOf();
|
||||
|
||||
return Codec.of(new MapEncoder.Implementation<Advancement>() {
|
||||
@Override
|
||||
public <T> RecordBuilder<T> encode(Advancement input, DynamicOps<T> ops, RecordBuilder<T> prefix) {
|
||||
var root = vanilla.encode(input, ops, prefix);
|
||||
if (!input.forgeConditions().isPresent())
|
||||
return root;
|
||||
|
||||
var children = input.forgeConditions().get();
|
||||
if (children.isEmpty())
|
||||
return root;
|
||||
|
||||
if (children.size() != 1)
|
||||
root.add(KEY, childCodec.encodeStart(ops, children));
|
||||
|
||||
var outerCondition = ConditionalRecipe.aggregate(null, children, ConditionalAdvancement::condition);
|
||||
if (outerCondition != null)
|
||||
root.add(ICondition.DEFAULT_FIELD, ICondition.CODEC.encodeStart(ops, outerCondition));
|
||||
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Stream<T> keys(DynamicOps<T> ops) {
|
||||
return Stream.concat(vanilla.keys(ops), List.of(ops.createString(KEY)).stream());
|
||||
}
|
||||
}, new MapDecoder.Implementation<Advancement>() {
|
||||
@Override
|
||||
public <T> DataResult<Advancement> decode(DynamicOps<T> ops, MapLike<T> input) {
|
||||
var root = vanilla.decode(ops, input);
|
||||
var children = input.get(KEY);
|
||||
if (children == null)
|
||||
return root;
|
||||
|
||||
var context = ConditionCodec.getContext(ops);
|
||||
return ops.getStream(children).flatMap(stream -> {
|
||||
var count = new AtomicInteger();
|
||||
var ret = stream.map(entry -> accept(context, ops, count, entry, root))
|
||||
.filter(Objects::nonNull)
|
||||
.findFirst()
|
||||
.orElse(null);
|
||||
|
||||
if (ret != null)
|
||||
return ret;
|
||||
|
||||
return DataResult.error(() -> "No advancement passed conditions, if this is the case, you should have an outer condition.");
|
||||
});
|
||||
}
|
||||
|
||||
private <T> DataResult<Advancement> accept(ICondition.IContext context, DynamicOps<T> ops, AtomicInteger count, T entry, DataResult<Advancement> root) {
|
||||
count.getAndIncrement();
|
||||
var map = ops.getMap(entry).result().orElse(null);
|
||||
if (map == null)
|
||||
return DataResult.error(() -> "Entry " + count.get() + " was not MapLike " + entry.getClass());
|
||||
|
||||
if (map.get(ICondition.DEFAULT_FIELD) != null) {
|
||||
var parsed = ICondition.SAFE_CODEC.parse(ops, (T)map.get(ICondition.DEFAULT_FIELD));
|
||||
if (parsed.result().isPresent()) {
|
||||
var condition = parsed.result().get();
|
||||
if (!condition.test(context, ops))
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
var child = map.get("child");
|
||||
if (child != null)
|
||||
return vanillaCodec.parse(ops, (T)child);
|
||||
return root;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> Stream<T> keys(DynamicOps<T> ops) {
|
||||
return Stream.concat(vanilla.keys(ops), List.of(ops.createString(KEY)).stream());
|
||||
}
|
||||
}).codec();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -8,16 +8,15 @@ package net.minecraftforge.common.crafting;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import java.util.Optional;
|
||||
import java.util.function.Consumer;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Stream;
|
||||
|
||||
import com.google.gson.JsonElement;
|
||||
import com.google.gson.JsonObject;
|
||||
import com.google.gson.JsonParseException;
|
||||
import com.mojang.serialization.Codec;
|
||||
import com.mojang.serialization.DataResult;
|
||||
import com.mojang.serialization.DynamicOps;
|
||||
import com.mojang.serialization.JsonOps;
|
||||
import com.mojang.serialization.MapCodec;
|
||||
import com.mojang.serialization.MapDecoder;
|
||||
import com.mojang.serialization.MapEncoder;
|
||||
@@ -26,25 +25,30 @@ import com.mojang.serialization.RecordBuilder;
|
||||
|
||||
import net.minecraft.advancements.Advancement;
|
||||
import net.minecraft.advancements.AdvancementHolder;
|
||||
import net.minecraft.core.HolderLookup.Provider;
|
||||
import net.minecraft.core.Holder.Reference;
|
||||
import net.minecraft.core.HolderGetter;
|
||||
import net.minecraft.core.HolderLookup;
|
||||
import net.minecraft.core.Registry;
|
||||
import net.minecraft.core.registries.Registries;
|
||||
import net.minecraft.data.recipes.RecipeBuilder;
|
||||
import net.minecraft.data.recipes.RecipeCategory;
|
||||
import net.minecraft.data.recipes.RecipeOutput;
|
||||
import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.CraftingInput;
|
||||
import net.minecraft.world.item.crafting.PlacementInfo;
|
||||
import net.minecraft.world.item.crafting.Recipe;
|
||||
import net.minecraft.world.item.crafting.RecipeBookCategories;
|
||||
import net.minecraft.world.item.crafting.RecipeBookCategory;
|
||||
import net.minecraft.world.item.crafting.RecipeInput;
|
||||
import net.minecraft.world.item.crafting.RecipeSerializer;
|
||||
import net.minecraft.world.item.crafting.RecipeType;
|
||||
import net.minecraft.world.level.Level;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
import net.minecraft.resources.ResourceKey;
|
||||
import net.minecraft.resources.Identifier;
|
||||
import net.minecraftforge.common.crafting.conditions.ConditionCodec;
|
||||
import net.minecraftforge.common.crafting.conditions.ICondition;
|
||||
import net.minecraftforge.common.crafting.conditions.ICondition.IContext;
|
||||
import net.minecraftforge.common.crafting.conditions.OrCondition;
|
||||
import net.minecraftforge.common.crafting.conditions.TrueCondition;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
/**
|
||||
@@ -58,53 +62,40 @@ import org.jetbrains.annotations.Nullable;
|
||||
* This also means that you can wrap ALL recipes in a Conditional even those that don't explicitly
|
||||
* have support for them in their data gen.
|
||||
*/
|
||||
public class ConditionalRecipe {
|
||||
public static Builder builder() {
|
||||
return new Builder();
|
||||
public class ConditionalRecipe implements Recipe<RecipeInput> {
|
||||
public static Builder builder(RecipeOutput output) {
|
||||
return new Builder(output);
|
||||
}
|
||||
|
||||
private final @Nullable ICondition mainCondition;
|
||||
private final List<InnerRecipe> children;
|
||||
private final Recipe<RecipeInput> first;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
private ConditionalRecipe(@Nullable ICondition mainCondition, List<InnerRecipe> children) {
|
||||
this.mainCondition = mainCondition;
|
||||
this.children = children;
|
||||
this.first = (Recipe<RecipeInput>)children.getFirst().recipe();
|
||||
}
|
||||
|
||||
public static class Builder {
|
||||
private final List<InnerRecipe> recipes = new ArrayList<>();
|
||||
private final List<InnerAdvancement> advancements = new ArrayList<>();
|
||||
private final Bouncer bouncer;
|
||||
|
||||
private final RecipeOutput bouncer = new RecipeOutput() {
|
||||
@Override
|
||||
public void accept(ResourceKey<Recipe<?>> id, Recipe<?> value, @Nullable AdvancementHolder advancement) {
|
||||
recipe(id, value, advancement);
|
||||
}
|
||||
@Nullable private ICondition condition;
|
||||
@Nullable private ICondition mainCondition;
|
||||
@Nullable private Identifier advancementId;
|
||||
@Nullable private RecipeCategory category = null;
|
||||
|
||||
@SuppressWarnings("removal")
|
||||
@Override
|
||||
public Advancement.Builder advancement() {
|
||||
return Advancement.Builder.recipeAdvancement().parent(RecipeBuilder.ROOT_RECIPE_ADVANCEMENT);
|
||||
}
|
||||
private Builder(RecipeOutput output) {
|
||||
this.bouncer = new Bouncer(output, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void accept(ResourceKey<Recipe<?>> id, Recipe<?> recipe, Identifier advancementId, JsonElement advancement) {
|
||||
AdvancementHolder holder = null;
|
||||
if (advancement != null) {
|
||||
Advancement adv = Advancement.CODEC.parse(JsonOps.INSTANCE, advancement).getOrThrow(JsonParseException::new);
|
||||
holder = new AdvancementHolder(advancementId, adv);
|
||||
}
|
||||
accept(id, recipe, holder);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Provider registry() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void includeRootAdvancement() { }
|
||||
};
|
||||
|
||||
@Nullable
|
||||
private ICondition condition;
|
||||
@Nullable
|
||||
private ICondition mainCondition;
|
||||
|
||||
@Nullable
|
||||
private Identifier advancementId;
|
||||
public Builder category(RecipeCategory category) {
|
||||
this.category = category;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder mainCondition(ICondition value) {
|
||||
if (this.mainCondition != null)
|
||||
@@ -151,81 +142,94 @@ public class ConditionalRecipe {
|
||||
if (recipes.isEmpty())
|
||||
throw new IllegalStateException("Invalid ConditionalRecipe builder, No recipes");
|
||||
|
||||
JsonElement advancement = null;
|
||||
AdvancementHolder advancement = null;
|
||||
if (!advancements.isEmpty()) {
|
||||
var adv = ConditionalAdvancement.builder();
|
||||
for (var data : advancements) {
|
||||
adv.condition(data.condition());
|
||||
if (data.json != null)
|
||||
adv.advancement(data.json());
|
||||
else
|
||||
adv.advancement(data.advancement());
|
||||
adv.advancement(data.advancement());
|
||||
}
|
||||
if (advancementId == null)
|
||||
advancementId = id.withPrefix("recipes/");
|
||||
advancement = adv.build(out.registry());
|
||||
} else {
|
||||
advancementId = null;
|
||||
if (advancementId == null) {
|
||||
if (this.category == null)
|
||||
advancementId = id.withPrefix("recipes/");
|
||||
else
|
||||
advancementId = id.withPrefix("recipes/" + category.getFolderName() + '/');
|
||||
}
|
||||
advancement = adv.build(advancementId);
|
||||
}
|
||||
|
||||
var key = ResourceKey.create(Registries.RECIPE, id);
|
||||
out.accept(key, new Wrapper(mainCondition, recipes), advancementId, advancement);
|
||||
out.accept(ResourceKey.create(Registries.RECIPE, id), new ConditionalRecipe(mainCondition, recipes), advancement);
|
||||
}
|
||||
|
||||
private record Bouncer(RecipeOutput wrapped, Builder builder) implements RecipeOutput {
|
||||
@Override
|
||||
public void accept(ResourceKey<Recipe<?>> id, Recipe<?> value, @Nullable AdvancementHolder advancement) {
|
||||
builder.recipe(id, value, advancement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Advancement.Builder advancement() {
|
||||
return wrapped.advancement();
|
||||
}
|
||||
|
||||
@Override
|
||||
public <S> HolderGetter<S> lookup(ResourceKey<? extends Registry<? extends S>> key) {
|
||||
return wrapped.lookup(key);
|
||||
}
|
||||
|
||||
@SuppressWarnings("deprecation")
|
||||
@Override
|
||||
public <S> Stream<Reference<S>> listContextElements(ResourceKey<? extends Registry<? extends S>> key) {
|
||||
return wrapped.listContextElements(key);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <S> Optional<HolderLookup.RegistryLookup<S>> registryLookup(ResourceKey<? extends Registry<? extends S>> registry) {
|
||||
return wrapped.registryLookup(registry);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private record InnerRecipe(ICondition condition, Recipe<?> recipe) {}
|
||||
private record InnerAdvancement(ICondition condition, AdvancementHolder advancement, JsonObject json) {}
|
||||
|
||||
private static class Wrapper implements Recipe<CraftingInput> {
|
||||
@Override public boolean matches(CraftingInput inv, Level level) { return false; }
|
||||
@Override public ItemStack assemble(CraftingInput inv) { return null; }
|
||||
@Override public boolean showNotification() { return false; }
|
||||
@Override public String group() { return "ungrouped wrapper"; }
|
||||
// In order to not error during data loading when all elements are filtered out, we need to add an outer condition so we can read it from the top level
|
||||
static <T> @Nullable ICondition aggregate(@Nullable ICondition main, List<T> conditionals, Function<T, ICondition> getter) {
|
||||
if (main != null)
|
||||
return main;
|
||||
if (conditionals.isEmpty())
|
||||
return null;
|
||||
if (conditionals.size() == 1)
|
||||
return getter.apply(conditionals.getFirst());
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
@Override
|
||||
public RecipeSerializer<? extends Recipe<CraftingInput>> getSerializer() {
|
||||
return (RecipeSerializer)ConditionalRecipe.SERIALZIER;
|
||||
var list = new ArrayList<ICondition>(conditionals.size());
|
||||
for (var entry : conditionals) {
|
||||
var condition = getter.apply(entry);
|
||||
if (condition == null || condition == TrueCondition.INSTANCE)
|
||||
return null;
|
||||
list.add(condition);
|
||||
}
|
||||
|
||||
@Override public RecipeType<? extends Recipe<CraftingInput>> getType() { throw new UnsupportedOperationException(); }
|
||||
|
||||
@Nullable private final ICondition main;
|
||||
private final List<InnerRecipe> recipes;
|
||||
private Wrapper(@Nullable ICondition main, List<InnerRecipe> recipes) {
|
||||
this.main = main;
|
||||
this.recipes = recipes;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlacementInfo placementInfo() {
|
||||
return PlacementInfo.NOT_PLACEABLE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeBookCategory recipeBookCategory() {
|
||||
return RecipeBookCategories.STONECUTTER;
|
||||
}
|
||||
|
||||
return new OrCondition(list);
|
||||
}
|
||||
|
||||
private static final MapCodec<Recipe<?>> CODEC = Codec.of(new MapEncoder.Implementation<>() {
|
||||
@Override
|
||||
public <T> RecordBuilder<T> encode(Recipe<?> input, DynamicOps<T> ops, RecordBuilder<T> prefix) {
|
||||
if (!(input instanceof Wrapper))
|
||||
new IllegalStateException("ConditionalRecipe.CODEC can only be used during data gen, how did you get here?");
|
||||
Wrapper wrapper = (Wrapper)input;
|
||||
if (!(input instanceof ConditionalRecipe))
|
||||
new IllegalStateException("ConditionalRecipe.CODEC can only be used for ConditionRecipes, how did you get here?");
|
||||
|
||||
if (wrapper.main != null)
|
||||
prefix.add(ICondition.DEFAULT_FIELD, ICondition.CODEC.encodeStart(ops, wrapper.main));
|
||||
else if (wrapper.recipes.size() == 1)
|
||||
prefix.add(ICondition.DEFAULT_FIELD, ICondition.CODEC.encodeStart(ops, wrapper.recipes.get(0).condition()));
|
||||
var wrapper = (ConditionalRecipe)input;
|
||||
|
||||
var outerCondition = aggregate(wrapper.mainCondition, wrapper.children, InnerRecipe::condition);
|
||||
if (outerCondition != null)
|
||||
prefix.add(ICondition.DEFAULT_FIELD, ICondition.CODEC.encodeStart(ops, outerCondition));
|
||||
|
||||
var recipes = ops.listBuilder();
|
||||
for (var recipe : wrapper.recipes) {
|
||||
for (var recipe : wrapper.children) {
|
||||
var map = ops.mapBuilder();
|
||||
if (wrapper.main != null || wrapper.recipes.size() != 1)
|
||||
if (wrapper.mainCondition != null || wrapper.children.size() != 1)
|
||||
map.add(ICondition.DEFAULT_FIELD, recipe.condition(), ICondition.CODEC);
|
||||
map.add("recipe", recipe.recipe(), Recipe.CODEC);
|
||||
map.add("recipe", recipe.recipe(), Recipe.DIRECT_CODEC);
|
||||
recipes.add(map.build(ops.emptyMap()));
|
||||
}
|
||||
prefix.add("recipes", recipes.build(ops.emptyList()));
|
||||
@@ -274,7 +278,7 @@ public class ConditionalRecipe {
|
||||
if (recipe == null)
|
||||
return DataResult.error(() -> "Missing `recipe` entry " + count.value);
|
||||
|
||||
var ret = Recipe.CODEC.parse(ops, (T)recipe);
|
||||
var ret = Recipe.DIRECT_CODEC.parse(ops, (T)recipe);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -284,14 +288,61 @@ public class ConditionalRecipe {
|
||||
}
|
||||
});
|
||||
|
||||
public static final RecipeSerializer<Recipe<?>> SERIALZIER = new RecipeSerializer<Recipe<?>>(CODEC,
|
||||
StreamCodec.of(
|
||||
(_, _) -> new UnsupportedOperationException("ConditionaRecipe.SERIALIZER does not support encoding to network"),
|
||||
_ -> { throw new UnsupportedOperationException("ConditionaRecipe.SERIALIZER does not support encoding to network"); }
|
||||
)
|
||||
private static final StreamCodec<RegistryFriendlyByteBuf, ConditionalRecipe> STREAM_CODEC = StreamCodec.of(
|
||||
(_, _) -> new UnsupportedOperationException("ConditionaRecipe.SERIALIZER does not support encoding to network"),
|
||||
_ -> { throw new UnsupportedOperationException("ConditionaRecipe.SERIALIZER does not support encoding to network"); }
|
||||
);
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
private static MapCodec<ConditionalRecipe> typedCodec() {
|
||||
return (MapCodec<ConditionalRecipe>)(MapCodec)CODEC;
|
||||
}
|
||||
public static final RecipeSerializer<ConditionalRecipe> SERIALZIER = new RecipeSerializer<>(typedCodec(), STREAM_CODEC);
|
||||
|
||||
private static final class Holder<T> {
|
||||
private T value;
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeSerializer<ConditionalRecipe> getSerializer() {
|
||||
return SERIALZIER;
|
||||
}
|
||||
|
||||
// This should never happen, as we're just doing this during data gen.
|
||||
// But we need to have a full Recipe object in order for datagen to work.
|
||||
@Override
|
||||
public boolean matches(RecipeInput input, Level level) {
|
||||
return this.first.matches(input, level);
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemStack assemble(RecipeInput input) {
|
||||
return this.first.assemble((RecipeInput)input);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean showNotification() {
|
||||
return this.first.showNotification();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String group() {
|
||||
return this.first.group();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public RecipeType<Recipe<RecipeInput>> getType() {
|
||||
return (RecipeType<Recipe<RecipeInput>>)this.first.getType();
|
||||
}
|
||||
|
||||
@Override
|
||||
public PlacementInfo placementInfo() {
|
||||
return this.first.placementInfo();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecipeBookCategory recipeBookCategory() {
|
||||
return this.first.recipeBookCategory();
|
||||
}
|
||||
}
|
||||
@@ -37,8 +37,10 @@ public interface ICondition {
|
||||
@ApiStatus.Internal
|
||||
public static Identifier KEY = Identifier.fromNamespaceAndPath("forge", "condition_context");
|
||||
|
||||
default <T, O extends DelegatingOps<T>> O wrap(O ops) {
|
||||
return ops.withContext(KEY, this);
|
||||
default <T, O extends DynamicOps<T>> DynamicOps<T> wrap(O ops) {
|
||||
@SuppressWarnings("unchecked")
|
||||
var delegate = (ops instanceof DelegatingOps del) ? (DelegatingOps<T>)del : new DelegatingOps<>(ops) {};
|
||||
return delegate.withContext(KEY, this);
|
||||
}
|
||||
|
||||
IContext EMPTY = new IContext() {
|
||||
|
||||
@@ -22,6 +22,8 @@ public record TagEmptyCondition(TagKey<Item> tag) implements ICondition {
|
||||
|
||||
@Override
|
||||
public boolean test(ICondition.IContext context, DynamicOps<?> ops) {
|
||||
if (tag.toString().contains("dirt"))
|
||||
System.currentTimeMillis();
|
||||
return context.getTag(tag).isEmpty();
|
||||
}
|
||||
|
||||
|
||||
+7
-16
@@ -19,6 +19,8 @@ import net.minecraft.world.item.ItemStack;
|
||||
import net.minecraft.world.item.crafting.Ingredient;
|
||||
import net.minecraft.core.Holder;
|
||||
import net.minecraft.network.RegistryFriendlyByteBuf;
|
||||
import net.minecraft.network.codec.ByteBufCodecs;
|
||||
import net.minecraft.network.codec.StreamCodec;
|
||||
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -85,21 +87,10 @@ public class CompoundIngredient extends AbstractIngredient {
|
||||
).apply(builder, CompoundIngredient::new)
|
||||
);
|
||||
|
||||
public static final IIngredientSerializer<CompoundIngredient> SERIALIZER = new IIngredientSerializer<>() {
|
||||
@Override
|
||||
public MapCodec<CompoundIngredient> codec() {
|
||||
return CODEC;
|
||||
}
|
||||
public static final StreamCodec<RegistryFriendlyByteBuf, CompoundIngredient> STREAM_CODEC = StreamCodec.composite(
|
||||
Ingredient.CONTENTS_STREAM_CODEC.apply(ByteBufCodecs.list()), i -> i.children,
|
||||
CompoundIngredient::new
|
||||
);
|
||||
|
||||
@Override
|
||||
public void write(RegistryFriendlyByteBuf buffer, CompoundIngredient value) {
|
||||
buffer.writeCollection(value.children, (_, child) -> Ingredient.CONTENTS_STREAM_CODEC.encode(buffer, child));
|
||||
}
|
||||
|
||||
@Override
|
||||
public CompoundIngredient read(RegistryFriendlyByteBuf buffer) {
|
||||
var children = buffer.readCollection(ArrayList::new, _ -> Ingredient.CONTENTS_STREAM_CODEC.decode(buffer));
|
||||
return new CompoundIngredient(children);
|
||||
}
|
||||
};
|
||||
public static final IIngredientSerializer<CompoundIngredient> SERIALIZER = IIngredientSerializer.simple(CODEC, STREAM_CODEC);
|
||||
}
|
||||
Loaded 100 of 614 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user