mirror of
https://github.com/GTNewHorizons/Botania.git
synced 2026-11-20 20:22:33 +00:00
More portability stuff and cleanups
This commit is contained in:
1 parent
75a4dd16cc
commit
2303c4056c
8 files changed
+115
-7
No files matched your search
@@ -0,0 +1,108 @@
|
||||
/*
|
||||
* This class is distributed as part of the Botania Mod.
|
||||
* Get the Source Code in github:
|
||||
* https://github.com/Vazkii/Botania
|
||||
*
|
||||
* Botania is Open Source and distributed under the
|
||||
* Botania License: http://botaniamod.net/license.php
|
||||
*/
|
||||
package vazkii.botania.client.model;
|
||||
|
||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||
|
||||
import net.minecraft.block.BlockState;
|
||||
import net.minecraft.client.renderer.model.BakedQuad;
|
||||
import net.minecraft.client.renderer.model.IBakedModel;
|
||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||
import net.minecraft.client.renderer.model.ItemOverrideList;
|
||||
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
|
||||
import net.minecraft.util.Direction;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.ILightReader;
|
||||
import net.minecraftforge.client.model.data.IModelData;
|
||||
|
||||
import javax.annotation.Nonnull;
|
||||
import javax.annotation.Nullable;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class DelegatedModel implements IBakedModel {
|
||||
protected final IBakedModel originalModel;
|
||||
|
||||
public DelegatedModel(IBakedModel originalModel) {
|
||||
this.originalModel = originalModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion() {
|
||||
return originalModel.isAmbientOcclusion();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isAmbientOcclusion(BlockState state) {
|
||||
return originalModel.isAmbientOcclusion(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGui3d() {
|
||||
return originalModel.isGui3d();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean func_230044_c_() {
|
||||
return originalModel.func_230044_c_();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBuiltInRenderer() {
|
||||
return originalModel.isBuiltInRenderer();
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture() {
|
||||
return originalModel.getParticleTexture();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemCameraTransforms getItemCameraTransforms() {
|
||||
return originalModel.getItemCameraTransforms();
|
||||
}
|
||||
|
||||
@Override
|
||||
public ItemOverrideList getOverrides() {
|
||||
return originalModel.getOverrides();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean doesHandlePerspectives() {
|
||||
return originalModel.doesHandlePerspectives();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IBakedModel handlePerspective(ItemCameraTransforms.TransformType cameraTransformType, MatrixStack mat) {
|
||||
return originalModel.handlePerspective(cameraTransformType, mat);
|
||||
}
|
||||
|
||||
@Override
|
||||
public TextureAtlasSprite getParticleTexture(@Nonnull IModelData data) {
|
||||
return originalModel.getParticleTexture(data);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, @Nonnull Random rand, @Nonnull IModelData extraData) {
|
||||
return originalModel.getQuads(state, side, rand, extraData);
|
||||
}
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public IModelData getModelData(@Nonnull ILightReader world, @Nonnull BlockPos pos, @Nonnull BlockState state, @Nonnull IModelData tileData) {
|
||||
return originalModel.getModelData(world, pos, state, tileData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BakedQuad> getQuads(@Nullable BlockState state, @Nullable Direction side, Random rand) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -74,7 +74,7 @@ public class FloatingFlowerModel implements IModelGeometry<FloatingFlowerModel>
|
||||
return new Baked(bakedFlower, bakedIslands);
|
||||
}
|
||||
|
||||
public static class Baked extends BakedModelWrapper<IBakedModel> {
|
||||
public static class Baked extends DelegatedModel {
|
||||
private final Map<IFloatingFlower.IslandType, List<BakedQuad>> genQuads = new HashMap<>();
|
||||
private final Map<IFloatingFlower.IslandType, Map<Direction, List<BakedQuad>>> faceQuads = new HashMap<>();
|
||||
|
||||
|
||||
@@ -124,7 +124,7 @@ public class GunModel implements IBakedModel {
|
||||
return cache.computeIfAbsent(Pair.of(lens.getItem(), clip), p -> new CompositeBakedModel(bakery, lens, clip ? originalModelClip : originalModel));
|
||||
}
|
||||
|
||||
private static class CompositeBakedModel extends BakedModelWrapper<IBakedModel> {
|
||||
private static class CompositeBakedModel extends DelegatedModel {
|
||||
private static final BlockModel MODEL_GENERATED = ObfuscationReflectionHelper.getPrivateValue(ModelBakery.class, null, "field_177606_o");
|
||||
|
||||
private final List<BakedQuad> genQuads = new ArrayList<>();
|
||||
|
||||
@@ -32,7 +32,7 @@ import javax.annotation.Nonnull;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
public class PlatformModel extends BakedModelWrapper<IBakedModel> {
|
||||
public class PlatformModel extends DelegatedModel {
|
||||
public PlatformModel(IBakedModel original) {
|
||||
super(original);
|
||||
}
|
||||
|
||||
@@ -30,7 +30,7 @@ public class BlockBifrost extends BlockBifrostPerm implements ITileEntityProvide
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getPickBlock(@Nonnull BlockState state, RayTraceResult target, @Nonnull IBlockReader world, @Nonnull BlockPos pos, PlayerEntity player) {
|
||||
public ItemStack getItem(@Nonnull IBlockReader world, @Nonnull BlockPos pos, @Nonnull BlockState state) {
|
||||
return new ItemStack(ModItems.rainbowRod);
|
||||
}
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ public class BlockSolidVines extends VineBlock {
|
||||
|
||||
@Nonnull
|
||||
@Override
|
||||
public ItemStack getPickBlock(@Nonnull BlockState state, RayTraceResult target, @Nonnull IBlockReader world, @Nonnull BlockPos pos, PlayerEntity player) {
|
||||
public ItemStack getItem(@Nonnull IBlockReader world, @Nonnull BlockPos pos, @Nonnull BlockState state) {
|
||||
return new ItemStack(Blocks.VINE);
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,8 @@ package vazkii.botania.common.brew;
|
||||
|
||||
import net.minecraft.potion.Effect;
|
||||
import net.minecraftforge.event.RegistryEvent;
|
||||
|
||||
import net.minecraftforge.registries.IForgeRegistry;
|
||||
|
||||
import vazkii.botania.common.block.ModBlocks;
|
||||
import vazkii.botania.common.brew.potion.*;
|
||||
import vazkii.botania.common.lib.LibMisc;
|
||||
|
||||
@@ -220,7 +220,7 @@ public class BotaniaAPIImpl implements BotaniaAPI {
|
||||
|
||||
public Map<ResourceLocation, Integer> oreWeights = Collections.emptyMap();
|
||||
public Map<ResourceLocation, Integer> netherOreWeights = Collections.emptyMap();
|
||||
private Map<IRegistryDelegate<Block>, Function<DyeColor, Block>> paintableBlocks = new ConcurrentHashMap<>();
|
||||
private final Map<IRegistryDelegate<Block>, Function<DyeColor, Block>> paintableBlocks = new ConcurrentHashMap<>();
|
||||
|
||||
@Override
|
||||
public Map<ResourceLocation, Integer> getOreWeights() {
|
||||
|
||||
Reference in new issue
Block a user