diff --git a/src/main/java/appeng/block/misc/BlockCharger.java b/src/main/java/appeng/block/misc/BlockCharger.java index 8c3b76c71..cab36ce57 100644 --- a/src/main/java/appeng/block/misc/BlockCharger.java +++ b/src/main/java/appeng/block/misc/BlockCharger.java @@ -66,7 +66,7 @@ public class BlockCharger extends AEBaseTileBlock public BlockCharger() { - super( Properties.create(Material.IRON) ); + super( Properties.create(Material.IRON).notSolid() ); this.setFullSize( this.setOpaque( false ) ); } diff --git a/src/main/java/appeng/block/networking/BlockWireless.java b/src/main/java/appeng/block/networking/BlockWireless.java index 7d851a761..7e21a4bac 100644 --- a/src/main/java/appeng/block/networking/BlockWireless.java +++ b/src/main/java/appeng/block/networking/BlockWireless.java @@ -26,10 +26,12 @@ import appeng.container.implementations.ContainerWireless; import appeng.helpers.AEGlassMaterial; import appeng.tile.networking.TileWireless; import appeng.util.Platform; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.entity.player.PlayerEntity; import net.minecraft.state.EnumProperty; import net.minecraft.state.StateContainer; +import net.minecraft.state.properties.BlockStateProperties; import net.minecraft.util.ActionResultType; import net.minecraft.util.Direction; import net.minecraft.util.Hand; @@ -65,36 +67,30 @@ public class BlockWireless extends AEBaseTileBlock public BlockWireless() { - super( Properties.create(AEGlassMaterial.INSTANCE) ); + super( Properties.create(AEGlassMaterial.INSTANCE).notSolid() ); this.setFullSize( false ); this.setOpaque( false ); this.setDefaultState( this.getDefaultState().with( STATE, State.OFF ) ); } - // FIXME This has to be triggered by the tile entity's state changing directly @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; - TileWireless te = this.getTileEntity( world, pos ); - if( te != null ) + if( te.isActive() ) { - if( te.isActive() ) - { - teState = State.HAS_CHANNEL; - } - else if( te.isPowered() ) - { - teState = State.ON; - } + teState = State.HAS_CHANNEL; + } + else if( te.isPowered() ) + { + teState = State.ON; } - return super.updatePostPlacement(stateIn, facing, facingState, world, pos, facingPos) - .with( STATE, teState ); + return currentState.with(STATE, teState); } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void fillStateContainer(StateContainer.Builder builder) { super.fillStateContainer(builder); builder.add(STATE); } @@ -173,7 +169,7 @@ public class BlockWireless extends AEBaseTileBlock return VoxelShapes.create( new AxisAlignedBB( minX, minY, minZ, maxX, maxY, maxZ ) ); } - return VoxelShapes.fullCube(); + return VoxelShapes.empty(); } @Override @@ -237,7 +233,7 @@ public class BlockWireless extends AEBaseTileBlock } else { - return VoxelShapes.fullCube(); + return VoxelShapes.empty(); } } diff --git a/src/main/java/appeng/block/paint/PaintRendering.java b/src/main/java/appeng/block/paint/PaintRendering.java index 135c47ce3..3350faf61 100644 --- a/src/main/java/appeng/block/paint/PaintRendering.java +++ b/src/main/java/appeng/block/paint/PaintRendering.java @@ -19,7 +19,6 @@ public class PaintRendering extends BlockRenderingCustomizer public void customize( IBlockRendering rendering, IItemRendering itemRendering ) { rendering.renderType(RenderType.getCutout()); - // FIXME rendering.builtInModel( "models/block/paint", new PaintModel() ); // Disable auto rotation rendering.modelCustomizer( ( location, model ) -> model ); } diff --git a/src/main/java/appeng/block/paint/PaintSplotchesBakedModel.java b/src/main/java/appeng/block/paint/PaintSplotchesBakedModel.java index 255542304..12e928db4 100644 --- a/src/main/java/appeng/block/paint/PaintSplotchesBakedModel.java +++ b/src/main/java/appeng/block/paint/PaintSplotchesBakedModel.java @@ -40,9 +40,9 @@ import net.minecraftforge.client.model.data.IModelData; 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_PAINT2 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "blocks/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_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, "block/paint2" )); + private static final Material TEXTURE_PAINT3 = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "block/paint3" )); private final TextureAtlasSprite[] textures; diff --git a/src/main/java/appeng/block/qnb/QnbFormedBakedModel.java b/src/main/java/appeng/block/qnb/QnbFormedBakedModel.java index 3056c0829..dce50f5be 100644 --- a/src/main/java/appeng/block/qnb/QnbFormedBakedModel.java +++ b/src/main/java/appeng/block/qnb/QnbFormedBakedModel.java @@ -27,10 +27,10 @@ import java.util.function.Function; 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_RING = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "blocks/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_CORNER = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "blocks/quantum_ring_light_corner" )); + 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, "block/quantum_ring" )); + 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, "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_COVERED_CABLE = new Material(AtlasTexture.LOCATION_BLOCKS_TEXTURE, new ResourceLocation( AppEng.MOD_ID, "parts/cable/covered/transparent" )); diff --git a/src/main/java/appeng/block/storage/BlockChest.java b/src/main/java/appeng/block/storage/BlockChest.java index e75c68da3..3f4ad3934 100644 --- a/src/main/java/appeng/block/storage/BlockChest.java +++ b/src/main/java/appeng/block/storage/BlockChest.java @@ -27,6 +27,7 @@ import appeng.container.implementations.ContainerQNB; import appeng.core.localization.PlayerMessages; import appeng.tile.storage.TileChest; import appeng.util.Platform; +import net.minecraft.block.Block; import net.minecraft.block.BlockState; import net.minecraft.block.material.Material; import net.minecraft.entity.player.PlayerEntity; @@ -56,7 +57,7 @@ public class BlockChest extends AEBaseTileBlock } @Override - protected void fillStateContainer(StateContainer.Builder builder) { + protected void fillStateContainer(StateContainer.Builder builder) { super.fillStateContainer(builder); builder.add(SLOT_STATE); } diff --git a/src/main/java/appeng/bootstrap/BlockRendering.java b/src/main/java/appeng/bootstrap/BlockRendering.java index 1a27149a2..78bf0826b 100644 --- a/src/main/java/appeng/bootstrap/BlockRendering.java +++ b/src/main/java/appeng/bootstrap/BlockRendering.java @@ -22,7 +22,7 @@ package appeng.bootstrap; import appeng.block.AEBaseTileBlock; import appeng.bootstrap.components.BlockColorComponent; import appeng.bootstrap.components.RenderTypeComponent; -import appeng.bootstrap.components.TileEntityRendererComponent; +import appeng.client.render.model.AutoRotatingBakedModel; import net.minecraft.block.Block; import net.minecraft.client.renderer.RenderType; 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 // 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 ); + // TODO : 1.12 if( this.blockColor != null ) { factory.addBootstrapComponent( new BlockColorComponent( block, this.blockColor ) ); diff --git a/src/main/java/appeng/bootstrap/components/IModelBakeComponent.java b/src/main/java/appeng/bootstrap/components/IModelBakeComponent.java new file mode 100644 index 000000000..54a2a314a --- /dev/null +++ b/src/main/java/appeng/bootstrap/components/IModelBakeComponent.java @@ -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); + +} diff --git a/src/main/java/appeng/bootstrap/components/ModelOverrideComponent.java b/src/main/java/appeng/bootstrap/components/ModelOverrideComponent.java index 1607ac554..72b0d05cb 100644 --- a/src/main/java/appeng/bootstrap/components/ModelOverrideComponent.java +++ b/src/main/java/appeng/bootstrap/components/ModelOverrideComponent.java @@ -29,15 +29,12 @@ import com.google.common.collect.Sets; import net.minecraft.client.renderer.model.IBakedModel; import net.minecraft.client.renderer.model.ModelBakery; import net.minecraft.util.ResourceLocation; -import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.client.event.ModelBakeEvent; -import net.minecraftforge.common.MinecraftForge; -import net.minecraftforge.eventbus.api.SubscribeEvent; import appeng.core.AppEng; -public class ModelOverrideComponent implements IPreInitComponent +public class ModelOverrideComponent implements IModelBakeComponent { // Maps from resource path to customizer @@ -48,13 +45,6 @@ public class ModelOverrideComponent implements IPreInitComponent this.customizer.put( resourcePath, customizer ); } - @Override - public void preInitialize( Dist dist ) - { - MinecraftForge.EVENT_BUS.register( this ); - } - - @SubscribeEvent public void onModelBakeEvent( final ModelBakeEvent event ) { Map modelRegistry = event.getModelRegistry(); diff --git a/src/main/java/appeng/bootstrap/components/TileEntityRendererComponent.java b/src/main/java/appeng/bootstrap/components/TileEntityRendererComponent.java deleted file mode 100644 index bb9a20577..000000000 --- a/src/main/java/appeng/bootstrap/components/TileEntityRendererComponent.java +++ /dev/null @@ -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 . - */ - -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 - */ -public class TileEntityRendererComponent implements IPreInitComponent -{ - - private final TileEntityType tileEntityType; - - private final Function> tileEntityRenderer; - - public TileEntityRendererComponent(TileEntityType tileEntityType, - Function> tileEntityRenderer) - { - this.tileEntityType = tileEntityType; - this.tileEntityRenderer = tileEntityRenderer; - } - - @Override - // public void modelReg( Dist dist ) - public void preInitialize( Dist dist ) - { - ClientRegistry.bindTileEntityRenderer( tileEntityType, tileEntityRenderer); - } -} diff --git a/src/main/java/appeng/client/render/cablebus/CubeBuilder.java b/src/main/java/appeng/client/render/cablebus/CubeBuilder.java index 3dcd40590..3128ffaa1 100644 --- a/src/main/java/appeng/client/render/cablebus/CubeBuilder.java +++ b/src/main/java/appeng/client/render/cablebus/CubeBuilder.java @@ -408,6 +408,7 @@ public class CubeBuilder if( e.getIndex() == 0 ) { builder.put( i, u, v ); + break; } else if( e.getIndex() == 2 && renderFullBright ) { @@ -416,8 +417,8 @@ public class CubeBuilder final float lightMapU = (float) ( 15 * 0x20 ) / 0xFFFF; final float lightMapV = (float) ( 15 * 0x20 ) / 0xFFFF; builder.put( i, lightMapU, lightMapV ); + break; } - break; default: builder.put( i ); break; diff --git a/src/main/java/appeng/client/render/crafting/CraftingCubeModel.java b/src/main/java/appeng/client/render/crafting/CraftingCubeModel.java index 6d3d935af..27fe3a1db 100644 --- a/src/main/java/appeng/client/render/crafting/CraftingCubeModel.java +++ b/src/main/java/appeng/client/render/crafting/CraftingCubeModel.java @@ -117,6 +117,6 @@ class CraftingCubeModel implements IModelGeometry 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)); } } diff --git a/src/main/java/appeng/client/render/effects/LightningArcParticleData.java b/src/main/java/appeng/client/render/effects/LightningArcParticleData.java index 9e08597fa..f9868995b 100644 --- a/src/main/java/appeng/client/render/effects/LightningArcParticleData.java +++ b/src/main/java/appeng/client/render/effects/LightningArcParticleData.java @@ -2,10 +2,10 @@ package appeng.client.render.effects; import com.mojang.brigadier.StringReader; import com.mojang.brigadier.exceptions.CommandSyntaxException; -import com.sun.javafx.geom.Vec3f; import net.minecraft.network.PacketBuffer; import net.minecraft.particles.IParticleData; import net.minecraft.particles.ParticleType; +import net.minecraft.util.math.Vec3d; import java.util.Locale; @@ -14,9 +14,9 @@ import java.util.Locale; */ public class LightningArcParticleData implements IParticleData { - public final Vec3f target; + public final Vec3d target; - public LightningArcParticleData(Vec3f target) { + public LightningArcParticleData(Vec3d target) { this.target = target; } @@ -29,7 +29,7 @@ public class LightningArcParticleData implements IParticleData { float y = reader.readFloat(); reader.expect(' '); float z = reader.readFloat(); - return new LightningArcParticleData(new Vec3f(x, y, z)); + return new LightningArcParticleData(new Vec3d(x, y, z)); } @Override @@ -37,7 +37,7 @@ public class LightningArcParticleData implements IParticleData { float x = buffer.readFloat(); float y = 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 public void write(PacketBuffer buffer) { - buffer.writeFloat(target.x); - buffer.writeFloat(target.y); - buffer.writeFloat(target.z); + buffer.writeFloat((float) target.x); + buffer.writeFloat((float) target.y); + buffer.writeFloat((float) target.z); } @Override diff --git a/src/main/java/appeng/client/render/model/AutoRotatingBakedModel.java b/src/main/java/appeng/client/render/model/AutoRotatingBakedModel.java index 0aa21e9c7..481c1825e 100644 --- a/src/main/java/appeng/client/render/model/AutoRotatingBakedModel.java +++ b/src/main/java/appeng/client/render/model/AutoRotatingBakedModel.java @@ -160,7 +160,7 @@ public class AutoRotatingBakedModel implements IBakedModel 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 diff --git a/src/main/java/appeng/client/render/model/AutoRotatingModel.java b/src/main/java/appeng/client/render/model/AutoRotatingModel.java deleted file mode 100644 index c87d48495..000000000 --- a/src/main/java/appeng/client/render/model/AutoRotatingModel.java +++ /dev/null @@ -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 { - - private final BlockModel blockModel; - - public AutoRotatingModel(BlockModel blockModel) { - this.blockModel = blockModel; - } - - @Override - public IBakedModel bake(IModelConfiguration owner, ModelBakery bakery, Function spriteGetter, IModelTransform modelTransform, ItemOverrideList overrides, ResourceLocation modelLocation) { - return new AutoRotatingBakedModel( - this.blockModel.bakeModel(bakery, this.blockModel, spriteGetter, modelTransform, modelLocation, true) - ); - } - - @Override - public Collection getTextures(IModelConfiguration owner, Function modelGetter, Set> missingTextureErrors) { - return this.blockModel.getTextures(modelGetter, missingTextureErrors); - } - -} diff --git a/src/main/java/appeng/client/render/model/AutoRotatingModelLoader.java b/src/main/java/appeng/client/render/model/AutoRotatingModelLoader.java deleted file mode 100644 index dcbaa527f..000000000 --- a/src/main/java/appeng/client/render/model/AutoRotatingModelLoader.java +++ /dev/null @@ -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 { - - 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); - } - -} diff --git a/src/main/java/appeng/client/render/spatial/SpatialPylonModel.java b/src/main/java/appeng/client/render/spatial/SpatialPylonModel.java index 41a203544..704fd3908 100644 --- a/src/main/java/appeng/client/render/spatial/SpatialPylonModel.java +++ b/src/main/java/appeng/client/render/spatial/SpatialPylonModel.java @@ -57,7 +57,7 @@ public class SpatialPylonModel implements IModelGeometry 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() ) ); } } diff --git a/src/main/java/appeng/client/render/tesr/InscriberTESR.java b/src/main/java/appeng/client/render/tesr/InscriberTESR.java index e748bf115..c3a908b2a 100644 --- a/src/main/java/appeng/client/render/tesr/InscriberTESR.java +++ b/src/main/java/appeng/client/render/tesr/InscriberTESR.java @@ -32,7 +32,7 @@ public final class InscriberTESR extends TileEntityRenderer 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; diff --git a/src/main/java/appeng/core/AppEng.java b/src/main/java/appeng/core/AppEng.java index 3cf13973f..5628ccb10 100644 --- a/src/main/java/appeng/core/AppEng.java +++ b/src/main/java/appeng/core/AppEng.java @@ -144,6 +144,7 @@ public final class AppEng DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(this::clientSetup)); DistExecutor.runWhenOn(Dist.CLIENT, () -> () -> modEventBus.addListener(registration::modelRegistryEvent)); 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::onTick ); @@ -203,7 +204,6 @@ public final class AppEng addBuiltInModel("paint_splotches", PaintSplotchesModel::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, "auto_rotating"), AutoRotatingModelLoader.INSTANCE); } private static > void addBuiltInModel(String id, Supplier modelFactory) { diff --git a/src/main/java/appeng/core/Registration.java b/src/main/java/appeng/core/Registration.java index eb769fe0d..b218a115a 100644 --- a/src/main/java/appeng/core/Registration.java +++ b/src/main/java/appeng/core/Registration.java @@ -104,14 +104,12 @@ import net.minecraft.tileentity.TileEntityType; import net.minecraft.util.ResourceLocation; import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.OnlyIn; -import net.minecraftforge.client.event.ColorHandlerEvent; -import net.minecraftforge.client.event.ModelRegistryEvent; -import net.minecraftforge.client.event.ParticleFactoryRegisterEvent; -import net.minecraftforge.client.event.TextureStitchEvent; +import net.minecraftforge.client.event.*; import net.minecraftforge.client.model.ModelLoader; import net.minecraftforge.common.crafting.CraftingHelper; import net.minecraftforge.common.extensions.IForgeContainerType; import net.minecraftforge.event.RegistryEvent; +import net.minecraftforge.eventbus.api.Event; import net.minecraftforge.fml.DistExecutor; import net.minecraftforge.fml.event.server.FMLServerStartingEvent; 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())); } + @OnlyIn(Dist.CLIENT) + public void handleModelBake(ModelBakeEvent event) { + final ApiDefinitions definitions = Api.INSTANCE.definitions(); + definitions.getRegistry().getBootstrapComponents( IModelBakeComponent.class ).forEachRemaining(c -> c.onModelBakeEvent(event)); + } } diff --git a/src/main/java/appeng/core/api/definitions/ApiBlocks.java b/src/main/java/appeng/core/api/definitions/ApiBlocks.java index b165c57a1..737ad240c 100644 --- a/src/main/java/appeng/core/api/definitions/ApiBlocks.java +++ b/src/main/java/appeng/core/api/definitions/ApiBlocks.java @@ -30,6 +30,7 @@ import appeng.block.grindstone.BlockGrinder; import appeng.block.misc.*; import appeng.block.networking.*; import appeng.block.paint.BlockPaint; +import appeng.block.paint.PaintRendering; import appeng.block.qnb.BlockQuantumLinkChamber; import appeng.block.qnb.BlockQuantumRing; import appeng.block.qnb.QuantumBridgeRendering; @@ -494,7 +495,7 @@ public final class ApiBlocks implements IBlocks this.paint = registry.block( "paint", BlockPaint::new ) .features( AEFeature.PAINT_BALLS ) .tileEntity( registry.tileEntity("paint", TilePaint.class, TilePaint::new).build() ) -// FIXME .rendering( new PaintRendering() ) + .rendering( new PaintRendering() ) .build(); this.skyStoneStairs = deco.block( "sky_stone_stairs", () -> new StairsBlock(this.skyStoneBlock().block()::getDefaultState, SKYSTONE_PROPERTIES ) ) diff --git a/src/main/java/appeng/tile/AEBaseTile.java b/src/main/java/appeng/tile/AEBaseTile.java index 5ce6d3b35..cb55b1d91 100644 --- a/src/main/java/appeng/tile/AEBaseTile.java +++ b/src/main/java/appeng/tile/AEBaseTile.java @@ -297,6 +297,9 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, // TODO: Optimize Network Load if( this.world != null ) { + this.requestModelDataUpdate(); + + boolean alreadyUpdated = false; // Let the block update it's own state with our internal state changes BlockState currentState = getBlockState(); if (currentState.getBlock() instanceof AEBaseTileBlock) { @@ -305,10 +308,13 @@ public class AEBaseTile extends TileEntity implements IOrientable, ICommonTile, if (currentState != newState) { AELog.blockUpdate(this.pos, currentState, newState, this); this.world.setBlockState(pos, newState); + alreadyUpdated = true; } } - this.requestModelDataUpdate(); + if (!alreadyUpdated) { + this.world.notifyBlockUpdate(this.pos, currentState, currentState, 1); + } } } } diff --git a/src/main/resources/assets/appliedenergistics2/blockstates/wireless_access_point.json b/src/main/resources/assets/appliedenergistics2/blockstates/wireless_access_point.json index 2318d737e..75c772c11 100644 --- a/src/main/resources/assets/appliedenergistics2/blockstates/wireless_access_point.json +++ b/src/main/resources/assets/appliedenergistics2/blockstates/wireless_access_point.json @@ -1,41 +1,55 @@ { - "forge_marker": 1, - "defaults": { - "model": "appliedenergistics2:block/wireless_access_point_chassis", - "y": 180 - }, - "variants": { - "state": { - "off": { - "submodel": { - "state": { - "model": "appliedenergistics2:block/wireless_access_point_status_off" - }, - "torch": { - "model": "appliedenergistics2:block/wireless_access_point_off" - } - } + "multipart": [ + { + "apply": { + "model": "appliedenergistics2:block/wireless_access_point_chassis", + "y": 180 + } + }, + { + "when": { + "state": "off" }, - "on": { - "submodel": { - "state": { - "model": "appliedenergistics2:block/wireless_access_point_status_on" - }, - "torch": { - "model": "appliedenergistics2:block/wireless_access_point_off" - } - } + "apply": { + "model": "appliedenergistics2:block/wireless_access_point_status_off", + "y": 180 + } + }, + { + "when": { + "state": "off|on" }, - "has_channel": { - "submodel": { - "state": { - "model": "appliedenergistics2:block/wireless_access_point_status_has_channel" - }, - "torch": { - "model": "appliedenergistics2:block/wireless_access_point_on" - } - } + "apply": { + "model": "appliedenergistics2:block/wireless_access_point_off", + "y": 180 + } + }, + { + "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 } } - } + ] } diff --git a/src/main/resources/assets/appliedenergistics2/models/block/inscriber.json b/src/main/resources/assets/appliedenergistics2/models/block/inscriber.json index 6648edae2..d80704b0e 100644 --- a/src/main/resources/assets/appliedenergistics2/models/block/inscriber.json +++ b/src/main/resources/assets/appliedenergistics2/models/block/inscriber.json @@ -1,5 +1,4 @@ { - "loader": "appliedenergistics2:auto_rotating", "parent": "block/orientable", "textures": { "particle": "appliedenergistics2:block/inscriber", diff --git a/src/main/resources/assets/appliedenergistics2/models/block/paint.json b/src/main/resources/assets/appliedenergistics2/models/block/paint.json new file mode 100644 index 000000000..05d363339 --- /dev/null +++ b/src/main/resources/assets/appliedenergistics2/models/block/paint.json @@ -0,0 +1,3 @@ +{ + "loader": "appliedenergistics2:paint_splotches" +} \ No newline at end of file diff --git a/src/main/resources/assets/appliedenergistics2/models/block/qnb/qnb_formed.json b/src/main/resources/assets/appliedenergistics2/models/block/qnb/qnb_formed.json new file mode 100644 index 000000000..5411616f1 --- /dev/null +++ b/src/main/resources/assets/appliedenergistics2/models/block/qnb/qnb_formed.json @@ -0,0 +1,3 @@ +{ + "loader": "appliedenergistics2:quantum_bridge_formed" +} \ No newline at end of file diff --git a/src/main/resources/assets/appliedenergistics2/models/item/wireless_access_point.json b/src/main/resources/assets/appliedenergistics2/models/item/wireless_access_point.json index 3a530222d..fb5f2bafe 100644 --- a/src/main/resources/assets/appliedenergistics2/models/item/wireless_access_point.json +++ b/src/main/resources/assets/appliedenergistics2/models/item/wireless_access_point.json @@ -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"} + } + } + ] } \ No newline at end of file diff --git a/src/test/resources/assets/uvlightmapjsontest/models/block/uvlblock.json b/src/test/resources/assets/uvlightmapjsontest/models/block/uvlblock.json index 840c8facd..58c04f0a7 100644 --- a/src/test/resources/assets/uvlightmapjsontest/models/block/uvlblock.json +++ b/src/test/resources/assets/uvlightmapjsontest/models/block/uvlblock.json @@ -1,7 +1,7 @@ { "ae2_uvl_marker": true, "textures": { - "0": "blocks/obsidian", + "0": "block/obsidian", "1": "uvlightmapjsontest:blocks/BlockControllerLights" }, "elements": [ diff --git a/src/test/resources/assets/uvlightmapjsontest/models/block/uvlblock_vanilla.json b/src/test/resources/assets/uvlightmapjsontest/models/block/uvlblock_vanilla.json index 263099216..d721b7e9f 100644 --- a/src/test/resources/assets/uvlightmapjsontest/models/block/uvlblock_vanilla.json +++ b/src/test/resources/assets/uvlightmapjsontest/models/block/uvlblock_vanilla.json @@ -1,6 +1,6 @@ { "parent": "uvlightmapjsontest:block/uvlblock", "textures": { - "0": "blocks/diamond_block" + "0": "block/diamond_block" } }