More Rendering Fixes

This commit is contained in:
Sebastian Hartte
2020-06-07 15:56:48 +02:00
parent 2dc2f90d5b
commit 1c7a28c606
29 changed files with 300 additions and 217 deletions
@@ -66,7 +66,7 @@ public class BlockCharger extends AEBaseTileBlock<TileCharger>
public BlockCharger() public BlockCharger()
{ {
super( Properties.create(Material.IRON) ); super( Properties.create(Material.IRON).notSolid() );
this.setFullSize( this.setOpaque( false ) ); this.setFullSize( this.setOpaque( false ) );
} }
@@ -26,10 +26,12 @@ import appeng.container.implementations.ContainerWireless;
import appeng.helpers.AEGlassMaterial; import appeng.helpers.AEGlassMaterial;
import appeng.tile.networking.TileWireless; import appeng.tile.networking.TileWireless;
import appeng.util.Platform; import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.state.EnumProperty; import net.minecraft.state.EnumProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateContainer;
import net.minecraft.state.properties.BlockStateProperties;
import net.minecraft.util.ActionResultType; import net.minecraft.util.ActionResultType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
@@ -65,36 +67,30 @@ public class BlockWireless extends AEBaseTileBlock<TileWireless>
public BlockWireless() public BlockWireless()
{ {
super( Properties.create(AEGlassMaterial.INSTANCE) ); super( Properties.create(AEGlassMaterial.INSTANCE).notSolid() );
this.setFullSize( false ); this.setFullSize( false );
this.setOpaque( false ); this.setOpaque( false );
this.setDefaultState( this.getDefaultState().with( STATE, State.OFF ) ); this.setDefaultState( this.getDefaultState().with( STATE, State.OFF ) );
} }
// FIXME This has to be triggered by the tile entity's state changing directly
@Override @Override
public BlockState updatePostPlacement(BlockState stateIn, Direction facing, BlockState facingState, IWorld world, BlockPos pos, BlockPos facingPos) { protected BlockState updateBlockStateFromTileEntity(BlockState currentState, TileWireless te) {
State teState = State.OFF; State teState = State.OFF;
TileWireless te = this.getTileEntity( world, pos ); if( te.isActive() )
if( te != null )
{ {
if( te.isActive() ) teState = State.HAS_CHANNEL;
{ }
teState = State.HAS_CHANNEL; else if( te.isPowered() )
} {
else if( te.isPowered() ) teState = State.ON;
{
teState = State.ON;
}
} }
return super.updatePostPlacement(stateIn, facing, facingState, world, pos, facingPos) return currentState.with(STATE, teState);
.with( STATE, teState );
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder builder) { protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.fillStateContainer(builder);
builder.add(STATE); builder.add(STATE);
} }
@@ -173,7 +169,7 @@ public class BlockWireless extends AEBaseTileBlock<TileWireless>
return VoxelShapes.create( new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ ) ); return VoxelShapes.create( new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ ) );
} }
return VoxelShapes.fullCube(); return VoxelShapes.empty();
} }
@Override @Override
@@ -237,7 +233,7 @@ public class BlockWireless extends AEBaseTileBlock<TileWireless>
} }
else else
{ {
return VoxelShapes.fullCube(); return VoxelShapes.empty();
} }
} }
@@ -19,7 +19,6 @@ public class PaintRendering extends BlockRenderingCustomizer
public void customize( IBlockRendering rendering, IItemRendering itemRendering ) public void customize( IBlockRendering rendering, IItemRendering itemRendering )
{ {
rendering.renderType(RenderType.getCutout()); rendering.renderType(RenderType.getCutout());
// FIXME rendering.builtInModel( "models/block/paint", new PaintModel() );
// Disable auto rotation // Disable auto rotation
rendering.modelCustomizer( ( location, model ) -> model ); rendering.modelCustomizer( ( location, model ) -> model );
} }
@@ -40,9 +40,9 @@ import net.minecraftforge.client.model.data.IModelData;
class PaintSplotchesBakedModel implements IDynamicBakedModel class PaintSplotchesBakedModel implements IDynamicBakedModel
{ {
private static final Material TEXTURE_PAINT1 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(AppEng.MOD_ID, "blocks/paint1" )); private static final Material TEXTURE_PAINT1 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(AppEng.MOD_ID, "block/paint1" ));
private static final Material TEXTURE_PAINT2 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "blocks/paint2" )); private static final Material TEXTURE_PAINT2 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "block/paint2" ));
private static final Material TEXTURE_PAINT3 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "blocks/paint3" )); private static final Material TEXTURE_PAINT3 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "block/paint3" ));
private final TextureAtlasSprite[] textures; private final TextureAtlasSprite[] textures;
@@ -27,10 +27,10 @@ import java.util.function.Function;
class QnbFormedBakedModel implements IDynamicBakedModel class QnbFormedBakedModel implements IDynamicBakedModel
{ {
private static final Material TEXTURE_LINK = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(AppEng.MOD_ID, "blocks/quantum_link" )); private static final Material TEXTURE_LINK = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(AppEng.MOD_ID, "block/quantum_link" ));
private static final Material TEXTURE_RING = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_ring" )); private static final Material TEXTURE_RING = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "block/quantum_ring" ));
private static final Material TEXTURE_RING_LIGHT = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_ring_light" )); private static final Material TEXTURE_RING_LIGHT = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "block/quantum_ring_light" ));
private static final Material TEXTURE_RING_LIGHT_CORNER = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_ring_light_corner" )); private static final Material TEXTURE_RING_LIGHT_CORNER = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "block/quantum_ring_light_corner" ));
private static final Material TEXTURE_CABLE_GLASS = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "parts/cable/glass/transparent" )); private static final Material TEXTURE_CABLE_GLASS = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "parts/cable/glass/transparent" ));
private static final Material TEXTURE_COVERED_CABLE = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "parts/cable/covered/transparent" )); private static final Material TEXTURE_COVERED_CABLE = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "parts/cable/covered/transparent" ));
@@ -27,6 +27,7 @@ import appeng.container.implementations.ContainerQNB;
import appeng.core.localization.PlayerMessages; import appeng.core.localization.PlayerMessages;
import appeng.tile.storage.TileChest; import appeng.tile.storage.TileChest;
import appeng.util.Platform; import appeng.util.Platform;
import net.minecraft.block.Block;
import net.minecraft.block.BlockState; import net.minecraft.block.BlockState;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
@@ -56,7 +57,7 @@ public class BlockChest extends AEBaseTileBlock<TileChest>
} }
@Override @Override
protected void fillStateContainer(StateContainer.Builder builder) { protected void fillStateContainer(StateContainer.Builder<Block, BlockState> builder) {
super.fillStateContainer(builder); super.fillStateContainer(builder);
builder.add(SLOT_STATE); builder.add(SLOT_STATE);
} }
@@ -22,7 +22,7 @@ package appeng.bootstrap;
import appeng.block.AEBaseTileBlock; import appeng.block.AEBaseTileBlock;
import appeng.bootstrap.components.BlockColorComponent; import appeng.bootstrap.components.BlockColorComponent;
import appeng.bootstrap.components.RenderTypeComponent; import appeng.bootstrap.components.RenderTypeComponent;
import appeng.bootstrap.components.TileEntityRendererComponent; import appeng.client.render.model.AutoRotatingBakedModel;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.client.renderer.RenderType; import net.minecraft.client.renderer.RenderType;
import net.minecraft.client.renderer.color.IBlockColor; import net.minecraft.client.renderer.color.IBlockColor;
@@ -105,12 +105,12 @@ class BlockRendering implements IBlockRendering
{ {
// This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as // This is a default rotating model if the base-block uses an AE tile entity which exposes UP/FRONT as
// extended props // extended props
// FIXME factory.addModelOverride( block.getRegistryName().getPath(), ( l, m ) -> new AutoRotatingModel( m ) ); factory.addModelOverride( block.getRegistryName().getPath(), ( l, m ) -> new AutoRotatingBakedModel( m ) );
} }
// TODO : 1.12
this.builtInModels.forEach( factory::addBuiltInModel ); this.builtInModels.forEach( factory::addBuiltInModel );
// TODO : 1.12
if( this.blockColor != null ) if( this.blockColor != null )
{ {
factory.addBootstrapComponent( new BlockColorComponent( block, this.blockColor ) ); factory.addBootstrapComponent( new BlockColorComponent( block, this.blockColor ) );
@@ -0,0 +1,10 @@
package appeng.bootstrap.components;
import appeng.bootstrap.IBootstrapComponent;
import net.minecraftforge.client.event.ModelBakeEvent;
public interface IModelBakeComponent extends IBootstrapComponent {
void onModelBakeEvent(ModelBakeEvent event);
}
@@ -29,15 +29,12 @@ import com.google.common.collect.Sets;
import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.IBakedModel;
import net.minecraft.client.renderer.model.ModelBakery; import net.minecraft.client.renderer.model.ModelBakery;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.client.event.ModelBakeEvent; import net.minecraftforge.client.event.ModelBakeEvent;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.eventbus.api.SubscribeEvent;
import appeng.core.AppEng; import appeng.core.AppEng;
public class ModelOverrideComponent implements IPreInitComponent public class ModelOverrideComponent implements IModelBakeComponent
{ {
// Maps from resource path to customizer // Maps from resource path to customizer
@@ -48,13 +45,6 @@ public class ModelOverrideComponent implements IPreInitComponent
this.customizer.put( resourcePath, customizer ); this.customizer.put( resourcePath, customizer );
} }
@Override
public void preInitialize( Dist dist )
{
MinecraftForge.EVENT_BUS.register( this );
}
@SubscribeEvent
public void onModelBakeEvent( final ModelBakeEvent event ) public void onModelBakeEvent( final ModelBakeEvent event )
{ {
Map<ResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry(); Map<ResourceLocation, IBakedModel> modelRegistry = event.getModelRegistry();
@@ -1,58 +0,0 @@
/*
* This file is part of Applied Energistics 2.
* Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved.
*
* Applied Energistics 2 is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Applied Energistics 2 is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public License
* along with Applied Energistics 2. If not, see <http://www.gnu.org/licenses/lgpl>.
*/
package appeng.bootstrap.components;
import java.util.function.Function;
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
import net.minecraft.tileentity.TileEntityType;
import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.fml.client.registry.ClientRegistry;
import appeng.tile.AEBaseTile;
/**
* Registers a TESR for a given tile entity class.
*
* @param <T>
*/
public class TileEntityRendererComponent<T extends AEBaseTile> implements IPreInitComponent
{
private final TileEntityType<T> tileEntityType;
private final Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super T>> tileEntityRenderer;
public TileEntityRendererComponent(TileEntityType<T> tileEntityType,
Function<? super TileEntityRendererDispatcher, ? extends TileEntityRenderer<? super T>> tileEntityRenderer)
{
this.tileEntityType = tileEntityType;
this.tileEntityRenderer = tileEntityRenderer;
}
@Override
// public void modelReg( Dist dist )
public void preInitialize( Dist dist )
{
ClientRegistry.bindTileEntityRenderer( tileEntityType, tileEntityRenderer);
}
}
@@ -408,6 +408,7 @@ public class CubeBuilder
if( e.getIndex() == 0 ) if( e.getIndex() == 0 )
{ {
builder.put( i, u, v ); builder.put( i, u, v );
break;
} }
else if( e.getIndex() == 2 && renderFullBright ) else if( e.getIndex() == 2 && renderFullBright )
{ {
@@ -416,8 +417,8 @@ public class CubeBuilder
final float lightMapU = (float) ( 15 * 0x20 ) / 0xFFFF; final float lightMapU = (float) ( 15 * 0x20 ) / 0xFFFF;
final float lightMapV = (float) ( 15 * 0x20 ) / 0xFFFF; final float lightMapV = (float) ( 15 * 0x20 ) / 0xFFFF;
builder.put( i, lightMapU, lightMapV ); builder.put( i, lightMapU, lightMapV );
break;
} }
break;
default: default:
builder.put( i ); builder.put( i );
break; break;
@@ -117,6 +117,6 @@ class CraftingCubeModel implements IModelGeometry<CraftingCubeModel>
private static Material texture( String name ) private static Material texture( String name )
{ {
return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(AppEng.MOD_ID, "blocks/crafting/" + name)); return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation(AppEng.MOD_ID, "block/crafting/" + name));
} }
} }
@@ -2,10 +2,10 @@ package appeng.client.render.effects;
import com.mojang.brigadier.StringReader; import com.mojang.brigadier.StringReader;
import com.mojang.brigadier.exceptions.CommandSyntaxException; import com.mojang.brigadier.exceptions.CommandSyntaxException;
import com.sun.javafx.geom.Vec3f;
import net.minecraft.network.PacketBuffer; import net.minecraft.network.PacketBuffer;
import net.minecraft.particles.IParticleData; import net.minecraft.particles.IParticleData;
import net.minecraft.particles.ParticleType; import net.minecraft.particles.ParticleType;
import net.minecraft.util.math.Vec3d;
import java.util.Locale; import java.util.Locale;
@@ -14,9 +14,9 @@ import java.util.Locale;
*/ */
public class LightningArcParticleData implements IParticleData { public class LightningArcParticleData implements IParticleData {
public final Vec3f target; public final Vec3d target;
public LightningArcParticleData(Vec3f target) { public LightningArcParticleData(Vec3d target) {
this.target = target; this.target = target;
} }
@@ -29,7 +29,7 @@ public class LightningArcParticleData implements IParticleData {
float y = reader.readFloat(); float y = reader.readFloat();
reader.expect(' '); reader.expect(' ');
float z = reader.readFloat(); float z = reader.readFloat();
return new LightningArcParticleData(new Vec3f(x, y, z)); return new LightningArcParticleData(new Vec3d(x, y, z));
} }
@Override @Override
@@ -37,7 +37,7 @@ public class LightningArcParticleData implements IParticleData {
float x = buffer.readFloat(); float x = buffer.readFloat();
float y = buffer.readFloat(); float y = buffer.readFloat();
float z = buffer.readFloat(); float z = buffer.readFloat();
return new LightningArcParticleData(new Vec3f(x, y, z)); return new LightningArcParticleData(new Vec3d(x, y, z));
} }
}; };
@@ -48,9 +48,9 @@ public class LightningArcParticleData implements IParticleData {
@Override @Override
public void write(PacketBuffer buffer) { public void write(PacketBuffer buffer) {
buffer.writeFloat(target.x); buffer.writeFloat((float) target.x);
buffer.writeFloat(target.y); buffer.writeFloat((float) target.y);
buffer.writeFloat(target.z); buffer.writeFloat((float) target.z);
} }
@Override @Override
@@ -160,7 +160,7 @@ public class AutoRotatingBakedModel implements IBakedModel
if( forward == null || up == null ) if( forward == null || up == null )
{ {
return this.parent.getQuads( state, side, rand ); return this.parent.getQuads( state, side, rand, extraData );
} }
// The model has other properties than just forward/up, so it would cause our cache to inadvertendly also cache // The model has other properties than just forward/up, so it would cause our cache to inadvertendly also cache
@@ -1,34 +0,0 @@
package appeng.client.render.model;
import com.mojang.datafixers.util.Pair;
import net.minecraft.client.renderer.model.*;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.model.IModelConfiguration;
import net.minecraftforge.client.model.geometry.IModelGeometry;
import java.util.Collection;
import java.util.Set;
import java.util.function.Function;
public class AutoRotatingModel implements IModelGeometry<AutoRotatingModel> {
private final BlockModel blockModel;
public AutoRotatingModel(BlockModel blockModel) {
this.blockModel = blockModel;
}
@Override
public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function<Material, TextureAtlasSprite> spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) {
return new AutoRotatingBakedModel(
this.blockModel.bakeModel(bakery, this.blockModel, spriteGetter, modelTransform, modelLocation, true)
);
}
@Override
public Collection<Material> getTextures(IModelConfiguration owner, Function<ResourceLocation, IUnbakedModel> modelGetter, Set<Pair<String, String>> missingTextureErrors) {
return this.blockModel.getTextures(modelGetter, missingTextureErrors);
}
}
@@ -1,24 +0,0 @@
package appeng.client.render.model;
import com.google.gson.JsonDeserializationContext;
import com.google.gson.JsonObject;
import net.minecraft.client.renderer.model.BlockModel;
import net.minecraft.resources.IResourceManager;
import net.minecraftforge.client.model.IModelLoader;
public class AutoRotatingModelLoader implements IModelLoader<AutoRotatingModel> {
public static final AutoRotatingModelLoader INSTANCE = new AutoRotatingModelLoader();
@Override
public void onResourceManagerReload(IResourceManager resourceManager) {
}
@Override
public AutoRotatingModel read(JsonDeserializationContext deserializationContext, JsonObject modelContents) {
modelContents.remove("loader");
BlockModel blockModel = deserializationContext.deserialize(modelContents, BlockModel.class);
return new AutoRotatingModel(blockModel);
}
}
@@ -57,7 +57,7 @@ public class SpatialPylonModel implements IModelGeometry<SpatialPylonModel>
private static Material getTexturePath( SpatialPylonTextureType type ) private static Material getTexturePath( SpatialPylonTextureType type )
{ {
return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "blocks/spatial_pylon/" + type.name().toLowerCase() ) ); return new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "block/spatial_pylon/" + type.name().toLowerCase() ) );
} }
} }
@@ -32,7 +32,7 @@ public final class InscriberTESR extends TileEntityRenderer<TileInscriber>
private static final float ITEM_RENDER_SCALE = 1.0f / 1.2f; private static final float ITEM_RENDER_SCALE = 1.0f / 1.2f;
private static final ResourceLocation TEXTURE_INSIDE = new ResourceLocation( AppEng.MOD_ID, "blocks/inscriber_inside" ); private static final ResourceLocation TEXTURE_INSIDE = new ResourceLocation( AppEng.MOD_ID, "block/inscriber_inside" );
private static TextureAtlasSprite textureInside; private static TextureAtlasSprite textureInside;
+1 -1
View File
@@ -144,6 +144,7 @@ public final class AppEng
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(this::clientSetup)); DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(this::clientSetup));
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(registration::modelRegistryEvent)); DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(registration::modelRegistryEvent));
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(registration::registerItemColors)); DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(registration::registerItemColors));
DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(registration::handleModelBake));
MinecraftForge.EVENT_BUS.addListener( TickHandler.INSTANCE::unloadWorld ); MinecraftForge.EVENT_BUS.addListener( TickHandler.INSTANCE::unloadWorld );
MinecraftForge.EVENT_BUS.addListener( TickHandler.INSTANCE::onTick ); MinecraftForge.EVENT_BUS.addListener( TickHandler.INSTANCE::onTick );
@@ -203,7 +204,6 @@ public final class AppEng
addBuiltInModel("paint_splotches", PaintSplotchesModel::new); addBuiltInModel("paint_splotches", PaintSplotchesModel::new);
addBuiltInModel("quantum_bridge_formed", QnbFormedModel::new); addBuiltInModel("quantum_bridge_formed", QnbFormedModel::new);
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "crafting_cube"), CraftingCubeModelLoader.INSTANCE); ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "crafting_cube"), CraftingCubeModelLoader.INSTANCE);
ModelLoaderRegistry.registerLoader(new ResourceLocation(AppEng.MOD_ID, "auto_rotating"), AutoRotatingModelLoader.INSTANCE);
} }
private static <T extends IModelGeometry<T>> void addBuiltInModel(String id, Supplier<T> modelFactory) { private static <T extends IModelGeometry<T>> void addBuiltInModel(String id, Supplier<T> modelFactory) {
+7 -4
View File
@@ -104,14 +104,12 @@ import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
import net.minecraftforge.api.distmarker.OnlyIn; import net.minecraftforge.api.distmarker.OnlyIn;
import net.minecraftforge.client.event.ColorHandlerEvent; import net.minecraftforge.client.event.*;
import net.minecraftforge.client.event.ModelRegistryEvent;
import net.minecraftforge.client.event.ParticleFactoryRegisterEvent;
import net.minecraftforge.client.event.TextureStitchEvent;
import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.client.model.ModelLoader;
import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.common.crafting.CraftingHelper;
import net.minecraftforge.common.extensions.IForgeContainerType; import net.minecraftforge.common.extensions.IForgeContainerType;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.Event;
import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.DistExecutor;
import net.minecraftforge.fml.event.server.FMLServerStartingEvent; import net.minecraftforge.fml.event.server.FMLServerStartingEvent;
import net.minecraftforge.fml.loading.FMLEnvironment; import net.minecraftforge.fml.loading.FMLEnvironment;
@@ -888,4 +886,9 @@ final class Registration
definitions.getRegistry().getBootstrapComponents( IItemColorRegistrationComponent.class ).forEachRemaining(c -> c.register(event.getItemColors(), event.getBlockColors())); definitions.getRegistry().getBootstrapComponents( IItemColorRegistrationComponent.class ).forEachRemaining(c -> c.register(event.getItemColors(), event.getBlockColors()));
} }
@OnlyIn(Dist.CLIENT)
public void handleModelBake(ModelBakeEvent event) {
final ApiDefinitions definitions = Api.INSTANCE.definitions();
definitions.getRegistry().getBootstrapComponents( IModelBakeComponent.class ).forEachRemaining(c -> c.onModelBakeEvent(event));
}
} }
@@ -30,6 +30,7 @@ import appeng.block.grindstone.BlockGrinder;
import appeng.block.misc.*; import appeng.block.misc.*;
import appeng.block.networking.*; import appeng.block.networking.*;
import appeng.block.paint.BlockPaint; import appeng.block.paint.BlockPaint;
import appeng.block.paint.PaintRendering;
import appeng.block.qnb.BlockQuantumLinkChamber; import appeng.block.qnb.BlockQuantumLinkChamber;
import appeng.block.qnb.BlockQuantumRing; import appeng.block.qnb.BlockQuantumRing;
import appeng.block.qnb.QuantumBridgeRendering; import appeng.block.qnb.QuantumBridgeRendering;
@@ -494,7 +495,7 @@ public final class ApiBlocks implements IBlocks
this.paint = registry.block( "paint", BlockPaint::new ) this.paint = registry.block( "paint", BlockPaint::new )
.features( AEFeature.PAINT_BALLS ) .features( AEFeature.PAINT_BALLS )
.tileEntity( registry.tileEntity("paint", TilePaint.class, TilePaint::new).build() ) .tileEntity( registry.tileEntity("paint", TilePaint.class, TilePaint::new).build() )
// FIXME .rendering( new PaintRendering() ) .rendering( new PaintRendering() )
.build(); .build();
this.skyStoneStairs = deco.block( "sky_stone_stairs", () -> new StairsBlock(this.skyStoneBlock().block()::getDefaultState, SKYSTONE_PROPERTIES ) ) this.skyStoneStairs = deco.block( "sky_stone_stairs", () -> new StairsBlock(this.skyStoneBlock().block()::getDefaultState, SKYSTONE_PROPERTIES ) )
+7 -1
View File
@@ -297,6 +297,9 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
// TODO: Optimize Network Load // TODO: Optimize Network Load
if( this.world != null ) if( this.world != null )
{ {
this.requestModelDataUpdate();
boolean alreadyUpdated = false;
// Let the block update it's own state with our internal state changes // Let the block update it's own state with our internal state changes
BlockState currentState = getBlockState(); BlockState currentState = getBlockState();
if (currentState.getBlock() instanceof AEBaseTileBlock) { if (currentState.getBlock() instanceof AEBaseTileBlock) {
@@ -305,10 +308,13 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile,
if (currentState != newState) { if (currentState != newState) {
AELog.blockUpdate(this.pos, currentState, newState, this); AELog.blockUpdate(this.pos, currentState, newState, this);
this.world.setBlockState(pos, newState); this.world.setBlockState(pos, newState);
alreadyUpdated = true;
} }
} }
this.requestModelDataUpdate(); if (!alreadyUpdated) {
this.world.notifyBlockUpdate(this.pos, currentState, currentState, 1);
}
} }
} }
} }
@@ -1,41 +1,55 @@
{ {
"forge_marker": 1, "multipart": [
"defaults": { {
"model": "appliedenergistics2:block/wireless_access_point_chassis", "apply": {
"y": 180 "model": "appliedenergistics2:block/wireless_access_point_chassis",
}, "y": 180
"variants": { }
"state": { },
"off": { {
"submodel": { "when": {
"state": { "state": "off"
"model": "appliedenergistics2:block/wireless_access_point_status_off"
},
"torch": {
"model": "appliedenergistics2:block/wireless_access_point_off"
}
}
}, },
"on": { "apply": {
"submodel": { "model": "appliedenergistics2:block/wireless_access_point_status_off",
"state": { "y": 180
"model": "appliedenergistics2:block/wireless_access_point_status_on" }
}, },
"torch": { {
"model": "appliedenergistics2:block/wireless_access_point_off" "when": {
} "state": "off|on"
}
}, },
"has_channel": { "apply": {
"submodel": { "model": "appliedenergistics2:block/wireless_access_point_off",
"state": { "y": 180
"model": "appliedenergistics2:block/wireless_access_point_status_has_channel" }
}, },
"torch": { {
"model": "appliedenergistics2:block/wireless_access_point_on" "when": {
} "state": "on"
} },
"apply": {
"model": "appliedenergistics2:block/wireless_access_point_status_on",
"y": 180
}
},
{
"when": {
"state": "has_channel"
},
"apply": {
"model": "appliedenergistics2:block/wireless_access_point_on",
"y": 180
}
},
{
"when": {
"state": "has_channel"
},
"apply": {
"model": "appliedenergistics2:block/wireless_access_point_status_has_channel",
"y": 180
} }
} }
} ]
} }
@@ -1,5 +1,4 @@
{ {
"loader": "appliedenergistics2:auto_rotating",
"parent": "block/orientable", "parent": "block/orientable",
"textures": { "textures": {
"particle": "appliedenergistics2:block/inscriber", "particle": "appliedenergistics2:block/inscriber",
@@ -0,0 +1,3 @@
{
"loader": "appliedenergistics2:paint_splotches"
}
@@ -0,0 +1,3 @@
{
"loader": "appliedenergistics2:quantum_bridge_formed"
}
@@ -1,3 +1,176 @@
{ {
"parent": "appliedenergistics2:block/wireless_access_point_off" "parent": "block/block",
"textures": {
"particle": "appliedenergistics2:block/wireless_access_point_inside",
"inside": "appliedenergistics2:block/wireless_access_point_inside",
"sides": "appliedenergistics2:parts/monitor_sides",
"sidesStatus": "appliedenergistics2:parts/monitor_sides_status",
"torch": "appliedenergistics2:block/wireless_access_point",
"indicator": "appliedenergistics2:parts/monitor_sides_status_off"
},
"elements": [
{
"from": [4.875, 5, 5],
"to": [5.875, 11, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [12.875, 8, 8]},
"faces": {
"north": {"uv": [12, 5, 13, 11], "texture": "#sidesStatus"},
"east": {"uv": [5, 5, 11, 11], "texture": "#sides"},
"south": {"uv": [3, 5, 4, 11], "texture": "#sidesStatus"},
"west": {"uv": [5, 5, 11, 11], "texture": "#sides"},
"up": {"uv": [12, 5, 13, 11], "rotation": 270, "texture": "#sidesStatus"},
"down": {"uv": [12, 5, 13, 11], "rotation": 90, "texture": "#sidesStatus"}
}
},
{
"from": [5.875, 5, 5],
"to": [6.875, 11, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [12.875, 8, 8]},
"faces": {
"north": {"uv": [11, 5, 12, 11], "texture": "#sides"},
"east": {"uv": [5, 5, 11, 11], "texture": "#inside"},
"south": {"uv": [4, 5, 5, 11], "texture": "#sides"},
"west": {"uv": [5, 5, 11, 11], "texture": "#inside"},
"up": {"uv": [11, 5, 12, 11], "rotation": 270, "texture": "#sides"},
"down": {"uv": [11, 5, 12, 11], "rotation": 90, "texture": "#sides"}
}
},
{
"name": "Side Antenna I Up",
"from": [6.875, 10, 6],
"to": [8.875, 12, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [12.875, 8, 8]},
"faces": {
"north": {"uv": [9, 4, 11, 6], "texture": "#sides"},
"east": {"uv": [6, 4, 10, 6], "texture": "#inside"},
"south": {"uv": [5, 4, 7, 6], "texture": "#sides"},
"west": {"uv": [6, 4, 10, 6], "texture": "#inside"},
"up": {"uv": [9, 6, 11, 10], "rotation": 270, "texture": "#sides"},
"down": {"uv": [9, 6, 11, 10], "rotation": 90, "texture": "#sides"}
}
},
{
"name": "Side Antenna I Down",
"from": [6.875, 4, 6],
"to": [8.875, 6, 10],
"rotation": {"angle": 0, "axis": "y", "origin": [12.875, 8, 8]},
"faces": {
"north": {"uv": [9, 10, 11, 12], "texture": "#sides"},
"east": {"uv": [6, 10, 10, 12], "texture": "#inside"},
"south": {"uv": [5, 10, 7, 12], "texture": "#sides"},
"west": {"uv": [6, 10, 10, 12], "texture": "#inside"},
"up": {"uv": [9, 6, 11, 10], "rotation": 270, "texture": "#sides"},
"down": {"uv": [9, 6, 11, 10], "rotation": 90, "texture": "#sides"}
}
},
{
"name": "Side Antenna I West",
"from": [6.875, 6, 10],
"to": [8.875, 10, 12],
"rotation": {"angle": 0, "axis": "y", "origin": [12.875, 8, 8]},
"faces": {
"north": {"uv": [9, 6, 11, 10], "texture": "#sides"},
"east": {"uv": [4, 6, 6, 10], "texture": "#inside"},
"south": {"uv": [5, 6, 7, 10], "texture": "#sides"},
"west": {"uv": [10, 6, 12, 10], "texture": "#inside"},
"up": {"uv": [9, 4, 11, 6], "rotation": 270, "texture": "#sides"},
"down": {"uv": [9, 10, 11, 12], "rotation": 90, "texture": "#sides"}
}
},
{
"name": "Side Antenna I East",
"from": [6.875, 6, 4],
"to": [8.875, 10, 6],
"rotation": {"angle": 0, "axis": "y", "origin": [12.875, 8, 8]},
"faces": {
"north": {"uv": [9, 6, 11, 10], "texture": "#sides"},
"east": {"uv": [10, 6, 12, 10], "texture": "#inside"},
"south": {"uv": [5, 6, 7, 10], "texture": "#sides"},
"west": {"uv": [4, 6, 6, 10], "texture": "#inside"},
"up": {"uv": [9, 10, 11, 12], "rotation": 270, "texture": "#sides"},
"down": {"uv": [9, 4, 11, 6], "rotation": 90, "texture": "#sides"}
}
},
{
"name": "Side Antenna II Up",
"from": [7.875, 12, 7],
"to": [10.875, 13, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [12.875, 8, 8]},
"faces": {
"north": {"uv": [7, 3, 10, 4], "texture": "#sides"},
"east": {"uv": [7, 3, 9, 4], "texture": "#inside"},
"south": {"uv": [6, 3, 9, 4], "texture": "#sides"},
"west": {"uv": [7, 3, 9, 4], "texture": "#inside"},
"up": {"uv": [7, 7, 10, 9], "rotation": 270, "texture": "#sides"},
"down": {"uv": [7, 7, 10, 9], "rotation": 90, "texture": "#sides"}
}
},
{
"name": "Side Antenna II Down",
"from": [7.875, 3, 7],
"to": [10.875, 4, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [12.875, 8, 8]},
"faces": {
"north": {"uv": [7, 12, 10, 13], "texture": "#sides"},
"east": {"uv": [7, 12, 9, 13], "texture": "#inside"},
"south": {"uv": [6, 12, 9, 13], "texture": "#sides"},
"west": {"uv": [7, 12, 9, 13], "texture": "#inside"},
"up": {"uv": [7, 7, 10, 9], "rotation": 270, "texture": "#sides"},
"down": {"uv": [7, 7, 10, 9], "rotation": 90, "texture": "#sides"}
}
},
{
"name": "Side Antenna II West",
"from": [7.875, 7, 12],
"to": [10.875, 9, 13],
"rotation": {"angle": 0, "axis": "y", "origin": [12.875, 8, 8]},
"faces": {
"north": {"uv": [7, 7, 10, 9], "texture": "#sides"},
"east": {"uv": [3, 7, 4, 9], "texture": "#inside"},
"south": {"uv": [6, 7, 9, 9], "texture": "#sides"},
"west": {"uv": [12, 7, 13, 9], "texture": "#inside"},
"up": {"uv": [7, 3, 10, 4], "rotation": 270, "texture": "#sides"},
"down": {"uv": [7, 12, 10, 13], "rotation": 90, "texture": "#sides"}
}
},
{
"name": "Side Antenna II East",
"from": [7.875, 7, 3],
"to": [10.875, 9, 4],
"rotation": {"angle": 0, "axis": "y", "origin": [12.875, 8, 8]},
"faces": {
"north": {"uv": [7, 7, 10, 9], "texture": "#sides"},
"east": {"uv": [12, 7, 13, 9], "texture": "#inside"},
"south": {"uv": [6, 7, 9, 9], "texture": "#sides"},
"west": {"uv": [3, 7, 4, 9], "texture": "#inside"},
"up": {"uv": [7, 12, 10, 13], "rotation": 270, "texture": "#sides"},
"down": {"uv": [7, 3, 10, 4], "rotation": 90, "texture": "#sides"}
}
},
{
"name": "Antenna Off",
"from": [5.875, 7, 7],
"to": [13.875, 9, 9],
"rotation": {"angle": 0, "axis": "y", "origin": [12.875, 8, 8]},
"faces": {
"north": {"uv": [1, 7, 9, 9], "rotation": 180, "texture": "#torch"},
"east": {"uv": [7, 7, 9, 9], "rotation": 270, "texture": "#torch"},
"south": {"uv": [1, 7, 9, 9], "texture": "#torch"},
"up": {"uv": [1, 7, 9, 9], "texture": "#torch"},
"down": {"uv": [1, 7, 9, 9], "texture": "#torch"}
}
},
{
"name": "Status Off",
"from": [4.875, 5, 5],
"to": [5.875, 11, 11],
"rotation": {"angle": 0, "axis": "y", "origin": [12.875, 8, 8]},
"faces": {
"north": {"uv": [12, 5, 13, 11], "texture": "#indicator"},
"south": {"uv": [3, 5, 4, 11], "texture": "#indicator"},
"up": {"uv": [12, 5, 13, 11], "rotation": 270, "texture": "#indicator"},
"down": {"uv": [12, 5, 13, 11], "rotation": 90, "texture": "#indicator"}
}
}
]
} }
@@ -1,7 +1,7 @@
{ {
"ae2_uvl_marker": true, "ae2_uvl_marker": true,
"textures": { "textures": {
"0": "blocks/obsidian", "0": "block/obsidian",
"1": "uvlightmapjsontest:blocks/BlockControllerLights" "1": "uvlightmapjsontest:blocks/BlockControllerLights"
}, },
"elements": [ "elements": [
@@ -1,6 +1,6 @@
{ {
"parent": "uvlightmapjsontest:block/uvlblock", "parent": "uvlightmapjsontest:block/uvlblock",
"textures": { "textures": {
"0": "blocks/diamond_block" "0": "block/diamond_block"
} }
} }