mirror of
https://github.com/Ellpeck/ActuallyAdditions.git
synced 2024-11-22 15:18:34 +01:00
commit
3634a3e71e
31 changed files with 691 additions and 103 deletions
|
@ -80,12 +80,12 @@ f03fc3f6983755f0c8d231554a92acfcef9e90a0 assets/actuallyadditions/blockstates/la
|
||||||
04e242e27c9debdcf924adc4e7e85e8879c8d9ba assets/actuallyadditions/blockstates/lamp_red.json
|
04e242e27c9debdcf924adc4e7e85e8879c8d9ba assets/actuallyadditions/blockstates/lamp_red.json
|
||||||
7cfadd0f25de8b5035641238a8e18ffac1ef356c assets/actuallyadditions/blockstates/lamp_white.json
|
7cfadd0f25de8b5035641238a8e18ffac1ef356c assets/actuallyadditions/blockstates/lamp_white.json
|
||||||
5e526bf21366f7382a19261b71c73f96d62a3a0c assets/actuallyadditions/blockstates/lamp_yellow.json
|
5e526bf21366f7382a19261b71c73f96d62a3a0c assets/actuallyadditions/blockstates/lamp_yellow.json
|
||||||
c384311568a9dc7a4313ebf050f590792de7e7aa assets/actuallyadditions/blockstates/laser_relay.json
|
9a80b2d1281ed112a7e1a3b9639c5dc872ccf8b8 assets/actuallyadditions/blockstates/laser_relay.json
|
||||||
64b9076d7ebd666dd8cabd88c8fdab6e5ae15124 assets/actuallyadditions/blockstates/laser_relay_advanced.json
|
aa09a7e86d9bf3ad1bad45c9f9b9d5f0c13afcc9 assets/actuallyadditions/blockstates/laser_relay_advanced.json
|
||||||
3e11aee568ff4c28dc9a51a6800faa3047a0aa81 assets/actuallyadditions/blockstates/laser_relay_extreme.json
|
95f8ec3018d85b3c99065a913a73217d5ea3a086 assets/actuallyadditions/blockstates/laser_relay_extreme.json
|
||||||
89e137a4932755e23cd7dc3e46d223b2332d11e1 assets/actuallyadditions/blockstates/laser_relay_fluids.json
|
e18d4ba1f8eedefbdf0c6b86bc77511130ced533 assets/actuallyadditions/blockstates/laser_relay_fluids.json
|
||||||
a3821b684b590b815499ff25847ecfbbc217f14d assets/actuallyadditions/blockstates/laser_relay_item.json
|
a5bd1eb03cecd98679f49205efcc9276ec3092da assets/actuallyadditions/blockstates/laser_relay_item.json
|
||||||
33069098e2bb435c696b1862d9d47971b3247117 assets/actuallyadditions/blockstates/laser_relay_item_advanced.json
|
fb19f1e3140a2481745c6bb844a75344b3aa642d assets/actuallyadditions/blockstates/laser_relay_item_advanced.json
|
||||||
eae81ba22d5b7761dd5a03d909d857007a40c9e2 assets/actuallyadditions/blockstates/lava_factory_casing.json
|
eae81ba22d5b7761dd5a03d909d857007a40c9e2 assets/actuallyadditions/blockstates/lava_factory_casing.json
|
||||||
9bcb5be7108d01028f654dcc8698b801a1663117 assets/actuallyadditions/blockstates/lava_factory_controller.json
|
9bcb5be7108d01028f654dcc8698b801a1663117 assets/actuallyadditions/blockstates/lava_factory_controller.json
|
||||||
27a1c7620994f8f4b325e9323003e9a8ea9ee931 assets/actuallyadditions/blockstates/leaf_generator.json
|
27a1c7620994f8f4b325e9323003e9a8ea9ee931 assets/actuallyadditions/blockstates/leaf_generator.json
|
||||||
|
|
|
@ -1,7 +1,30 @@
|
||||||
{
|
{
|
||||||
"variants": {
|
"variants": {
|
||||||
"": {
|
"facing=down": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay",
|
||||||
|
"x": 180
|
||||||
|
},
|
||||||
|
"facing=up": {
|
||||||
"model": "actuallyadditions:block/laser_relay"
|
"model": "actuallyadditions:block/laser_relay"
|
||||||
|
},
|
||||||
|
"facing=north": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay",
|
||||||
|
"x": 90
|
||||||
|
},
|
||||||
|
"facing=south": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay",
|
||||||
|
"x": 90,
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=west": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay",
|
||||||
|
"x": 90,
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"facing=east": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay",
|
||||||
|
"x": 90,
|
||||||
|
"y": 90
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,30 @@
|
||||||
{
|
{
|
||||||
"variants": {
|
"variants": {
|
||||||
"": {
|
"facing=down": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_advanced",
|
||||||
|
"x": 180
|
||||||
|
},
|
||||||
|
"facing=up": {
|
||||||
"model": "actuallyadditions:block/laser_relay_advanced"
|
"model": "actuallyadditions:block/laser_relay_advanced"
|
||||||
|
},
|
||||||
|
"facing=north": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_advanced",
|
||||||
|
"x": 90
|
||||||
|
},
|
||||||
|
"facing=south": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_advanced",
|
||||||
|
"x": 90,
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=west": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_advanced",
|
||||||
|
"x": 90,
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"facing=east": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_advanced",
|
||||||
|
"x": 90,
|
||||||
|
"y": 90
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,30 @@
|
||||||
{
|
{
|
||||||
"variants": {
|
"variants": {
|
||||||
"": {
|
"facing=down": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_extreme",
|
||||||
|
"x": 180
|
||||||
|
},
|
||||||
|
"facing=up": {
|
||||||
"model": "actuallyadditions:block/laser_relay_extreme"
|
"model": "actuallyadditions:block/laser_relay_extreme"
|
||||||
|
},
|
||||||
|
"facing=north": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_extreme",
|
||||||
|
"x": 90
|
||||||
|
},
|
||||||
|
"facing=south": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_extreme",
|
||||||
|
"x": 90,
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=west": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_extreme",
|
||||||
|
"x": 90,
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"facing=east": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_extreme",
|
||||||
|
"x": 90,
|
||||||
|
"y": 90
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,30 @@
|
||||||
{
|
{
|
||||||
"variants": {
|
"variants": {
|
||||||
"": {
|
"facing=down": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_fluids",
|
||||||
|
"x": 180
|
||||||
|
},
|
||||||
|
"facing=up": {
|
||||||
"model": "actuallyadditions:block/laser_relay_fluids"
|
"model": "actuallyadditions:block/laser_relay_fluids"
|
||||||
|
},
|
||||||
|
"facing=north": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_fluids",
|
||||||
|
"x": 90
|
||||||
|
},
|
||||||
|
"facing=south": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_fluids",
|
||||||
|
"x": 90,
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=west": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_fluids",
|
||||||
|
"x": 90,
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"facing=east": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_fluids",
|
||||||
|
"x": 90,
|
||||||
|
"y": 90
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,30 @@
|
||||||
{
|
{
|
||||||
"variants": {
|
"variants": {
|
||||||
"": {
|
"facing=down": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_item",
|
||||||
|
"x": 180
|
||||||
|
},
|
||||||
|
"facing=up": {
|
||||||
"model": "actuallyadditions:block/laser_relay_item"
|
"model": "actuallyadditions:block/laser_relay_item"
|
||||||
|
},
|
||||||
|
"facing=north": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_item",
|
||||||
|
"x": 90
|
||||||
|
},
|
||||||
|
"facing=south": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_item",
|
||||||
|
"x": 90,
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=west": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_item",
|
||||||
|
"x": 90,
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"facing=east": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_item",
|
||||||
|
"x": 90,
|
||||||
|
"y": 90
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,30 @@
|
||||||
{
|
{
|
||||||
"variants": {
|
"variants": {
|
||||||
"": {
|
"facing=down": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_item_advanced",
|
||||||
|
"x": 180
|
||||||
|
},
|
||||||
|
"facing=up": {
|
||||||
"model": "actuallyadditions:block/laser_relay_item_advanced"
|
"model": "actuallyadditions:block/laser_relay_item_advanced"
|
||||||
|
},
|
||||||
|
"facing=north": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_item_advanced",
|
||||||
|
"x": 90
|
||||||
|
},
|
||||||
|
"facing=south": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_item_advanced",
|
||||||
|
"x": 90,
|
||||||
|
"y": 180
|
||||||
|
},
|
||||||
|
"facing=west": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_item_advanced",
|
||||||
|
"x": 90,
|
||||||
|
"y": 270
|
||||||
|
},
|
||||||
|
"facing=east": {
|
||||||
|
"model": "actuallyadditions:block/laser_relay_item_advanced",
|
||||||
|
"x": 90,
|
||||||
|
"y": 90
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,7 +2,6 @@ package de.ellpeck.actuallyadditions.data;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
|
||||||
import net.minecraft.block.*;
|
import net.minecraft.block.*;
|
||||||
import net.minecraft.data.DataGenerator;
|
import net.minecraft.data.DataGenerator;
|
||||||
import net.minecraft.state.properties.BlockStateProperties;
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
|
@ -72,12 +71,12 @@ public class BlockStateGenerator extends BlockStateProvider {
|
||||||
buildCubeAll(ActuallyBlocks.EMPOWERED_VOID_CRYSTAL);
|
buildCubeAll(ActuallyBlocks.EMPOWERED_VOID_CRYSTAL);
|
||||||
buildCubeAll(ActuallyBlocks.EMPOWERED_EMERADIC_CRYSTAL);
|
buildCubeAll(ActuallyBlocks.EMPOWERED_EMERADIC_CRYSTAL);
|
||||||
buildCubeAll(ActuallyBlocks.EMPOWERED_ENORI_CRYSTAL);
|
buildCubeAll(ActuallyBlocks.EMPOWERED_ENORI_CRYSTAL);
|
||||||
standardBlock(ActuallyBlocks.LASER_RELAY);
|
fullyDirectionalBlock(ActuallyBlocks.LASER_RELAY);
|
||||||
standardBlock(ActuallyBlocks.LASER_RELAY_ADVANCED);
|
fullyDirectionalBlock(ActuallyBlocks.LASER_RELAY_ADVANCED);
|
||||||
standardBlock(ActuallyBlocks.LASER_RELAY_EXTREME);
|
fullyDirectionalBlock(ActuallyBlocks.LASER_RELAY_EXTREME);
|
||||||
standardBlock(ActuallyBlocks.LASER_RELAY_FLUIDS);
|
fullyDirectionalBlock(ActuallyBlocks.LASER_RELAY_FLUIDS);
|
||||||
standardBlock(ActuallyBlocks.LASER_RELAY_ITEM);
|
fullyDirectionalBlock(ActuallyBlocks.LASER_RELAY_ITEM);
|
||||||
standardBlock(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED);
|
fullyDirectionalBlock(ActuallyBlocks.LASER_RELAY_ITEM_ADVANCED);
|
||||||
standardBlock(ActuallyBlocks.RANGED_COLLECTOR);
|
standardBlock(ActuallyBlocks.RANGED_COLLECTOR);
|
||||||
standardBlock(ActuallyBlocks.XP_SOLIDIFIER);
|
standardBlock(ActuallyBlocks.XP_SOLIDIFIER);
|
||||||
standardBlock(ActuallyBlocks.ENERGIZER);
|
standardBlock(ActuallyBlocks.ENERGIZER);
|
||||||
|
|
|
@ -26,12 +26,12 @@ import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
|
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
import de.ellpeck.actuallyadditions.mod.items.ItemCoffee;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.lens.LensMining;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
|
import de.ellpeck.actuallyadditions.mod.misc.BannerHelper;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
|
import de.ellpeck.actuallyadditions.mod.misc.DungeonLoot;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
|
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.LaserRelayConnectionHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.MethodHandler;
|
import de.ellpeck.actuallyadditions.mod.misc.apiimpl.MethodHandler;
|
||||||
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
import de.ellpeck.actuallyadditions.mod.network.PacketHandler;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.particle.ActuallyParticles;
|
||||||
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
import de.ellpeck.actuallyadditions.mod.update.UpdateChecker;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.ResourceReloader;
|
import de.ellpeck.actuallyadditions.mod.util.ResourceReloader;
|
||||||
import net.minecraft.entity.EntityClassification;
|
import net.minecraft.entity.EntityClassification;
|
||||||
|
@ -43,6 +43,7 @@ import net.minecraft.item.Items;
|
||||||
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.ParticleFactoryRegisterEvent;
|
||||||
import net.minecraftforge.common.MinecraftForge;
|
import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.common.crafting.CraftingHelper;
|
import net.minecraftforge.common.crafting.CraftingHelper;
|
||||||
import net.minecraftforge.event.AddReloadListenerEvent;
|
import net.minecraftforge.event.AddReloadListenerEvent;
|
||||||
|
@ -100,6 +101,7 @@ public class ActuallyAdditions {
|
||||||
ActuallyContainers.CONTAINERS.register(eventBus);
|
ActuallyContainers.CONTAINERS.register(eventBus);
|
||||||
ENTITIES.register(eventBus);
|
ENTITIES.register(eventBus);
|
||||||
eventBus.addListener(this::onConfigReload);
|
eventBus.addListener(this::onConfigReload);
|
||||||
|
ActuallyParticles.init(eventBus);
|
||||||
|
|
||||||
MinecraftForge.EVENT_BUS.addListener(this::serverStarted);
|
MinecraftForge.EVENT_BUS.addListener(this::serverStarted);
|
||||||
MinecraftForge.EVENT_BUS.addListener(this::serverStopped);
|
MinecraftForge.EVENT_BUS.addListener(this::serverStopped);
|
||||||
|
@ -110,6 +112,7 @@ public class ActuallyAdditions {
|
||||||
|
|
||||||
eventBus.addListener(this::setup);
|
eventBus.addListener(this::setup);
|
||||||
eventBus.addListener(this::clientSetup);
|
eventBus.addListener(this::clientSetup);
|
||||||
|
eventBus.addListener(this::particleFactoryRegister);
|
||||||
IFarmerBehavior.initBehaviors();
|
IFarmerBehavior.initBehaviors();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,6 +155,10 @@ public class ActuallyAdditions {
|
||||||
ActuallyAdditionsClient.setup(event);
|
ActuallyAdditionsClient.setup(event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void particleFactoryRegister(ParticleFactoryRegisterEvent event) {
|
||||||
|
ActuallyAdditionsClient.registerParticleFactories();
|
||||||
|
}
|
||||||
|
|
||||||
public void serverStarted(FMLServerStartedEvent event) {
|
public void serverStarted(FMLServerStartedEvent event) {
|
||||||
// TODO: [port] check if this is needed
|
// TODO: [port] check if this is needed
|
||||||
|
|
||||||
|
|
|
@ -12,22 +12,19 @@ package de.ellpeck.actuallyadditions.mod;
|
||||||
|
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.*;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.*;
|
||||||
import de.ellpeck.actuallyadditions.mod.entity.EntityWorm;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.entity.InitEntities;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.entity.RenderWorm;
|
import de.ellpeck.actuallyadditions.mod.entity.RenderWorm;
|
||||||
import de.ellpeck.actuallyadditions.mod.event.ClientEvents;
|
import de.ellpeck.actuallyadditions.mod.event.ClientEvents;
|
||||||
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
import de.ellpeck.actuallyadditions.mod.fluids.InitFluids;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
|
import de.ellpeck.actuallyadditions.mod.inventory.ActuallyContainers;
|
||||||
import de.ellpeck.actuallyadditions.mod.inventory.gui.*;
|
import de.ellpeck.actuallyadditions.mod.inventory.gui.*;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
import de.ellpeck.actuallyadditions.mod.items.ActuallyItems;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemWorm;
|
|
||||||
import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
|
import de.ellpeck.actuallyadditions.mod.misc.special.SpecialRenderInit;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.particle.*;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.ScreenManager;
|
import net.minecraft.client.gui.ScreenManager;
|
||||||
import net.minecraft.client.network.play.ClientPlayNetHandler;
|
import net.minecraft.client.network.play.ClientPlayNetHandler;
|
||||||
import net.minecraft.client.renderer.RenderType;
|
import net.minecraft.client.renderer.RenderType;
|
||||||
import net.minecraft.client.renderer.RenderTypeLookup;
|
import net.minecraft.client.renderer.RenderTypeLookup;
|
||||||
import net.minecraft.item.IItemPropertyGetter;
|
|
||||||
import net.minecraft.item.ItemModelsProperties;
|
import net.minecraft.item.ItemModelsProperties;
|
||||||
import net.minecraft.network.play.client.CPlayerDiggingPacket;
|
import net.minecraft.network.play.client.CPlayerDiggingPacket;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
@ -37,7 +34,6 @@ import net.minecraftforge.common.MinecraftForge;
|
||||||
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
import net.minecraftforge.fml.client.registry.ClientRegistry;
|
||||||
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
import net.minecraftforge.fml.client.registry.RenderingRegistry;
|
||||||
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
import net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;
|
||||||
import net.minecraftforge.fml.javafmlmod.FMLJavaModLoadingContext;
|
|
||||||
|
|
||||||
public class ActuallyAdditionsClient {
|
public class ActuallyAdditionsClient {
|
||||||
|
|
||||||
|
@ -75,8 +71,8 @@ public class ActuallyAdditionsClient {
|
||||||
setupSpecialRenders();
|
setupSpecialRenders();
|
||||||
|
|
||||||
event.enqueueWork(() ->
|
event.enqueueWork(() ->
|
||||||
ItemModelsProperties.register(ActuallyItems.WORM.get(), new ResourceLocation(ActuallyAdditions.MODID, "snail"),
|
ItemModelsProperties.register(ActuallyItems.WORM.get(), new ResourceLocation(ActuallyAdditions.MODID, "snail"),
|
||||||
(stack, world, entity) -> "snail mail".equalsIgnoreCase(stack.getHoverName().getString()) ? 1F : 0F));
|
(stack, world, entity) -> "snail mail".equalsIgnoreCase(stack.getHoverName().getString()) ? 1F : 0F));
|
||||||
|
|
||||||
setupRenderLayers();
|
setupRenderLayers();
|
||||||
}
|
}
|
||||||
|
@ -113,6 +109,11 @@ public class ActuallyAdditionsClient {
|
||||||
RenderingRegistry.registerEntityRenderingHandler(ActuallyAdditions.ENTITY_WORM.get(), RenderWorm::new);
|
RenderingRegistry.registerEntityRenderingHandler(ActuallyAdditions.ENTITY_WORM.get(), RenderWorm::new);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void registerParticleFactories() {
|
||||||
|
Minecraft.getInstance().particleEngine.register(ActuallyParticles.LASER_ITEM.get(), ParticleLaserItem.Factory::new);
|
||||||
|
Minecraft.getInstance().particleEngine.register(ActuallyParticles.BEAM.get(), ParticleBeam.Factory::new);
|
||||||
|
}
|
||||||
|
|
||||||
// TODO: [port] validate that this works
|
// TODO: [port] validate that this works
|
||||||
public static void sendBreakPacket(BlockPos pos) {
|
public static void sendBreakPacket(BlockPos pos) {
|
||||||
ClientPlayNetHandler connection = Minecraft.getInstance().getConnection();
|
ClientPlayNetHandler connection = Minecraft.getInstance().getConnection();
|
||||||
|
|
|
@ -26,8 +26,14 @@ public class BlockItemInterface extends BlockContainerBase {
|
||||||
super(ActuallyBlocks.defaultPickProps(0));
|
super(ActuallyBlocks.defaultPickProps(0));
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Override
|
@Override
|
||||||
public TileEntity newBlockEntity(IBlockReader worldIn) {
|
public boolean hasTileEntity(BlockState state) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Nullable
|
||||||
|
@Override
|
||||||
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
return new TileEntityItemInterface();
|
return new TileEntityItemInterface();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@ public class BlockItemInterfaceHopping extends BlockItemInterface {
|
||||||
return Shapes.HOPPING_ITEM_VIEWER_SHAPE;
|
return Shapes.HOPPING_ITEM_VIEWER_SHAPE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
//@Override
|
||||||
public TileEntity newBlockEntity(IBlockReader worldIn) {
|
public TileEntity newBlockEntity(IBlockReader worldIn) {
|
||||||
return new TileEntityItemInterfaceHopping();
|
return new TileEntityItemInterfaceHopping();
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.blocks;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
||||||
|
import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
|
||||||
import de.ellpeck.actuallyadditions.api.laser.Network;
|
import de.ellpeck.actuallyadditions.api.laser.Network;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock;
|
import de.ellpeck.actuallyadditions.mod.blocks.base.FullyDirectionalBlock;
|
||||||
|
@ -20,9 +21,16 @@ import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles;
|
import de.ellpeck.actuallyadditions.mod.items.ItemEngineerGoggles;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemLaserRelayUpgrade;
|
import de.ellpeck.actuallyadditions.mod.items.ItemLaserRelayUpgrade;
|
||||||
import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench;
|
import de.ellpeck.actuallyadditions.mod.items.ItemLaserWrench;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.*;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergy;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyAdvanced;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayEnergyExtreme;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayFluids;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItem;
|
||||||
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelayItemAdvanced;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
|
import io.netty.util.internal.ConcurrentSet;
|
||||||
import net.minecraft.block.BlockState;
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.MainWindow;
|
import net.minecraft.client.MainWindow;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
@ -42,6 +50,9 @@ import net.minecraft.world.World;
|
||||||
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 java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
|
||||||
public class BlockLaserRelay extends FullyDirectionalBlock.Container implements IHudDisplay {
|
public class BlockLaserRelay extends FullyDirectionalBlock.Container implements IHudDisplay {
|
||||||
|
|
||||||
|
@ -146,8 +157,13 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
|
||||||
return ActionResultType.FAIL;
|
return ActionResultType.FAIL;
|
||||||
}
|
}
|
||||||
|
|
||||||
//@Override
|
@Override
|
||||||
public TileEntity newBlockEntity(IBlockReader world) {
|
public boolean hasTileEntity(BlockState state) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public TileEntity createTileEntity(BlockState state, IBlockReader world) {
|
||||||
switch (this.type) {
|
switch (this.type) {
|
||||||
case ITEM:
|
case ITEM:
|
||||||
return new TileEntityLaserRelayItem();
|
return new TileEntityLaserRelayItem();
|
||||||
|
@ -200,11 +216,27 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onRemove(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) {
|
public void onRemove(BlockState state, World world, BlockPos pos, BlockState newState, boolean isMoving) {
|
||||||
super.onRemove(state, world, pos, newState, isMoving);
|
|
||||||
|
|
||||||
if (state != newState) {
|
if (state != newState) {
|
||||||
|
ConcurrentSet<IConnectionPair> connectionPairs = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(pos, world);
|
||||||
ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pos, world);
|
ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(pos, world);
|
||||||
|
List<BlockPos> relayPositions = new ArrayList<>();
|
||||||
|
connectionPairs.forEach(pair -> {
|
||||||
|
for (BlockPos pairPos : pair.getPositions()) {
|
||||||
|
if (!pos.equals(pairPos)) {
|
||||||
|
relayPositions.add(pairPos);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
//Update the connected relays to sync the changes to the client
|
||||||
|
relayPositions.forEach(relayPos -> {
|
||||||
|
TileEntity tile = world.getBlockEntity(relayPos);
|
||||||
|
if(tile instanceof TileEntityLaserRelay) {
|
||||||
|
TileEntityLaserRelay relay = (TileEntityLaserRelay) tile;
|
||||||
|
relay.sendUpdate();
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
super.onRemove(state, world, pos, newState, isMoving);
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
// @Override
|
// @Override
|
||||||
|
@ -225,6 +257,19 @@ public class BlockLaserRelay extends FullyDirectionalBlock.Container implements
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
|
||||||
return Shapes.RELAY_SHAPE;
|
switch (state.getValue(FACING)) {
|
||||||
|
case UP:
|
||||||
|
return Shapes.LaserRelayShapes.SHAPE_U;
|
||||||
|
case DOWN:
|
||||||
|
return Shapes.LaserRelayShapes.SHAPE_D;
|
||||||
|
case EAST:
|
||||||
|
return Shapes.LaserRelayShapes.SHAPE_E;
|
||||||
|
case SOUTH:
|
||||||
|
return Shapes.LaserRelayShapes.SHAPE_S;
|
||||||
|
case WEST:
|
||||||
|
return Shapes.LaserRelayShapes.SHAPE_W;
|
||||||
|
default:
|
||||||
|
return Shapes.LaserRelayShapes.SHAPE_N;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -135,6 +135,15 @@ public class Shapes {
|
||||||
.add(15, 1, 0, 16, 15, 1)
|
.add(15, 1, 0, 16, 15, 1)
|
||||||
.standardReduceBuild().get();
|
.standardReduceBuild().get();
|
||||||
|
|
||||||
|
static final class LaserRelayShapes {
|
||||||
|
static final VoxelShape SHAPE_U = Stream.of(Block.box(1, 0, 1, 15, 1, 15), Block.box(3, 1, 3, 13, 5, 13), Block.box(7, 4, 7, 9, 10, 9)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get();
|
||||||
|
static final VoxelShape SHAPE_D = Stream.of(Block.box(1, 15, 1, 15, 16, 15), Block.box(3, 11, 3, 13, 15, 13), Block.box(7, 6, 7, 9, 12, 9)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get();
|
||||||
|
static final VoxelShape SHAPE_N = Stream.of(Block.box(1, 1, 15, 15, 15, 16), Block.box(3, 3, 11, 13, 13, 15), Block.box(7, 7, 6, 9, 9, 12)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get();
|
||||||
|
static final VoxelShape SHAPE_E = Stream.of(Block.box(0, 1, 1, 1, 15, 15), Block.box(1, 3, 3, 5, 13, 13), Block.box(4, 7, 7, 10, 9, 9)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get();
|
||||||
|
static final VoxelShape SHAPE_S = Stream.of(Block.box(1, 1, 0, 15, 15, 1), Block.box(3, 3, 1, 13, 13, 5), Block.box(7, 7, 4, 9, 9, 10)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get();
|
||||||
|
static final VoxelShape SHAPE_W = Stream.of(Block.box(15, 1, 1, 16, 15, 15), Block.box(11, 3, 3, 15, 13, 13), Block.box(6, 7, 7, 12, 9, 9)).reduce((v1, v2) -> VoxelShapes.join(v1, v2, IBooleanFunction.OR)).get();
|
||||||
|
}
|
||||||
|
|
||||||
public static class ShapeBuilder {
|
public static class ShapeBuilder {
|
||||||
Stream.Builder<VoxelShape> shapes = Stream.builder();
|
Stream.Builder<VoxelShape> shapes = Stream.builder();
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,6 @@
|
||||||
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
package de.ellpeck.actuallyadditions.mod.blocks.render;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import de.ellpeck.actuallyadditions.api.ActuallyAdditionsAPI;
|
|
||||||
import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
|
import de.ellpeck.actuallyadditions.api.laser.IConnectionPair;
|
||||||
import de.ellpeck.actuallyadditions.api.laser.LaserType;
|
import de.ellpeck.actuallyadditions.api.laser.LaserType;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
import de.ellpeck.actuallyadditions.mod.config.ConfigValues;
|
||||||
|
@ -22,23 +21,28 @@ import de.ellpeck.actuallyadditions.mod.tile.TileEntityLaserRelay;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StackUtil;
|
||||||
import io.netty.util.internal.ConcurrentSet;
|
import io.netty.util.internal.ConcurrentSet;
|
||||||
|
import net.minecraft.block.BlockState;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
|
||||||
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
import net.minecraft.client.renderer.tileentity.TileEntityRendererDispatcher;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.state.properties.BlockStateProperties;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
import net.minecraft.util.Direction;
|
||||||
|
import net.minecraft.util.Rotation;
|
||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
import net.minecraft.util.math.BlockPos;
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.vector.Quaternion;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
|
import net.minecraft.util.math.vector.Vector3f;
|
||||||
|
|
||||||
public class RenderLaserRelay extends TileEntityRenderer<TileEntityLaserRelay> {
|
public class RenderLaserRelay extends TileEntityRenderer<TileEntityLaserRelay> {
|
||||||
|
|
||||||
private static final float[] COLOR = new float[]{1F, 0F, 0F};
|
private static final int COLOR = 16711680;
|
||||||
private static final float[] COLOR_ITEM = new float[]{0F, 124F / 255F, 16F / 255F};
|
private static final int COLOR_ITEM = 31760;
|
||||||
private static final float[] COLOR_FLUIDS = new float[]{0F, 97F / 255F, 198F / 255F};
|
private static final int COLOR_FLUIDS = 25030;
|
||||||
private static final float[] COLOR_INFRARED = new float[]{209F / 255F, 179F / 255F, 239F / 255F};
|
private static final int COLOR_INFRARED = 13743087;
|
||||||
|
|
||||||
public RenderLaserRelay(TileEntityRendererDispatcher rendererDispatcherIn) {
|
public RenderLaserRelay(TileEntityRendererDispatcher rendererDispatcherIn) {
|
||||||
super(rendererDispatcherIn);
|
super(rendererDispatcherIn);
|
||||||
|
@ -47,6 +51,7 @@ public class RenderLaserRelay extends TileEntityRenderer<TileEntityLaserRelay> {
|
||||||
@Override
|
@Override
|
||||||
public void render(TileEntityLaserRelay tile, float partialTicks, MatrixStack matrices, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) {
|
public void render(TileEntityLaserRelay tile, float partialTicks, MatrixStack matrices, IRenderTypeBuffer buffer, int combinedLight, int combinedOverlay) {
|
||||||
TileEntityLaserRelay relay = tile;
|
TileEntityLaserRelay relay = tile;
|
||||||
|
BlockState state = tile.getBlockState();
|
||||||
boolean hasInvis = false;
|
boolean hasInvis = false;
|
||||||
|
|
||||||
PlayerEntity player = Minecraft.getInstance().player;
|
PlayerEntity player = Minecraft.getInstance().player;
|
||||||
|
@ -61,13 +66,15 @@ public class RenderLaserRelay extends TileEntityRenderer<TileEntityLaserRelay> {
|
||||||
ItemStack hand = player.getMainHandItem();
|
ItemStack hand = player.getMainHandItem();
|
||||||
if (hasGoggles || StackUtil.isValid(hand) && (hand.getItem() == ConfigValues.itemCompassConfigurator || hand.getItem() instanceof ItemLaserWrench) || "themattabase".equals(player.getName().getString())) {
|
if (hasGoggles || StackUtil.isValid(hand) && (hand.getItem() == ConfigValues.itemCompassConfigurator || hand.getItem() instanceof ItemLaserWrench) || "themattabase".equals(player.getName().getString())) {
|
||||||
matrices.pushPose();
|
matrices.pushPose();
|
||||||
|
Direction direction = state.hasProperty(BlockStateProperties.FACING) ?
|
||||||
|
state.getValue(BlockStateProperties.FACING) : Direction.UP;
|
||||||
|
|
||||||
float yTrans = 0.2f; //tile.getBlockMetadata() == 0 ? 0.2F : 0.8F; // TODO: [port][fix] no clue what this is
|
float yTrans = direction.getAxis() == Direction.Axis.Y ? 0.2f : 0.8F; //tile.getBlockMetadata() == 0 ? 0.2F : 0.8F; // TODO: [port][fix] no clue what this is
|
||||||
matrices.translate(0.5F, yTrans, 0.5F);
|
matrices.translate(0.5F, yTrans, 0.5F);
|
||||||
matrices.scale(0.2F, 0.2F, 0.2F);
|
matrices.scale(0.2F, 0.2F, 0.2F);
|
||||||
|
|
||||||
double boop = Util.getMillis() / 800D;
|
double boop = Util.getMillis() / 800D;
|
||||||
matrices.mulPose(new Quaternion((float) (boop * 40D % 360), 0, 1, 0)); // TODO: [port][test] this might not work
|
matrices.mulPose(Vector3f.YP.rotationDegrees((float) (boop * 40D % 360)));
|
||||||
|
|
||||||
AssetUtil.renderItemInWorld(upgrade, combinedLight, combinedOverlay, matrices, buffer);
|
AssetUtil.renderItemInWorld(upgrade, combinedLight, combinedOverlay, matrices, buffer);
|
||||||
|
|
||||||
|
@ -75,7 +82,7 @@ public class RenderLaserRelay extends TileEntityRenderer<TileEntityLaserRelay> {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ConcurrentSet<IConnectionPair> connections = ActuallyAdditionsAPI.connectionHandler.getConnectionsFor(tile.getBlockPos(), tile.getLevel());
|
ConcurrentSet<IConnectionPair> connections = tile.getConnections();
|
||||||
if (connections != null && !connections.isEmpty()) {
|
if (connections != null && !connections.isEmpty()) {
|
||||||
for (IConnectionPair pair : connections) {
|
for (IConnectionPair pair : connections) {
|
||||||
if (!pair.doesSuppressRender() && tile.getBlockPos().equals(pair.getPositions()[0])) {
|
if (!pair.doesSuppressRender() && tile.getBlockPos().equals(pair.getPositions()[0])) {
|
||||||
|
@ -88,17 +95,26 @@ public class RenderLaserRelay extends TileEntityRenderer<TileEntityLaserRelay> {
|
||||||
boolean otherInvis = StackUtil.isValid(secondUpgrade) && secondUpgrade.getItem() == ActuallyItems.LASER_UPGRADE_INVISIBILITY.get();
|
boolean otherInvis = StackUtil.isValid(secondUpgrade) && secondUpgrade.getItem() == ActuallyItems.LASER_UPGRADE_INVISIBILITY.get();
|
||||||
|
|
||||||
if (hasGoggles || !hasInvis || !otherInvis) {
|
if (hasGoggles || !hasInvis || !otherInvis) {
|
||||||
float[] color = hasInvis && otherInvis
|
int color = hasInvis && otherInvis
|
||||||
? COLOR_INFRARED
|
? COLOR_INFRARED : relay.type == LaserType.ITEM
|
||||||
: relay.type == LaserType.ITEM
|
? COLOR_ITEM : relay.type == LaserType.FLUID
|
||||||
? COLOR_ITEM
|
? COLOR_FLUIDS : COLOR;
|
||||||
: relay.type == LaserType.FLUID
|
|
||||||
? COLOR_FLUIDS
|
|
||||||
: COLOR;
|
|
||||||
|
|
||||||
AssetUtil.renderLaser(first.getX() + 0.5, first.getY() + 0.5, first.getZ() + 0.5, second.getX() + 0.5, second.getY() + 0.5, second.getZ() + 0.5, 120, hasInvis && otherInvis
|
BlockPos offsetStart = first.subtract(tile.getBlockPos());
|
||||||
? 0.1F
|
BlockPos offsetEnd = second.subtract(tile.getBlockPos());
|
||||||
: 0.35F, 0.05, color);
|
offsetEnd = offsetEnd.rotate(Rotation.CLOCKWISE_90);
|
||||||
|
|
||||||
|
matrices.pushPose();
|
||||||
|
|
||||||
|
AssetUtil.renderLaser(matrices, buffer,
|
||||||
|
new Vector3d(offsetStart.getX(), offsetStart.getY(), offsetStart.getZ()),
|
||||||
|
new Vector3d(offsetEnd.getX(), offsetEnd.getY(), offsetEnd.getZ()),
|
||||||
|
120, color,
|
||||||
|
hasInvis && otherInvis
|
||||||
|
? 0.1F
|
||||||
|
: 0.35F, 0.05F);
|
||||||
|
|
||||||
|
matrices.popPose();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,6 +39,7 @@ public class CommonConfig {
|
||||||
public static ForgeConfigSpec.IntValue RECONSTRUCTOR_POWER;
|
public static ForgeConfigSpec.IntValue RECONSTRUCTOR_POWER;
|
||||||
public static ForgeConfigSpec.IntValue OIL_GENERATOR_TRANSFER;
|
public static ForgeConfigSpec.IntValue OIL_GENERATOR_TRANSFER;
|
||||||
public static ForgeConfigSpec.IntValue MINER_LENS_ENERGY;
|
public static ForgeConfigSpec.IntValue MINER_LENS_ENERGY;
|
||||||
|
public static ForgeConfigSpec.BooleanValue LASER_RELAY_LOSS;
|
||||||
|
|
||||||
public static void build() {
|
public static void build() {
|
||||||
BUILDER.comment("Machine Settings").push("machineSettings");
|
BUILDER.comment("Machine Settings").push("machineSettings");
|
||||||
|
@ -47,6 +48,7 @@ public class CommonConfig {
|
||||||
RECONSTRUCTOR_POWER = BUILDER.comment("The amount of power the atomic reconstructor can store.").defineInRange("reconstructorPower", 300000, 300000, Integer.MAX_VALUE);
|
RECONSTRUCTOR_POWER = BUILDER.comment("The amount of power the atomic reconstructor can store.").defineInRange("reconstructorPower", 300000, 300000, Integer.MAX_VALUE);
|
||||||
OIL_GENERATOR_TRANSFER = BUILDER.comment("The amount of power the oil generator can transfer per tick.").defineInRange("oilGeneratorTransfer", 500, 100, Integer.MAX_VALUE);
|
OIL_GENERATOR_TRANSFER = BUILDER.comment("The amount of power the oil generator can transfer per tick.").defineInRange("oilGeneratorTransfer", 500, 100, Integer.MAX_VALUE);
|
||||||
MINER_LENS_ENERGY = BUILDER.comment("The energy use of the Atomic Reconstructor's Mining Lens.").defineInRange("minerLensEnergy", 60000, 1, Integer.MAX_VALUE);
|
MINER_LENS_ENERGY = BUILDER.comment("The energy use of the Atomic Reconstructor's Mining Lens.").defineInRange("minerLensEnergy", 60000, 1, Integer.MAX_VALUE);
|
||||||
|
LASER_RELAY_LOSS = BUILDER.comment("If Energy Laser Relays should have energy loss.").define("laserRelayLoss", true);
|
||||||
|
|
||||||
BUILDER.pop();
|
BUILDER.pop();
|
||||||
}
|
}
|
||||||
|
|
|
@ -96,8 +96,8 @@ public final class ActuallyItems {
|
||||||
|
|
||||||
public static final RegistryObject<Item> ENGINEERS_GOGGLES_ADVANCED = ITEMS.register("engineers_goggles_advanced", () -> new ItemEngineerGoggles(true));
|
public static final RegistryObject<Item> ENGINEERS_GOGGLES_ADVANCED = ITEMS.register("engineers_goggles_advanced", () -> new ItemEngineerGoggles(true));
|
||||||
public static final RegistryObject<Item> ENGINEERS_GOGGLES = ITEMS.register("engineers_goggles", () -> new ItemEngineerGoggles(false));
|
public static final RegistryObject<Item> ENGINEERS_GOGGLES = ITEMS.register("engineers_goggles", () -> new ItemEngineerGoggles(false));
|
||||||
public static final RegistryObject<Item> LASER_UPGRADE_RANGE = ITEMS.register("laser_upgrade_range", ItemBase::new);
|
public static final RegistryObject<Item> LASER_UPGRADE_RANGE = ITEMS.register("laser_upgrade_range", ItemLaserRelayUpgrade::new);
|
||||||
public static final RegistryObject<Item> LASER_UPGRADE_INVISIBILITY = ITEMS.register("laser_upgrade_invisibility", ItemBase::new);
|
public static final RegistryObject<Item> LASER_UPGRADE_INVISIBILITY = ITEMS.register("laser_upgrade_invisibility", ItemLaserRelayUpgrade::new);
|
||||||
public static final Supplier<Item> HANDHELD_FILLER = ITEMS.register("handheld_filler", ItemFillingWand::new);
|
public static final Supplier<Item> HANDHELD_FILLER = ITEMS.register("handheld_filler", ItemFillingWand::new);
|
||||||
public static final RegistryObject<Item> TRAVELERS_SACK = ITEMS.register("travelers_sack", () -> new ItemBag(false));
|
public static final RegistryObject<Item> TRAVELERS_SACK = ITEMS.register("travelers_sack", () -> new ItemBag(false));
|
||||||
public static final RegistryObject<Item> VOID_SACK = ITEMS.register("void_sack", () -> new ItemBag(true));
|
public static final RegistryObject<Item> VOID_SACK = ITEMS.register("void_sack", () -> new ItemBag(true));
|
||||||
|
|
|
@ -70,13 +70,15 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH
|
||||||
@Override
|
@Override
|
||||||
public ConcurrentSet<IConnectionPair> getConnectionsFor(BlockPos relay, World world) {
|
public ConcurrentSet<IConnectionPair> getConnectionsFor(BlockPos relay, World world) {
|
||||||
ConcurrentSet<IConnectionPair> allPairs = new ConcurrentSet<>();
|
ConcurrentSet<IConnectionPair> allPairs = new ConcurrentSet<>();
|
||||||
/* for (Network aNetwork : WorldData.get(world).laserRelayNetworks) {
|
if(!world.isClientSide) {
|
||||||
for (IConnectionPair pair : aNetwork.connections) {
|
for (Network aNetwork : WorldData.get(world).laserRelayNetworks) {
|
||||||
if (pair.contains(relay)) {
|
for (IConnectionPair pair : aNetwork.connections) {
|
||||||
allPairs.add(pair);
|
if (pair.contains(relay)) {
|
||||||
|
allPairs.add(pair);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/ //TODO ohhh boy
|
} //TODO ohhh boy
|
||||||
return allPairs;
|
return allPairs;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -107,7 +109,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public Network getNetworkFor(BlockPos relay, World world) {
|
public Network getNetworkFor(BlockPos relay, World world) {
|
||||||
if (world != null) {
|
if (world != null && !world.isClientSide) {
|
||||||
for (Network aNetwork : WorldData.get(world).laserRelayNetworks) {
|
for (Network aNetwork : WorldData.get(world).laserRelayNetworks) {
|
||||||
for (IConnectionPair pair : aNetwork.connections) {
|
for (IConnectionPair pair : aNetwork.connections) {
|
||||||
if (pair.contains(relay)) {
|
if (pair.contains(relay)) {
|
||||||
|
@ -135,7 +137,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world, boolean suppressConnectionRender, boolean removeIfConnected) {
|
public boolean addConnection(BlockPos firstRelay, BlockPos secondRelay, LaserType type, World world, boolean suppressConnectionRender, boolean removeIfConnected) {
|
||||||
if (firstRelay == null || secondRelay == null || firstRelay == secondRelay || firstRelay.equals(secondRelay)) {
|
if (world.isClientSide || firstRelay == null || secondRelay == null || firstRelay == secondRelay || firstRelay.equals(secondRelay)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
WorldData data = WorldData.get(world);
|
WorldData data = WorldData.get(world);
|
||||||
|
@ -184,7 +186,7 @@ public final class LaserRelayConnectionHandler implements ILaserRelayConnectionH
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeConnection(World world, BlockPos firstRelay, BlockPos secondRelay) {
|
public void removeConnection(World world, BlockPos firstRelay, BlockPos secondRelay) {
|
||||||
if (world != null && firstRelay != null && secondRelay != null) {
|
if (world != null && !world.isClientSide && firstRelay != null && secondRelay != null) {
|
||||||
Network network = this.getNetworkFor(firstRelay, world);
|
Network network = this.getNetworkFor(firstRelay, world);
|
||||||
|
|
||||||
if (network != null) {
|
if (network != null) {
|
||||||
|
|
|
@ -20,14 +20,12 @@ import de.ellpeck.actuallyadditions.mod.particle.ParticleLaserItem;
|
||||||
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
import de.ellpeck.actuallyadditions.mod.tile.TileEntityBase;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.particle.Particle;
|
|
||||||
import net.minecraft.entity.Entity;
|
import net.minecraft.entity.Entity;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
import net.minecraft.entity.player.ServerPlayerEntity;
|
import net.minecraft.entity.player.ServerPlayerEntity;
|
||||||
import net.minecraft.inventory.container.Container;
|
import net.minecraft.inventory.container.Container;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.nbt.NBTUtil;
|
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
import net.minecraft.util.RegistryKey;
|
import net.minecraft.util.RegistryKey;
|
||||||
import net.minecraft.util.ResourceLocation;
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
@ -84,8 +82,11 @@ public final class PacketHandler {
|
||||||
double outY = compound.getDouble("OutY") + 0.525;
|
double outY = compound.getDouble("OutY") + 0.525;
|
||||||
double outZ = compound.getDouble("OutZ") + 0.5;
|
double outZ = compound.getDouble("OutZ") + 0.5;
|
||||||
|
|
||||||
Particle fx = new ParticleLaserItem(mc.level, outX, outY, outZ, stack, 0.025, inX, inY, inZ);
|
// Particle fx = new ParticleLaserItem(mc.level, outX, outY, outZ, stack, 0.025, inX, inY, inZ);
|
||||||
//mc.effectRenderer.addEffect(fx); //TODO
|
//mc.effectRenderer.addEffect(fx); //TODO
|
||||||
|
|
||||||
|
mc.level.addParticle(ParticleLaserItem.Factory.createData(stack, outX, outY, outZ),
|
||||||
|
inX, inY, inZ, 0, 0.025, 0);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
public static final IDataHandler GUI_BUTTON_TO_TILE_HANDLER = (compound, context) -> {
|
public static final IDataHandler GUI_BUTTON_TO_TILE_HANDLER = (compound, context) -> {
|
||||||
|
|
|
@ -0,0 +1,20 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.particle;
|
||||||
|
|
||||||
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
|
import net.minecraft.particles.ParticleType;
|
||||||
|
import net.minecraftforge.eventbus.api.IEventBus;
|
||||||
|
import net.minecraftforge.fml.RegistryObject;
|
||||||
|
import net.minecraftforge.registries.DeferredRegister;
|
||||||
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
|
||||||
|
public class ActuallyParticles {
|
||||||
|
private static final DeferredRegister<ParticleType<?>> PARTICLE_TYPES = DeferredRegister.create(ForgeRegistries.PARTICLE_TYPES, ActuallyAdditions.MODID);
|
||||||
|
|
||||||
|
|
||||||
|
public static final RegistryObject<ParticleType<LaserItemParticleData>> LASER_ITEM = PARTICLE_TYPES.register("laser_item", LaserItemParticleType::new);
|
||||||
|
public static final RegistryObject<ParticleType<BeamParticleData>> BEAM = PARTICLE_TYPES.register("beam", BeamParticleType::new);
|
||||||
|
|
||||||
|
public static void init(IEventBus evt) {
|
||||||
|
PARTICLE_TYPES.register(evt);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,136 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.particle;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.StringReader;
|
||||||
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
import net.minecraft.particles.IParticleData;
|
||||||
|
import net.minecraft.particles.ParticleType;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class BeamParticleData extends ParticleType<BeamParticleData> implements IParticleData {
|
||||||
|
private ParticleType<BeamParticleData> type;
|
||||||
|
public static final Codec<BeamParticleData> CODEC = RecordCodecBuilder.create(instance -> instance.group(
|
||||||
|
Codec.DOUBLE.fieldOf("endX").forGetter(d -> d.endX),
|
||||||
|
Codec.DOUBLE.fieldOf("endY").forGetter(d -> d.endY),
|
||||||
|
Codec.DOUBLE.fieldOf("endZ").forGetter(d -> d.endZ),
|
||||||
|
Codec.FLOAT.fieldOf("r").forGetter(d -> d.color[0]),
|
||||||
|
Codec.FLOAT.fieldOf("g").forGetter(d -> d.color[1]),
|
||||||
|
Codec.FLOAT.fieldOf("b").forGetter(d -> d.color[2]),
|
||||||
|
Codec.FLOAT.fieldOf("alpha").forGetter(d -> d.alpha),
|
||||||
|
Codec.INT.fieldOf("maxAge").forGetter(d -> d.maxAge),
|
||||||
|
Codec.DOUBLE.fieldOf("rotationTime").forGetter(d -> d.rotationTime),
|
||||||
|
Codec.FLOAT.fieldOf("size").forGetter(d -> d.size)
|
||||||
|
)
|
||||||
|
.apply(instance, BeamParticleData::new));
|
||||||
|
protected final double endX, endY, endZ;
|
||||||
|
protected final float[] color = new float[3];
|
||||||
|
protected final float alpha;
|
||||||
|
protected final int maxAge;
|
||||||
|
protected final double rotationTime;
|
||||||
|
protected final float size;
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
static final IDeserializer<BeamParticleData> DESERIALIZER = new IDeserializer<BeamParticleData>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BeamParticleData fromCommand(ParticleType<BeamParticleData> type, StringReader reader) throws CommandSyntaxException {
|
||||||
|
reader.expect(' ');
|
||||||
|
double endX = reader.readDouble();
|
||||||
|
reader.expect(' ');
|
||||||
|
double endY = reader.readDouble();
|
||||||
|
reader.expect(' ');
|
||||||
|
double endZ = reader.readDouble();
|
||||||
|
reader.expect(' ');
|
||||||
|
float red = (float) reader.readDouble();
|
||||||
|
reader.expect(' ');
|
||||||
|
float green = (float) reader.readDouble();
|
||||||
|
reader.expect(' ');
|
||||||
|
float blue = (float) reader.readDouble();
|
||||||
|
reader.expect(' ');
|
||||||
|
float alpha = (float) reader.readDouble();
|
||||||
|
reader.expect(' ');
|
||||||
|
int maxAge = reader.readInt();
|
||||||
|
reader.expect(' ');
|
||||||
|
double rotationTime = reader.readDouble();
|
||||||
|
reader.expect(' ');
|
||||||
|
float size = (float) reader.readDouble();
|
||||||
|
return new BeamParticleData(type, endX, endY, endZ, red, green, blue, alpha, maxAge, rotationTime, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BeamParticleData fromNetwork(ParticleType<BeamParticleData> type, PacketBuffer buffer) {
|
||||||
|
double endX = buffer.readDouble();
|
||||||
|
double endY = buffer.readDouble();
|
||||||
|
double endZ = buffer.readDouble();
|
||||||
|
float red = buffer.readFloat();
|
||||||
|
float green = buffer.readFloat();
|
||||||
|
float blue = buffer.readFloat();
|
||||||
|
float alpha = buffer.readFloat();
|
||||||
|
int maxAge = buffer.readInt();
|
||||||
|
double rotationTime = buffer.readDouble();
|
||||||
|
float size = buffer.readFloat();
|
||||||
|
|
||||||
|
return new BeamParticleData(type, endX, endY, endZ, red, green, blue, alpha, maxAge, rotationTime, size);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public BeamParticleData(ParticleType<BeamParticleData> particleTypeData,
|
||||||
|
double endX, double endY, double endZ, float red, float green, float blue, float alpha,
|
||||||
|
int maxAge, double rotationTime, float size) {
|
||||||
|
super(false, DESERIALIZER);
|
||||||
|
this.type = particleTypeData;
|
||||||
|
this.endX = endX;
|
||||||
|
this.endY = endY;
|
||||||
|
this.endZ = endZ;
|
||||||
|
this.color[0] = red;
|
||||||
|
this.color[1] = green;
|
||||||
|
this.color[2] = blue;
|
||||||
|
this.alpha = alpha;
|
||||||
|
this.maxAge = maxAge;
|
||||||
|
this.rotationTime = rotationTime;
|
||||||
|
this.size = size;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BeamParticleData(double endX, double endY, double endZ, float red, float green, float blue, float alpha,
|
||||||
|
int maxAge, double rotationTime, float size) {
|
||||||
|
this(ActuallyParticles.BEAM.get(), endX, endY, endZ, red, green, blue, alpha, maxAge, rotationTime, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BeamParticleData(double endX, double endY, double endZ, float[] color, float alpha,
|
||||||
|
int maxAge, double rotationTime, float size) {
|
||||||
|
this(ActuallyParticles.BEAM.get(), endX, endY, endZ, color[0], color[1], color[2], alpha, maxAge, rotationTime, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ParticleType<?> getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNetwork(PacketBuffer buffer) {
|
||||||
|
buffer.writeDouble(this.endX);
|
||||||
|
buffer.writeDouble(this.endY);
|
||||||
|
buffer.writeDouble(this.endZ);
|
||||||
|
buffer.writeFloat(this.color[0]);
|
||||||
|
buffer.writeFloat(this.color[1]);
|
||||||
|
buffer.writeFloat(this.color[2]);
|
||||||
|
buffer.writeFloat(this.alpha);
|
||||||
|
buffer.writeInt(this.maxAge);
|
||||||
|
buffer.writeDouble(this.rotationTime);
|
||||||
|
buffer.writeFloat(this.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String writeToString() {
|
||||||
|
return String.format(Locale.ROOT, "%s %.2f %.2f %.2f, %.2f %.2f %.2f %.2f %d %.2f %.2f",
|
||||||
|
this.endX, this.endY, this.endZ, this.color[0], this.color[1], this.color[2], this.alpha,
|
||||||
|
this.maxAge, this.rotationTime, this.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Codec<BeamParticleData> codec() {
|
||||||
|
return BeamParticleData.CODEC;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.particle;
|
||||||
|
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import net.minecraft.particles.ParticleType;
|
||||||
|
|
||||||
|
public class BeamParticleType extends ParticleType<BeamParticleData> {
|
||||||
|
public BeamParticleType() {
|
||||||
|
super(false, BeamParticleData.DESERIALIZER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Codec<BeamParticleData> codec() {
|
||||||
|
return BeamParticleData.CODEC;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,95 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.particle;
|
||||||
|
|
||||||
|
import com.mojang.brigadier.StringReader;
|
||||||
|
import com.mojang.brigadier.exceptions.CommandSyntaxException;
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import com.mojang.serialization.codecs.RecordCodecBuilder;
|
||||||
|
import net.minecraft.item.Item;
|
||||||
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.network.PacketBuffer;
|
||||||
|
import net.minecraft.particles.IParticleData;
|
||||||
|
import net.minecraft.particles.ParticleType;
|
||||||
|
import net.minecraft.util.ResourceLocation;
|
||||||
|
import net.minecraftforge.registries.ForgeRegistries;
|
||||||
|
|
||||||
|
import java.util.Locale;
|
||||||
|
|
||||||
|
public class LaserItemParticleData extends ParticleType<LaserItemParticleData> implements IParticleData {
|
||||||
|
private ParticleType<LaserItemParticleData> type;
|
||||||
|
public static final Codec<LaserItemParticleData> CODEC = RecordCodecBuilder.create(instance -> instance.group(
|
||||||
|
ItemStack.CODEC.fieldOf("stack").forGetter(d -> d.stack),
|
||||||
|
Codec.DOUBLE.fieldOf("outputX").forGetter(d -> d.outputX),
|
||||||
|
Codec.DOUBLE.fieldOf("outputY").forGetter(d -> d.outputY),
|
||||||
|
Codec.DOUBLE.fieldOf("outputZ").forGetter(d -> d.outputZ)
|
||||||
|
)
|
||||||
|
.apply(instance, LaserItemParticleData::new));
|
||||||
|
protected final ItemStack stack;
|
||||||
|
protected final double outputX, outputY, outputZ;
|
||||||
|
@SuppressWarnings("deprecation")
|
||||||
|
static final IParticleData.IDeserializer<LaserItemParticleData> DESERIALIZER = new IParticleData.IDeserializer<LaserItemParticleData>() {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LaserItemParticleData fromCommand(ParticleType<LaserItemParticleData> type, StringReader reader) throws CommandSyntaxException {
|
||||||
|
reader.expect(' ');
|
||||||
|
String itemString = reader.readString();
|
||||||
|
ResourceLocation itemLocation = ResourceLocation.tryParse(itemString);
|
||||||
|
Item item = itemLocation == null ? null : ForgeRegistries.ITEMS.getValue(itemLocation);
|
||||||
|
ItemStack stack = item == null ? ItemStack.EMPTY : new ItemStack(item);
|
||||||
|
reader.expect(' ');
|
||||||
|
double outputX = reader.readDouble();
|
||||||
|
reader.expect(' ');
|
||||||
|
double outputY = reader.readDouble();
|
||||||
|
reader.expect(' ');
|
||||||
|
double outputZ = reader.readDouble();
|
||||||
|
return new LaserItemParticleData(type, stack, outputX, outputY, outputZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LaserItemParticleData fromNetwork(ParticleType<LaserItemParticleData> type, PacketBuffer buffer) {
|
||||||
|
ItemStack stack = buffer.readItem();
|
||||||
|
double outputX = buffer.readDouble();
|
||||||
|
double outputY = buffer.readDouble();
|
||||||
|
double outputZ = buffer.readDouble();
|
||||||
|
return new LaserItemParticleData(type, stack, outputX, outputY, outputZ);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
public LaserItemParticleData(ParticleType<LaserItemParticleData> particleTypeData, ItemStack stack,
|
||||||
|
double outputX, double outputY, double outputZ) {
|
||||||
|
super(false, DESERIALIZER);
|
||||||
|
this.type = particleTypeData;
|
||||||
|
this.stack = stack;
|
||||||
|
this.outputX = outputX;
|
||||||
|
this.outputY = outputY;
|
||||||
|
this.outputZ = outputZ;
|
||||||
|
}
|
||||||
|
|
||||||
|
public LaserItemParticleData(ItemStack stack, double outputX, double outputY, double outputZ) {
|
||||||
|
this(ActuallyParticles.LASER_ITEM.get(), stack, outputX, outputY, outputZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ParticleType<?> getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void writeToNetwork(PacketBuffer buffer) {
|
||||||
|
buffer.writeItemStack(this.stack, true);
|
||||||
|
buffer.writeDouble(this.outputX);
|
||||||
|
buffer.writeDouble(this.outputY);
|
||||||
|
buffer.writeDouble(this.outputZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String writeToString() {
|
||||||
|
return String.format(Locale.ROOT, "%s %s %.2f %.2f %.2f", ForgeRegistries.PARTICLE_TYPES.getKey(this.getType()),
|
||||||
|
ForgeRegistries.ITEMS.getKey(this.stack.getItem()),
|
||||||
|
this.outputX, this.outputY, this.outputZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Codec<LaserItemParticleData> codec() {
|
||||||
|
return LaserItemParticleData.CODEC;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
package de.ellpeck.actuallyadditions.mod.particle;
|
||||||
|
|
||||||
|
import com.mojang.serialization.Codec;
|
||||||
|
import net.minecraft.particles.ParticleType;
|
||||||
|
|
||||||
|
public class LaserItemParticleType extends ParticleType<LaserItemParticleData> {
|
||||||
|
public LaserItemParticleType() {
|
||||||
|
super(false, LaserItemParticleData.DESERIALIZER);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Codec<LaserItemParticleData> codec() {
|
||||||
|
return LaserItemParticleData.CODEC;
|
||||||
|
}
|
||||||
|
}
|
|
@ -12,10 +12,13 @@ package de.ellpeck.actuallyadditions.mod.particle;
|
||||||
|
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
|
import net.minecraft.client.particle.IAnimatedSprite;
|
||||||
|
import net.minecraft.client.particle.IParticleFactory;
|
||||||
import net.minecraft.client.particle.IParticleRenderType;
|
import net.minecraft.client.particle.IParticleRenderType;
|
||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
|
import net.minecraft.particles.IParticleData;
|
||||||
|
|
||||||
public class ParticleBeam extends Particle {
|
public class ParticleBeam extends Particle {
|
||||||
|
|
||||||
|
@ -27,7 +30,8 @@ public class ParticleBeam extends Particle {
|
||||||
private final float size;
|
private final float size;
|
||||||
private final float alpha;
|
private final float alpha;
|
||||||
|
|
||||||
public ParticleBeam(ClientWorld world, double startX, double startY, double startZ, double endX, double endY, double endZ, float[] color, int maxAge, double rotationTime, float size, float alpha) {
|
public ParticleBeam(ClientWorld world, double startX, double startY, double startZ, double endX, double endY, double endZ,
|
||||||
|
float[] color, float alpha, int maxAge, double rotationTime, float size) {
|
||||||
super(world, startX, startY, startZ);
|
super(world, startX, startY, startZ);
|
||||||
this.endX = endX;
|
this.endX = endX;
|
||||||
this.endY = endY;
|
this.endY = endY;
|
||||||
|
@ -50,4 +54,22 @@ public class ParticleBeam extends Particle {
|
||||||
public IParticleRenderType getRenderType() {
|
public IParticleRenderType getRenderType() {
|
||||||
return IParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;
|
return IParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static class Factory implements IParticleFactory<BeamParticleData> {
|
||||||
|
public Factory(IAnimatedSprite sprite) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Particle createParticle(BeamParticleData data, ClientWorld worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
|
||||||
|
return new ParticleBeam(worldIn, x, y, z, data.endX, data.endY, data.endZ, data.color, data.alpha, data.maxAge,
|
||||||
|
data.rotationTime, data.size);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IParticleData createData(double endX, double endY, double endZ, float[] color, float alpha,
|
||||||
|
int maxAge, double rotationTime, float size) {
|
||||||
|
return new BeamParticleData(endX, endY, endZ, color, alpha, maxAge, rotationTime, size);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,20 +10,29 @@
|
||||||
|
|
||||||
package de.ellpeck.actuallyadditions.mod.particle;
|
package de.ellpeck.actuallyadditions.mod.particle;
|
||||||
|
|
||||||
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
import com.mojang.blaze3d.systems.RenderSystem;
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
import de.ellpeck.actuallyadditions.mod.util.AssetUtil;
|
||||||
import net.minecraft.client.Minecraft;
|
import net.minecraft.client.Minecraft;
|
||||||
|
import net.minecraft.client.particle.IAnimatedSprite;
|
||||||
|
import net.minecraft.client.particle.IParticleFactory;
|
||||||
import net.minecraft.client.particle.IParticleRenderType;
|
import net.minecraft.client.particle.IParticleRenderType;
|
||||||
import net.minecraft.client.particle.Particle;
|
import net.minecraft.client.particle.Particle;
|
||||||
import net.minecraft.client.renderer.ActiveRenderInfo;
|
import net.minecraft.client.renderer.ActiveRenderInfo;
|
||||||
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
import net.minecraft.client.renderer.RenderHelper;
|
import net.minecraft.client.renderer.RenderHelper;
|
||||||
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||||
import net.minecraft.client.world.ClientWorld;
|
import net.minecraft.client.world.ClientWorld;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
import net.minecraft.particles.IParticleData;
|
||||||
import net.minecraft.util.Util;
|
import net.minecraft.util.Util;
|
||||||
|
import net.minecraft.util.math.BlockPos;
|
||||||
import net.minecraft.util.math.vector.Vector3d;
|
import net.minecraft.util.math.vector.Vector3d;
|
||||||
import org.lwjgl.opengl.GL14;
|
import net.minecraft.util.math.vector.Vector3f;
|
||||||
|
import net.minecraft.world.LightType;
|
||||||
|
|
||||||
public class ParticleLaserItem extends Particle {
|
public class ParticleLaserItem extends Particle {
|
||||||
private final double otherX;
|
private final double otherX;
|
||||||
|
@ -56,40 +65,65 @@ public class ParticleLaserItem extends Particle {
|
||||||
super.remove();
|
super.remove();
|
||||||
|
|
||||||
if (this.otherX != 0 || this.otherY != 0 || this.otherZ != 0) {
|
if (this.otherX != 0 || this.otherY != 0 || this.otherZ != 0) {
|
||||||
Particle fx = new ParticleLaserItem(this.level, this.otherX, this.otherY, this.otherZ, this.stack, -0.025);
|
this.level.addParticle(Factory.createData(this.stack, 0, 0, 0),
|
||||||
Minecraft.getInstance().particleEngine.add(fx);
|
this.otherX, this.otherY, this.otherZ, 0, -0.025, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void render(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) {
|
public void render(IVertexBuilder buffer, ActiveRenderInfo renderInfo, float partialTicks) {
|
||||||
|
Minecraft mc = Minecraft.getInstance();
|
||||||
|
IRenderTypeBuffer.Impl renderBuffer = mc.renderBuffers().bufferSource();
|
||||||
|
Vector3d cam = renderInfo.getPosition();
|
||||||
|
|
||||||
RenderSystem.pushMatrix();
|
RenderSystem.pushMatrix();
|
||||||
RenderHelper.turnBackOn();
|
RenderHelper.turnBackOn();
|
||||||
|
MatrixStack matrices = new MatrixStack();
|
||||||
|
matrices.pushPose();
|
||||||
|
|
||||||
Vector3d cam = renderInfo.getPosition();
|
matrices.translate(x - cam.x, y - cam.y, z - cam.z);
|
||||||
RenderSystem.translated(this.x - cam.x(), this.y - cam.y(), this.z - cam.z());
|
matrices.scale(0.3F, 0.3F, 0.3F);
|
||||||
RenderSystem.scalef(0.3F, 0.3F, 0.3F);
|
|
||||||
|
|
||||||
double boop = Util.getMillis() / 600D;
|
double boop = Util.getMillis() / 600D;
|
||||||
RenderSystem.rotatef((float) (boop * 40D % 360), 0, 1, 0);
|
matrices.mulPose(Vector3f.YP.rotationDegrees((float) (boop * 40D % 360)));
|
||||||
|
|
||||||
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
RenderSystem.color4f(1.0F, 1.0F, 1.0F, 1.0F);
|
||||||
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA.value, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA.value, GlStateManager.SourceFactor.ONE.value, GlStateManager.DestFactor.ZERO.value);
|
RenderSystem.blendFuncSeparate(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA,
|
||||||
|
GlStateManager.SourceFactor.ONE, GlStateManager.DestFactor.ZERO);
|
||||||
|
|
||||||
float ageRatio = (float) this.age / (float) this.lifetime;
|
float ageRatio = (float) this.age / (float) this.lifetime;
|
||||||
float color = this.yd < 0
|
float color = this.yd < 0
|
||||||
? 1F - ageRatio
|
? 1F - ageRatio
|
||||||
: ageRatio;
|
: ageRatio;
|
||||||
GL14.glBlendColor(color, color, color, color);
|
RenderSystem.blendColor(color, color, color, color);
|
||||||
|
|
||||||
AssetUtil.renderItemWithoutScrewingWithColors(this.stack);
|
int blockLight = level.getBrightness(LightType.BLOCK, new BlockPos(x, y, z));
|
||||||
|
int skyLight = level.getBrightness(LightType.SKY, new BlockPos(x, y, z));
|
||||||
|
AssetUtil.renderItemWithoutScrewingWithColors(this.stack, matrices, LightTexture.pack(blockLight, skyLight), OverlayTexture.NO_OVERLAY);
|
||||||
|
|
||||||
RenderHelper.turnOff();
|
RenderHelper.turnOff();
|
||||||
|
matrices.popPose();
|
||||||
RenderSystem.popMatrix();
|
RenderSystem.popMatrix();
|
||||||
|
renderBuffer.endBatch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public IParticleRenderType getRenderType() {
|
public IParticleRenderType getRenderType() {
|
||||||
return IParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;
|
return IParticleRenderType.PARTICLE_SHEET_TRANSLUCENT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static class Factory implements IParticleFactory<LaserItemParticleData> {
|
||||||
|
public Factory(IAnimatedSprite sprite) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Particle createParticle(LaserItemParticleData data, ClientWorld worldIn, double x, double y, double z, double xSpeed, double ySpeed, double zSpeed) {
|
||||||
|
return new ParticleLaserItem(worldIn, x, y, z, data.stack, ySpeed, data.outputX, data.outputY, data.outputZ);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static IParticleData createData(ItemStack stack, double outputX, double outputY, double outputZ) {
|
||||||
|
return new LaserItemParticleData(stack, outputX, outputY, outputZ);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -42,6 +42,8 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase {
|
||||||
private Network cachedNetwork;
|
private Network cachedNetwork;
|
||||||
private int changeAmountAtCaching = -1;
|
private int changeAmountAtCaching = -1;
|
||||||
private int lastRange;
|
private int lastRange;
|
||||||
|
// List of connections that are synced to the client for RenderLaserRelay to use
|
||||||
|
private final ConcurrentSet<IConnectionPair> connections = new ConcurrentSet<>();
|
||||||
|
|
||||||
public TileEntityLaserRelay(TileEntityType<?> tileType, LaserType type) {
|
public TileEntityLaserRelay(TileEntityType<?> tileType, LaserType type) {
|
||||||
super(tileType, 1);
|
super(tileType, 1);
|
||||||
|
@ -55,10 +57,12 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase {
|
||||||
if (type == NBTType.SYNC) {
|
if (type == NBTType.SYNC) {
|
||||||
ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(this.worldPosition, this.level);
|
ActuallyAdditionsAPI.connectionHandler.removeRelayFromNetwork(this.worldPosition, this.level);
|
||||||
|
|
||||||
|
this.connections.clear();
|
||||||
ListNBT list = compound.getList("Connections", 10);
|
ListNBT list = compound.getList("Connections", 10);
|
||||||
if (!list.isEmpty()) {
|
if (!list.isEmpty()) {
|
||||||
for (int i = 0; i < list.size(); i++) {
|
for (int i = 0; i < list.size(); i++) {
|
||||||
ConnectionPair pair = new ConnectionPair();
|
ConnectionPair pair = new ConnectionPair();
|
||||||
|
this.connections.add(pair);
|
||||||
pair.readFromNBT(list.getCompound(i));
|
pair.readFromNBT(list.getCompound(i));
|
||||||
ActuallyAdditionsAPI.connectionHandler.addConnection(pair.getPositions()[0], pair.getPositions()[1], this.type, this.level, pair.doesSuppressRender());
|
ActuallyAdditionsAPI.connectionHandler.addConnection(pair.getPositions()[0], pair.getPositions()[1], this.type, this.level, pair.doesSuppressRender());
|
||||||
}
|
}
|
||||||
|
@ -97,6 +101,7 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase {
|
||||||
for (IConnectionPair pair : connections) {
|
for (IConnectionPair pair : connections) {
|
||||||
int distanceSq = (int) pair.getPositions()[0].distSqr(pair.getPositions()[1]);
|
int distanceSq = (int) pair.getPositions()[0].distSqr(pair.getPositions()[1]);
|
||||||
if (distanceSq > range * range) {
|
if (distanceSq > range * range) {
|
||||||
|
this.connections.remove(pair);
|
||||||
ActuallyAdditionsAPI.connectionHandler.removeConnection(this.level, pair.getPositions()[0], pair.getPositions()[1]);
|
ActuallyAdditionsAPI.connectionHandler.removeConnection(this.level, pair.getPositions()[0], pair.getPositions()[1]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -184,4 +189,8 @@ public abstract class TileEntityLaserRelay extends TileEntityInventoryBase {
|
||||||
public abstract String getCompassDisplayString();
|
public abstract String getCompassDisplayString();
|
||||||
|
|
||||||
public abstract void onCompassAction(PlayerEntity player);
|
public abstract void onCompassAction(PlayerEntity player);
|
||||||
|
|
||||||
|
public ConcurrentSet<IConnectionPair> getConnections() {
|
||||||
|
return connections;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -15,7 +15,7 @@ import de.ellpeck.actuallyadditions.api.laser.LaserType;
|
||||||
import de.ellpeck.actuallyadditions.api.laser.Network;
|
import de.ellpeck.actuallyadditions.api.laser.Network;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
import de.ellpeck.actuallyadditions.mod.blocks.ActuallyBlocks;
|
||||||
import de.ellpeck.actuallyadditions.mod.config.values.ConfigBoolValues;
|
import de.ellpeck.actuallyadditions.mod.config.CommonConfig;
|
||||||
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
import de.ellpeck.actuallyadditions.mod.util.StringUtil;
|
||||||
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
import it.unimi.dsi.fastutil.objects.ObjectOpenHashSet;
|
||||||
import net.minecraft.entity.player.PlayerEntity;
|
import net.minecraft.entity.player.PlayerEntity;
|
||||||
|
@ -186,8 +186,8 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay {
|
||||||
|
|
||||||
if (totalReceiverAmount > 0 && !relaysThatWork.isEmpty()) {
|
if (totalReceiverAmount > 0 && !relaysThatWork.isEmpty()) {
|
||||||
int amountPer = maxTransfer / totalReceiverAmount <= 0
|
int amountPer = maxTransfer / totalReceiverAmount <= 0
|
||||||
? maxTransfer / totalReceiverAmount
|
? maxTransfer
|
||||||
: maxTransfer;
|
: maxTransfer / totalReceiverAmount;
|
||||||
|
|
||||||
for (TileEntityLaserRelayEnergy theRelay : relaysThatWork) {
|
for (TileEntityLaserRelayEnergy theRelay : relaysThatWork) {
|
||||||
double highestLoss = Math.max(theRelay.getLossPercentage(), this.getLossPercentage());
|
double highestLoss = Math.max(theRelay.getLossPercentage(), this.getLossPercentage());
|
||||||
|
@ -231,7 +231,7 @@ public class TileEntityLaserRelayEnergy extends TileEntityLaserRelay {
|
||||||
}
|
}
|
||||||
|
|
||||||
private int calcDeduction(int theoreticalReceived, double highestLoss) {
|
private int calcDeduction(int theoreticalReceived, double highestLoss) {
|
||||||
return ConfigBoolValues.LASER_RELAY_LOSS.isEnabled()
|
return CommonConfig.Machines.LASER_RELAY_LOSS.get()
|
||||||
? MathHelper.ceil(theoreticalReceived * (highestLoss / 100))
|
? MathHelper.ceil(theoreticalReceived * (highestLoss / 100))
|
||||||
: 0;
|
: 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ package de.ellpeck.actuallyadditions.mod.util;
|
||||||
|
|
||||||
import com.mojang.blaze3d.matrix.MatrixStack;
|
import com.mojang.blaze3d.matrix.MatrixStack;
|
||||||
import com.mojang.blaze3d.platform.GlStateManager;
|
import com.mojang.blaze3d.platform.GlStateManager;
|
||||||
|
import com.mojang.blaze3d.systems.RenderSystem;
|
||||||
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
import com.mojang.blaze3d.vertex.IVertexBuilder;
|
||||||
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
import de.ellpeck.actuallyadditions.mod.ActuallyAdditions;
|
||||||
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderTypes;
|
import de.ellpeck.actuallyadditions.mod.blocks.render.RenderTypes;
|
||||||
|
@ -23,9 +24,14 @@ import net.minecraft.client.Minecraft;
|
||||||
import net.minecraft.client.gui.FontRenderer;
|
import net.minecraft.client.gui.FontRenderer;
|
||||||
import net.minecraft.client.renderer.BufferBuilder;
|
import net.minecraft.client.renderer.BufferBuilder;
|
||||||
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
import net.minecraft.client.renderer.IRenderTypeBuffer;
|
||||||
|
import net.minecraft.client.renderer.ItemRenderer;
|
||||||
import net.minecraft.client.renderer.LightTexture;
|
import net.minecraft.client.renderer.LightTexture;
|
||||||
import net.minecraft.client.renderer.Tessellator;
|
import net.minecraft.client.renderer.Tessellator;
|
||||||
|
import net.minecraft.client.renderer.model.IBakedModel;
|
||||||
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
import net.minecraft.client.renderer.model.ItemCameraTransforms;
|
||||||
|
import net.minecraft.client.renderer.texture.AtlasTexture;
|
||||||
|
import net.minecraft.client.renderer.texture.OverlayTexture;
|
||||||
|
import net.minecraft.client.renderer.texture.TextureManager;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
import net.minecraft.nbt.CompoundNBT;
|
import net.minecraft.nbt.CompoundNBT;
|
||||||
import net.minecraft.tileentity.TileEntity;
|
import net.minecraft.tileentity.TileEntity;
|
||||||
|
@ -38,6 +44,7 @@ import net.minecraft.util.math.vector.Vector3f;
|
||||||
import net.minecraft.world.World;
|
import net.minecraft.world.World;
|
||||||
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.ForgeHooksClient;
|
||||||
import net.minecraftforge.fml.network.PacketDistributor;
|
import net.minecraftforge.fml.network.PacketDistributor;
|
||||||
|
|
||||||
public final class AssetUtil {
|
public final class AssetUtil {
|
||||||
|
@ -93,28 +100,29 @@ public final class AssetUtil {
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
public static void renderItemWithoutScrewingWithColors(ItemStack stack) {
|
public static void renderItemWithoutScrewingWithColors(ItemStack stack, MatrixStack matrices, int combinedOverlay, int combinedLight) {
|
||||||
/* if (StackUtil.isValid(stack)) {
|
if (StackUtil.isValid(stack)) {
|
||||||
Minecraft mc = Minecraft.getInstance();
|
Minecraft mc = Minecraft.getInstance();
|
||||||
ItemRenderer renderer = mc.getItemRenderer();
|
ItemRenderer renderer = mc.getItemRenderer();
|
||||||
TextureManager manager = mc.getTextureManager();
|
TextureManager manager = mc.getTextureManager();
|
||||||
|
IRenderTypeBuffer.Impl irendertypebuffer$impl = mc.renderBuffers().bufferSource();
|
||||||
|
|
||||||
IBakedModel model = renderer.getItemModelWithOverrides(stack, null, null);
|
IBakedModel model = renderer.getModel(stack, null, null);
|
||||||
|
manager.bind(AtlasTexture.LOCATION_BLOCKS);
|
||||||
manager.bind(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
manager.getTexture(AtlasTexture.LOCATION_BLOCKS).setBlurMipmap(false, false);
|
||||||
manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).setBlurMipmap(false, false);
|
RenderSystem.enableRescaleNormal();
|
||||||
GlStateManager._enableRescaleNormal();
|
RenderSystem.enableBlend();
|
||||||
GlStateManager._enableBlend();
|
RenderSystem.pushMatrix();
|
||||||
GlStateManager._pushMatrix();
|
model = ForgeHooksClient.handleCameraTransforms(matrices, model, ItemCameraTransforms.TransformType.FIXED, false);
|
||||||
model = ForgeHooksClient.handleCameraTransforms(model, ItemCameraTransforms.TransformType.FIXED, false);
|
renderer.render(stack, ItemCameraTransforms.TransformType.FIXED, false, matrices, irendertypebuffer$impl,
|
||||||
renderer.renderItem(stack, model);
|
combinedOverlay, combinedLight, model);
|
||||||
GlStateManager.cullFace(GlStateManager.CullFace.BACK);
|
RenderSystem.popMatrix();
|
||||||
GlStateManager._popMatrix();
|
RenderSystem.disableRescaleNormal();
|
||||||
GlStateManager._disableRescaleNormal();
|
RenderSystem.disableBlend();
|
||||||
GlStateManager._disableBlend();
|
manager.bind(AtlasTexture.LOCATION_BLOCKS);
|
||||||
manager.bind(TextureMap.LOCATION_BLOCKS_TEXTURE);
|
manager.getTexture(AtlasTexture.LOCATION_BLOCKS).restoreLastBlurMipmap();
|
||||||
manager.getTexture(TextureMap.LOCATION_BLOCKS_TEXTURE).restoreLastBlurMipmap();
|
irendertypebuffer$impl.endBatch();
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@OnlyIn(Dist.CLIENT)
|
@OnlyIn(Dist.CLIENT)
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"textures": [
|
||||||
|
]
|
||||||
|
}
|
|
@ -0,0 +1,4 @@
|
||||||
|
{
|
||||||
|
"textures": [
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in a new issue