mirror of
https://github.com/GTNewHorizons/ForestryMC.git
synced 2026-11-20 20:12:19 +00:00
Add new Wood Model Loader (#1367)
This commit is contained in:
1 parent
b5faab51c3
commit
eb63e75200
1039 files changed
+1011
-10035
No files matched your search
@@ -11,6 +11,8 @@
|
||||
package forestry.arboriculture;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.EnumMap;
|
||||
import java.util.HashMap;
|
||||
@@ -43,6 +45,7 @@ import forestry.core.utils.Log;
|
||||
|
||||
public class WoodAccess implements IWoodAccess {
|
||||
private static final Map<WoodBlockKind, WoodMap> woodMaps = new EnumMap<>(WoodBlockKind.class);
|
||||
private static final List<IWoodType> registeredWoodTypes = new ArrayList<>();
|
||||
|
||||
static {
|
||||
for (WoodBlockKind woodBlockKind : WoodBlockKind.values()) {
|
||||
@@ -195,6 +198,9 @@ public class WoodAccess implements IWoodAccess {
|
||||
int meta = woodTyped.getMetaFromState(blockState);
|
||||
IWoodType woodType = woodTyped.getWoodType(meta);
|
||||
ItemStack itemStack = new ItemStack(woodTyped, 1, meta);
|
||||
if(!(woodType instanceof EnumVanillaWoodType)){
|
||||
PluginArboriculture.proxy.registerWoodModel(woodTyped, true);
|
||||
}
|
||||
register(woodType, woodBlockKind, fireproof, blockState, itemStack);
|
||||
}
|
||||
}
|
||||
@@ -207,6 +213,9 @@ public class WoodAccess implements IWoodAccess {
|
||||
IBlockState blockState = woodTyped.getDefaultState();
|
||||
IWoodType woodType = woodTyped.getWoodType(0);
|
||||
ItemStack itemStack = new ItemStack(woodTyped);
|
||||
if(!(woodType instanceof EnumVanillaWoodType)){
|
||||
PluginArboriculture.proxy.registerWoodModel(woodTyped, false);
|
||||
}
|
||||
register(woodType, woodBlockKind, fireproof, blockState, itemStack);
|
||||
}
|
||||
|
||||
@@ -218,6 +227,9 @@ public class WoodAccess implements IWoodAccess {
|
||||
throw new NullPointerException("Invalid itemStack: " + itemStack);
|
||||
}
|
||||
WoodMap woodMap = woodMaps.get(woodBlockKind);
|
||||
if(!registeredWoodTypes.contains(woodType)){
|
||||
registeredWoodTypes.add(woodType);
|
||||
}
|
||||
woodMap.getItem(fireproof).put(woodType, itemStack);
|
||||
woodMap.getBlock(fireproof).put(woodType, blockState);
|
||||
}
|
||||
@@ -249,4 +261,9 @@ public class WoodAccess implements IWoodAccess {
|
||||
}
|
||||
return blockState;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<IWoodType> getRegisteredWoodTypes() {
|
||||
return registeredWoodTypes;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user