Compare commits
2 Commits
Author | SHA1 | Date |
---|---|---|
|
b5cbfff336 | |
|
0ca725187f |
|
@ -9,7 +9,7 @@ yarn_mappings=1.21.1+build.3
|
|||
loader_version=0.16.10
|
||||
|
||||
# Mod Properties
|
||||
mod_version=0.0.1.alpha.3
|
||||
mod_version=0.0.1.alpha.5
|
||||
maven_group=arzumify.coretechs
|
||||
archives_base_name=coretechs
|
||||
|
||||
|
@ -17,4 +17,4 @@ archives_base_name=coretechs
|
|||
fabric_version=0.115.1+1.21.1
|
||||
polymer_version=0.9.18+1.21.1
|
||||
polyenergy_version=3.0.0
|
||||
located_version=1.0.0
|
||||
located_version=1.0.0
|
||||
|
|
|
@ -21,7 +21,6 @@ public class TexturedBlockItem extends PolymerBlockItem {
|
|||
|
||||
@Override
|
||||
public int getPolymerCustomModelData(ItemStack itemStack, @Nullable ServerPlayerEntity player) {
|
||||
System.out.println(model.modelPath());
|
||||
return model.value();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -44,11 +44,8 @@ public class CopperWire extends BlockWithEntity implements PolymerTexturedBlock
|
|||
|
||||
@Override
|
||||
protected void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
|
||||
System.out.println("onStateReplaced");
|
||||
if (!world.isClient() && state.isOf(newState.getBlock())) {
|
||||
System.out.println("world is not client");
|
||||
if (!world.isClient() && !state.isOf(newState.getBlock())) {
|
||||
var entity = world.getBlockEntity(pos);
|
||||
System.out.println("entity: " + entity);
|
||||
if (entity != null) {
|
||||
((ServerBlockEntityEvents.Unload) entity).onUnload(entity, (ServerWorld) world);
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package arzumify.coretechs.energy;
|
||||
|
||||
import arzumify.coretechs.BlockEntityTypes;
|
||||
import arzumify.located.math.Vec3i;
|
||||
import arzumify.polyenergy.api.EnergyProvider;
|
||||
import arzumify.polyenergy.api.EnergyReceiver;
|
||||
import arzumify.located.math.Vec3i;
|
||||
import arzumify.polyenergy.impl.MatchMaker;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerBlockEntityEvents;
|
||||
import net.fabricmc.fabric.api.event.lifecycle.v1.ServerTickEvents;
|
||||
|
@ -38,20 +38,14 @@ public class CopperWireEntity extends BlockEntity implements EnergyProvider, Ene
|
|||
|
||||
if (!wire.receivers.isEmpty() && wire.energy > 0 && wire.active) {
|
||||
wire.energy = Common.extract(1, 16, wire.energy, wire.providers, wire);
|
||||
} else {
|
||||
System.out.println("Fails conditions: " + wire.receivers.isEmpty() + " " + wire.energy + " " + wire.active);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public long extract(long amount, EnergyReceiver receiver) {
|
||||
System.out.println("Giving " + amount + " to " + receiver);
|
||||
if (!blackListed.contains(receiver)) {
|
||||
System.out.println("Not blacklisted");
|
||||
var extracted = Math.min(amount, Math.min(1, energy));
|
||||
System.out.println("Extracted " + extracted);
|
||||
energy -= extracted;
|
||||
System.out.println("Energy is now " + energy);
|
||||
blackListed.add(receiver);
|
||||
return extracted;
|
||||
} else {
|
||||
|
@ -87,8 +81,7 @@ public class CopperWireEntity extends BlockEntity implements EnergyProvider, Ene
|
|||
reload();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void onUnload(BlockEntity blockEntity, ServerWorld serverWorld) {
|
||||
MatchMaker.matchMaker.Remove(this);
|
||||
|
|
|
@ -38,11 +38,8 @@ public class CreativeGenerator extends BlockWithEntity implements BlockEntityPro
|
|||
|
||||
@Override
|
||||
protected void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
|
||||
System.out.println("onStateReplaced");
|
||||
if (!world.isClient() && state.isOf(newState.getBlock())) {
|
||||
System.out.println("world is not client");
|
||||
if (!world.isClient() && !state.isOf(newState.getBlock())) {
|
||||
var entity = world.getBlockEntity(pos);
|
||||
System.out.println("entity: " + entity);
|
||||
if (entity != null) {
|
||||
((ServerBlockEntityEvents.Unload) entity).onUnload(entity, (ServerWorld) world);
|
||||
}
|
||||
|
|
|
@ -29,14 +29,12 @@ public class CreativeGeneratorEntity extends BlockEntity implements EnergyProvid
|
|||
|
||||
@Override
|
||||
public void ready(EnergyReceiver energyReceiver) {
|
||||
System.out.println("Ready " + energyReceiver);
|
||||
receivers.add(energyReceiver);
|
||||
energyReceiver.ready(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unready(EnergyReceiver energyReceiver) {
|
||||
System.out.println("Unready " + energyReceiver);
|
||||
receivers.remove(energyReceiver);
|
||||
}
|
||||
|
||||
|
|
|
@ -18,7 +18,6 @@ import net.minecraft.server.world.ServerWorld;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class Magnet extends BlockWithEntity implements BlockEntityProvider, PolymerTexturedBlock {
|
||||
|
@ -41,11 +40,8 @@ public class Magnet extends BlockWithEntity implements BlockEntityProvider, Poly
|
|||
|
||||
@Override
|
||||
protected void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
|
||||
System.out.println("onStateReplaced");
|
||||
if (!world.isClient() && state.isOf(newState.getBlock())) {
|
||||
System.out.println("world is not client");
|
||||
if (!world.isClient() && !state.isOf(newState.getBlock())) {
|
||||
var entity = world.getBlockEntity(pos);
|
||||
System.out.println("entity: " + entity);
|
||||
if (entity != null) {
|
||||
((ServerBlockEntityEvents.Unload) entity).onUnload(entity, (ServerWorld) world);
|
||||
}
|
||||
|
@ -53,11 +49,6 @@ public class Magnet extends BlockWithEntity implements BlockEntityProvider, Poly
|
|||
super.onStateReplaced(state, world, pos, newState, moved);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBroken(WorldAccess world, BlockPos pos, BlockState state) {
|
||||
super.onBroken(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends BlockWithEntity> getCodec() {
|
||||
return createCodec(Magnet::new);
|
||||
|
|
|
@ -42,23 +42,18 @@ public class MagnetEntity extends BlockEntity implements EnergyReceiver, ServerB
|
|||
|
||||
@Override
|
||||
public void ready(EnergyProvider energyProvider) {
|
||||
System.out.println("Ready " + energyProvider);
|
||||
providers.add(energyProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unready(EnergyProvider energyProvider) {
|
||||
System.out.println("Unready " + energyProvider);
|
||||
providers.remove(energyProvider);
|
||||
}
|
||||
|
||||
public static void tick(World world, BlockPos pos, BlockState ignoredState, MagnetEntity magnet) {
|
||||
System.out.println("Trying to extract energy");
|
||||
magnet.energy = Common.extract(1, 16, magnet.energy, magnet.providers, magnet);
|
||||
|
||||
System.out.println("Tick energy: " + magnet.energy);
|
||||
if (magnet.energy >= 1 && magnet.active) {
|
||||
System.out.println("Magnet activated");
|
||||
magnet.energy -= 1;
|
||||
var entities = world.getOtherEntities(null, new Box(pos).expand(10));
|
||||
for (var entity : entities) {
|
||||
|
|
|
@ -18,7 +18,6 @@ import net.minecraft.server.world.ServerWorld;
|
|||
import net.minecraft.util.Identifier;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraft.world.WorldAccess;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
|
||||
public class Summoner extends BlockWithEntity implements BlockEntityProvider, PolymerTexturedBlock {
|
||||
|
@ -41,11 +40,8 @@ public class Summoner extends BlockWithEntity implements BlockEntityProvider, Po
|
|||
|
||||
@Override
|
||||
protected void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
|
||||
System.out.println("onStateReplaced");
|
||||
if (!world.isClient() && state.isOf(newState.getBlock())) {
|
||||
System.out.println("world is not client");
|
||||
if (!world.isClient() && !state.isOf(newState.getBlock())) {
|
||||
var entity = world.getBlockEntity(pos);
|
||||
System.out.println("entity: " + entity);
|
||||
if (entity != null) {
|
||||
((ServerBlockEntityEvents.Unload) entity).onUnload(entity, (ServerWorld) world);
|
||||
}
|
||||
|
@ -53,11 +49,6 @@ public class Summoner extends BlockWithEntity implements BlockEntityProvider, Po
|
|||
super.onStateReplaced(state, world, pos, newState, moved);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBroken(WorldAccess world, BlockPos pos, BlockState state) {
|
||||
super.onBroken(world, pos, state);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected MapCodec<? extends BlockWithEntity> getCodec() {
|
||||
return createCodec(Summoner::new);
|
||||
|
|
|
@ -36,13 +36,11 @@ public class SummonerEntity extends BlockEntity implements EnergyReceiver, Serve
|
|||
|
||||
@Override
|
||||
public void ready(EnergyProvider energyProvider) {
|
||||
System.out.println("Ready " + energyProvider);
|
||||
providers.add(energyProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unready(EnergyProvider energyProvider) {
|
||||
System.out.println("Unready " + energyProvider);
|
||||
providers.remove(energyProvider);
|
||||
}
|
||||
|
||||
|
@ -91,4 +89,4 @@ public class SummonerEntity extends BlockEntity implements EnergyReceiver, Serve
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -40,11 +40,8 @@ public class Voltmeter extends BlockWithEntity implements BlockEntityProvider, P
|
|||
|
||||
@Override
|
||||
protected void onStateReplaced(BlockState state, World world, BlockPos pos, BlockState newState, boolean moved) {
|
||||
System.out.println("onStateReplaced");
|
||||
if (!world.isClient() && state.isOf(newState.getBlock())) {
|
||||
System.out.println("world is not client");
|
||||
if (!world.isClient() && !state.isOf(newState.getBlock())) {
|
||||
var entity = world.getBlockEntity(pos);
|
||||
System.out.println("entity: " + entity);
|
||||
if (entity != null) {
|
||||
((ServerBlockEntityEvents.Unload) entity).onUnload(entity, (ServerWorld) world);
|
||||
}
|
||||
|
|
|
@ -29,19 +29,17 @@ public class VoltmeterEntity extends BlockEntity implements EnergyReceiver, Serv
|
|||
|
||||
@Override
|
||||
public void ready(EnergyProvider energyProvider) {
|
||||
System.out.println("Ready " + energyProvider);
|
||||
providers.add(energyProvider);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unready(EnergyProvider energyProvider) {
|
||||
System.out.println("Unready " + energyProvider);
|
||||
providers.remove(energyProvider);
|
||||
}
|
||||
|
||||
public static void tick(World ignoredWorld, BlockPos ignoredPos, BlockState ignoredState, VoltmeterEntity voltmeter) {
|
||||
for (EnergyProvider provider : voltmeter.providers) {
|
||||
System.out.println("Extracted " + provider.extract(Long.MAX_VALUE, voltmeter));
|
||||
// System.out.println("Extracted " + provider.extract(Long.MAX_VALUE, voltmeter));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
After Width: | Height: | Size: 768 B |
Before Width: | Height: | Size: 631 B After Width: | Height: | Size: 12 KiB |
|
@ -1,7 +1,6 @@
|
|||
{
|
||||
"credit": "Made with Blockbench",
|
||||
"parent": "block/block",
|
||||
"texture_size": [23, 23],
|
||||
"textures": {
|
||||
"0": "coretechs:item/magnet",
|
||||
"particle": "coretechs:item/magnet"
|
||||
|
@ -11,24 +10,120 @@
|
|||
"from": [2, 0, 2],
|
||||
"to": [14, 1, 14],
|
||||
"faces": {
|
||||
"north": {"uv": [6.26087, 0, 14.6087, 0.69565], "texture": "#0"},
|
||||
"east": {"uv": [6.26087, 0, 14.6087, 0.69565], "texture": "#0"},
|
||||
"south": {"uv": [6.26087, 0, 14.6087, 0.69565], "texture": "#0"},
|
||||
"west": {"uv": [6.26087, 0.69565, 14.6087, 0], "texture": "#0"},
|
||||
"up": {"uv": [6.26087, 0, 14.6087, 8.34783], "texture": "#0"},
|
||||
"down": {"uv": [6.26087, 0, 14.6087, 8.34783], "texture": "#0"}
|
||||
"north": {
|
||||
"uv": [
|
||||
4.5,
|
||||
5.5,
|
||||
10.5,
|
||||
6
|
||||
],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
4.5,
|
||||
5.5,
|
||||
10.5,
|
||||
6
|
||||
],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
4.5,
|
||||
5.5,
|
||||
10.5,
|
||||
6
|
||||
],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
4.5,
|
||||
5.5,
|
||||
10.5,
|
||||
6
|
||||
],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
4.5,
|
||||
0,
|
||||
10.5,
|
||||
6
|
||||
],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
4.5,
|
||||
0,
|
||||
10.5,
|
||||
6
|
||||
],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
"from": [3, 2, 3],
|
||||
"to": [13, 16, 13],
|
||||
"faces": {
|
||||
"north": {"uv": [0, 0, 6.95652, 9.73913], "texture": "#0"},
|
||||
"east": {"uv": [0, 0, 6.95652, 9.73913], "texture": "#0"},
|
||||
"south": {"uv": [0, 0, 6.95652, 9.73913], "texture": "#0"},
|
||||
"west": {"uv": [0, 0, 6.95652, 9.73913], "texture": "#0"},
|
||||
"up": {"uv": [6.95652, 16, 0, 9.04348], "texture": "#0"},
|
||||
"down": {"uv": [6.95652, 9.04348, 0, 16], "texture": "#0"}
|
||||
"north": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5,
|
||||
7
|
||||
],
|
||||
"texture": "#0"
|
||||
},
|
||||
"east": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5,
|
||||
7
|
||||
],
|
||||
"texture": "#0"
|
||||
},
|
||||
"south": {
|
||||
"uv": [
|
||||
5,
|
||||
0,
|
||||
0,
|
||||
7
|
||||
],
|
||||
"texture": "#0"
|
||||
},
|
||||
"west": {
|
||||
"uv": [
|
||||
0,
|
||||
0,
|
||||
5,
|
||||
7
|
||||
],
|
||||
"texture": "#0"
|
||||
},
|
||||
"up": {
|
||||
"uv": [
|
||||
0,
|
||||
6.5,
|
||||
5,
|
||||
11.5
|
||||
],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
0,
|
||||
6.5,
|
||||
5,
|
||||
11.5
|
||||
],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
|
@ -40,47 +135,116 @@
|
|||
"east": {"uv": [0.69565, 0.69565, 3.47826, 1.3913], "texture": "#0"},
|
||||
"south": {"uv": [0.69565, 0.69565, 3.47826, 1.3913], "texture": "#0"},
|
||||
"west": {"uv": [0.69565, 0.69565, 3.47826, 1.3913], "texture": "#0"},
|
||||
"up": {"uv": [0, 0, 2.78261, 2.78261], "texture": "#missing"},
|
||||
"down": {"uv": [0, 0, 2.78261, 2.78261], "texture": "#missing"}
|
||||
"up": {
|
||||
"uv": [
|
||||
8,
|
||||
1.5,
|
||||
10,
|
||||
3.5
|
||||
],
|
||||
"texture": "#0"
|
||||
},
|
||||
"down": {
|
||||
"uv": [
|
||||
8,
|
||||
1.5,
|
||||
10,
|
||||
3.5
|
||||
],
|
||||
"texture": "#0"
|
||||
}
|
||||
}
|
||||
}
|
||||
],
|
||||
"gui_light": "side",
|
||||
"display": {
|
||||
"gui": {
|
||||
"rotation": [ 30, 225, 0 ],
|
||||
"translation": [ 0, 0, 0],
|
||||
"scale":[ 0.625, 0.625, 0.625 ]
|
||||
},
|
||||
"ground": {
|
||||
"rotation": [ 0, 0, 0 ],
|
||||
"translation": [ 0, 3, 0],
|
||||
"scale":[ 0.25, 0.25, 0.25 ]
|
||||
},
|
||||
"fixed": {
|
||||
"rotation": [ 0, 0, 0 ],
|
||||
"translation": [ 0, 0, 0],
|
||||
"scale":[ 0.5, 0.5, 0.5 ]
|
||||
},
|
||||
"thirdperson_righthand": {
|
||||
"rotation": [ 75, 45, 0 ],
|
||||
"translation": [ 0, 2.5, 0],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
"rotation": [
|
||||
75,
|
||||
45,
|
||||
0
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
2.5,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
0.375,
|
||||
0.375,
|
||||
0.375
|
||||
]
|
||||
},
|
||||
"thirdperson_lefthand": {
|
||||
"rotation": [ 75, 45, 0 ],
|
||||
"translation": [ 0, 2.5, 0],
|
||||
"scale": [ 0.375, 0.375, 0.375 ]
|
||||
"rotation": [
|
||||
75,
|
||||
45,
|
||||
0
|
||||
],
|
||||
"translation": [
|
||||
0,
|
||||
2.5,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
0.375,
|
||||
0.375,
|
||||
0.375
|
||||
]
|
||||
},
|
||||
"firstperson_righthand": {
|
||||
"rotation": [ 0, 45, 0 ],
|
||||
"translation": [ 0, 0, 0 ],
|
||||
"scale": [ 0.40, 0.40, 0.40 ]
|
||||
"rotation": [
|
||||
0,
|
||||
45,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
0.4,
|
||||
0.4,
|
||||
0.4
|
||||
]
|
||||
},
|
||||
"firstperson_lefthand": {
|
||||
"rotation": [ 0, 225, 0 ],
|
||||
"translation": [ 0, 0, 0 ],
|
||||
"scale": [ 0.40, 0.40, 0.40 ]
|
||||
"rotation": [
|
||||
0,
|
||||
225,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
0.4,
|
||||
0.4,
|
||||
0.4
|
||||
]
|
||||
},
|
||||
"ground": {
|
||||
"translation": [
|
||||
0,
|
||||
3,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
0.25,
|
||||
0.25,
|
||||
0.25
|
||||
]
|
||||
},
|
||||
"gui": {
|
||||
"rotation": [
|
||||
30,
|
||||
225,
|
||||
0
|
||||
],
|
||||
"scale": [
|
||||
0.625,
|
||||
0.625,
|
||||
0.625
|
||||
]
|
||||
},
|
||||
"fixed": {
|
||||
"scale": [
|
||||
0.5,
|
||||
0.5,
|
||||
0.5
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
Before Width: | Height: | Size: 671 B After Width: | Height: | Size: 612 B |
Before Width: | Height: | Size: 149 B After Width: | Height: | Size: 151 B |
Before Width: | Height: | Size: 162 B After Width: | Height: | Size: 196 B |
Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 275 B |
|
@ -24,7 +24,8 @@
|
|||
"minecraft": ">1.20",
|
||||
"java": ">=21",
|
||||
"fabric-api": "*",
|
||||
"polymer-bundled": "*"
|
||||
"polymer-bundled": "*",
|
||||
"polyenergy": "*"
|
||||
},
|
||||
"suggests": {
|
||||
}
|
||||
|
|