misc changes, including item drops

This commit is contained in:
Ellpeck 2020-01-23 16:05:52 +01:00
parent 25d3550e0a
commit 136c125f2c
103 changed files with 1523 additions and 404 deletions

1
.gitignore vendored
View file

@ -19,3 +19,4 @@
*.launch *.launch
.settings/org.eclipse.jdt.core.prefs .settings/org.eclipse.jdt.core.prefs
*.prefs *.prefs
.cache

View file

@ -75,6 +75,10 @@ minecraft {
} }
} }
sourceSets.main.resources {
srcDir 'src/generated/resources'
}
repositories { repositories {
maven { maven {
url = "https://dvs1.progwml6.com/files/maven" url = "https://dvs1.progwml6.com/files/maven"

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"naturesaura:ancient_stick"
]
}

View file

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"naturesaura:golden_leaves",
"naturesaura:ancient_leaves",
"naturesaura:decayed_leaves"
]
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"naturesaura:ancient_log",
"naturesaura:ancient_bark"
]
}

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"naturesaura:ancient_planks"
]
}

View file

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"naturesaura:dimension_rail_end",
"naturesaura:dimension_rail_nether",
"naturesaura:dimension_rail_overworld"
]
}

View file

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"naturesaura:ancient_slab",
"naturesaura:infused_slab",
"naturesaura:infused_brick_slab"
]
}

View file

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"naturesaura:ancient_stairs",
"naturesaura:infused_brick_stairs",
"naturesaura:infused_stairs"
]
}

View file

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"naturesaura:golden_leaves",
"naturesaura:ancient_leaves",
"naturesaura:decayed_leaves"
]
}

View file

@ -0,0 +1,7 @@
{
"replace": false,
"values": [
"naturesaura:ancient_log",
"naturesaura:ancient_bark"
]
}

View file

@ -0,0 +1,6 @@
{
"replace": false,
"values": [
"naturesaura:ancient_planks"
]
}

View file

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"naturesaura:dimension_rail_end",
"naturesaura:dimension_rail_nether",
"naturesaura:dimension_rail_overworld"
]
}

View file

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"naturesaura:ancient_slab",
"naturesaura:infused_slab",
"naturesaura:infused_brick_slab"
]
}

View file

@ -0,0 +1,8 @@
{
"replace": false,
"values": [
"naturesaura:ancient_stairs",
"naturesaura:infused_brick_stairs",
"naturesaura:infused_stairs"
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:ancient_bark"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:ancient_leaves"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:ancient_log"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:ancient_planks"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:ancient_sapling"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,33 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:set_count",
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "naturesaura:ancient_slab",
"properties": {
"type": "double"
}
}
],
"count": 2
},
{
"function": "minecraft:explosion_decay"
}
],
"name": "naturesaura:ancient_slab"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:ancient_stairs"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:animal_generator"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:animal_spawner"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:aura_detector"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:auto_crafter"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:chunk_loader"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:conversion_catalyst"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:crushing_catalyst"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:decayed_leaves"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:dimension_rail_end"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:dimension_rail_nether"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:dimension_rail_overworld"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:end_flower"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:ender_crate"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:field_creator"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:firework_generator"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:flower_generator"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:furnace_heater"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:generator_limit_remover"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:gold_brick"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:gold_powder"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:golden_leaves"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:grated_chute"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:hopper_upgrade"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:infused_brick"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,33 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:set_count",
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "naturesaura:infused_brick_slab",
"properties": {
"type": "double"
}
}
],
"count": 2
},
{
"function": "minecraft:explosion_decay"
}
],
"name": "naturesaura:infused_brick_slab"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:infused_brick_stairs"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:infused_iron_block"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,33 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"functions": [
{
"function": "minecraft:set_count",
"conditions": [
{
"condition": "minecraft:block_state_property",
"block": "naturesaura:infused_slab",
"properties": {
"type": "double"
}
}
],
"count": 2
},
{
"function": "minecraft:explosion_decay"
}
],
"name": "naturesaura:infused_slab"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:infused_stairs"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:infused_stone"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:moss_generator"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:nature_altar"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:oak_generator"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:offering_table"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:pickup_stopper"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:placer"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:potion_generator"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:powder_placer"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:projectile_generator"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:rf_converter"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:spawn_lamp"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:time_changer"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -0,0 +1,20 @@
{
"type": "minecraft:block",
"pools": [
{
"name": "main",
"rolls": 1,
"entries": [
{
"type": "minecraft:item",
"name": "naturesaura:wood_stand"
}
],
"conditions": [
{
"condition": "minecraft:survives_explosion"
}
]
}
]
}

View file

@ -123,13 +123,9 @@ public final class Helper {
if (!stack.isEmpty()) { if (!stack.isEmpty()) {
GlStateManager.pushMatrix(); GlStateManager.pushMatrix();
GlStateManager.disableLighting(); GlStateManager.disableLighting();
GlStateManager.pushTextureAttributes();
GlStateManager.pushLightingAttributes();
RenderHelper.enableStandardItemLighting(); RenderHelper.enableStandardItemLighting();
Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.FIXED); Minecraft.getInstance().getItemRenderer().renderItem(stack, ItemCameraTransforms.TransformType.FIXED);
RenderHelper.disableStandardItemLighting(); RenderHelper.disableStandardItemLighting();
GlStateManager.popAttributes();
GlStateManager.popAttributes();
GlStateManager.enableLighting(); GlStateManager.enableLighting();
GlStateManager.popMatrix(); GlStateManager.popMatrix();
} }

View file

@ -66,12 +66,6 @@ public final class NaturesAura {
} }
public void setup(FMLCommonSetupEvent event) { public void setup(FMLCommonSetupEvent event) {
Helper.populateObjectHolders(ModBlocks.class, ForgeRegistries.BLOCKS);
Helper.populateObjectHolders(ModTileEntities.class, ForgeRegistries.TILE_ENTITIES);
Helper.populateObjectHolders(ModEntities.class, ForgeRegistries.ENTITIES);
Helper.populateObjectHolders(ModItems.class, ForgeRegistries.ITEMS);
Helper.populateObjectHolders(ModPotions.class, ForgeRegistries.POTIONS);
this.preInit(event); this.preInit(event);
this.init(event); this.init(event);
this.postInit(event); this.postInit(event);

View file

@ -16,11 +16,15 @@ public interface IDrainSpotEffect {
ResourceLocation getName(); ResourceLocation getName();
default int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { default ActiveType isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
return -1; return ActiveType.INACTIVE;
} }
default ItemStack getDisplayIcon() { default ItemStack getDisplayIcon() {
return ItemStack.EMPTY; return ItemStack.EMPTY;
} }
public enum ActiveType {
INACTIVE, INHIBITED, ACTIVE
}
} }

View file

@ -3,8 +3,9 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityAnimalGenerator; import de.ellpeck.naturesaura.blocks.tiles.TileEntityAnimalGenerator;
import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.INPC; import net.minecraft.entity.INPC;
@ -71,13 +72,11 @@ public class BlockAnimalGenerator extends BlockContainerImpl implements IVisuali
gen.setGenerationValues(time, amount); gen.setGenerationValues(time, amount);
BlockPos genPos = gen.getPos(); BlockPos genPos = gen.getPos();
/* TODO
PacketHandler.sendToAllAround(entity.world, pos, 32, new PacketParticles( PacketHandler.sendToAllAround(entity.world, pos, 32, new PacketParticles(
(float) entity.posX, (float) entity.posY, (float) entity.posZ, 17, (float) entity.posX, (float) entity.posY, (float) entity.posZ, 17,
child ? 1 : 0, child ? 1 : 0,
(int) (entity.getEyeHeight() * 10F), (int) (entity.getEyeHeight() * 10F),
genPos.getX(), genPos.getY(), genPos.getZ())); genPos.getX(), genPos.getY(), genPos.getZ()));
*/
return true; return true;
}); });

View file

@ -12,9 +12,13 @@ import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.storage.loot.LootContext;
import net.minecraft.world.storage.loot.LootParameters;
import javax.annotation.Nullable; import javax.annotation.Nullable;
import java.util.List;
import java.util.Random; import java.util.Random;
import java.util.function.Supplier; import java.util.function.Supplier;
@ -49,31 +53,36 @@ public class BlockContainerImpl extends ContainerBlock implements IModItem, IMod
return BlockRenderType.MODEL; return BlockRenderType.MODEL;
} }
/* TODO this @Override @Override
public void breakBlock(World worldIn, BlockPos pos, BlockState state) { public void onPlayerDestroy(IWorld worldIn, BlockPos pos, BlockState state) {
if (!worldIn.isRemote) { super.onPlayerDestroy(worldIn, pos, state);
}
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
List<ItemStack> drops = super.getDrops(state, builder);
TileEntity tile = builder.get(LootParameters.BLOCK_ENTITY);
if (tile instanceof TileEntityImpl) {
for (ItemStack stack : drops) {
if (stack.getItem() != this.asItem())
continue;
((TileEntityImpl) tile).modifyDrop(stack);
break;
}
}
return drops;
}
@Override
public void onReplaced(BlockState state, World worldIn, BlockPos pos, BlockState newState, boolean isMoving) {
if (state.getBlock() != newState.getBlock()) {
TileEntity tile = worldIn.getTileEntity(pos); TileEntity tile = worldIn.getTileEntity(pos);
if (tile instanceof TileEntityImpl) if (tile instanceof TileEntityImpl)
((TileEntityImpl) tile).dropInventory(); ((TileEntityImpl) tile).dropInventory();
} }
super.breakBlock(worldIn, pos, state); super.onReplaced(state, worldIn, pos, newState, isMoving);
}*/ }
/*
TODO drop stuff
@Override
public List<ItemStack> getDrops(BlockState state, LootContext.Builder builder) {
TileEntity tile = builder.getWorld().getTileEntity(builder.get(LootParameters.POSITION));
if (tile instanceof TileEntityImpl)
drops.add(((TileEntityImpl) tile).getDrop(state, fortune));
else
super.getDrops(drops, world, pos, state, fortune);
}*/
/* @Override
public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest) {
return willHarvest || super.removedByPlayer(state, world, pos, player, false);
}*/
@Override @Override
public void harvestBlock(World worldIn, PlayerEntity player, BlockPos pos, BlockState state, @Nullable TileEntity te, ItemStack stack) { public void harvestBlock(World worldIn, PlayerEntity player, BlockPos pos, BlockState state, @Nullable TileEntity te, ItemStack stack) {

View file

@ -5,10 +5,7 @@ import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.IModelProvider; import de.ellpeck.naturesaura.reg.IModelProvider;
import de.ellpeck.naturesaura.reg.ModRegistry; import de.ellpeck.naturesaura.reg.ModRegistry;
import de.ellpeck.naturesaura.reg.ModTileType; import de.ellpeck.naturesaura.reg.ModTileType;
import net.minecraft.block.BlockState; import net.minecraft.block.*;
import net.minecraft.block.Blocks;
import net.minecraft.block.BushBlock;
import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.LivingEntity; import net.minecraft.entity.LivingEntity;
import net.minecraft.entity.boss.dragon.EnderDragonEntity; import net.minecraft.entity.boss.dragon.EnderDragonEntity;
@ -16,12 +13,14 @@ import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.fluid.IFluidState; import net.minecraft.fluid.IFluidState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Direction;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.world.IBlockReader; import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorldReader;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.gen.Heightmap; import net.minecraft.world.gen.Heightmap;
import net.minecraftforge.common.IPlantable;
import net.minecraftforge.common.MinecraftForge; import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent; import net.minecraftforge.event.entity.living.LivingEvent.LivingUpdateEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
@ -30,13 +29,21 @@ import javax.annotation.Nullable;
public class BlockEndFlower extends BushBlock implements IModItem, IModelProvider { public class BlockEndFlower extends BushBlock implements IModItem, IModelProvider {
protected static final VoxelShape SHAPE = Block.makeCuboidShape(5.0D, 0.0D, 5.0D, 11.0D, 10.0D, 11.0D);
public BlockEndFlower() { public BlockEndFlower() {
super(ModBlocks.prop(Material.PLANTS).hardnessAndResistance(0.5F).sound(SoundType.PLANT)); super(ModBlocks.prop(Material.PLANTS).doesNotBlockMovement().hardnessAndResistance(0.5F).sound(SoundType.PLANT));
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
ModRegistry.add(this); ModRegistry.add(this);
ModRegistry.add(new ModTileType<>(TileEntityEndFlower::new, this)); ModRegistry.add(new ModTileType<>(TileEntityEndFlower::new, this));
} }
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
Vec3d vec3d = state.getOffset(worldIn, pos);
return SHAPE.withOffset(vec3d.x, vec3d.y, vec3d.z);
}
@SubscribeEvent @SubscribeEvent
public void onDragonTick(LivingUpdateEvent event) { public void onDragonTick(LivingUpdateEvent event) {
LivingEntity living = event.getEntityLiving(); LivingEntity living = event.getEntityLiving();
@ -59,31 +66,34 @@ public class BlockEndFlower extends BushBlock implements IModItem, IModelProvide
} }
@Override @Override
public boolean canSustainPlant(BlockState state, IBlockReader world, BlockPos pos, Direction facing, IPlantable plantable) { protected boolean isValidGround(BlockState state, IBlockReader worldIn, BlockPos pos) {
return state.getBlock() == Blocks.END_STONE; return state.getBlock() == Blocks.END_STONE;
} }
@Override
public boolean isValidPosition(BlockState state, IWorldReader worldIn, BlockPos pos) {
return worldIn.getBlockState(pos.down()).getBlock() == Blocks.END_STONE;
}
@Override @Override
public String getBaseName() { public String getBaseName() {
return "end_flower"; return "end_flower";
} }
/*
@Override
public void onInit(FMLInitializationEvent event) {
GameRegistry.registerTileEntity(TileEntityEndFlower.class, new ResourceLocation(NaturesAura.MOD_ID, "end_flower"));
}
*/
@Nullable @Nullable
@Override @Override
public TileEntity createTileEntity(BlockState state, IBlockReader world) { public TileEntity createTileEntity(BlockState state, IBlockReader world) {
return new TileEntityEndFlower(); return new TileEntityEndFlower();
} }
@Override
public boolean hasTileEntity(BlockState state) {
return true;
}
@Override @Override
public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid) { public boolean removedByPlayer(BlockState state, World world, BlockPos pos, PlayerEntity player, boolean willHarvest, IFluidState fluid) {
return willHarvest || super.removedByPlayer(state, world, pos, player, false, fluid); return willHarvest || super.removedByPlayer(state, world, pos, player, willHarvest, fluid);
} }
@Override @Override

View file

@ -22,7 +22,6 @@ import net.minecraftforge.api.distmarker.OnlyIn;
import javax.annotation.Nullable; import javax.annotation.Nullable;
// TODO
public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock { public class BlockGoldPowder extends BlockImpl implements IColorProvidingBlock {
public static final EnumProperty<AttachPos> NORTH = EnumProperty.create("north", AttachPos.class); public static final EnumProperty<AttachPos> NORTH = EnumProperty.create("north", AttachPos.class);

View file

@ -8,15 +8,19 @@ import net.minecraft.item.BlockItemUseContext;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.state.DirectionProperty; import net.minecraft.state.DirectionProperty;
import net.minecraft.state.StateContainer; import net.minecraft.state.StateContainer;
import net.minecraft.tileentity.IHopper;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockRenderLayer; import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.MathHelper; import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.shapes.IBooleanFunction;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape; import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
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;
@ -26,25 +30,62 @@ import javax.annotation.Nullable;
public class BlockGratedChute extends BlockContainerImpl { public class BlockGratedChute extends BlockContainerImpl {
// TODO voxel shape stuff
public static final DirectionProperty FACING = HopperBlock.FACING; public static final DirectionProperty FACING = HopperBlock.FACING;
private static final AxisAlignedBB BASE_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 0.625D, 1.0D); private static final VoxelShape INPUT_SHAPE = Block.makeCuboidShape(0.0D, 10.0D, 0.0D, 16.0D, 16.0D, 16.0D);
private static final AxisAlignedBB SOUTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 1.0D, 1.0D, 0.125D); private static final VoxelShape MIDDLE_SHAPE = Block.makeCuboidShape(4.0D, 4.0D, 4.0D, 12.0D, 10.0D, 12.0D);
private static final AxisAlignedBB NORTH_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.875D, 1.0D, 1.0D, 1.0D); private static final VoxelShape INPUT_MIDDLE_SHAPE = VoxelShapes.or(MIDDLE_SHAPE, INPUT_SHAPE);
private static final AxisAlignedBB WEST_AABB = new AxisAlignedBB(0.875D, 0.0D, 0.0D, 1.0D, 1.0D, 1.0D); private static final VoxelShape COMBINED_SHAPE = VoxelShapes.combineAndSimplify(INPUT_MIDDLE_SHAPE, IHopper.INSIDE_BOWL_SHAPE, IBooleanFunction.ONLY_FIRST);
private static final AxisAlignedBB EAST_AABB = new AxisAlignedBB(0.0D, 0.0D, 0.0D, 0.125D, 1.0D, 1.0D); private static final VoxelShape DOWN_SHAPE = VoxelShapes.or(COMBINED_SHAPE, Block.makeCuboidShape(6.0D, 0.0D, 6.0D, 10.0D, 4.0D, 10.0D));
private static final VoxelShape EAST_SHAPE = VoxelShapes.or(COMBINED_SHAPE, Block.makeCuboidShape(12.0D, 4.0D, 6.0D, 16.0D, 8.0D, 10.0D));
private static final VoxelShape BASE_TOP = makeCuboidShape(0, 9, 0, 16, 10, 16); private static final VoxelShape NORTH_SHAPE = VoxelShapes.or(COMBINED_SHAPE, Block.makeCuboidShape(6.0D, 4.0D, 0.0D, 10.0D, 8.0D, 4.0D));
private static final VoxelShape BASE_SOUTH = makeCuboidShape(0, 9, 0, 16, 16, 1); private static final VoxelShape SOUTH_SHAPE = VoxelShapes.or(COMBINED_SHAPE, Block.makeCuboidShape(6.0D, 4.0D, 12.0D, 10.0D, 8.0D, 16.0D));
private static final VoxelShape BASE_NORTH = makeCuboidShape(0, 9, 15, 16, 16, 16); private static final VoxelShape WEST_SHAPE = VoxelShapes.or(COMBINED_SHAPE, Block.makeCuboidShape(0.0D, 4.0D, 6.0D, 4.0D, 8.0D, 10.0D));
private static final VoxelShape BASE_WEST = makeCuboidShape(15, 9, 0, 16, 26, 16); private static final VoxelShape DOWN_RAYTRACE_SHAPE = IHopper.INSIDE_BOWL_SHAPE;
private static final VoxelShape BASE_EAST = makeCuboidShape(0, 9, 0, 1, 16, 16); private static final VoxelShape EAST_RAYTRACE_SHAPE = VoxelShapes.or(IHopper.INSIDE_BOWL_SHAPE, Block.makeCuboidShape(12.0D, 8.0D, 6.0D, 16.0D, 10.0D, 10.0D));
private static final VoxelShape BASE_BOTTOM = makeCuboidShape(4, 4, 4, 12, 9, 12); private static final VoxelShape NORTH_RAYTRACE_SHAPE = VoxelShapes.or(IHopper.INSIDE_BOWL_SHAPE, Block.makeCuboidShape(6.0D, 8.0D, 0.0D, 10.0D, 10.0D, 4.0D));
private static final VoxelShape SOUTH_RAYTRACE_SHAPE = VoxelShapes.or(IHopper.INSIDE_BOWL_SHAPE, Block.makeCuboidShape(6.0D, 8.0D, 12.0D, 10.0D, 10.0D, 16.0D));
private static final VoxelShape WEST_RAYTRACE_SHAPE = VoxelShapes.or(IHopper.INSIDE_BOWL_SHAPE, Block.makeCuboidShape(0.0D, 8.0D, 6.0D, 4.0D, 10.0D, 10.0D));
public BlockGratedChute() { public BlockGratedChute() {
super("grated_chute", TileEntityGratedChute::new, ModBlocks.prop(Material.IRON).hardnessAndResistance(3.0F, 8.0F).sound(SoundType.METAL)); super("grated_chute", TileEntityGratedChute::new, ModBlocks.prop(Material.IRON).hardnessAndResistance(3.0F, 8.0F).sound(SoundType.METAL));
} }
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
switch (state.get(FACING)) {
case DOWN:
return DOWN_SHAPE;
case NORTH:
return NORTH_SHAPE;
case SOUTH:
return SOUTH_SHAPE;
case WEST:
return WEST_SHAPE;
case EAST:
return EAST_SHAPE;
default:
return COMBINED_SHAPE;
}
}
@Override
public VoxelShape getRaytraceShape(BlockState state, IBlockReader worldIn, BlockPos pos) {
switch (state.get(FACING)) {
case DOWN:
return DOWN_RAYTRACE_SHAPE;
case NORTH:
return NORTH_RAYTRACE_SHAPE;
case SOUTH:
return SOUTH_RAYTRACE_SHAPE;
case WEST:
return WEST_RAYTRACE_SHAPE;
case EAST:
return EAST_RAYTRACE_SHAPE;
default:
return IHopper.INSIDE_BOWL_SHAPE;
}
}
@Override @Override
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
if (!player.isSneaking()) if (!player.isSneaking())

View file

@ -1,7 +1,6 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar; import de.ellpeck.naturesaura.blocks.tiles.TileEntityNatureAltar;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar; import de.ellpeck.naturesaura.blocks.tiles.render.RenderNatureAltar;
import de.ellpeck.naturesaura.reg.ITESRProvider; import de.ellpeck.naturesaura.reg.ITESRProvider;
@ -13,6 +12,10 @@ import net.minecraft.util.Hand;
import net.minecraft.util.Tuple; import net.minecraft.util.Tuple;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
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;
@ -20,41 +23,22 @@ import net.minecraftforge.common.ToolType;
public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider { public class BlockNatureAltar extends BlockContainerImpl implements ITESRProvider {
// TODO bounds private static final VoxelShape SHAPE = VoxelShapes.create(0, 0, 0, 1, 12 / 16F, 1);
public BlockNatureAltar() { public BlockNatureAltar() {
super("nature_altar", TileEntityNatureAltar::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(4F).harvestLevel(1).harvestTool(ToolType.PICKAXE)); super("nature_altar", TileEntityNatureAltar::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(4F).harvestLevel(1).harvestTool(ToolType.PICKAXE));
} }
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return SHAPE;
}
@Override @Override
public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) { public boolean onBlockActivated(BlockState state, World worldIn, BlockPos pos, PlayerEntity player, Hand handIn, BlockRayTraceResult hit) {
return Helper.putStackOnTile(player, handIn, pos, 0, true); return Helper.putStackOnTile(player, handIn, pos, 0, true);
} }
/* @Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean isOpaqueCube(BlockState state) {
return false;
}
@Override
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
return false;
}
@Override
public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) {
return side == Direction.DOWN;
}
@Override
public BlockFaceShape getBlockFaceShape(IWorld worldIn, BlockState state, BlockPos pos, Direction face) {
return BlockFaceShape.UNDEFINED;
}*/
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public Tuple<Class, TileEntityRenderer> getTESR() { public Tuple<Class, TileEntityRenderer> getTESR() {

View file

@ -1,7 +1,6 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityOfferingTable; import de.ellpeck.naturesaura.blocks.tiles.TileEntityOfferingTable;
import de.ellpeck.naturesaura.blocks.tiles.render.RenderOfferingTable; import de.ellpeck.naturesaura.blocks.tiles.render.RenderOfferingTable;
import de.ellpeck.naturesaura.reg.ITESRProvider; import de.ellpeck.naturesaura.reg.ITESRProvider;
@ -12,17 +11,19 @@ import net.minecraft.client.renderer.tileentity.TileEntityRenderer;
import net.minecraft.entity.player.PlayerEntity; import net.minecraft.entity.player.PlayerEntity;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.Tuple; import net.minecraft.util.Tuple;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
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;
public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvider { public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvider {
// TODO bounds private static final VoxelShape SHAPE = VoxelShapes.create(2 / 16F, 0F, 2 / 16F, 14 / 16F, 1F, 14 / 16F);
private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(2 / 16F, 0F, 2 / 16F, 14 / 16F, 1F, 14 / 16F);
public BlockOfferingTable() { public BlockOfferingTable() {
super("offering_table", TileEntityOfferingTable::new, ModBlocks.prop(Material.WOOD).hardnessAndResistance(2F).sound(SoundType.WOOD)); super("offering_table", TileEntityOfferingTable::new, ModBlocks.prop(Material.WOOD).hardnessAndResistance(2F).sound(SoundType.WOOD));
@ -33,31 +34,11 @@ public class BlockOfferingTable extends BlockContainerImpl implements ITESRProvi
return Helper.putStackOnTile(player, handIn, pos, 0, true); return Helper.putStackOnTile(player, handIn, pos, 0, true);
} }
/* @Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override @Override
public boolean isOpaqueCube(BlockState state) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return false; return SHAPE;
} }
@Override
public boolean isNormalCube(BlockState state, IWorld world, BlockPos pos) {
return false;
}
@Override
public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) {
return false;
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
return BlockFaceShape.UNDEFINED;
}*/
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public Tuple<Class, TileEntityRenderer> getTESR() { public Tuple<Class, TileEntityRenderer> getTESR() {

View file

@ -1,46 +1,25 @@
package de.ellpeck.naturesaura.blocks; package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntityPowderPlacer; import de.ellpeck.naturesaura.blocks.tiles.TileEntityPowderPlacer;
import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
public class BlockPowderPlacer extends BlockContainerImpl { public class BlockPowderPlacer extends BlockContainerImpl {
// TODO bound box
private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(0F, 0F, 0F, 1F, 4 / 16F, 1F); private static final VoxelShape SHAPE = VoxelShapes.create(0F, 0F, 0F, 1F, 4 / 16F, 1F);
public BlockPowderPlacer() { public BlockPowderPlacer() {
super("powder_placer", TileEntityPowderPlacer::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2, 5F).sound(SoundType.STONE)); super("powder_placer", TileEntityPowderPlacer::new, ModBlocks.prop(Material.ROCK).hardnessAndResistance(2, 5F).sound(SoundType.STONE));
} }
/*
@Override
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
return BOUND_BOX;
}
@Override @Override
public boolean isFullCube(BlockState state) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return false; return SHAPE;
} }
@Override
public boolean isOpaqueCube(BlockState state) {
return false;
}
@Override
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
return false;
}
@Override
public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) {
return side == Direction.DOWN;
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
return BlockFaceShape.UNDEFINED;
}*/
} }

View file

@ -3,10 +3,10 @@ package de.ellpeck.naturesaura.blocks;
import de.ellpeck.naturesaura.Helper; import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.render.IVisualizable; import de.ellpeck.naturesaura.api.render.IVisualizable;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.blocks.tiles.TileEntitySpawnLamp; import de.ellpeck.naturesaura.blocks.tiles.TileEntitySpawnLamp;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles; import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.block.BlockState;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.entity.MobEntity; import net.minecraft.entity.MobEntity;
@ -15,6 +15,10 @@ import net.minecraft.util.BlockRenderLayer;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
@ -26,8 +30,7 @@ import net.minecraftforge.eventbus.api.SubscribeEvent;
public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable { public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable {
// TODO bounding box private static final VoxelShape SHAPE = VoxelShapes.create(4 / 16F, 0F, 4 / 16F, 12 / 16F, 13 / 16F, 12 / 16F);
private static final AxisAlignedBB AABB = new AxisAlignedBB(4 / 16F, 0F, 4 / 16F, 12 / 16F, 13 / 16F, 12 / 16F);
public BlockSpawnLamp() { public BlockSpawnLamp() {
super("spawn_lamp", TileEntitySpawnLamp::new, ModBlocks.prop(Material.IRON).hardnessAndResistance(3F).lightValue(15).sound(SoundType.METAL)); super("spawn_lamp", TileEntitySpawnLamp::new, ModBlocks.prop(Material.IRON).hardnessAndResistance(3F).lightValue(15).sound(SoundType.METAL));
@ -66,10 +69,10 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable
}); });
} }
/* @Override @Override
public AxisAlignedBB getBoundingBox(BlockState state, IWorld source, BlockPos pos) { public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return AABB; return SHAPE;
}*/ }
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
@ -77,31 +80,6 @@ public class BlockSpawnLamp extends BlockContainerImpl implements IVisualizable
return BlockRenderLayer.CUTOUT; return BlockRenderLayer.CUTOUT;
} }
/* @Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean isOpaqueCube(BlockState state) {
return false;
}
@Override
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
return false;
}
@Override
public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) {
return false;
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
return BlockFaceShape.UNDEFINED;
}*/
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) { public AxisAlignedBB getVisualizationBounds(World world, BlockPos pos) {

View file

@ -17,9 +17,12 @@ import net.minecraft.item.crafting.Ingredient;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.Hand; import net.minecraft.util.Hand;
import net.minecraft.util.Tuple; import net.minecraft.util.Tuple;
import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.util.math.BlockRayTraceResult; import net.minecraft.util.math.BlockRayTraceResult;
import net.minecraft.util.math.shapes.ISelectionContext;
import net.minecraft.util.math.shapes.VoxelShape;
import net.minecraft.util.math.shapes.VoxelShapes;
import net.minecraft.world.IBlockReader;
import net.minecraft.world.IWorld; import net.minecraft.world.IWorld;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraftforge.api.distmarker.Dist; import net.minecraftforge.api.distmarker.Dist;
@ -36,13 +39,18 @@ import java.util.List;
public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider { public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider {
private static final AxisAlignedBB BOUND_BOX = new AxisAlignedBB(3 / 16F, 0F, 3 / 16F, 13 / 16F, 13 / 16F, 13 / 16F); private static final VoxelShape SHAPE = VoxelShapes.create(3 / 16F, 0F, 3 / 16F, 13 / 16F, 13 / 16F, 13 / 16F);
public BlockWoodStand() { public BlockWoodStand() {
super("wood_stand", TileEntityWoodStand::new, ModBlocks.prop(Material.WOOD).hardnessAndResistance(1.5F).sound(SoundType.WOOD).harvestLevel(0).harvestTool(ToolType.AXE)); super("wood_stand", TileEntityWoodStand::new, ModBlocks.prop(Material.WOOD).hardnessAndResistance(1.5F).sound(SoundType.WOOD).harvestLevel(0).harvestTool(ToolType.AXE));
MinecraftForge.EVENT_BUS.register(this); MinecraftForge.EVENT_BUS.register(this);
} }
@Override
public VoxelShape getShape(BlockState state, IBlockReader worldIn, BlockPos pos, ISelectionContext context) {
return SHAPE;
}
@SubscribeEvent @SubscribeEvent
public void onTreeGrow(SaplingGrowTreeEvent event) { public void onTreeGrow(SaplingGrowTreeEvent event) {
IWorld world = event.getWorld(); IWorld world = event.getWorld();
@ -96,38 +104,6 @@ public class BlockWoodStand extends BlockContainerImpl implements ITESRProvider
return Helper.putStackOnTile(player, handIn, pos, 0, true); return Helper.putStackOnTile(player, handIn, pos, 0, true);
} }
/*
@Override
public AxisAlignedBB getBoundingBox(BlockState state, IBlockAccess source, BlockPos pos) {
return BOUND_BOX;
}
@Override
public boolean isFullCube(BlockState state) {
return false;
}
@Override
public boolean isOpaqueCube(BlockState state) {
return false;
}
@Override
public boolean isNormalCube(BlockState state, IBlockAccess world, BlockPos pos) {
return false;
}
@Override
public boolean isSideSolid(BlockState baseState, IBlockAccess world, BlockPos pos, Direction side) {
return false;
}
@Override
public BlockFaceShape getBlockFaceShape(IBlockAccess worldIn, BlockState state, BlockPos pos, Direction face) {
return BlockFaceShape.UNDEFINED;
}*/
@Override @Override
@OnlyIn(Dist.CLIENT) @OnlyIn(Dist.CLIENT)
public Tuple<Class, TileEntityRenderer> getTESR() { public Tuple<Class, TileEntityRenderer> getTESR() {

View file

@ -87,8 +87,8 @@ public class TileEntityEndFlower extends TileEntityImpl implements ITickableTile
if (this.container.getStoredAura() <= 0) { if (this.container.getStoredAura() <= 0) {
this.world.setBlockState(this.pos, Blocks.DEAD_BUSH.getDefaultState()); this.world.setBlockState(this.pos, Blocks.DEAD_BUSH.getDefaultState());
/* PacketHandler.sendToAllAround(this.world, this.pos, 32, PacketHandler.sendToAllAround(this.world, this.pos, 32,
new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 18, this.container.getAuraColor()));*/ new PacketParticles(this.pos.getX(), this.pos.getY(), this.pos.getZ(), 18, this.container.getAuraColor()));
} }
} }
} else { } else {

View file

@ -4,7 +4,6 @@ import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.misc.IWorldData; import de.ellpeck.naturesaura.api.misc.IWorldData;
import de.ellpeck.naturesaura.blocks.BlockEnderCrate; import de.ellpeck.naturesaura.blocks.BlockEnderCrate;
import net.minecraft.block.BlockState;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
@ -86,14 +85,12 @@ public class TileEntityEnderCrate extends TileEntityImpl {
} }
@Override @Override
public ItemStack getDrop(BlockState state, int fortune) { public void modifyDrop(ItemStack regularItem) {
ItemStack drop = super.getDrop(state, fortune);
if (this.name != null) { if (this.name != null) {
if (!drop.hasTag()) if (!regularItem.hasTag())
drop.setTag(new CompoundNBT()); regularItem.setTag(new CompoundNBT());
drop.getTag().putString(NaturesAura.MOD_ID + ":ender_name", this.name); regularItem.getTag().putString(NaturesAura.MOD_ID + ":ender_name", this.name);
} }
return drop;
} }
@Override @Override

View file

@ -131,24 +131,14 @@ public class TileEntityImpl extends TileEntity {
} }
} }
public ItemStack getDrop(BlockState state, int fortune) { public void modifyDrop(ItemStack regularItem) {
// TODO weird drop stuff
/*Block block = state.getBlock();
ItemStack stack = new ItemStack(
block.getItemDropped(state, this.world.rand, fortune),
block.quantityDropped(state, fortune, this.world.rand),
block.damageDropped(state));
CompoundNBT compound = new CompoundNBT(); CompoundNBT compound = new CompoundNBT();
this.writeNBT(compound, SaveType.BLOCK); this.writeNBT(compound, SaveType.BLOCK);
if (!compound.isEmpty()) { if (!compound.isEmpty()) {
stack.setTagCompound(new CompoundNBT()); if (!regularItem.hasTag())
stack.getTagCompound().setTag("data", compound); regularItem.setTag(new CompoundNBT());
regularItem.getTag().put("data", compound);
} }
return stack;*/
return null;
} }
public void loadDataOnPlace(ItemStack stack) { public void loadDataOnPlace(ItemStack stack) {

View file

@ -6,15 +6,16 @@ import de.ellpeck.naturesaura.api.recipes.OfferingRecipe;
import de.ellpeck.naturesaura.blocks.multi.Multiblocks; import de.ellpeck.naturesaura.blocks.multi.Multiblocks;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
import de.ellpeck.naturesaura.packet.PacketParticles; import de.ellpeck.naturesaura.packet.PacketParticles;
import net.minecraft.entity.effect.LightningBoltEntity;
import net.minecraft.entity.item.ItemEntity; import net.minecraft.entity.item.ItemEntity;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.nbt.CompoundNBT; import net.minecraft.nbt.CompoundNBT;
import net.minecraft.nbt.INBT; import net.minecraft.nbt.INBT;
import net.minecraft.nbt.ListNBT; import net.minecraft.nbt.ListNBT;
import net.minecraft.tileentity.ITickableTileEntity; import net.minecraft.tileentity.ITickableTileEntity;
import net.minecraft.tileentity.TileEntityType;
import net.minecraft.util.Direction; import net.minecraft.util.Direction;
import net.minecraft.util.math.AxisAlignedBB; import net.minecraft.util.math.AxisAlignedBB;
import net.minecraft.world.server.ServerWorld;
import net.minecraftforge.items.IItemHandlerModifiable; import net.minecraftforge.items.IItemHandlerModifiable;
import net.minecraftforge.items.ItemStackHandler; import net.minecraftforge.items.ItemStackHandler;
@ -74,9 +75,8 @@ public class TileEntityOfferingTable extends TileEntityImpl implements ITickable
for (int i = 0; i < recipeCount; i++) for (int i = 0; i < recipeCount; i++)
this.itemsToSpawn.add(recipe.output.copy()); this.itemsToSpawn.add(recipe.output.copy());
// TODO weather effects ((ServerWorld) this.world).addLightningBolt(new LightningBoltEntity(this.world, this.pos.getX(), this.pos.getY(), this.pos.getZ(), true));
//this.world.addWeatherEffect(new LightningBoltEntity(this.world, this.pos.getX(), this.pos.getY(), this.pos.getZ(), true)); PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
PacketHandler.sendToAllAround(this.world, this.pos, 32, new PacketParticles(
(float) item.posX, (float) item.posY, (float) item.posZ, 13, (float) item.posX, (float) item.posY, (float) item.posZ, 13,
this.pos.getX(), this.pos.getY(), this.pos.getZ())); this.pos.getX(), this.pos.getY(), this.pos.getZ()));

View file

@ -3,6 +3,7 @@ package de.ellpeck.naturesaura.chunk;
import de.ellpeck.naturesaura.api.NaturesAuraAPI; import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect; import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect;
import de.ellpeck.naturesaura.api.aura.chunk.IDrainSpotEffect.ActiveType;
import de.ellpeck.naturesaura.api.aura.type.IAuraType; import de.ellpeck.naturesaura.api.aura.type.IAuraType;
import de.ellpeck.naturesaura.packet.PacketAuraChunk; import de.ellpeck.naturesaura.packet.PacketAuraChunk;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
@ -181,13 +182,13 @@ public class AuraChunk implements IAuraChunk {
for (Map.Entry<BlockPos, MutableInt> entry : this.drainSpots.entrySet()) { for (Map.Entry<BlockPos, MutableInt> entry : this.drainSpots.entrySet()) {
BlockPos pos = entry.getKey(); BlockPos pos = entry.getKey();
MutableInt amount = entry.getValue(); MutableInt amount = entry.getValue();
int state = effect.isActiveHere(player, this.chunk, this, pos, amount.intValue()); ActiveType state = effect.isActiveHere(player, this.chunk, this, pos, amount.intValue());
if (state < 0) if (state == ActiveType.INACTIVE)
continue; continue;
ItemStack stack = effect.getDisplayIcon(); ItemStack stack = effect.getDisplayIcon();
if (stack.isEmpty()) if (stack.isEmpty())
continue; continue;
icons.put(effect.getName(), new Tuple<>(stack, state == 0)); icons.put(effect.getName(), new Tuple<>(stack, state == ActiveType.INHIBITED));
} }
} }
} }

View file

@ -48,14 +48,14 @@ public class AnimalEffect implements IDrainSpotEffect {
} }
@Override @Override
public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { public ActiveType isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
if (!this.calcValues(player.world, pos, spot)) if (!this.calcValues(player.world, pos, spot))
return -1; return ActiveType.INACTIVE;
if (!this.bb.contains(player.getPositionVector())) if (!this.bb.contains(player.getPositionVector()))
return -1; return ActiveType.INACTIVE;
if (!NaturesAuraAPI.instance().isEffectPowderActive(player.world, player.getPosition(), NAME)) if (!NaturesAuraAPI.instance().isEffectPowderActive(player.world, player.getPosition(), NAME))
return 0; return ActiveType.INHIBITED;
return 1; return ActiveType.ACTIVE;
} }
@Override @Override

View file

@ -42,12 +42,12 @@ public class BreathlessEffect implements IDrainSpotEffect {
} }
@Override @Override
public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { public ActiveType isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
if (!this.calcValues(player.world, pos, spot)) if (!this.calcValues(player.world, pos, spot))
return -1; return ActiveType.INACTIVE;
if (!this.bb.contains(player.getPositionVector())) if (!this.bb.contains(player.getPositionVector()))
return -1; return ActiveType.INACTIVE;
return 1; return ActiveType.ACTIVE;
} }
@Override @Override

View file

@ -38,14 +38,14 @@ public class CacheRechargeEffect implements IDrainSpotEffect {
} }
@Override @Override
public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { public ActiveType isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
if (!this.calcValues(player.world, pos, spot)) if (!this.calcValues(player.world, pos, spot))
return -1; return ActiveType.INACTIVE;
if (!this.bb.contains(player.getPositionVector())) if (!this.bb.contains(player.getPositionVector()))
return -1; return ActiveType.INACTIVE;
if (NaturesAuraAPI.instance().isEffectPowderActive(player.world, player.getPosition(), NAME)) if (NaturesAuraAPI.instance().isEffectPowderActive(player.world, player.getPosition(), NAME))
return 0; return ActiveType.INHIBITED;
return 1; return ActiveType.ACTIVE;
} }
@Override @Override

View file

@ -40,12 +40,12 @@ public class ExplosionEffect implements IDrainSpotEffect {
} }
@Override @Override
public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { public ActiveType isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
if (!this.calcValues(player.world, pos, spot)) if (!this.calcValues(player.world, pos, spot))
return -1; return ActiveType.INACTIVE;
if (player.getDistanceSq(pos.getX(), pos.getY(), pos.getZ()) > this.dist * this.dist) if (player.getDistanceSq(pos.getX(), pos.getY(), pos.getZ()) > this.dist * this.dist)
return -1; return ActiveType.INACTIVE;
return 1; return ActiveType.ACTIVE;
} }
@Override @Override

View file

@ -38,12 +38,12 @@ public class GrassDieEffect implements IDrainSpotEffect {
} }
@Override @Override
public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { public ActiveType isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
if (!this.calcValues(player.world, pos, spot)) if (!this.calcValues(player.world, pos, spot))
return -1; return ActiveType.INACTIVE;
if (player.getDistanceSq(pos.getX(), pos.getY(), pos.getZ()) > this.dist * this.dist) if (player.getDistanceSq(pos.getX(), pos.getY(), pos.getZ()) > this.dist * this.dist)
return -1; return ActiveType.INACTIVE;
return 1; return ActiveType.ACTIVE;
} }
@Override @Override

View file

@ -48,14 +48,14 @@ public class OreSpawnEffect implements IDrainSpotEffect {
} }
@Override @Override
public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { public ActiveType isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
if (!this.calcValues(player.world, pos, spot)) if (!this.calcValues(player.world, pos, spot))
return -1; return ActiveType.INACTIVE;
if (player.getDistanceSq(pos.getX(), pos.getY(), pos.getZ()) > this.dist * this.dist) if (player.getDistanceSq(pos.getX(), pos.getY(), pos.getZ()) > this.dist * this.dist)
return -1; return ActiveType.INACTIVE;
if (!NaturesAuraAPI.instance().isEffectPowderActive(player.world, player.getPosition(), NAME)) if (!NaturesAuraAPI.instance().isEffectPowderActive(player.world, player.getPosition(), NAME))
return 0; return ActiveType.INHIBITED;
return 1; return ActiveType.ACTIVE;
} }
@Override @Override

View file

@ -40,14 +40,14 @@ public class PlantBoostEffect implements IDrainSpotEffect {
} }
@Override @Override
public int isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) { public ActiveType isActiveHere(PlayerEntity player, Chunk chunk, IAuraChunk auraChunk, BlockPos pos, Integer spot) {
if (!this.calcValues(player.world, pos, spot)) if (!this.calcValues(player.world, pos, spot))
return -1; return ActiveType.INACTIVE;
if (player.getDistanceSq(pos.getX(), pos.getY(), pos.getZ()) > this.dist * this.dist) if (player.getDistanceSq(pos.getX(), pos.getY(), pos.getZ()) > this.dist * this.dist)
return -1; return ActiveType.INACTIVE;
if (NaturesAuraAPI.instance().isEffectPowderActive(player.world, player.getPosition(), NAME)) if (NaturesAuraAPI.instance().isEffectPowderActive(player.world, player.getPosition(), NAME))
return 0; return ActiveType.INHIBITED;
return 1; return ActiveType.ACTIVE;
} }
@Override @Override

View file

@ -6,8 +6,12 @@ import de.ellpeck.naturesaura.api.NaturesAuraAPI;
import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk; import de.ellpeck.naturesaura.api.aura.chunk.IAuraChunk;
import de.ellpeck.naturesaura.chunk.AuraChunk; import de.ellpeck.naturesaura.chunk.AuraChunk;
import de.ellpeck.naturesaura.chunk.AuraChunkProvider; import de.ellpeck.naturesaura.chunk.AuraChunkProvider;
import de.ellpeck.naturesaura.misc.BlockLootProvider;
import de.ellpeck.naturesaura.misc.BlockTagProvider;
import de.ellpeck.naturesaura.misc.ItemTagProvider;
import de.ellpeck.naturesaura.misc.WorldData; import de.ellpeck.naturesaura.misc.WorldData;
import de.ellpeck.naturesaura.packet.PacketHandler; import de.ellpeck.naturesaura.packet.PacketHandler;
import net.minecraft.data.DataGenerator;
import net.minecraft.util.ResourceLocation; import net.minecraft.util.ResourceLocation;
import net.minecraft.world.World; import net.minecraft.world.World;
import net.minecraft.world.chunk.Chunk; import net.minecraft.world.chunk.Chunk;
@ -19,6 +23,7 @@ import net.minecraftforge.event.TickEvent;
import net.minecraftforge.event.world.ChunkWatchEvent; import net.minecraftforge.event.world.ChunkWatchEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.ObfuscationReflectionHelper; import net.minecraftforge.fml.common.ObfuscationReflectionHelper;
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;
import java.lang.reflect.InvocationTargetException; import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method; import java.lang.reflect.Method;

View file

@ -0,0 +1,82 @@
package de.ellpeck.naturesaura.misc;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import de.ellpeck.naturesaura.blocks.Slab;
import de.ellpeck.naturesaura.reg.IModItem;
import de.ellpeck.naturesaura.reg.ModRegistry;
import net.minecraft.block.Block;
import net.minecraft.block.SlabBlock;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.DirectoryCache;
import net.minecraft.data.IDataProvider;
import net.minecraft.state.properties.SlabType;
import net.minecraft.util.ResourceLocation;
import net.minecraft.world.storage.loot.*;
import net.minecraft.world.storage.loot.conditions.BlockStateProperty;
import net.minecraft.world.storage.loot.conditions.SurvivesExplosion;
import net.minecraft.world.storage.loot.functions.ExplosionDecay;
import net.minecraft.world.storage.loot.functions.SetCount;
import javax.annotation.Nonnull;
import java.io.IOException;
import java.nio.file.Path;
import java.util.HashMap;
import java.util.Map;
import java.util.function.Function;
public class BlockLootProvider implements IDataProvider {
private static final Gson GSON = new GsonBuilder().setPrettyPrinting().create();
private final DataGenerator generator;
private final Map<Block, Function<Block, LootTable.Builder>> lootFunctions = new HashMap<>();
public BlockLootProvider(DataGenerator generator) {
this.generator = generator;
for (IModItem item : ModRegistry.ALL_ITEMS) {
if (!(item instanceof Block))
continue;
Block block = (Block) item;
if (block instanceof Slab) {
this.lootFunctions.put(block, BlockLootProvider::genSlab);
} else {
this.lootFunctions.put(block, BlockLootProvider::genRegular);
}
}
}
@Override
public void act(DirectoryCache cache) throws IOException {
for (Map.Entry<Block, Function<Block, LootTable.Builder>> function : this.lootFunctions.entrySet()) {
Block block = function.getKey();
Function<Block, LootTable.Builder> func = function.getValue();
LootTable table = func.apply(block).setParameterSet(LootParameterSets.BLOCK).build();
Path path = getPath(this.generator.getOutputFolder(), block.getRegistryName());
IDataProvider.save(GSON, cache, LootTableManager.toJson(table), path);
}
}
private static Path getPath(Path root, ResourceLocation id) {
return root.resolve("data/" + id.getNamespace() + "/loot_tables/blocks/" + id.getPath() + ".json");
}
private static LootTable.Builder genSlab(Block b) {
LootEntry.Builder<?> entry = ItemLootEntry.builder(b)
.acceptFunction(SetCount.func_215932_a(ConstantRange.of(2)).acceptCondition(BlockStateProperty.builder(b).with(SlabBlock.TYPE, SlabType.DOUBLE)))
.acceptFunction(ExplosionDecay.func_215863_b());
return LootTable.builder().addLootPool(LootPool.builder().name("main").rolls(ConstantRange.of(1)).addEntry(entry));
}
private static LootTable.Builder genRegular(Block b) {
LootEntry.Builder<?> entry = ItemLootEntry.builder(b);
LootPool.Builder pool = LootPool.builder().name("main").rolls(ConstantRange.of(1)).addEntry(entry)
.acceptCondition(SurvivesExplosion.builder());
return LootTable.builder().addLootPool(pool);
}
@Nonnull
@Override
public String getName() {
return "Nature's Aura Loot";
}
}

View file

@ -0,0 +1,22 @@
package de.ellpeck.naturesaura.misc;
import de.ellpeck.naturesaura.blocks.ModBlocks;
import net.minecraft.data.BlockTagsProvider;
import net.minecraft.data.DataGenerator;
import net.minecraft.tags.BlockTags;
public class BlockTagProvider extends BlockTagsProvider {
public BlockTagProvider(DataGenerator generatorIn) {
super(generatorIn);
}
@Override
protected void registerTags() {
this.getBuilder(BlockTags.LOGS).add(ModBlocks.ANCIENT_LOG, ModBlocks.ANCIENT_BARK);
this.getBuilder(BlockTags.PLANKS).add(ModBlocks.ANCIENT_PLANKS);
this.getBuilder(BlockTags.STAIRS).add(ModBlocks.ANCIENT_STAIRS, ModBlocks.INFUSED_BRICK_STAIRS, ModBlocks.INFUSED_STAIRS);
this.getBuilder(BlockTags.LEAVES).add(ModBlocks.GOLDEN_LEAVES, ModBlocks.ANCIENT_LEAVES, ModBlocks.DECAYED_LEAVES);
this.getBuilder(BlockTags.RAILS).add(ModBlocks.DIMENSION_RAIL_END, ModBlocks.DIMENSION_RAIL_NETHER, ModBlocks.DIMENSION_RAIL_OVERWORLD);
this.getBuilder(BlockTags.SLABS).add(ModBlocks.ANCIENT_SLAB, ModBlocks.INFUSED_SLAB, ModBlocks.INFUSED_BRICK_SLAB);
}
}

View file

@ -0,0 +1,26 @@
package de.ellpeck.naturesaura.misc;
import de.ellpeck.naturesaura.items.ModItems;
import net.minecraft.data.DataGenerator;
import net.minecraft.data.ItemTagsProvider;
import net.minecraft.tags.BlockTags;
import net.minecraft.tags.ItemTags;
import net.minecraftforge.common.Tags;
public class ItemTagProvider extends ItemTagsProvider {
public ItemTagProvider(DataGenerator generatorIn) {
super(generatorIn);
}
@Override
protected void registerTags() {
this.copy(BlockTags.LOGS, ItemTags.LOGS);
this.copy(BlockTags.PLANKS, ItemTags.PLANKS);
this.copy(BlockTags.STAIRS, ItemTags.STAIRS);
this.copy(BlockTags.LEAVES, ItemTags.LEAVES);
this.copy(BlockTags.RAILS, ItemTags.RAILS);
this.copy(BlockTags.SLABS, ItemTags.SLABS);
this.getBuilder(Tags.Items.RODS_WOODEN).add(ModItems.ANCIENT_STICK);
}
}

View file

@ -1,16 +1,24 @@
package de.ellpeck.naturesaura.reg; package de.ellpeck.naturesaura.reg;
import de.ellpeck.naturesaura.Helper;
import de.ellpeck.naturesaura.ModConfig; import de.ellpeck.naturesaura.ModConfig;
import de.ellpeck.naturesaura.NaturesAura; import de.ellpeck.naturesaura.NaturesAura;
import de.ellpeck.naturesaura.blocks.*; import de.ellpeck.naturesaura.blocks.*;
import de.ellpeck.naturesaura.blocks.tiles.ModTileEntities;
import de.ellpeck.naturesaura.entities.EntityEffectInhibitor; import de.ellpeck.naturesaura.entities.EntityEffectInhibitor;
import de.ellpeck.naturesaura.entities.EntityMoverMinecart; import de.ellpeck.naturesaura.entities.EntityMoverMinecart;
import de.ellpeck.naturesaura.entities.ModEntities;
import de.ellpeck.naturesaura.items.*; import de.ellpeck.naturesaura.items.*;
import de.ellpeck.naturesaura.items.tools.*; import de.ellpeck.naturesaura.items.tools.*;
import de.ellpeck.naturesaura.misc.BlockLootProvider;
import de.ellpeck.naturesaura.misc.BlockTagProvider;
import de.ellpeck.naturesaura.misc.ItemTagProvider;
import de.ellpeck.naturesaura.potion.ModPotions;
import de.ellpeck.naturesaura.potion.PotionBreathless; import de.ellpeck.naturesaura.potion.PotionBreathless;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.block.SoundType; import net.minecraft.block.SoundType;
import net.minecraft.block.material.Material; import net.minecraft.block.material.Material;
import net.minecraft.data.DataGenerator;
import net.minecraft.entity.EntityClassification; import net.minecraft.entity.EntityClassification;
import net.minecraft.entity.EntityType; import net.minecraft.entity.EntityType;
import net.minecraft.inventory.EquipmentSlotType; import net.minecraft.inventory.EquipmentSlotType;
@ -22,6 +30,7 @@ import net.minecraft.world.dimension.DimensionType;
import net.minecraftforge.event.RegistryEvent; import net.minecraftforge.event.RegistryEvent;
import net.minecraftforge.eventbus.api.SubscribeEvent; import net.minecraftforge.eventbus.api.SubscribeEvent;
import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.common.Mod;
import net.minecraftforge.fml.event.lifecycle.GatherDataEvent;
import java.util.HashSet; import java.util.HashSet;
import java.util.Set; import java.util.Set;
@ -29,7 +38,7 @@ import java.util.Set;
@Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD) @Mod.EventBusSubscriber(bus = Mod.EventBusSubscriber.Bus.MOD)
public final class ModRegistry { public final class ModRegistry {
private static final Set<IModItem> ALL_ITEMS = new HashSet<>(); public static final Set<IModItem> ALL_ITEMS = new HashSet<>();
public static void add(IModItem item) { public static void add(IModItem item) {
ALL_ITEMS.add(item); ALL_ITEMS.add(item);
@ -94,6 +103,8 @@ public final class ModRegistry {
event.getRegistry().register(new BlockRFConverter()); event.getRegistry().register(new BlockRFConverter());
if (ModConfig.enabledFeatures.chunkLoader) if (ModConfig.enabledFeatures.chunkLoader)
event.getRegistry().register(new BlockChunkLoader()); event.getRegistry().register(new BlockChunkLoader());
Helper.populateObjectHolders(ModBlocks.class, event.getRegistry());
} }
@SubscribeEvent @SubscribeEvent
@ -149,6 +160,7 @@ public final class ModRegistry {
new EnderAccess(), new EnderAccess(),
new CaveFinder() new CaveFinder()
); );
Helper.populateObjectHolders(ModItems.class, event.getRegistry());
} }
@SubscribeEvent @SubscribeEvent
@ -157,6 +169,7 @@ public final class ModRegistry {
if (item instanceof ModTileType) if (item instanceof ModTileType)
event.getRegistry().register(((ModTileType) item).type); event.getRegistry().register(((ModTileType) item).type);
} }
Helper.populateObjectHolders(ModTileEntities.class, event.getRegistry());
} }
@SubscribeEvent @SubscribeEvent
@ -164,6 +177,7 @@ public final class ModRegistry {
event.getRegistry().registerAll( event.getRegistry().registerAll(
new PotionBreathless() new PotionBreathless()
); );
Helper.populateObjectHolders(ModPotions.class, event.getRegistry());
} }
@SubscribeEvent @SubscribeEvent
@ -176,84 +190,25 @@ public final class ModRegistry {
.setTrackingRange(64).setUpdateInterval(20).immuneToFire().build(NaturesAura.MOD_ID + ":effect_inhibitor") .setTrackingRange(64).setUpdateInterval(20).immuneToFire().build(NaturesAura.MOD_ID + ":effect_inhibitor")
.setRegistryName("effect_inhibitor") .setRegistryName("effect_inhibitor")
); );
} Helper.populateObjectHolders(ModEntities.class, event.getRegistry());
/*
private static void registerPotion(Effect potion, String name) {
potion.setRegistryName("potion." + NaturesAura.MOD_ID + "." + name + ".name");
potion.setRegistryName(NaturesAura.MOD_ID, name);
ForgeRegistries.POTIONS.register(potion);
} }
private static void registerItem(Item item, String name, ItemGroup tab) { @SubscribeEvent
item.setRegistryName(NaturesAura.MOD_ID, name); public static void gatherData(GatherDataEvent event) {
ForgeRegistries.ITEMS.register(item); DataGenerator generator = event.getGenerator();
generator.addProvider(new BlockLootProvider(generator));
item.setCreativeTab(tab); generator.addProvider(new BlockTagProvider(generator));
generator.addProvider(new ItemTagProvider(generator));
} }
private static void registerBlock(Block block, String name, BlockItem item, ItemGroup tab) {
block.setTranslationKey(NaturesAura.MOD_ID + "." + name);
block.setRegistryName(NaturesAura.MOD_ID, name);
ForgeRegistries.BLOCKS.register(block);
if (item != null) {
item.setRegistryName(block.getRegistryName());
ForgeRegistries.ITEMS.register(item);
}
block.setCreativeTab(tab);
}
private static ItemGroup getTab(IModItem item) {
if (item instanceof ICreativeItem) {
return ((ICreativeItem) item).getGroupToAdd();
}
return null;
}
public static void preInit(FMLCommonSetupEvent event) {
for (IModItem item : ALL_ITEMS) {
if (item instanceof Item) {
registerItem((Item) item, item.getBaseName(), getTab(item));
} else if (item instanceof Block) {
Block block = (Block) item;
BlockItem itemBlock;
if (item instanceof ICustomItemBlockProvider) {
itemBlock = ((ICustomItemBlockProvider) item).getItemBlock();
} else {
itemBlock = new BlockItem(block);
}
registerBlock(block, item.getBaseName(), itemBlock, getTab(item));
} else if (item instanceof Effect) {
registerPotion((Effect) item, item.getBaseName());
}
if (item instanceof IModelProvider) {
Map<ItemStack, ModelResourceLocation> models = ((IModelProvider) item).getModelLocations();
for (ItemStack stack : models.keySet())
NaturesAura.proxy.registerRenderer(stack, models.get(stack));
}
item.onPreInit(event);
}
}
*/
public static void init() { public static void init() {
for (IModItem item : ALL_ITEMS) { for (IModItem item : ALL_ITEMS) {
if (item instanceof IColorProvidingBlock) { if (item instanceof IColorProvidingBlock)
NaturesAura.proxy.addColorProvidingBlock((IColorProvidingBlock) item); NaturesAura.proxy.addColorProvidingBlock((IColorProvidingBlock) item);
} if (item instanceof IColorProvidingItem)
if (item instanceof IColorProvidingItem) {
NaturesAura.proxy.addColorProvidingItem((IColorProvidingItem) item); NaturesAura.proxy.addColorProvidingItem((IColorProvidingItem) item);
} if (item instanceof ITESRProvider)
if (item instanceof ITESRProvider) {
NaturesAura.proxy.registerTESR((ITESRProvider) item); NaturesAura.proxy.registerTESR((ITESRProvider) item);
}
} }
} }
} }

View file

@ -7,8 +7,7 @@
"faces": { "faces": {
"down": { "down": {
"uv": [3, 3, 13, 13], "uv": [3, 3, 13, 13],
"texture": "#top", "texture": "#top"
"cullface": "down"
}, },
"up": { "up": {
"uv": [3, 3, 13, 13], "uv": [3, 3, 13, 13],
@ -16,23 +15,19 @@
}, },
"north": { "north": {
"uv": [3, 3, 13, 13], "uv": [3, 3, 13, 13],
"texture": "#texture", "texture": "#texture"
"cullface": "north"
}, },
"south": { "south": {
"uv": [3, 3, 13, 13], "uv": [3, 3, 13, 13],
"texture": "#texture", "texture": "#texture"
"cullface": "south"
}, },
"west": { "west": {
"uv": [3, 3, 13, 13], "uv": [3, 3, 13, 13],
"texture": "#texture", "texture": "#texture"
"cullface": "west"
}, },
"east": { "east": {
"uv": [3, 3, 13, 13], "uv": [3, 3, 13, 13],
"texture": "#texture", "texture": "#texture"
"cullface": "east"
} }
} }
} }

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"naturesaura:ancient_stick"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"naturesaura:ancient_leaves"
]
}

View file

@ -1,7 +0,0 @@
{
"replace": false,
"values": [
"naturesaura:ancient_log",
"naturesaura:ancient_bark"
]
}

View file

@ -1,6 +0,0 @@
{
"replace": false,
"values": [
"naturesaura:ancient_planks"
]
}

Some files were not shown because too many files have changed in this diff Show more